dl_uniapp/pages/index.vue

110 lines
2.5 KiB
Vue
Raw Normal View History

2025-03-18 17:41:45 +08:00
<template>
2025-03-21 17:57:53 +08:00
<view class="content">
<!-- 主体区域 -->
2025-03-31 14:31:41 +08:00
<view class="content-body">
2025-03-21 17:57:53 +08:00
<!-- 通告列表页 -->
<notice-index v-show="'home'==menuCode"></notice-index>
2025-04-07 13:53:10 +08:00
<mine-index :nowUserType.sync="nowUserType" @update:params="updateParams"
v-show="'my'==menuCode"></mine-index>
2025-04-02 11:34:12 +08:00
<subscribe v-show="'dingyue'==menuCode"></subscribe>
2025-04-03 16:46:51 +08:00
<my-notice v-show="'myNotice'==menuCode"></my-notice>
2025-03-21 17:57:53 +08:00
</view>
2025-03-31 15:40:40 +08:00
<tabBarVue :menuCode="menuCode" ref="tarBar" @changeMenu="changeMenu"></tabBarVue>
2025-03-21 17:57:53 +08:00
</view>
2025-03-18 17:41:45 +08:00
</template>
<script>
2025-04-07 13:53:10 +08:00
import {
changeUserType,
getUserType,
formatNumberWithUnits,
calculateTimeDifference
} from '@/utils/common.js'
2025-03-21 17:57:53 +08:00
import tabBarVue from '@/components/tabbar/tabBar.vue'
2025-04-02 11:34:12 +08:00
import noticeIndex from '@/pages/components/notice-index.vue'
import subscribe from '@/pages/components/subscribe.vue'
import mineIndex from '@/pages/mine/mine-index.vue'
2025-04-03 16:46:51 +08:00
import myNotice from '@/pages/components/my-notice.vue'
2025-03-21 17:57:53 +08:00
export default {
2025-03-31 14:31:41 +08:00
components: {
2025-03-21 17:57:53 +08:00
tabBarVue,
noticeIndex,
2025-04-02 11:34:12 +08:00
subscribe,
2025-04-03 16:46:51 +08:00
mineIndex,
myNotice
2025-03-21 17:57:53 +08:00
},
data() {
return {
2025-04-07 13:53:10 +08:00
//当前用户类型
nowUserType: null,
2025-03-31 14:31:41 +08:00
menus: ['全部', '最新', '高奖励', '急招', '品牌置换'],
2025-03-21 17:57:53 +08:00
menuIndex: 0,
2025-03-31 14:31:41 +08:00
dataList: ['1', '2', '2', '2'],
2025-03-21 17:57:53 +08:00
queryParams: {
pageNo: 1,
pageSize: 10,
},
total: 0,
//下来刷新状态
isTriggered: false,
2025-04-02 18:34:15 +08:00
menuCode: "home",
2025-03-21 17:57:53 +08:00
}
},
onLoad: function() {
2025-04-07 13:53:10 +08:00
this.nowUserType = getUserType()
2025-03-21 17:57:53 +08:00
},
methods: {
2025-04-07 13:53:10 +08:00
updateParams(newVal) {
this.nowUserType = newVal;
},
2025-03-21 17:57:53 +08:00
itemClick(index, item) {
this.menuIndex = index
},
/**
* 菜单切换
* @param {Object} code
*/
2025-03-31 14:31:41 +08:00
changeMenu(code) {
this.menuCode = code
2025-03-21 17:57:53 +08:00
},
/**
* 上滑加载数据
*/
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
},
}
}
</script>
2025-03-18 17:41:45 +08:00
2025-03-21 17:57:53 +08:00
<style lang="scss">
.content {
width: 100%;
color: #363636;
2025-03-31 14:31:41 +08:00
background-color: #F6F6F6;
2025-03-21 17:57:53 +08:00
font-size: 38rpx;
2025-04-02 18:34:15 +08:00
height: calc(100vh - var(--window-bottom) - 117rpx);
2025-03-31 14:31:41 +08:00
}
.content-body {
width: 100%;
2025-04-02 18:34:15 +08:00
height: 100%;
2025-03-31 14:31:41 +08:00
background-color: white;
2025-04-02 18:34:15 +08:00
// padding-bottom: calc(var(--window-bottom) + 127rpx);
2025-03-21 17:57:53 +08:00
}
2025-03-31 14:31:41 +08:00
</style>