页面整合

This commit is contained in:
aixianling
2022-06-24 20:50:47 +08:00
parent d979943852
commit 9292429c8c
3 changed files with 222 additions and 220 deletions

View File

@@ -1,7 +1,7 @@
<template> <template>
<section class="AppMassNotification"> <section class="AppMassNotification">
<keep-alive :include="['List']"> <keep-alive :include="['List']">
<component ref="component" :is="component" :instance="instance" :params="params" :dict="dict" @change="onChange"/> <component ref="component" :is="currentPage" :instance="instance" :params="params" :dict="dict" @change="onChange"/>
</keep-alive> </keep-alive>
</section> </section>
</template> </template>
@@ -25,22 +25,18 @@ export default {
include: [], include: [],
} }
}, },
computed: {
currentPage() {
const {hash} = this.$route
return hash == "#add" ? Add : List
},
},
methods: { methods: {
onChange(data) { onChange(data) {
if (data.type === "Add") { if (data.type === "Add") {
this.component = "Add"; this.$router.push({hash: "#add", query: data.params})
this.params = data.params; } else {
} this.$router.push({})
if (data.type === "List") {
this.component = "List";
this.params = data.params;
this.$nextTick(() => {
if (data.isRefresh) {
this.$refs.component.getTableData();
}
});
} }
}, },
}, },

View File

