2022-11-18 10:33:37 +00:00
|
|
|
|
<template>
|
|
|
|
|
<view class="pad-x120">
|
|
|
|
|
<!-- 头部 -->
|
2022-12-22 08:47:05 +00:00
|
|
|
|
<status-nav navBarTitle="公告管理"></status-nav>
|
2022-11-18 10:33:37 +00:00
|
|
|
|
<view class="content" :style="{'padding-top':statusHeight+50+'px'}">
|
2022-12-22 08:47:05 +00:00
|
|
|
|
<!-- 公告状态 -->
|
|
|
|
|
<view class="notick-status">
|
|
|
|
|
<view class="radio-item" @tap="changeNotickStatus(index)" v-for="(item,index) in radioList" :key="index">
|
|
|
|
|
<view :class="radioIndex==index?'checked':''"></view>
|
|
|
|
|
<view class="font26">{{item}}</view>
|
2022-12-08 10:07:45 +00:00
|
|
|
|
</view>
|
2022-11-18 10:33:37 +00:00
|
|
|
|
</view>
|
2022-12-22 08:47:05 +00:00
|
|
|
|
<!-- 公告内容 -->
|
|
|
|
|
<view class="notick-txt">
|
|
|
|
|
<view class="notick-tips font26">请编辑公告内容</view>
|
2023-01-14 03:15:59 +00:00
|
|
|
|
<textarea class="input font26" name="msg" v-model="noticeMsg" placeholder="请填写公告内容"></textarea>
|
2022-11-18 10:33:37 +00:00
|
|
|
|
</view>
|
2023-01-14 03:15:59 +00:00
|
|
|
|
<!-- 提交按钮 -->
|
2022-12-22 08:47:05 +00:00
|
|
|
|
<view class="enter-detail-btns color-white font30">
|
2023-01-14 03:15:59 +00:00
|
|
|
|
<view class="btn" @tap="savaNoticeEv('btn')">发布</view>
|
|
|
|
|
<view class="btn" @tap="backEv">取消</view>
|
2022-12-08 10:07:45 +00:00
|
|
|
|
</view>
|
2022-11-18 10:33:37 +00:00
|
|
|
|
</view>
|
|
|
|
|
<!-- 尾部 -->
|
2022-12-22 09:36:10 +00:00
|
|
|
|
<tabbar :userType="userType" current="2"></tabbar>
|
2022-11-18 10:33:37 +00:00
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
import tabbar from '@/components/tabbar/tabbar';
|
|
|
|
|
export default {
|
|
|
|
|
components:{
|
|
|
|
|
tabbar
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
statusHeight:uni.getSystemInfoSync().statusBarHeight, //状态栏高度
|
|
|
|
|
userType:'director', //账户类型 工人:worker 负责人:director
|
2022-12-22 08:47:05 +00:00
|
|
|
|
radioList:['开启','禁用'],
|
|
|
|
|
radioIndex:0, //当前选择
|
2023-01-14 03:15:59 +00:00
|
|
|
|
noticeMsg:'', //公告内容
|
2022-11-18 10:33:37 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onLoad(op) {
|
2023-01-14 03:15:59 +00:00
|
|
|
|
|
2022-11-18 10:33:37 +00:00
|
|
|
|
},
|
|
|
|
|
onShow() {
|
2023-01-14 03:15:59 +00:00
|
|
|
|
// 获取工地公告
|
|
|
|
|
this.getWorksiteNotice();
|
2022-11-18 10:33:37 +00:00
|
|
|
|
},
|
|
|
|
|
methods: {
|
2022-12-22 08:47:05 +00:00
|
|
|
|
// 改变公告开启状态
|
|
|
|
|
changeNotickStatus(index){
|
|
|
|
|
if(this.radioIndex !== index){
|
|
|
|
|
this.radioIndex = index;
|
2023-01-14 03:15:59 +00:00
|
|
|
|
// 发布公告
|
|
|
|
|
this.savaNoticeEv('change');
|
2022-12-22 08:47:05 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2023-01-14 03:15:59 +00:00
|
|
|
|
// 获取工地公告
|
|
|
|
|
getWorksiteNotice(){
|
|
|
|
|
this.$requst.get('/api/v1/index/worksite-notice',{worksite_id:uni.getStorageSync('baseWorksiteId')}).then(res=>{
|
|
|
|
|
if(res.code==0){
|
|
|
|
|
console.log(res,'工地公告');
|
|
|
|
|
this.noticeMsg = res.data.content;
|
2022-11-18 10:33:37 +00:00
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
2023-01-14 03:15:59 +00:00
|
|
|
|
// 发布公告
|
|
|
|
|
savaNoticeEv(type){
|
|
|
|
|
let params = {
|
|
|
|
|
status:this.radioIndex==0?1:0,
|
|
|
|
|
content:this.noticeMsg
|
2022-12-08 10:07:45 +00:00
|
|
|
|
}
|
2023-01-14 03:15:59 +00:00
|
|
|
|
this.$requst.post('/api/v1/manager/save-notice',params).then(res=>{
|
|
|
|
|
if(res.code==0){
|
|
|
|
|
if(type=='change'){
|
|
|
|
|
if(this.radioIndex==0){
|
|
|
|
|
this.$toolAll.tools.showToast('已开启');
|
|
|
|
|
}else{
|
|
|
|
|
this.$toolAll.tools.showToast('已禁用');
|
|
|
|
|
}
|
2022-12-08 10:07:45 +00:00
|
|
|
|
}else{
|
2023-01-14 03:15:59 +00:00
|
|
|
|
this.$toolAll.tools.showToast('发布成功');
|
2022-12-08 10:07:45 +00:00
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
this.$toolAll.tools.showToast(res.msg);
|
2023-01-14 03:15:59 +00:00
|
|
|
|
if(type=='change'){
|
|
|
|
|
if(this.radioIndex==0){
|
|
|
|
|
this.radioIndex = 1;
|
|
|
|
|
}else{
|
|
|
|
|
this.radioIndex = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-12-08 10:07:45 +00:00
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
2023-01-14 03:15:59 +00:00
|
|
|
|
// 取消发布
|
|
|
|
|
backEv(){
|
|
|
|
|
uni.navigateBack({
|
|
|
|
|
delta:1
|
|
|
|
|
})
|
2022-11-18 10:33:37 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
|
|
</style>
|