167 lines
3.9 KiB
Vue
167 lines
3.9 KiB
Vue
<template>
|
|
<view class="content">
|
|
<!-- 主体区域 -->
|
|
<view class="content-body">
|
|
<!-- 通告列表页 -->
|
|
<notice-index v-if="'home'==menuCode"></notice-index>
|
|
<mine-index :key="nowUserType" :nowUserType="nowUserType" v-if="'my'==menuCode"
|
|
@refreshUserType="refreshUserType()"></mine-index>
|
|
<subscribe v-if="'dingyue'==menuCode"></subscribe>
|
|
<my-notice v-if="'myNotice'==menuCode && '02'==nowUserType"></my-notice>
|
|
<my-notice-tg v-if="'myNotice'==menuCode && '01'==nowUserType"></my-notice-tg>
|
|
</view>
|
|
<tabBarVue :menuCode="menuCode" :nowUserType="nowUserType" ref="tarBar" @changeMenu="changeMenu"></tabBarVue>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
changeUserType,
|
|
getUserType,
|
|
formatNumberWithUnits,
|
|
calculateTimeDifference
|
|
} from '@/utils/common.js'
|
|
import tabBarVue from '@/components/tabbar/tabBar.vue'
|
|
import noticeIndex from '@/pages/components/notice-index.vue'
|
|
import subscribe from '@/pages/components/subscribe.vue'
|
|
import mineIndex from '@/pages/mine/mine-index.vue'
|
|
import myNotice from '@/pages/components/my-notice.vue'
|
|
import myNoticeTg from '@/pages/components/my-notice-tg.vue'
|
|
import {
|
|
getSiteConfig
|
|
} from '@/api/system/config.js'
|
|
import constant from '@/utils/constant'
|
|
import {
|
|
setStrData
|
|
} from '@/utils/auth.js'
|
|
export default {
|
|
components: {
|
|
tabBarVue,
|
|
noticeIndex,
|
|
subscribe,
|
|
mineIndex,
|
|
myNotice,
|
|
myNoticeTg
|
|
},
|
|
data() {
|
|
return {
|
|
//当前用户类型
|
|
nowUserType: null,
|
|
menus: ['全部', '最新', '高奖励', '急招', '品牌置换'],
|
|
menuIndex: 0,
|
|
dataList: ['1', '2', '2', '2'],
|
|
queryParams: {
|
|
pageNo: 1,
|
|
pageSize: 10,
|
|
},
|
|
total: 0,
|
|
//下来刷新状态
|
|
isTriggered: false,
|
|
menuCode: "home",
|
|
}
|
|
},
|
|
watch: {
|
|
nowUserType(newVal, oldVal) {
|
|
console.log(newVal, "newVal")
|
|
console.log(oldVal, "oldVal")
|
|
this.nowUserType = newVal;
|
|
},
|
|
},
|
|
mounted() {
|
|
this.refreshUserType()
|
|
},
|
|
onShow() {
|
|
this.refreshUserType()
|
|
},
|
|
onLoad: function() {
|
|
this.selectSiteConfig("platform_tel")
|
|
},
|
|
methods: {
|
|
/**
|
|
* 重新获取当前角色
|
|
*/
|
|
refreshUserType() {
|
|
this.nowUserType = getUserType()
|
|
},
|
|
updateParams(newVal) {
|
|
this.nowUserType = newVal;
|
|
},
|
|
|
|
itemClick(index, item) {
|
|
this.menuIndex = index
|
|
},
|
|
/**
|
|
* 菜单切换
|
|
* @param {Object} code
|
|
*/
|
|
changeMenu(code) {
|
|
this.nowUserType = getUserType()
|
|
if ("fabu" == code) {
|
|
this.$tab.navigateTo('/pages/notice/public-notice')
|
|
} else {
|
|
this.menuCode = code
|
|
}
|
|
},
|
|
/**
|
|
* 上滑加载数据
|
|
*/
|
|
onReachBottomCus() {
|
|
//判断 如果页码*页容量大于等于总条数,提示该页数据加载完毕
|
|
if (this.queryParams.pageNo * this.queryParams.pageSize >= this.total) {
|
|
uni.$u.toast('没有更多数据了')
|
|
return
|
|
}
|
|
//页码+1,调用获取数据的方法获取第二页数据
|
|
this.queryParams.pageNo++
|
|
},
|
|
/**
|
|
* 下拉刷新数据
|
|
*/
|
|
onRefresherrefresh() {
|
|
this.isTriggered = true
|
|
this.queryParams.pageNo = 1
|
|
this.total = 0
|
|
},
|
|
/**
|
|
* 查询平台配置
|
|
*/
|
|
selectSiteConfig(code) {
|
|
getSiteConfig({
|
|
code: code
|
|
}).then(res => {
|
|
let jsonArray = JSON.parse(res.data)
|
|
jsonArray.map((item) => {
|
|
if (constant.customer_service == item.name) {
|
|
setStrData(constant.customer_service, item.value)
|
|
} else if (constant.wechat_img == item.name) {
|
|
setStrData(constant.wechat_img, item.value)
|
|
}
|
|
})
|
|
}).catch((e) => {
|
|
uni.showToast({
|
|
icon: 'error',
|
|
duration: 2000,
|
|
title: e
|
|
});
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.content {
|
|
width: 100%;
|
|
color: #363636;
|
|
background-color: #F6F6F6;
|
|
font-size: 38rpx;
|
|
height: calc(100vh - var(--window-bottom) - 117rpx);
|
|
}
|
|
|
|
.content-body {
|
|
width: 100%;
|
|
height: 100%;
|
|
background-color: white;
|
|
// padding-bottom: calc(var(--window-bottom) + 127rpx);
|
|
}
|
|
</style> |