Browse Source

添加系统消息页面

master
mike 3 years ago
parent
commit
40735ccfa2
  1. 11
      packages/article/article.vue
  2. 101
      packages/notify/notify.vue
  3. 11
      pages.json
  4. 16
      pages/settings/settings.vue
  5. 18
      service/index.js

11
packages/article/article.vue

@ -6,6 +6,7 @@
<script>
import { tipsDetail,aboutUs, gradeAgreement, privacyAgreement, cardDesign, ratingStandard, getServiceStandard } from '@/service/agreementArticle.js';
import { notifyDetail } from '@/service/index.js';
export default {
data(){
@ -29,6 +30,8 @@
this.getRatingStandard();
}else if(options.type === 'service_standard'){
this.getServiceStandard();
}else if(options.type === 'notify_detail'){
this.notifyDetail();
}else{
this.getTips();
}
@ -90,6 +93,14 @@
title: res.data.datas.title
})
},
async notifyDetail(){
let res = await notifyDetail(this.id);
this.article = res.data.datas.content;
uni.setNavigationBarTitle({
title: res.data.datas.title
})
}
}
}
</script>

101
packages/notify/notify.vue

@ -0,0 +1,101 @@
<template>
<view style="padding-bottom: 30px;">
<view class="notify-panel" v-for="(item,index) in datas" :key="index" @click="toDetail(item)">
<view class="notify-panel-top">
<view class="notify-dot"></view>
<view class="notify-tips">收到一条新消息</view>
<view class="notify-time">{{item.create_time}}</view>
</view>
<view class="notify-panel-bottom">{{item.title}}</view>
</view>
<u-loadmore :status="status" />
</view>
</template>
<script>
import { notify } from '@/service/index.js';
export default {
onReachBottom(){
console.log("onReachBottom")
if(this.status == 'loadmore'){
this.fetchDatas(this.page + 1)
}
},
onLoad(){
this.fetchDatas()
},
data() {
return {
datas:[],
page:1,
status: 'nomore',
}
},
methods: {
async fetchDatas(page = 1){
let res = await notify(page)
if(res.data.datas.current_page == 1){
this.datas = res.data.datas.data
}else{
this.datas = this.datas.concat(res.data.datas.data)
}
if(res.data.datas.prev_page_url){
this.status ='loadmore'
}else{
this.status = 'nomore'
}
this.page = res.data.datas.current_page
console.log("fetchDatas",res)
},
toDetail(item){
this.$url('/packages/article/article?type=notify_detail&id='+item.id)
}
}
}
</script>
<style lang="scss">
.notify-panel{
display: flex;
flex-direction: column;
background-color: white;
margin-bottom: 10rpx;
}
.notify-panel-top{
display: flex;
align-items: center;
margin-left: 32rpx;
padding-top: 20rpx;
padding-bottom: 20rpx;
}
.notify-dot {
width: 12rpx;
height: 12rpx;
background-color: red;
border-radius: 6rpx;
margin-right: 10rpx;
}
.notify-panel-bottom{
margin-left: 32rpx;
margin-bottom: 30rpx;
font-size: 28rpx;
line-height: 40rpx;
color: #222222;
}
.notify-tips{
margin-right: 110rpx;
font-size: 32rpx;
font-weight: 500;
color: #222222;
line-height: 44rpx;
}
.notify-time{
font-size: 28rpx;
font-weight: 400;
color: #777777;
line-height: 40rpx;
}
</style>

11
pages.json

@ -129,7 +129,16 @@
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}]
} ,{
"path" : "notify/notify",
"style" :
{
"navigationBarTitleText": "系统消息",
"enablePullDownRefresh": false
}
}
]
}],
"globalStyle": {
"navigationBarTextStyle": "black",

16
pages/settings/settings.vue

@ -6,8 +6,8 @@
</u-cell>
<u-cell title="昵称" :isLink="false" :border="false" :value="userInfo.nick_name"></u-cell>
<u-cell title="收货地址" :isLink="true" :border="false" url="/packages/address/address"></u-cell>
<u-cell title="系统消息" :isLink="true" :border="false" @click="$msg('敬请期待')">
<!-- <u-badge class="badge" slot="value" numberType="overflow" max="99" :value="99"></u-badge> -->
<u-cell title="系统消息" :isLink="true" :border="false" url="/packages/notify/notify">
<u-badge class="badge" slot="value" numberType="overflow" max="99" :value="sysDots"></u-badge>
</u-cell>
<u-cell title="我的分销优惠码" :isLink="true" :border="false" url="/packages/agent/agent" v-if="isAgent()"></u-cell>
@ -18,12 +18,15 @@
</template>
<script>
import { my } from '@/service/index.js';
export default {
data() {
return {
src:"https://cdn.uviewui.com/uview/album/1.jpg",
userInfo: {},
version: ''
version: '',
sysDots:0,
}
},
onLoad(){
@ -33,7 +36,14 @@
this.version = miniProgram.version;
}
},
onShow(){
this.getUserCenterDetail()
},
methods: {
async getUserCenterDetail(){
let res = await my();
this.sysDots = res.data.datas.dots.system
},
logout(){
uni.removeStorage({key:'userInfo'});
uni.removeStorage({key:'qxk_sysinfo'});

18
service/index.js

@ -39,4 +39,22 @@ export async function sysInfo() {
url: '/api/v1/sys_info',
method: 'post',
})
}
// 获取系统消息列表
export async function notify(page) {
return await request({
url: '/api/v1/notifys',
method: 'post',
data:{page:page}
})
}
// 获取系统消息详情
export async function notifyDetail(id) {
return await request({
url: '/api/v1/notify_detail',
method: 'post',
data:{id:id}
})
}
Loading…
Cancel
Save