[更新发现]

This commit is contained in:
zhangmanman
2022-01-13 13:56:32 +08:00
parent 9af54bc24a
commit c82f40ee09
27 changed files with 1274 additions and 295 deletions

100
pages/notice/details.vue Normal file
View File

@@ -0,0 +1,100 @@
<template>
<view class="content">
<view class="tips">
<view class="noticeImg" :class="{active : noticeData.type == 'SystemNotification'}">
<block v-if="noticeData.type == 'SystemNotification'">
<u-icon name="bell-fill" color="#77e79f" size="20" bold style="padding: 14rpx"></u-icon>
</block>
<block v-else>
<u-icon name="calendar-fill" color="#f1a166" size="20" bold style="padding: 14rpx"></u-icon>
</block>
</view>
<view class="noticeBox">
<view class="noticeTitle">
{{ noticeData.type == 'SystemNotification' ? '系统通知' : '订单通知'}}
</view>
<view class="contant">
<view class="title">
{{ noticeData.title }}
</view>
<view class="text">
时间:{{ noticeData.created_at }}
</view>
<view class="text">
{{ noticeData.content }}
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import { noticeDet } from '@/apis/interfaces/notice'
export default {
data() {
return {
noticeData : ''
};
},
mounted() {
// 获取列表
this.getDet()
},
methods: {
// 列表
getDet(){
noticeDet(this.$Route.query.id).then(res => {
this.noticeData = res
})
}
}
};
</script>
<style lang="scss" scoped>
page {
background-color: $window-color;
}
.tips {
padding: $padding;
box-sizing: border-box;
position: relative;
.noticeImg {
width: 64rpx;
height: 64rpx;
text-align: center;
border-radius: 50%;
background-color: #ffefe2;
&.active {
background-color: #e7f8f0;
}
}
.noticeBox {
position: absolute;
left: 0;
top: 0;
width: 100%;
padding: $padding + 10 $padding $padding $padding + 90rpx;
box-sizing: border-box;
.noticeTitle {
margin-bottom: $margin;
}
.contant {
background-color: white;
padding: $padding $padding - 10;
box-sizing: border-box;
border-radius: $radius;
.title {
font-weight: bold;
margin-bottom: $margin;
}
.text {
line-height: 48rpx;
font-size: $title-size-m;
color: $text-gray;
}
}
}
}
</style>

102
pages/notice/index.vue Normal file
View File

@@ -0,0 +1,102 @@
<template>
<view class="content">
<view class="noticeList" v-for="(item, index) in tabArr" :key="index" @click="$Router.push({ name: 'noticeList', params: {type: item.type }})" >
<view class="noticeImg" :class="{active : item.count != 0}">
<block v-if="item.type == 'SystemNotification'">
<u-icon name="bell-fill" color="#77e79f" size="22" bold style="padding: 14rpx"></u-icon>
</block>
<block v-else>
<u-icon name="calendar-fill" color="#f1a166" size="22" bold style="padding: 14rpx"></u-icon>
</block>
</view>
<view class="noticeCont">
<view class="name">
{{ item.name }}
</view>
<view class="nowrap text">
{{ item.type == 'SystemNotification' ? 'APP特色功能介绍、官方推进、活动通知' : '商品订单购买成功、发货成功、退货' }}
</view>
</view>
</view>
</view>
</template>
<script>
import { categories } from '@/apis/interfaces/notice'
export default {
data() {
return {
tabArr : []
};
},
mounted() {
// 获取分类
this.getNotice()
},
methods: {
// 分类
getNotice(){
categories().then(res => {
this.tabArr = res
})
}
}
};
</script>
<style lang="scss" scoped>
page {
padding: $padding;
box-sizing: border-box;
background-color: $window-color;
}
.noticeList {
padding: $padding;
box-sizing: border-box;
position: relative;
background-color: white;
margin-bottom: $margin;
border-radius: $radius;
height: 146rpx;
&:first-child {
.noticeImg {
background-color: #e7f8f0;
}
}
.noticeImg {
width: 68rpx;
height: 68rpx;
text-align: center;
border-radius: 50%;
margin-top: $margin - 20;
background-color: #ffefe2;
position: relative;
&.active::after {
position: absolute;
content: '';
top: $margin - 25;
right: 0;
width: 12rpx;
height: 12rpx;
border-radius: 50%;
background-color: $text-price;
}
}
.noticeCont {
position: absolute;
left: 0;
top: 0;
width: 100%;
padding: $padding $padding 0 $padding + 100rpx;
.name {
font-weight: bold;
font-size: $title-size-lg;
}
.text {
margin-top: $margin - 20;
font-size: $title-size-sm;
}
}
}
</style>

108
pages/notice/list.vue Normal file
View File

@@ -0,0 +1,108 @@
<template>
<view class="content">
<view class="box" v-if="listArr.length > 0">
<view class="list" v-for="(item, index) in listArr" @click="$Router.push({ name: 'noticeDetails', params: {id: item.notification_id }})">
<view class="title">
{{ item.title }}
</view>
<view class="text">
{{ item.content }}<view class="more">点我查看<u-icon name="arrow-right-double" color="#34CE98" bold size="14" style="display: inline-block;"></u-icon></view>
</view>
</view>
<block v-if="page.total_page > 1">
<u-loadmore :status="status" />
</block>
</view>
<view class="noMessage" v-else>
<u-empty
mode="message"
/>
</view>
</view>
</template>
<script>
import { lists } from '@/apis/interfaces/notice'
export default {
data() {
return {
listArr : [],
status : 'loadmore',
page : ''
};
},
mounted() {
// 获取列表
this.getList()
},
methods: {
// 列表
getList(pages){
lists(this.$Route.query.type, {
page: pages
}).then(res => {
if(res.page.current == 1){
this.listArr = []
}
this.listArr = this.listArr.concat(res.data)
this.status = this.page.has_more ? 'loadmore': 'nomore'
this.page = res.page
})
}
},
// 下拉加载
onReachBottom() {
if(this.page.has_more){
this.status = 'loading'
let pages = this.page.current + 1
// 获取列表
this.getList(pages)
return
}
this.status = 'nomore'
}
};
</script>
<style lang="scss" scoped>
page {
background-color: $window-color;
}
.box {
padding: $padding;
box-sizing: border-box;
.list {
padding: $padding;
box-sizing: border-box;
border-radius: $radius;
background-color: white;
margin-bottom: $margin;
.title {
font-size: $title-size-lg;
margin-bottom: $margin - 10;
font-weight: bold;
}
.text {
font-size: $title-size-m;
color: $text-gray-m;
.more {
color: $main-color;
padding-left: $padding - 10;
}
}
}
}
.noMessage {
background-color: white;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-box-pack: center;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
</style>