Files
dvcp_v2_wxcp_app/src/project/saas/AppCooperationPropaganda/addPropaganda.vue

469 lines
12 KiB
Vue
Raw Normal View History

2022-08-30 11:22:08 +08:00
<template>
<div class="addPropaganda">
<div class="task_name">
<div><span class="color_red">*</span><span class="title">任务名称</span></div>
2022-09-02 10:59:05 +08:00
<u-input v-model="form.taskTitle" type="text" placeholder="请输入" maxlength="15" class="inpt"/>
2022-08-30 11:22:08 +08:00
</div>
<div class="send_scope">
<div><span class="color_red">*</span><span class="title">发送范围</span></div>
2022-08-30 18:08:25 +08:00
<div @click="toSleectScoped">
2022-09-02 14:14:55 +08:00
<span>
<span v-if="!form.sendScope">请选择</span>
<span v-if="form.sendScope">已选择</span>
<u-icon name="arrow-right" color="#CCD0D3"></u-icon>
</span>
2022-08-30 16:35:45 +08:00
</div>
</div>
<div class="send_content">
<div class="content_title">
<div><span class="color_red">*</span><span class="title">发送内容</span></div>
2022-09-01 16:27:19 +08:00
<div style="color: #3399FF;" @click="preview">预览</div>
2022-08-30 16:35:45 +08:00
</div>
<div class="content_text">
2022-09-02 14:14:55 +08:00
<u-input v-model="content" type="textarea" height="372" :auto-height="true" placeholder="请输入政策、活动、节日问候等内容" maxlength="1300"/>
2022-08-30 16:35:45 +08:00
</div>
<div class="content_fodder">
2022-08-31 13:43:21 +08:00
<!-- <div style="color: #8E8F91;">添加素材</div> -->
2022-08-30 16:35:45 +08:00
<div class="fodder_alls">
2022-08-31 13:43:21 +08:00
<!-- <div class="fodder_add"><u-icon name="plus" color="#CCD0D3" size="32"></u-icon></div> -->
2022-09-02 10:59:05 +08:00
<AiUploader :def.sync="files" placeholder="添加素材" type="file" :limit="9" multiple action="/admin/file/add2"></AiUploader>
2022-08-30 16:35:45 +08:00
</div>
</div>
</div>
2022-08-30 11:22:08 +08:00
2022-08-30 16:35:45 +08:00
<div class="isExamine">
<div class="examineChange">
<div>宣发需要审批</div>
2022-09-02 10:59:05 +08:00
<u-switch v-model="enableExamine" size="40" @change="enableExamine = !!enableExamine"></u-switch>
2022-08-30 11:22:08 +08:00
</div>
2022-09-02 14:49:20 +08:00
<div class="examine_person" v-if="enableExamine == true">
2022-08-30 16:35:45 +08:00
<div><span class="color_red">*</span><span class="title">审批人</span></div>
2022-09-02 14:47:43 +08:00
<div @click="getDeptUser">
2022-09-02 14:49:20 +08:00
<span v-if="!userList.length">请选择人员<u-icon name="arrow-right" color="#CCD0D3"></u-icon></span>
2022-09-02 10:59:05 +08:00
<div v-if="userList.length">
2022-08-31 13:43:21 +08:00
<AiOpenData type="departmentName" :openid="departmentId"/>
</div>
2022-08-30 16:35:45 +08:00
</div>
</div>
2022-09-02 10:59:05 +08:00
<div class="examineChange">
<div>定时发送</div>
<u-switch v-model="isTimedTask" size="40" @change="isTimedTask = !!isTimedTask"></u-switch>
</div>
2022-09-02 14:47:43 +08:00
<div class="examine_person" v-if="isTimedTask == true">
2022-09-02 10:59:05 +08:00
<div><span class="color_red">*</span><span class="title">发送时间</span></div>
<div @click="showTaskTime = true">
<span style="color: '#CCD0D3'" v-if="!form.choiceTime.length">请选择</span>
<span v-if="form.choiceTime.length">{{ form.choiceTime }}</span>
<u-icon name="arrow-right" color="#CCD0D3"/>
</div>
</div>
2022-08-30 16:35:45 +08:00
</div>
2022-09-02 10:59:05 +08:00
<u-picker v-model="showTaskTime" :params="params" mode="time" @confirm="choiceTime"></u-picker>
2022-09-01 16:27:19 +08:00
<div class="mask" v-show="showPopup" @tap="showPopup = false">
<div class="noticeModal" @tap.stop>
<div class="body">
2022-09-01 17:42:34 +08:00
2022-09-02 10:59:05 +08:00
<div class="text_content" v-if="content.length">
2022-09-01 16:27:19 +08:00
<img class="text_left" src="https://cdn.cunwuyun.cn/dvcp/announce/avatar.png" />
2022-09-02 10:59:05 +08:00
<div class="text_right">{{ content }}</div>
2022-09-01 16:27:19 +08:00
</div>
2022-09-01 17:42:34 +08:00
2022-09-02 10:59:05 +08:00
<div class="file_content" v-for="item in files" :key="item.id">
2022-09-01 17:42:34 +08:00
<img class="text_left" src="https://cdn.cunwuyun.cn/dvcp/announce/avatar.png" />
2022-09-02 14:14:55 +08:00
<img class="only_pic" :src="item.url" alt="" v-if="getExtension(item.name) == '.jpg' || getExtension(item.name) == '.jpeg'">
<video controls class="only_video" :src="item.url" v-if="getExtension(item.name) == '.mp4'"></video>
<div class="text_right file_right"
v-if="getExtension(item.name) != '.jpg' && getExtension(item.name) != '.jpeg' && getExtension(item.name) != '.mp4'">
2022-09-01 17:42:34 +08:00
<div class="cont_left">
2022-09-02 10:59:05 +08:00
<h4>{{ item.name }}</h4>
<p>{{ item.fileSizeStr }}</p>
2022-09-01 17:42:34 +08:00
</div>
<div class="cont_right">
2022-09-02 10:59:05 +08:00
<img :src="fileIcon(item.name)" alt="">
2022-09-01 17:42:34 +08:00
</div>
</div>
2022-09-02 10:59:05 +08:00
2022-09-01 17:42:34 +08:00
</div>
2022-09-01 16:27:19 +08:00
</div>
<div class="footer">
<div class="exit" @click="showPopup = false">退出预览</div>
</div>
</div>
</div>
2022-08-30 16:35:45 +08:00
<div class="btn">
2022-09-02 10:59:05 +08:00
<div class="submitBtn" @click="confirm">发送</div>
2022-08-30 11:22:08 +08:00
</div>
2022-08-30 16:35:45 +08:00
2022-08-30 11:22:08 +08:00
</div>
</template>
<script>
2022-08-31 13:43:21 +08:00
import { mapActions } from "vuex";
2022-08-30 11:22:08 +08:00
export default {
name: "addPropaganda",
data() {
return {
type: '',
2022-09-02 10:59:05 +08:00
form: {
taskTitle: '',
wxGroups: [], // 发送范围
contents: [], // 发送内容
enableExamine: '0', // 是否需要审批 0否 1是
examines: [], // 审批人
choiceTime: '', // 定时发送时间
sendScope: '', // 0全部居民群、1按部门选择、2按网格选择
sendType: '0', // 0立即发送、1定时发送
2022-09-02 14:14:55 +08:00
wxGroups: [],
2022-08-31 13:43:21 +08:00
},
2022-09-02 10:59:05 +08:00
enableExamine: false,
isTimedTask: false,
content: '',
files: [],
showTaskTime: false,
2022-08-31 13:43:21 +08:00
userList: [],
2022-09-01 16:27:19 +08:00
showPopup: false,
2022-09-02 10:59:05 +08:00
params: {
year: true,
month: true,
day: true,
hour: true,
minute: true,
second: true,
timestamp: false,
2022-09-02 14:14:55 +08:00
},
flag: false,
2022-08-30 11:22:08 +08:00
}
},
2022-08-30 16:35:45 +08:00
methods: {
2022-08-31 13:43:21 +08:00
...mapActions(['selectEnterpriseContact']),
2022-08-30 18:08:25 +08:00
toSleectScoped() {
uni.navigateTo({url: `./sendScoped?type=${this.type}`})
2022-08-31 13:43:21 +08:00
},
2022-09-01 16:27:19 +08:00
// 预览
preview() {
this.showPopup = true;
},
2022-09-01 18:03:38 +08:00
fileIcon(name) {
2022-09-02 10:59:05 +08:00
if (['.zip', '.rar','.mp4'].indexOf(this.getExtension(name)) !== -1) {
2022-09-01 18:03:38 +08:00
return 'https://cdn.cunwuyun.cn/dvcp/announce/zip.png'
}
if (['.doc', '.docx'].indexOf(this.getExtension(name)) !== -1) {
return 'https://cdn.cunwuyun.cn/dvcp/announce/world.png'
}
if (['.xls', '.xlsx'].indexOf(this.getExtension(name)) !== -1) {
return 'https://cdn.cunwuyun.cn/dvcp/announce/xls.png'
}
if (['.txt'].indexOf(this.getExtension(name)) !== -1) {
return 'https://cdn.cunwuyun.cn/dvcp/announce/txt.png'
}
if (['.pdf'].indexOf(this.getExtension(name)) !== -1) {
return 'https://cdn.cunwuyun.cn/dvcp/announce/pdf.png'
}
if (['.ppt', '.pptx'].indexOf(this.getExtension(name)) !== -1) {
return 'https://cdn.cunwuyun.cn/dvcp/announce/ppt.png'
}
},
getExtension(name) {
return name.substring(name.lastIndexOf('.'))
},
2022-09-02 10:59:05 +08:00
choiceTime(e) {
this.form.choiceTime = e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e.minute + ':' + e.second
},
confirm() {
2022-09-02 14:14:55 +08:00
if(this.flag) return
2022-09-02 14:47:43 +08:00
const firstContent = [
2022-09-02 14:14:55 +08:00
{
content: this.content,
msgType: '0'
},
]
2022-09-02 14:47:43 +08:00
this.form.contents.push(...firstContent)
const fileLists = this.files.map(item=> {
2022-09-02 14:49:20 +08:00
// if(this.getExtension(item.name)==)
2022-09-02 14:47:43 +08:00
})
2022-09-02 14:14:55 +08:00
if(!this.form.contents.length) {
return this.$u.toast("请输入发送内容")
}
// if(!this.enableExamine) {
// if(!this.form.examines.length) {
// return this.$u.toast("请选择审批人")
// } else {
// this.form.enableExamine = '1'
// }
// }
if(!this.isTimedTask) {
if(!this.form.choiceTime.length) {
return this.$u.toast("请选择发送时间")
}
}
this.$http.post(`/app/appmasssendingtask/addOrUpdate`, { ...this.form }).then(res=>{
this.flag = false
if(res?.code ==0) {
// uni.navigateBack()
this.$u.toast("新增成功")
}
})
2022-09-02 10:59:05 +08:00
},
2022-08-31 13:43:21 +08:00
getDeptUser() {
this.selectEnterpriseContact({
fromDepartmentId: 0,
mode: "multi",
type: ["user"],
// selectedDepartmentIds: this.departList?.map(e => e.id)
selectedUserIds: this.userList?.map(e => e.id)
}).then((res)=>{
// if(res?.departmentList) {
// this.departmentId = res.departmentList[0].id
// }
}
).catch((err) => {
console.log(err);
})
2022-08-30 18:08:25 +08:00
}
2022-08-30 16:35:45 +08:00
},
2022-08-30 11:22:08 +08:00
onShow() {
2022-09-02 14:14:55 +08:00
2022-08-30 11:22:08 +08:00
},
onLoad(o) {
this.type = o.index;
document.title = this.type==0? "群发居民群": this.type==1? "群发居民": "群发朋友圈"
2022-09-02 14:14:55 +08:00
uni.$on('checkedScope', res => {
this.form.sendScope = res.sendScope
})
2022-08-30 11:22:08 +08:00
}
}
</script>
<style lang="scss" scoped>
.addPropaganda {
font-size: 32px !important;
2022-08-31 17:05:17 +08:00
padding-bottom: 140px;
2022-08-30 16:35:45 +08:00
box-sizing: border-box;
2022-08-30 11:22:08 +08:00
.task_name,
2022-08-30 16:35:45 +08:00
.send_scope,
.send_content {
2022-08-30 11:22:08 +08:00
background: #FFF;
padding: 32px;
box-sizing: border-box;
margin-bottom: 16px;
box-shadow: inset 0px -1px 0px 0px #DDDDDD;
.title {
font-weight: 400;
font-size: 32px;
}
}
2022-08-30 16:35:45 +08:00
.send_scope {
display: flex;
justify-content: space-between;
}
2022-08-30 11:22:08 +08:00
2022-08-30 16:35:45 +08:00
.send_content {
.content_title {
display: flex;
justify-content: space-between;
}
.content_text {
margin-top: 12px;
border-bottom: 1px solid #DDD;
}
.content_fodder {
margin-top: 16px;
.fodder_alls {
display: flex;
margin-top: 16px;
.fodder_add {
border: 2px solid #DBDCDF;
padding: 20px 24px;
box-sizing: border-box;
border-radius: 8px;
}
}
}
}
.isExamine {
background: #FFF;
2022-09-01 17:42:34 +08:00
padding: 0px 32px;
2022-08-30 16:35:45 +08:00
box-sizing: border-box;
box-shadow: inset 0px -1px 0px 0px #DDDDDD;
.examineChange,
.examine_person {
display: flex;
justify-content: space-between;
2022-09-01 17:42:34 +08:00
padding: 26px 0px;
2022-08-30 16:35:45 +08:00
box-sizing: border-box;
2022-09-02 10:59:05 +08:00
border-top: 2px solid #DDD;
2022-08-30 16:35:45 +08:00
}
.examine_person {
2022-09-02 10:59:05 +08:00
// padding: 26px 0 0 0;
2022-08-30 16:35:45 +08:00
}
}
2022-08-30 11:22:08 +08:00
.color_red {
color: #FF4466;
}
.inpt {
margin-left: 14px;
}
2022-09-01 16:27:19 +08:00
.mask {
position: fixed;
top: 0;
bottom: 0;
margin: 0;
left: 0;
right: 0;
background: rgba(#000, 0.6);
z-index: 202103021409;
width: 100%;
height: 100%;
}
::v-deep .noticeModal {
position: fixed;
left: 50%;
top: 45%;
transform: translate(-50%, -50%);
width: 90%;
height: 85%;
.body {
background: #EBECF0;
border-radius: 16px 16px 0 0;
padding: 32px;
box-sizing: border-box;
height: 100%;
overflow-y: auto;
font-size: 28px;
font-weight: 400;
color: #333;
line-height: 48px;
2022-09-01 17:42:34 +08:00
.text_content,
.file_content {
2022-09-01 16:27:19 +08:00
display: flex;
2022-09-01 17:42:34 +08:00
margin-bottom: 32px;
2022-09-01 16:27:19 +08:00
.text_left {
margin-right: 32px;
width: 84px;
height: 84px;
}
2022-09-02 14:14:55 +08:00
.only_pic {
max-width: 206px;
max-height: 200px;
}
.only_video {
max-width: 284px;
max-height: 160px;
}
2022-09-01 16:27:19 +08:00
.text_right {
2022-09-01 17:42:34 +08:00
width: calc(100% - 116px);
2022-09-01 16:27:19 +08:00
background: #FFF;
border-radius: 10px;
padding: 24px;
box-sizing: border-box;
position: relative;
&::before {
position: absolute;
content: "";
width: 0;
height: 0;
top: 18px;
left: 0;
border-top: 12px solid transparent;
border-bottom: 12px solid transparent;
border-left: 12px solid transparent;
border-right: 12px solid #fff;
transform: translate(-100%, 0%);
}
}
2022-09-01 17:42:34 +08:00
.file_right {
display: flex;
.cont_left {
width: calc(100% - 90px);
h4 {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
2022-09-01 18:03:38 +08:00
font-weight: normal;
}
p {
color: #888888;
2022-09-01 17:42:34 +08:00
}
}
.cont_right {
width: 84px;
height: 84px;
img {
width: 100%;
height: 100%;
}
}
}
2022-09-01 16:27:19 +08:00
}
}
.footer {
width: 100%;
height: 112px;
line-height: 112px;
text-align: center;
background: #FFF;
border-radius: 0 0 16px 16px;
border-top: 2px solid #EEEEEE;
}
}
2022-08-30 16:35:45 +08:00
.btn {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 128px;
padding: 24px 32px;
box-sizing: border-box;
background: #FFF;
2022-08-30 18:08:25 +08:00
.submitBtn {
background: #1365DD;
width: 100%;
height: 80px;
line-height: 80px;
text-align: center;
color: #FFF;
border-radius: 8px;
}
2022-08-30 16:35:45 +08:00
}
2022-08-30 11:22:08 +08:00
}
</style>