diff --git a/api/business/notice.js b/api/business/notice.js index b49b0a0..9d31f4c 100644 --- a/api/business/notice.js +++ b/api/business/notice.js @@ -11,6 +11,16 @@ export function getNoticeList(params) { } +// 查询浏览足迹 +export function getHisList(params) { + return request({ + url: '/busi/notice/appFootprintList', + method: 'get', + params: params + }) +} + + // 订阅查询通告列表 export function getSubscribeList(params) { return request({ @@ -150,4 +160,4 @@ export function queryListByUserId(params) { method: 'get', params: params }) -} +} \ No newline at end of file diff --git a/pages/components/notice-index.vue b/pages/components/notice-index.vue index d386b68..f4b2ccb 100644 --- a/pages/components/notice-index.vue +++ b/pages/components/notice-index.vue @@ -280,7 +280,7 @@ /** * 选择平台 */ - choosePlat(index) { + async choosePlat(index) { if (index == 2) { //鉴权 if (!this.checkIfHasRights(rightsCode.subscribeSelect)) { @@ -327,7 +327,7 @@ * @param {Object} index * @param {Object} item */ - itemClick(index, item) { + async itemClick(index, item) { if ('全部' == item) { //全部 this.queryParams.sortBy = "" @@ -355,7 +355,7 @@ /** * 搜索 */ - goSeach() { + async goSeach() { //鉴权 if (!this.checkIfHasRights(rightsCode.searchNotice)) { return @@ -366,9 +366,10 @@ * 鉴权通用方法 * @param {Object} rigthsCode */ - checkIfHasRights(rigthsCode) { - if (!hasRights(rigthsCode)) { - toast("请开通会员") + async checkIfHasRights(rigthsCode) { + let res = await hasRights(rigthsCode) + if (!res) { + toast('请开通会员') return false } return true @@ -709,4 +710,4 @@ margin: 10rpx; } } - + \ No newline at end of file diff --git a/pages/index.vue b/pages/index.vue index 7c4490e..eac21aa 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -34,6 +34,11 @@ import { setStrData } from '@/utils/auth.js' + import { + toast, + hasRights + } from '@/utils/common.js' + import rightsCode from '@/utils/rightsCode' export default { components: { tabBarVue, @@ -46,7 +51,7 @@ data() { return { //当前用户类型 - nowUserType: null, + nowUserType: 'bz', menus: ['全部', '最新', '高奖励', '急招', '品牌置换'], menuIndex: 0, dataList: ['1', '2', '2', '2'], @@ -82,6 +87,7 @@ */ refreshUserType() { this.nowUserType = getUserType() + console.log(this.nowUserType, 90); }, updateParams(newVal) { this.nowUserType = newVal; @@ -99,9 +105,26 @@ if ("fabu" == code) { this.$tab.navigateTo('/pages/notice/public-notice') } else { + if (code == 'dingyue') { + if (!this.checkIfHasRights(rightsCode.subscribeSelect)) { + return + } + } this.menuCode = code } }, + /** + * 鉴权通用方法 + * @param {Object} rigthsCode + */ + async checkIfHasRights(rigthsCode) { + let res = await hasRights(rigthsCode) + if (!res) { + toast('请开通会员') + return false + } + return true + }, /** * 上滑加载数据 */ diff --git a/pages/mine/history/history.vue b/pages/mine/history/history.vue index af5b72c..377182f 100644 --- a/pages/mine/history/history.vue +++ b/pages/mine/history/history.vue @@ -26,6 +26,12 @@ toast, hasRights } from '@/utils/common.js' + import { + getCatgByCode + } from '@/api/system/config.js' + import { + getHisList + } from '@/api/business/notice.js' export default { components: { navigationBarVue, @@ -33,7 +39,7 @@ }, data() { return { - dataList: ['', '', '', '', '', '', ''], + dataList: [], queryParams: { pageNum: 1, pageSize: 10 @@ -44,8 +50,67 @@ //当前用户权益可以看几条浏览记录 maxHisNum: 20, } + }, + mounted() { + this.initData("dl_platform", "platformList") + this.initData("dl_blogger_type", "bloggerTypeList") + this.selectDataList() + }, + onLoad: function() { + }, methods: { + /** + * 初始化数据 + * @param {Object} code + * @param {Object} dataObj + */ + initData(code, dataObj) { + let that = this + getCatgByCode({ + code: code + }).then(res => { + if (res.code == 200) { + this[dataObj] = res.data + } + }).catch((e) => { + uni.showToast({ + icon: 'error', + duration: 2000, + title: e + }); + }) + }, + /** + * 查询数据 + */ + selectDataList() { + getHisList(this.queryParams).then(res => { + this.isTriggered = false + if (res.code == 200) { + if (this.queryParams.pageNum == 1) { + this.dataList = res.data.records + } else { + this.dataList = this.dataList.concat(res.data.records) + } + this.total = res.data.total + } + }).catch((e) => { + this.isTriggered = false + uni.showToast({ + icon: 'error', + duration: 2000, + title: e + }); + }) + }, + /** + * 查看通告详情 + * @param {Object} item + */ + goDetail(item) { + this.$tab.navigateTo(`/pages/notice/detail?id=${item.id}`) + }, /** * 上滑加载数据 */ @@ -57,6 +122,7 @@ } //页码+1,调用获取数据的方法获取第二页数据 this.queryParams.pageNum++ + this.selectDataList() }, /** * 下拉刷新数据 @@ -65,6 +131,8 @@ this.isTriggered = true this.queryParams.pageNum = 1 this.total = 0 + + this.selectDataList() }, /** * 查看通告详情 diff --git a/pages/notice/detail.vue b/pages/notice/detail.vue index 848109a..f1dc593 100644 --- a/pages/notice/detail.vue +++ b/pages/notice/detail.vue @@ -1,6 +1,6 @@