通知公告

This commit is contained in:
wanglei
2021-11-22 10:59:46 +08:00
parent 5aa59dd401
commit dddbbc6faf
4 changed files with 113 additions and 96 deletions

View File

@@ -1,5 +1,6 @@
<template> <template>
<div class="notification"> <div class="notification">
<template v-if="showList">
<AiTopFixed> <AiTopFixed>
<u-tabs :list="tabs" :is-scroll="false" height="96" bar-width="192" @click="change"></u-tabs> <u-tabs :list="tabs" :is-scroll="false" height="96" bar-width="192" @click="change"></u-tabs>
</AiTopFixed> </AiTopFixed>
@@ -8,7 +9,9 @@
<template v-if="!item.imgUrl"> <template v-if="!item.imgUrl">
<label> <label>
<b v-if="index==0 && item.readStatus==0"></b> <b v-if="index==0 && item.readStatus==0"></b>
<div class="tag" v-if="index==1" :style="color(item.status)">{{$dict.getLabel("announcementStatus",item.status)}}</div> <div class="tag" v-if="index==1" :style="color(item.status)">
{{$dict.getLabel("announcementStatus",item.status)}}
</div>
{{item.title}} {{item.title}}
</label> </label>
<u-gap height="16"></u-gap> <u-gap height="16"></u-gap>
@@ -22,7 +25,9 @@
<div class="left"> <div class="left">
<label> <label>
<b v-if="index==0 && item.readStatus==0"></b> <b v-if="index==0 && item.readStatus==0"></b>
<div class="tag" v-if="index==1" :style="color(item.status)">{{$dict.getLabel("announcementStatus",item.status)}}</div> <div class="tag" v-if="index==1" :style="color(item.status)">
{{$dict.getLabel("announcementStatus",item.status)}}
</div>
{{item.title}} {{item.title}}
</label> </label>
<u-gap height="16"></u-gap> <u-gap height="16"></u-gap>
@@ -40,11 +45,11 @@
<AiEmpty v-else/> <AiEmpty v-else/>
<u-loadmore :status="status" v-if="dataList.length"/> <u-loadmore :status="status" v-if="dataList.length"/>
<AiAdd @add="add"/> <AiAdd @add="add"/>
<u-popup :show="show" mode="bottom"> <u-popup :show="show" mode="bottom" closeOnClickOverlay>
<div class="popup-wrap"> <div class="popup-wrap">
<u-row justify="between"> <u-row justify="between">
<div class="colum" v-for="(item,index) in optList" :key="index" @click="handleOpt(item)"> <div class="colum" v-for="(item,index) in optList" :key="index" @click="handleOpt(item)">
<u-icon :name="item.icon" size="100" :custom-style="{backgroundColor:'#fff',borderRadius:'16px'}"></u-icon> <u-icon :name="item.icon" size="50" :custom-style="{backgroundColor:'#fff',borderRadius:'8px'}"></u-icon>
<u-gap height="16"></u-gap> <u-gap height="16"></u-gap>
{{item.name}} {{item.name}}
</div> </div>
@@ -55,6 +60,8 @@
<u-modal v-model="modal" :content="'是否确定' + content + '该公告?'" title="" show-confirm-button <u-modal v-model="modal" :content="'是否确定' + content + '该公告?'" title="" show-confirm-button
show-cancel-button confirm-text="确定" cancel-text="取消" show-cancel-button confirm-text="确定" cancel-text="取消"
@confirm="confirm"></u-modal> @confirm="confirm"></u-modal>
</template>
<component :is="comp" v-else :params="params"></component>
</div> </div>
</template> </template>
@@ -62,11 +69,12 @@
import AiAdd from "../../components/AiAdd"; import AiAdd from "../../components/AiAdd";
import AiEmpty from "../../components/AiEmpty/AiEmpty"; import AiEmpty from "../../components/AiEmpty/AiEmpty";
import AiTopFixed from "../../components/AiTopFixed"; import AiTopFixed from "../../components/AiTopFixed";
import {add, detail, read} from "./components"
export default { export default {
name: "notification", name: "notification",
appName: "通知公告", appName: "通知公告",
components: {AiAdd, AiEmpty,AiTopFixed}, components: {AiAdd, AiEmpty, AiTopFixed, add, detail, read},
data() { data() {
return { return {
index: 0, index: 0,
@@ -76,6 +84,9 @@
current: 1, current: 1,
dataList: [], dataList: [],
detail: {}, detail: {},
showList: true,
comp: "",
params: null,
status: "加载更多", status: "加载更多",
} }
}, },
@@ -178,15 +189,17 @@
if (this.index == 1) { if (this.index == 1) {
this.show = true; this.show = true;
} else { } else {
uni.navigateTo({ this.comp = "detail";
url: "/pages/notification/components/detail?id=" + this.detail.id + "&flag=" + true this.params = {
}) id: this.detail.id,
flag: true
};
this.showList = false;
} }
}, },
add() { add() {
uni.navigateTo({ this.comp = "add";
url: "/pages/notification/components/add" this.showList = false;
})
}, },
change(val) { change(val) {
this.index = val.index; this.index = val.index;
@@ -311,6 +324,7 @@
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
} }
} }
& > img { & > img {
width: 192px; width: 192px;
height: 144px; height: 144px;

View File

@@ -63,16 +63,15 @@
export default { export default {
name: "detail", name: "detail",
components:{AiBack,AiEmpty}, components:{AiBack,AiEmpty},
props:{
params:Object
},
data() { data() {
return { return {
detailObj: null, detailObj: {},
id: null,
flag: null,
} }
}, },
onLoad(opt){ created() {
this.id = opt.id;
this.flag = opt.flag;
this.getDetail(); this.getDetail();
}, },
methods: { methods: {
@@ -90,8 +89,8 @@
getDetail() { getDetail() {
this.$http.post("/app/appannouncement/detail", null, { this.$http.post("/app/appannouncement/detail", null, {
params: { params: {
id: this.id, id: this.params?.id,
detail: this.flag detail: this.params?.flag
} }
}).then(res=>{ }).then(res=>{
if(res && res.data){ if(res && res.data){
@@ -100,9 +99,9 @@
}) })
}, },
handleClick() { handleClick() {
uni.navigateTo({ this.$parent.params = this.params.id;
url:"/pages/notification/components/read?id=" + this.id, this.$parent.comp = "read";
}) this.$parent.showList = false;
} }
}, },
} }

View File

@@ -0,0 +1,3 @@
export {default as add} from "./add"
export {default as detail} from "./detail"
export {default as read} from "./read"

View File

@@ -5,7 +5,7 @@
</AiTopFixed> </AiTopFixed>
<div class="body"> <div class="body">
<div class="item" v-for="(item,index) in (current==0 ? list.read : list.unRead)" :key="index"> <div class="item" v-for="(item,index) in (current==0 ? list.read : list.unRead)" :key="index">
<u-avatar :src="item.avatar" mode="square" size="76"></u-avatar> <u-avatar :src="item.avatar" mode="square" size="38"></u-avatar>
<span class="name">{{item.name}}</span> <span class="name">{{item.name}}</span>
</div> </div>
</div> </div>
@@ -20,22 +20,23 @@
export default { export default {
name: "read", name: "read",
components: {AiBack, AiTopFixed}, components: {AiBack, AiTopFixed},
props:{
params:[String,Number]
},
data() { data() {
return { return {
current: 0, current: 0,
id: null,
list: [], list: [],
} }
}, },
onLoad(opt) { created() {
this.id = opt.id;
this.getList(); this.getList();
}, },
methods: { methods: {
getList() { getList() {
this.$http.post("/app/appannouncementreader/list-unread",null,{ this.$http.post("/app/appannouncementreader/list-unread",null,{
params:{ params:{
id:this.id id:this.params
} }
}).then(res => { }).then(res => {
if (res && res.data) { if (res && res.data) {