Browse Source

zhjw

master
李双庆 1 year ago
parent
commit
a973e96a65
  1. 21
      components/AQ/AQTabber.vue
  2. 172
      pages/student/index/index.vue

21
components/AQ/AQTabber.vue

@ -6,11 +6,8 @@
</template>
<script>
import fuiTabbar from "@/components/firstui/fui-tabbar/fui-tabbar.vue"
export default {
components:{
fuiTabbar
},
name: 'AQTabber',
data() {
return {
userType: '', //|1=,2=,3=
@ -18,24 +15,22 @@
tabBar: []
};
},
onShow(){
created() {
//
uni.setStorageSync('userType', 1)
//
this.userType = uni.getStorageSync('userType')
this.init()
},
methods: {
async init() {
switch (String(this.userType)) {
case "1": //
this.tabBar = [
{
this.tabBar = [{
text: "首页",
urlPath: 'pages/student/index/index', //
iconPath: "/static/images/tabbar/assembly_default_3x.png",
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png"
iconPath: "/static/images/tabbar/home.png",
selectedIconPath: "/static/images/tabbar/home_selected.png"
},
{
text: "课表",
@ -58,8 +53,7 @@
]
break;
case "2": //
this.tabBar = [
{
this.tabBar = [{
text: "首页",
urlPath: 'pages/student/index/index', //
iconPath: "/static/images/tabbar/assembly_default_3x.png",
@ -95,8 +89,7 @@
]
break;
case "3": //
this.tabBar = [
{
this.tabBar = [{
text: "首页",
urlPath: 'pages/student/index/index', //
iconPath: "/static/images/tabbar/assembly_default_3x.png",

172
pages/student/index/index.vue

@ -1,66 +1,5 @@
<template>
<view>
<view class="top">
<view class="top_1">发现</view>
<view class="top_2" @click="publishing"><fui-icon name="plussign" size="80" fontWeight="Number"></fui-icon></view>
</view>
<view style="position: relative;" class="middle" v-for="(item, index) in list" :key="index" v-if="list.length > 0">
<view class="middles">
<view class="middles_1" v-if="item.headimg">
<image class="middles_1_img" :src="item.headimg"></image>
</view>
<view class="middles_1" v-else>
<image class="middles_1_img" src="/static/images/home/tixing.png"></image>
</view>
<view class="middles_2">
<view class="middles_info1">{{item.user}}</view>
<view class="middles_info2">{{item.timedifference}}</view>
</view>
</view>
<view class="shoucang" style="border: 5rpx #f8627f solid;color: #f8627f;" v-if="item.collections == 1" @click="collection(item.id,um_id)">收藏</view>
<view class="shoucang" style="border: 5rpx #ccc solid;" v-else @click="collection(item.id,um_id)">收藏</view>
<view @click="coninfo(item)" style="height: 300rpx;width: 100%;overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-box-orient: vertical;">
<view class="middles_con">
{{item.activity}}
</view>
<view class="middles_con" v-if="item.imagesnum!=0">
<view>
<view style="width: 32%;height: 200rpx;display: inline-block;margin:2rpx;" v-for="(item1, index) in item.images" :key="index">
<image :src="item1" style="width: 100%;height: 100%;"></image>
</view>
</view>
</view>
<view class="middles_con">
{{item.content}}
</view>
</view>
<view class="middles_con" style="font-size: 20rpx;color: #ccc;" @click="coninfo(item)">
点击内容查看详情
</view>
<view class="middles_bom">
<view class="middles_bom_1 middles_boms" v-if="item.area">{{item.area}}</view>
<view class="middles_bom_2 middles_boms">
<fui-icon name="fabulous-fill" color="#f8627f" size="45" @click="like(item.id,item.um_id)"></fui-icon>
{{item.likes}}
</view>
<view class="middles_bom_3 middles_boms" @click="Comment(item.id)">
<fui-icon name="comment-fill" color="#6281a6" size="45"></fui-icon>
{{item.comment}}
</view>
</view>
<view style="width: 100%;height: 20rpx;"></view>
</view>
<view class="empty" v-if="!list.length">
<view style="width: 200rpx;">
<img src="@/static/icon-img/kkry.png" alt="" style="width: 180rpx;height: 180rpx;">
<view style="font-size: 28rpx;font-weight: 800;color: #00be8c;">
还没有任何提醒
</view>
</view>
</view>
<view style="width: 100%;height: 20rpx;"></view>
<AQTabber></AQTabber>
</view>
</template>
@ -76,104 +15,23 @@
},
data() {
return {
list:[],
likes:0,
type:1,
type1:1,
activity_id:0,
um_id:0,
urls:'http://medication.zeyan.wang/'
}
},
onLoad() {
wx.hideTabBar({
success: function() {
console.log('TabBar 已隐藏');
},
fail: function(err) {
console.error('隐藏TabBar失败', err);
}
});
const um_id = uni.getStorageSync('um_id');
this.um_id = um_id
if (um_id == '') {
uni.navigateTo({
url: '/pages/login/login'
})
}
this.fetchData(this.um_id)
},
methods: {
fetchData(um_id) {
user.activity_index({
um_id: um_id
}).then(res => {
console.log(res)
if(res.status == 200){
if(res.data == null){
this.list = []
}else{
this.list = res.data
}
}else{
uni.showToast({
title: res.msg,
icon: 'none'
})
}
});
},
onPullDownRefresh(){
this.fetchData(this.um_id)
},
publishing(){
uni.navigateTo({
url: '/pages/index/publishing'
})
},
like(id,um_id){
user.activity_like({um_id:um_id,activity_id:id,type:1}).then(res => {
if(res.status == 200){
user.activity_index({
um_id: um_id
}).then(res => {
console.log(res)
if(res.status == 200){
this.list = res.data
}
});
this.type = res.data.type
this.activity_id = res.data.activity_id
}else{
uni.showToast({
title: res.msg,
icon: 'none'
})
}
});
},
collection(id,um_id){
user.activity_like({um_id:um_id,activity_id:id,type:2}).then(res => {
if(res.status == 200){
console.log(res)
this.fetchData(this.um_id)
this.type1 = res.data.type
this.activity_id = res.data.activity_id
}else{
uni.showToast({
title: res.msg,
icon: 'none'
})
}
});
},
coninfo(item){
// user.coninfo({id:id}).then(res => {
// fetchData(um_id) {
// user.activity_index({
// um_id: um_id
// }).then(res => {
// console.log(res)
// if(res.status == 200){
uni.setStorageSync('coninfo', item);
uni.navigateTo({
url: '/pages/index/coninfo'
})
// if(res.data == null){
// this.list = []
// }else{
// this.list = res.data
// }
// }else{
// uni.showToast({
// title: res.msg,
@ -181,13 +39,7 @@
// })
// }
// });
},
Comment(id){
uni.setStorageSync('actid', id);
uni.navigateTo({
url: '/pages/index/Comment'
})
}
// },
}
}
</script>

Loading…
Cancel
Save