@@ -1,6 +1,6 @@
<template> <template>
<section class="Add"> <section class="Add">
<ai-detail v-if="!params.id"> <ai-detail v-if="!$route.query.id">
<template slot="title"> <template slot="title">
<ai-title title="群发通知" isShowBack isShowBottomBorder @onBackClick="cancel(false)"></ai-title> <ai-title title="群发通知" isShowBack isShowBottomBorder @onBackClick="cancel(false)"></ai-title>
</template> </template>
@@ -76,15 +76,18 @@
</el-form-item> </el-form-item>
<!-- 图片 --> <!-- 图片 -->
<el-form-item label="图片" style="width: 100%" v-if="form.contentType == 'image'"> <el-form-item label="图片" style="width: 100%" v-if="form.contentType == 'image'">
<ai-uploader :instance="instance" isWechat v-model="imgList" acceptType=".jpg,.png,.jpeg" :limit="1" url="/app/wxcp/upload/uploadFile?type=image"></ai-uploader> <ai-uploader :instance="instance" isWechat v-model="imgList" acceptType=".jpg,.png,.jpeg" :limit="1"
url="/app/wxcp/upload/uploadFile?type=image"></ai-uploader>
</el-form-item> </el-form-item>
<!-- 视频 --> <!-- 视频 -->
<el-form-item label="视频" style="width: 100%" v-if="form.contentType == 'video'"> <el-form-item label="视频" style="width: 100%" v-if="form.contentType == 'video'">
<ai-uploader :instance="instance" fileType="file" isWechat acceptType=".mp4" v-model="videoList" :limit="1" url="/app/wxcp/upload/uploadFile?type=video"></ai-uploader> <ai-uploader :instance="instance" fileType="file" isWechat acceptType=".mp4" v-model="videoList" :limit="1"
url="/app/wxcp/upload/uploadFile?type=video"></ai-uploader>
</el-form-item> </el-form-item>
<!-- 附件 --> <!-- 附件 -->
<el-form-item label="附件" style="width: 100%" v-if="form.contentType == 'file'"> <el-form-item label="附件" style="width: 100%" v-if="form.contentType == 'file'">
<ai-uploader :instance="instance" fileType="file" isWechat v-model="filesList" :limit="1" url="/app/wxcp/upload/uploadFile?type=file"></ai-uploader> <ai-uploader :instance="instance" fileType="file" isWechat v-model="filesList" :limit="1"
url="/app/wxcp/upload/uploadFile?type=file"></ai-uploader>
</el-form-item> </el-form-item>
</el-form> </el-form>
@@ -99,7 +102,7 @@
</ai-detail> </ai-detail>
<ai-detail class="add" v-if="params.id"> <ai-detail class="add" v-if="$route.query.id">
<template slot="title"> <template slot="title">
<ai-title title="群发通知详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)"></ai-title> <ai-title title="群发通知详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)"></ai-title>
</template> </template>
@@ -143,17 +146,14 @@
<script> <script>
import {mapState} from "vuex"; import {mapState} from "vuex";
import AiDvWrapper from '../../../../project/dvui/layout/AiDvWrapper/AiDvWrapper.vue';
export default { export default {
components: { AiDvWrapper },
name: 'Add', name: 'Add',
props: { props: {
instance: Function, instance: Function,
dict: Object, dict: Object
params: Object
}, },
data() {
data () {
return { return {
isShow: false, isShow: false,
data: {}, data: {},
@@ -190,16 +190,16 @@ export default {
users: [], users: [],
images: [], images: [],
rules: { rules: {
content: [{ required: true, message: '请输入群发内容'}], content: [{required: true, message: '请输入群发内容'}],
sendType: [{ required: true, message: '请选择群发方式' }], sendType: [{required: true, message: '请选择群发方式'}],
sendTime: [{ required: true, message: '请选择群发时间' }], sendTime: [{required: true, message: '请选择群发时间'}],
}, },
} }
}, },
computed: { computed: {
tagsChange() { tagsChange() {
if(this.tags.length) { if (this.tags.length) {
return this.form.tag = this.tags.toString(); return this.form.tag = this.tags.toString();
} }
}, },
@@ -209,20 +209,20 @@ export default {
...mapState(['user']) ...mapState(['user'])
}, },
created () { created() {
if (this.params.id) { if (this.$route.query.id) {
this.getInfo() this.getInfo()
} else { } else {
this.getSubTags() this.getSubTags()
} }
this.areaRootId = [this.user.info.areaId.substr(0, 6),'000000'].join("") this.areaRootId = [this.user.info.areaId.substr(0, 6), '000000'].join("")
}, },
filters: { filters: {
format(value) { format(value) {
if(value == 0) { if (value == 0) {
return '立即发送' return '立即发送'
} else if(value == 1) { } else if (value == 1) {
return '定时发送' return '定时发送'
} }
} }
@@ -239,23 +239,23 @@ export default {
this.form.wxUserId = val[0].id this.form.wxUserId = val[0].id
}, },
// 标签 // 标签
getSubTags () { getSubTags() {
this.instance.post(`/app/wxcp/wxcorptag/listAll`).then(res => { this.instance.post(`/app/wxcp/wxcorptag/listAll`).then(res => {
if (res?.data) { if (res?.data) {
this.subTags = res.data.records this.subTags = res.data.records
} }
}) })
}, },
getInfo () { getInfo() {
this.instance.post(`/app/pushmessage/detail?id=${this.params.id}`).then(res => { this.instance.post(`/app/pushmessage/detail?id=${this.$route.query.id}`).then(res => {
if (res?.data) { if (res?.data) {
this.data = res.data this.data = res.data
this.images = [{ url: res.data.fileList.filter(e=> e.contentType == "image")[0]?.accessUrl }] this.images = [{url: res.data.fileList.filter(e => e.contentType == "image")[0]?.accessUrl}]
this.fileDownLoad = [{ url:res.data.fileList.filter(e=> e.contentType == "file")[0]?.accessUrl }] this.fileDownLoad = [{url: res.data.fileList.filter(e => e.contentType == "file")[0]?.accessUrl}]
} }
}) })
}, },
confirm () { confirm() {
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (valid) {
this.form.fileList = [] this.form.fileList = []
@@ -265,7 +265,7 @@ export default {
} }
this.form.fileList.push(contentList) this.form.fileList.push(contentList)
if(this.imgList.length) { if (this.imgList.length) {
let item = { let item = {
contentType: 'image', contentType: 'image',
mediaId: this.imgList[0].media.mediaId, mediaId: this.imgList[0].media.mediaId,
@@ -274,7 +274,7 @@ export default {
this.form.fileList.push(item) this.form.fileList.push(item)
} }
if(this.videoList.length) { if (this.videoList.length) {
let item = { let item = {
contentType: 'video', contentType: 'video',
mediaId: this.videoList[0].media.mediaId, mediaId: this.videoList[0].media.mediaId,
@@ -283,7 +283,7 @@ export default {
this.form.fileList.push(item) this.form.fileList.push(item)
} }
if(this.filesList.length) { if (this.filesList.length) {
let item = { let item = {
contentType: 'file', contentType: 'file',
mediaId: this.filesList[0].media.mediaId, mediaId: this.filesList[0].media.mediaId,
@@ -305,7 +305,7 @@ export default {
} }
}) })
}, },
cancel (isRefresh) { cancel(isRefresh) {
this.$emit('change', { this.$emit('change', {
type: 'List', type: 'List',
isRefresh: isRefresh ? true : false isRefresh: isRefresh ? true : false
@@ -316,11 +316,11 @@ export default {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.Add { .Add {
height: 100%; height: 100%;
} }
.ai-card__title { .ai-card__title {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -335,9 +335,9 @@ export default {
color: #888888; color: #888888;
font-size: 14px; font-size: 14px;
} }
} }
.appletss { .appletss {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
@@ -383,21 +383,21 @@ export default {
border-color: #2266FF; border-color: #2266FF;
} }
} }
} }
.tips { .tips {
position: relative; position: relative;
top: 2px; top: 2px;
padding-left: 8px; padding-left: 8px;
color: #222222; color: #222222;
font-size: 14px; font-size: 14px;
} }
.el-form-item-item__textarea { .el-form-item-item__textarea {
position: relative; position: relative;
} }
.el-form-item__btn { .el-form-item__btn {
position: absolute; position: absolute;
bottom: 12px; bottom: 12px;
left: 12px; left: 12px;
@@ -408,15 +408,17 @@ export default {
user-select: none; user-select: none;
background: #fff; background: #fff;
cursor: pointer; cursor: pointer;
} }
.tags { .tags {
// padding: 10px; // padding: 10px;
.tag_title { .tag_title {
font-weight: 600; font-weight: 600;
} }
.tag_item { .tag_item {
margin: 5px 0; margin: 5px 0;
span { span {
display: inline-block; display: inline-block;
// padding: 5px 10px; // padding: 5px 10px;
@@ -429,10 +431,11 @@ export default {
border-radius: 4px; border-radius: 4px;
margin-right: 8px; margin-right: 8px;
} }
.active { .active {
background: #53bcea; background: #53bcea;
color: #FFFFFF; color: #FFFFFF;
} }
} }
} }
</style> </style>

View File

@@ -49,7 +49,8 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex' import {mapState} from 'vuex'
export default { export default {
name: "List", name: "List",
props: { props: {
@@ -60,7 +61,7 @@ export default {
data() { data() {
return { return {
tableData: [], tableData: [],
page: {current: 1, size: 10, total: 0,pages: 0}, page: {current: 1, size: 10, total: 0, pages: 0},
id: '', id: '',
} }
}, },
@@ -76,15 +77,15 @@ export default {
file: "附件" file: "附件"
} }
return [ return [
{ prop: "fileList", label: '消息类型', align: "center", width: "250px", formart: v => v?.map(e=> conType[e.contentType]).toString() }, {prop: "fileList", label: '消息类型', align: "center", width: "250px", formart: v => v?.map(e => conType[e.contentType]).toString()},
{ prop: "fileList", label: '消息类容', align: "center", width: "250px", formart: v => v?.filter(e=> e.contentType == 'text')[0].content }, {prop: "fileList", label: '消息类容', align: "center", width: "250px", formart: v => v?.filter(e => e.contentType == 'text')[0].content},
// { prop: "fileList", label: '消息内容', align: "center", width: "250px", formart: v => v?.filter(e => e.contentType == 'text')[0].content}, // { prop: "fileList", label: '消息内容', align: "center", width: "250px", formart: v => v?.filter(e => e.contentType == 'text')[0].content},
// { slot: 'type' }, // { slot: 'type' },
{ prop: "sendType", label: '发送类型', align: "center", width: "250px", formart: v => v == 0 ? '立即发送' : '定时发送'}, {prop: "sendType", label: '发送类型', align: "center", width: "250px", formart: v => v == 0 ? '立即发送' : '定时发送'},
{ prop: "createTime", label: '创建时间', align: "center", width: "250px"}, {prop: "createTime", label: '创建时间', align: "center", width: "250px"},
{ prop: "sendTime", label: '发送时间', align: "center", width: "250px"}, {prop: "sendTime", label: '发送时间', align: "center", width: "250px"},
{ prop: "userName", label: '创建人', align: "center", width: "250px", }, {prop: "userName", label: '创建人', align: "center", width: "250px",},
{ slot: "options" ,}, {slot: "options",},
] ]
}, },
...mapState(['user']) ...mapState(['user'])
@@ -105,7 +106,7 @@ export default {
}) })
}, },
mapType (type) { mapType(type) {
return { return {
'image': '图片', 'image': '图片',
'video': '视频', 'video': '视频',
@@ -131,6 +132,7 @@ export default {
.List { .List {
height: 100%; height: 100%;
background: #f3f4f5; background: #f3f4f5;
.count { .count {
cursor: pointer; cursor: pointer;
color: #2266FF; color: #2266FF;
@@ -142,14 +144,15 @@ export default {
} }
} }
img, video {
img, video {
width: 40px; width: 40px;
height: 40px; height: 40px;
margin-right: 10px; margin-right: 10px;
object-fit: cover; object-fit: cover;
} }
.message-info { .message-info {
padding: 8px; padding: 8px;
min-height: 116px; min-height: 116px;
@@ -172,7 +175,7 @@ export default {
.message-info__wrapper--right { .message-info__wrapper--right {
flex: 1; flex: 1;
overflow: hidden; overflow: hidden;
text-overflow:ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
@@ -181,7 +184,7 @@ export default {
color: #222222; color: #222222;
font-size: 14px; font-size: 14px;
overflow: hidden; overflow: hidden;
text-overflow:ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
font-weight: normal; font-weight: normal;
} }
@@ -199,11 +202,11 @@ export default {
color: #888888; color: #888888;
} }
} }
} }
.row-content { .row-content {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow:ellipsis; text-overflow: ellipsis;
} }
</style> </style>