deming/pages/information/information.vue
2020-08-05 21:06:29 +08:00

244 lines
4.9 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view>
<u-navbar :is-back="false" :title-size="36" title="消息">
<view class="slot-wrap">
<image src="../../static/pageD/info(3).png" @click="delMessage()"></image>
<image src="../../static/pageD/info(2).png"></image>
</view>
</u-navbar>
<view class="content">
<!-- 正文内容 -->
</view>
<!-- <view class="sousuo"></view> -->
<view class="backes">
<titles :information="information_dles"></titles>
</view>
<!-- 消息通知 -->
<view class="backes">
<view id="information">
<view class="information_dl" v-for="(item,index) in information_dl" :key="index" >
<view>
<image :src="item.url"></image>
</view>
<view class="title">{{item.title}}</view>
<view class="contentes">{{item.contentes}}</view>
<view class="times">{{item.title}}</view>
</view>
</view>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
import { mapState } from 'vuex';
import titles from "@/components/informations/titles/titles"
export default {
computed: {
...mapState(["hasLogin,token"])
},
data() {
return {
information_dles : [{
id: 0,
url: '../../static/pageD/info(11).png',
text: '公告/资讯'
},
{
id: 0,
url: '../../static/pageD/info(13).png',
text: '活动消息'
},
{
id: 0,
url: '../../static/pageD/info(14).png',
text: '交易物流'
},
{
id: 0,
url: '../../static/pageD/info(15).png',
text: '关注消息'
},
],
// 通知消息
information_dl: [
{
id: 0,
url: '../../static/pageD/info(11).png',
text: '通知消息',
contentes: '亲,您购物车中的 [新鲜盆栽] 降价4.00元。',
title: '2020-7-21'
},
{
id: 1,
url: '../../static/pageD/info(11).png',
text: '通知消息',
contentes: '亲,您购物车中的 [新鲜盆栽] 降价4.00元。',
title: '2020-7-21'
},
{
id: 2,
url: '../../static/pageD/info(11).png',
text: '通知消息',
contentes: '亲,您购物车中的 [新鲜盆栽] 降价4.00元。',
title: '2020-7-21'
},
],
value: '',
login: '登录',
show: false
};
},
onLoad() {
// /消息模块的请求
if (this.hasLogin) {
this.messageIndex();
}
},
methods: {
// 选中某个复选框时由checkbox时触发
checkboxChange(e) {
//console.log(e);
},
// 选中任一checkbox时由checkbox-group触发
checkboxGroupChange(e) {
// console.log(e);
},
mask_u() {
this.show = !this.show
},
// 消息模块的读取
messageIndex(){
console.log("消息模块的读取消息模块的读取消息模块的读取")
this.$u.api.messageIndex({}).then((res)=>{
console.log(res)
let data = res.data.allMessages;
for(let i in data){
var type = data[i].type;
console.log(data[i].type)
var array = []
array.push(type)
}
console.log( array)
// 获取到字段的类型 添加到数据中心
for(let j = 0; j < this.information_dles.length; j++ ){
console.log()
// this.information_dles[j].type = type;
for(let k = 0; k < array.length; k++ ){
this.information_dles[j].type = array[k];
console.log( array[k])
}
}
console.log(this.information_dles)
})
},
// 清空消息
delMessage(){
this.$u.api.delMessage({
type : "all"
}).then((res)=>{
console.log(res)
if(res.errCode == 0){
this.$refs.uToast.show({
title: '清除成功',
type: 'success'
})
}
})
}
},
components: {
titles,
}
};
</script>
<style lang="scss" scoped>
.sousuo {
height: 113rpx;
border: 1px #f00 solid;
}
.slot-wrap {
display: flex;
align-items: center;
/* 如果您想让slot内容占满整个导航栏的宽度 */
/* flex: 1; */
/* 如果您想让slot内容与导航栏左右有空隙 */
/* padding: 0 30rpx; */
image {
width: 60rpx;
height: 60rpx;
position: absolute;
right: 90rpx;
}
image:nth-child(2) {
width: 34rpx;
height: 40rpx;
position: absolute;
right: 30rpx;
}
}
.backes {
background: #fff;
margin-bottom: 10rpx;
}
.information_dl {
width: 710rpx;
margin: 0 auto;
overflow: hidden;
zoom: 1;
position: relative;
padding-bottom: 23rpx;
border-bottom: 1px #ececec solid;
padding: 20rpx 5rpx 23rpx 5rpx;
image {
width: 84rpx;
height: 84rpx;
margin-right: 16rpx;
}
view {
float: left;
display: block;
}
.title {
font-size: 30rpx;
color: #333;
width: 600rpx;
margin-bottom: 15rpx;
margin-top: 9rpx;
}
.contentes {
font-size: 20rpx;
color: #999;
width: 600rpx;
}
}
.times {
position: absolute;
top: 30rpx;
right: 0;
color: #333333;
font-size: 20rpx;
}
uni-page-wrapper {}
page {
background: #ececec !important;
}
</style>