Commit bee4f39d by test

接口调整

1 parent 3d5fcb69
...@@ -4,16 +4,10 @@ const service = window.CONFIG.services.wecom + '/tlp' ...@@ -4,16 +4,10 @@ const service = window.CONFIG.services.wecom + '/tlp'
/** /**
* 获取欢迎语列表 * 获取欢迎语列表
* @param {*} params * @param {*} params
{
"pageNum": "当前页",
"pageSize": "每页显示条数",
"welcomeMsg": "欢迎语关键词",
"welcomeMsgTplType": " 欢迎语模板类型:1:员工欢迎语;2:部门员工欢迎语;3:客户群欢迎语"
}
*/ */
export function getList(params) { export function getList (params) {
return request({ return request({
url: service + '/list', url: '/wecom/tlp/list',
params params
}) })
} }
...@@ -22,7 +16,7 @@ export function getList(params) { ...@@ -22,7 +16,7 @@ export function getList(params) {
* 根据欢迎语模板id获取模板使用范围 * 根据欢迎语模板id获取模板使用范围
* @param {*} id * @param {*} id
*/ */
export function getScop(id) { export function getScop (id) {
return request({ return request({
url: service + '/scop/' + id url: service + '/scop/' + id
}) })
...@@ -49,9 +43,9 @@ export function getScop(id) { ...@@ -49,9 +43,9 @@ export function getScop(id) {
"userIds":"ShengXiYong,SunXiWang" //员工欢迎语使用范围,员工id用逗号隔开 "userIds":"ShengXiYong,SunXiWang" //员工欢迎语使用范围,员工id用逗号隔开
} }
*/ */
export function addOrUpdate(data) { export function addOrUpdate (data) {
return request({ return request({
url: service + '/addorUpdate', url: '/wecom/tlp/addorUpdate',
method: 'POST', method: 'POST',
data data
}) })
...@@ -81,17 +75,17 @@ export function addOrUpdate(data) { ...@@ -81,17 +75,17 @@ export function addOrUpdate(data) {
* 删除欢迎语 * 删除欢迎语
* @param {*} ids * @param {*} ids
*/ */
export function remove(ids) { export function remove (ids) {
return request({ return request({
url: service + '/' + ids, url: '/wecom/tlp/remove/' + ids,
method: 'DELETE' method: 'DELETE'
}) })
} }
// 预览数据 // 预览数据
export function getPreview(id) { export function getPreview (id) {
return request({ return request({
url: service + '/tlp/preview', url: '/wecom/tlp/preview',
params: { params: {
id id
} }
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<!-- 附件 --> <!-- 附件 -->
<div class="g-card g-pad20" v-for="(item, index) in form.materialMsgList" :key="index"> <div class="g-card g-pad20" v-for="(item, index) in form.materialMsgList" :key="index">
<!-- 文本 --> <!-- 文本 -->
<div class="my-cord" v-if="item.msgType == 4"> <div class="my-cord" v-if="item.msgType == '4'">
<div class="operation"> <div class="operation">
<div v-if="showMorMaterial" class="algin" @click="onChooseMaterial(item.msgType, index)"> <div v-if="showMorMaterial" class="algin" @click="onChooseMaterial(item.msgType, index)">
<img style="margin-right: 3px" :src="require('@/assets/drainageCode/code-add.png')" alt="" />从素材中选择 <img style="margin-right: 3px" :src="require('@/assets/drainageCode/code-add.png')" alt="" />从素材中选择
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
</el-form-item> </el-form-item>
</div> </div>
<!-- 图片上传 --> <!-- 图片上传 -->
<div class="my-cord" v-else-if="item.msgType == 0"> <div class="my-cord" v-else-if="item.msgType == '0'">
<div class="operation"> <div class="operation">
<div v-if="showMorMaterial" class="algin" @click="onChooseMaterial(item.msgType, index)"> <div v-if="showMorMaterial" class="algin" @click="onChooseMaterial(item.msgType, index)">
<img style="margin-right: 3px" :src="require('@/assets/drainageCode/code-add.png')" alt="" />从素材中选择 <img style="margin-right: 3px" :src="require('@/assets/drainageCode/code-add.png')" alt="" />从素材中选择
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
</el-form-item> </el-form-item>
</div> </div>
<!-- 图文 --> <!-- 图文 -->
<div class="my-cord" v-else-if="item.msgType == 7"> <div class="my-cord" v-else-if="item.msgType == '7'">
<div class="operation"> <div class="operation">
<div v-if="showMorMaterial" class="algin" @click="onChooseMaterial(item.msgType, index)"> <div v-if="showMorMaterial" class="algin" @click="onChooseMaterial(item.msgType, index)">
<img style="margin-right: 3px" :src="require('@/assets/drainageCode/code-add.png')" alt="" />从素材中选择 <img style="margin-right: 3px" :src="require('@/assets/drainageCode/code-add.png')" alt="" />从素材中选择
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
</el-form-item> </el-form-item>
</div> </div>
<!-- 小程序 --> <!-- 小程序 -->
<div class="my-cord" v-else-if="item.msgType == 8"> <div class="my-cord" v-else-if="item.msgType == '8'">
<div class="operation"> <div class="operation">
<div v-if="showMorMaterial" class="algin" @click="onChooseMaterial(item.msgType, index)"> <div v-if="showMorMaterial" class="algin" @click="onChooseMaterial(item.msgType, index)">
<img style="margin-right: 3px" :src="require('@/assets/drainageCode/code-add.png')" alt="" />从素材中选择 <img style="margin-right: 3px" :src="require('@/assets/drainageCode/code-add.png')" alt="" />从素材中选择
...@@ -119,13 +119,13 @@ ...@@ -119,13 +119,13 @@
<!-- <el-dropdown-item :command="4"> <!-- <el-dropdown-item :command="4">
<el-button type="text">文字</el-button> <el-button type="text">文字</el-button>
</el-dropdown-item> --> </el-dropdown-item> -->
<el-dropdown-item :command="0"> <el-dropdown-item :command="'0'">
<el-button type="text">图片</el-button> <el-button type="text">图片</el-button>
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item :command="7"> <el-dropdown-item :command="'7'">
<el-button type="text">图文</el-button> <el-button type="text">图文</el-button>
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item :command="8"> <el-dropdown-item :command="'8'">
<el-button type="text">小程序</el-button> <el-button type="text">小程序</el-button>
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
...@@ -165,7 +165,6 @@ ...@@ -165,7 +165,6 @@
<el-button type="primary" @click="selectWelcome">确 定</el-button> <el-button type="primary" @click="selectWelcome">确 定</el-button>
</div> </div>
</el-dialog> </el-dialog>
<SelectUser :defaultValues="selectedUserList" :visible.sync="dialogVisibleSelectUser" title="选择使用员工" @success="selectedUser"></SelectUser> <SelectUser :defaultValues="selectedUserList" :visible.sync="dialogVisibleSelectUser" title="选择使用员工" @success="selectedUser"></SelectUser>
</div> </div>
</template> </template>
...@@ -228,6 +227,7 @@ ...@@ -228,6 +227,7 @@
}, },
watch: { watch: {
baseData (val) { baseData (val) {
console.log(2222)
if (val.welcomeMsg) { if (val.welcomeMsg) {
this.form = val this.form = val
} }
...@@ -336,21 +336,21 @@ ...@@ -336,21 +336,21 @@
let materialList = this.form.materialMsgList let materialList = this.form.materialMsgList
const validateFields = { const validateFields = {
4: [ '4': [
{ {
checkField: 'content', checkField: 'content',
errorField: 'contentError', errorField: 'contentError',
errorMsg: '请输入文本' errorMsg: '请输入文本'
} }
], ],
0: [ '0': [
{ {
checkField: 'materialUrl', checkField: 'materialUrl',
errorField: 'materialUrlError', errorField: 'materialUrlError',
errorMsg: '请上传图片' errorMsg: '请上传图片'
} }
], ],
7: [ '7': [
{ {
checkField: 'materialName', checkField: 'materialName',
errorField: 'materialNameError', errorField: 'materialNameError',
...@@ -362,7 +362,7 @@ ...@@ -362,7 +362,7 @@
errorMsg: '请输入图文链接' errorMsg: '请输入图文链接'
} }
], ],
8: [ '8': [
{ {
checkField: 'materialName', checkField: 'materialName',
errorField: 'materialNameError', errorField: 'materialNameError',
...@@ -427,14 +427,14 @@ ...@@ -427,14 +427,14 @@
if (checkMaterialResult) { if (checkMaterialResult) {
let goto = true let goto = true
this.form.materialMsgList.forEach((dd) => { this.form.materialMsgList.forEach((dd) => {
if (dd.msgType === 7) { if (dd.msgType === '7') {
let reUrl = /(http|https):\/\/([\w.]+\/?)\S*/ let reUrl = /(http|https):\/\/([\w.]+\/?)\S*/
if (!reUrl.test(dd.content)) { if (!reUrl.test(dd.content)) {
goto = false goto = false
dd.contentError = '必须以 http://或 https://开头' dd.contentError = '必须以 http://或 https://开头'
} }
} }
if (dd.msgType === 8) { if (dd.msgType === '8') {
let htm = /^.*html$/ let htm = /^.*html$/
if (!htm.test(dd.content)) { if (!htm.test(dd.content)) {
goto = false goto = false
......
...@@ -12,17 +12,17 @@ ...@@ -12,17 +12,17 @@
</div> </div>
<div class="item" v-for="(data, key) in list.materialMsgList" :key="key"> <div class="item" v-for="(data, key) in list.materialMsgList" :key="key">
<div class="avatar"><img src="../assets/drainageCode/header.png"></div> <div class="avatar"><img src="../assets/drainageCode/header.png"></div>
<div class="msg" v-if="data.msgType === 4"> <div class="msg" v-if="data.msgType === '4'">
<div class="word"> <div class="word">
{{data.content}} {{data.content}}
</div> </div>
</div> </div>
<div class="msg" v-if="data.msgType === 0"> <div class="msg" v-if="data.msgType === '0'">
<div class="image"> <div class="image">
<img :src="data.materialUrl" /> <img :src="data.materialUrl" />
</div> </div>
</div> </div>
<div class="msg" v-if="data.msgType === 7"> <div class="msg" v-if="data.msgType === '7'">
<div class="word-and-image"> <div class="word-and-image">
<div> <div>
{{data.materialName}} {{data.materialName}}
...@@ -37,16 +37,14 @@ ...@@ -37,16 +37,14 @@
</div> </div>
</div> </div>
</div> </div>
<div class="msg" v-if="data.msgType === 8"> <div class="msg" v-if="data.msgType === '8'">
<div class="miniprogram"> <div class="miniprogram">
<div class="mini-header"> <div class="mini-header">
<img src="../assets/drainageCode/miniprogram-icon.png" alt=""> <img src="../assets/drainageCode/miniprogram-icon.png" alt=""> {{data.materialName}}
{{data.materialName}}
</div> </div>
<img class="mini-img" :src="data.coverUrl" > <img class="mini-img" :src="data.coverUrl">
<div class="mini-footer"> <div class="mini-footer">
<img src="../assets/drainageCode/miniprogram-link.png" /> <img src="../assets/drainageCode/miniprogram-link.png" /> 小程序
小程序
</div> </div>
</div> </div>
</div> </div>
...@@ -93,7 +91,7 @@ ...@@ -93,7 +91,7 @@
</div> </div>
</div> </div>
</div> --> </div> -->
</div> </div>
</div> </div>
</template> </template>
...@@ -111,157 +109,150 @@ ...@@ -111,157 +109,150 @@
default: {} default: {}
} }
}, },
data() { data () {
return {} return {}
}, },
watch: {
},
computed: {}, computed: {},
created() {}, created () { },
mounted() {}, mounted () { },
methods: {}, methods: {},
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.preview { .preview {
margin: 0 auto; margin: 0 auto;
position: relative; position: relative;
width: 300px; width: 300px;
height: 640px; height: 640px;
background: url(../assets/drainageCode/preview-bg.png); background: url(../assets/drainageCode/preview-bg.png);
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
.title { .title {
position: absolute; position: absolute;
top: 37px; top: 37px;
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
font-size: 14px; font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC; font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400; font-weight: 400;
color: #333333; color: #333333;
} }
.content { .content {
position: absolute; position: absolute;
height: 545px; height: 545px;
width: 280px; width: 280px;
overflow-y: auto; overflow-y: auto;
top: 70px; top: 70px;
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
border-bottom-left-radius: 20px; border-bottom-left-radius: 20px;
border-bottom-right-radius: 20px; border-bottom-right-radius: 20px;
padding: 20px; padding: 20px;
.item { .item {
font-size: 12px; font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC; font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400; font-weight: 400;
color: #666666; color: #666666;
display: flex; display: flex;
margin-top: 20px; margin-top: 20px;
&:first-child { &:first-child {
margin-top: 0; margin-top: 0;
} }
.avatar { .avatar {
// align-self: center; // align-self: center;
margin-right: 5px; margin-right: 5px;
} }
.msg { .msg {
position: relative; position: relative;
min-height: 26px; min-height: 26px;
background: #FFFFFF; background: #ffffff;
box-shadow: 0px 2px 6px 0px rgba(60, 136, 240, 0.1); box-shadow: 0px 2px 6px 0px rgba(60, 136, 240, 0.1);
border: 1px solid #E1EDFC; border: 1px solid #e1edfc;
display: inline-block; display: inline-block;
border-radius: 4px; border-radius: 4px;
box-sizing: border-box; box-sizing: border-box;
word-break: break-all; word-break: break-all;
margin-left: 5px; margin-left: 5px;
&:before { &:before {
content: ' '; content: " ";
display: block; display: block;
position: absolute; position: absolute;
left: -5px; left: -5px;
box-shadow: 0px 2px 6px 0px rgba(60, 136, 240, 0.1); box-shadow: 0px 2px 6px 0px rgba(60, 136, 240, 0.1);
border-width: 5px; border-width: 5px;
border-left: 0; border-left: 0;
width: 0; width: 0;
border-style: solid; border-style: solid;
border-color: transparent; border-color: transparent;
border-right-color: #fff; border-right-color: #fff;
top: 8px; top: 8px;
z-index: 888; z-index: 888;
} }
.word { .word {
padding: 5px 12px; padding: 5px 12px;
} }
.image {
padding: 12px;
img {
width: 94px;
height: 90px;
}
}
.word-and-image {
padding: 12px;
.sub-content {
margin-top: 10px;
display: flex;
justify-content: space-between;
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #999999;
img {
height: 40px;
width: 40px;
}
}
}
.miniprogram {
padding: 12px;
.mini-header {
display: flex;
align-items: center;
img {
height: 18px;
width: 18px;
margin-right: 5px;
}
}
.mini-img {
margin: 10px 0;
width: 143px;
height: 120px;
}
.mini-footer {
display: flex;
align-items: center;
img {
height: 14px;
width: 14px;
margin-right: 5px;
}
}
}
}
}
.image {
padding: 12px;
} img {
width: 94px;
height: 90px;
}
}
.word-and-image {
padding: 12px;
.sub-content {
margin-top: 10px;
display: flex;
justify-content: space-between;
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #999999;
img {
height: 40px;
width: 40px;
}
}
}
.miniprogram {
padding: 12px;
.mini-header {
display: flex;
align-items: center;
img {
height: 18px;
width: 18px;
margin-right: 5px;
}
}
.mini-img {
margin: 10px 0;
width: 143px;
height: 120px;
}
.mini-footer {
display: flex;
align-items: center;
img {
height: 14px;
width: 14px;
margin-right: 5px;
}
}
}
}
}
}
} }
</style> </style>
<template>
<div>
<welcome-content v-if="show" :showTemplate="false" :showMember="form.welcomeMsgTplType === '2'" :showMorMaterial="true" :baseData="materialData" @submit="getWelData"></welcome-content>
</div>
</template>
<script> <script>
import { addOrUpdate, getPreview } from '@/api/drainageCode/welcome' import {
import SelectMaterial from '@/components/SelectMaterial' addOrUpdate, getPreview
import WelcomeContent from '@/components/WelcomeContent.vue' } from '@/api/drainageCode/welcome'
export default { import SelectMaterial from '@/components/SelectMaterial'
components: { import WelcomeContent from '@/components/WelcomeContent.vue'
SelectMaterial, export default {
WelcomeContent components: {
}, SelectMaterial,
props: {}, WelcomeContent
data() { },
return { props: {},
materialData: { data () {
welcomeMsg: '', return {
materialMsgList: [] name: '活码',
}, type: '新建',
dialogVisible: false, materialData: {
dialogVisibleSelectMaterial: false, welcomeMsg: '',
form: { materialMsgList: []
// id: '', },
welcomeMsgTplType: '', dialogVisible: false,
welcomeMsg: '', dialogVisibleSelectMaterial: false,
materialUrl: '' form: {
id: '',
welcomeMsgTplType: '',
welcomeMsg: '',
picUrl: '',
applet: [],
imageText: [],
userIds: ''
},
// 遮罩层
loading: false,
show: false
}
},
watch: {},
computed: {},
created () {
this.form.id = this.$route.query.id
let data = JSON.parse(localStorage.getItem('obj'))
this.form = Object.assign(this.form, data)
this.name = this.form.welcomeMsgTplType === '1' ? '活码' : this.form.welcomeMsgTplType === '2' ? '员工' : '入群'
this.type = this.form.id ? '编辑' : '新建'
this.$route.meta.title = (this.form.id ? '编辑' : '新建') + '欢迎语'
this.form.id && this.getData()
},
mounted () {
this.show = true
},
methods: {
getWelData (data) {
this.form.welcomeMsg = data.welcomeMsg
let img = []
let imgText = []
let applet = []
data.materialMsgList.forEach((unit, key) => {
if (unit.msgType === '0') {
img.push(unit.materialUrl)
}
if (unit.msgType === '7') {
let obj = {
imageTextTile: unit.materialName,
imageTextUrl: unit.content
}
imgText.push(obj)
}
if (unit.msgType === '8') {
let oob = {
appTile: unit.materialName,
appId: unit.materialUrl,
appPath: unit.content,
appPic: unit.coverUrl
}
applet.push(oob)
}
})
if (applet.length) {
this.form.applet = applet
} else {
this.form.applet = []
}
if (imgText.length) {
this.form.imageText = imgText
} else {
this.form.imageText = []
}
if (img.length) {
this.form.picUrl = img.join(',')
} else {
this.form.picUrl = ''
}
if (this.form.welcomeMsgTplType === '2') {
this.form.userIds = data.users.map(dd => {
return dd.userId
}).join(',')
}
this.submit()
}, },
// 遮罩层 getData () {
loading: false // getPreview(this.form.id).then(({ data }) => {
} this.materialData = this.form
}, console.log(this.materialData)
watch: {}, this.materialData.materialMsgList = []
computed: {}, let img = []
created() { let imgText = []
this.form = Object.assign(this.form, this.$route.query) let applet = []
this.$route.meta.title = (this.form.id ? '编辑' : '新建') + '欢迎语' if (this.form.picUrl) {
this.form.id && this.getData() this.form.picUrl.split(',').forEach(dd => {
}, let obj = {
mounted() {}, materialUrl: dd,
methods: { msgType: '0',
getWelData(data) { }
let form = this.form img.push(obj)
form.welcomeMsg = data.welcomeMsg
// this.form.mediaId = data.mediaId
// this.form.materialMsgList = data.materialMsgList
data.materialMsgList.forEach((element) => {
// 0 图片;4文本;7图文;8小程序
if (element.msgType == 0) {
;(form.picUrl || (form.picUrl = [])).push(element.materialUrl)
} else if (element.msgType == 7) {
;(form.imageText || (form.imageText = [])).push({
imageTextTile: element.materialName, //图文标题
imageTextUrl: element.content //图文路径
}) })
} else if (element.msgType == 8) { }
;(form.applet || (form.applet = [])).push({ if (this.form.imageText && this.form.imageText.length) {
appTile: element.materialName, //小程序标题 this.form.imageText.forEach(dd => {
appId: element.materialUrl, //小程序id let obj = {
appPath: element.content, //小程序路径 materialName: dd.imageTextTile,
appPic: element.coverUrl //小程序封面 content: dd.imageTextUrl,
msgType: '7'
}
imgText.push(obj)
}) })
} }
}) if (this.form.applet && this.form.applet.length) {
if (form.welcomeMsgTplType === '1') { this.form.applet.forEach(cc => {
form.userIds = data.users.map((e) => e.userId) + '' let obj = {
} materialName: cc.appTile,
form.picUrl += '' materialUrl: cc.appId,
this.submit() content: cc.appPath,
}, coverUrl: cc.appPic,
getData() { msgType: '8'
getPreview(this.form.id).then(({ data }) => {
this.materialData = {}
this.materialData = data
this.materialData.materialMsgList.forEach((item) => {
item.msgType = Number(item.msgType)
})
})
},
submit() {
debugger
addOrUpdate(this.form)
.then(({ data }) => {
this.msgSuccess('操作成功')
this.loading = false
// this.$router.back()
// console.log(form.welcomeMsgTplType === '1')
this.$router.push({
path: '/wechat/drainageCode/welcome/',
query: {
type: this.form.welcomeMsgTplType
} }
applet.push(obj)
}) })
}) }
.catch(() => { this.materialData.materialMsgList.push(...img)
this.loading = false this.materialData.materialMsgList.push(...imgText)
}) this.materialData.materialMsgList.push(...applet)
}, this.$forceUpdate()
insertName() { // })
this.form.welcomeMsg += '#客户昵称#' },
}, submit () {
// 选择素材确认按钮 addOrUpdate(this.form)
submitSelectMaterial(text, image, file) { .then(({
this.form.mediaId = image.id data
this.form.materialUrl = image.materialUrl }) => {
this.dialogVisibleSelectMaterial = false this.msgSuccess('操作成功')
this.loading = false
// this.$router.back()
console.log(this.form.welcomeMsgTplType === '1')
this.$router.push({
path: '/drainageCode/welcome/',
query: {
type: this.form.welcomeMsgTplType.toString()
}
})
})
.catch(() => {
this.loading = false
})
}
}, },
removeMaterial() {
this.form.mediaId = ''
this.form.materialUrl = ''
}
} }
}
</script> </script>
<template>
<welcome-content
:showTemplate="false"
:showMember="form.welcomeMsgTplType == 2"
:showMorMaterial="true"
:baseData="materialData"
@submit="getWelData"
></welcome-content>
</template>
<style lang="scss" scoped> <style lang="scss" scoped>
.page { .page {
padding: 30px; padding: 30px;
background-color: #fff; background-color: #fff;
border-radius: 8px; border-radius: 8px;
} }
.form {
width: 50%; .form {
max-width: 500px; width: 50%;
} max-width: 500px;
}
.filter-wrap {
justify-content: space-between;
}
.filter-wrap { .list-wrap {
justify-content: space-between; flex-wrap: wrap;
} }
.list-wrap {
flex-wrap: wrap; .crumb- {
} // 一级 页面标题
&title {
display: flex;
flex-direction: column;
justify-content: center;
height: 90px; // line-height: 90px;
font-size: 18px;
font-weight: 500;
color: #333;
padding: 0 20px;
background: #fff;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
}
.crumb {
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #666666;
display: flex;
}
</style> </style>
<template>
<div>
<div>
<!-- v-hasPermi="['wecom:tlp:add']" -->
<el-form label-position="left" inline label-width="80px">
<el-form-item label="欢迎语">
<el-input placeholder="请输入欢迎语" v-model="query.welcomeMsg" style="width:260px;"></el-input>
</el-form-item>
<el-form-item label-width="0">
<!-- <el-button v-hasPermi="['wecom:code:list']" type="cyan" @click="getList(1)">查询</el-button> -->
<el-button type="primary" @click="getList(0)">查询</el-button>
<el-button @click="query.welcomeMsg = ''">清空</el-button>
</el-form-item>
</el-form>
<div style="margin-top:20px;display:flex;justify-content:space-between;">
<el-button type="primary" size="mini" @click="goRoute()">新建{{ wel[type] }}欢迎语</el-button>
<div>
<el-button style="align-self: flex-end;" size="mini" type="primary" plain @click="removeMult()">批量删除</el-button>
</div>
</div>
</div>
<div>
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="欢迎语" align="center" prop="welcomeMsg" min-width="250" show-overflow-tooltip/>
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" @click="showPreview(scope.row)">预览</el-button>
<el-divider direction="vertical"></el-divider>
<el-button size="mini" type="text" @click="goRoute(scope.row)">编辑</el-button>
<!-- v-hasPermi="['wecom:tlp:edit']" -->
<el-divider direction="vertical"></el-divider>
<el-button size="mini" type="text" @click="remove(scope.row.id)">删除</el-button>
<!-- v-hasPermi="['wecom:tlp:remove']" -->
</template>
</el-table-column>
</el-table>
<div class="bottom">
<pagination :total="total" :page.sync="query.pageNum" :limit.sync="query.pageSize" @pagination="getList()" />
</div>
</div>
<el-dialog title="预览" :visible.sync="showPreviewDialog" width="50%">
<div>
<preview-client :list="previewData"></preview-client>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="showPreviewDialog = false">关闭</el-button>
</span>
</el-dialog>
</div>
</template>
<script> <script>
import * as api from '@/api/drainageCode/welcome' import PreviewClient from '@/components/previewInMobileClient.vue'
export default { import { getList, remove } from '@/api/drainageCode/welcome'
name: 'Tab', export default {
components: {}, name: 'Tab',
props: { components: {
type: { PreviewClient
type: Number | String,
default: '1',
}, },
}, props: {
data() { type: {
return { type: Number | String,
// 查询参数 default: '1',
query: {
pageNum: 1,
pageSize: 10,
welcomeMsg: undefined,
welcomeMsgTplType: 1,
}, },
loading: false, },
total: 0, data () {
list: [], return {
wel: { ids: [],
1: '活码', // 查询参数
2: '员工', query: {
3: '入群', pageNum: 1,
pageSize: 10,
welcomeMsg: undefined,
welcomeMsgTplType: 1,
},
loading: false,
total: 0,
list: [],
wel: {
1: '活码',
2: '员工',
3: '入群',
},
showPreviewDialog: false,
previewData: {}
}
},
watch: {},
computed: {},
created () {
this.query.welcomeMsgTplType = +this.type
this.getList()
},
mounted () { },
methods: {
handleSelectionChange (selection) {
this.ids = selection.map((item) => item.id)
}, },
} /** 查询 */
}, getList (page) {
watch: {}, page && (this.query.pageNum = page)
computed: {}, this.loading = true
created() { getList(this.query).then(({ rows, total }) => {
this.query.welcomeMsgTplType = +this.type
this.getList()
},
mounted() {},
methods: {
/** 查询 */
getList(page) {
page && (this.query.pageNum = page)
this.loading = true
api
.getList(this.query)
.then(({ rows, total }) => {
this.list = rows this.list = rows
this.total = +total this.total = +total
this.loading = false this.loading = false
this.$emit('total', [this.type, this.total])
}) })
.catch(() => { .catch(() => {
this.loading = false this.loading = false
})
},
/** 删除按钮操作 */
remove (id) {
// const operIds = id || this.ids + "";
this.$confirm('是否确认删除吗?', '警告', {
type: 'warning',
}) })
}, .then(() => {
/** 删除按钮操作 */ return remove(id)
remove(id) { })
// const operIds = id || this.ids + ""; .then(() => {
this.$confirm('是否确认删除吗?', '警告', { this.getList()
type: 'warning', this.msgSuccess('删除成功')
}) })
.then(function() { },
return api.remove(id) removeMult () {
if (!this.ids.length) {
this.msgInfo('请勾选需要删除的项!')
return
}
this.$confirm('是否确认删除吗?', '警告', {
type: 'warning',
}) })
.then(() => { .then(() => {
this.getList() return remove(this.ids.join(','))
this.msgSuccess('删除成功') })
.then(() => {
this.getList()
this.msgSuccess('删除成功')
})
},
goRoute (data) {
let query = {}
if (data) {
query.id = data.id
} else {
query.welcomeMsgTplType = this.type
}
localStorage.setItem('obj', JSON.stringify(data))
this.$router.push({
path: '/drainageCode/welcomeAdd',
query: query
}) })
}, },
goRoute(data) { showPreview (data) {
let query = {} // getPreview(data.id).then(res => {
if (data) { this.previewData = data
let { id, welcomeMsgTplType, welcomeMsg, materialUrl } = data this.previewData.materialMsgList = []
query = { id, welcomeMsgTplType, welcomeMsg, materialUrl } let img = []
} else { let imgText = []
query.welcomeMsgTplType = this.type let applet = []
if (data.picUrl) {
data.picUrl.split(',').forEach(dd => {
let obj = {
materialUrl: dd,
msgType: '0',
}
img.push(obj)
})
}
if (data.imageText && data.imageText.length) {
data.imageText.forEach(dd => {
let obj = {
materialName: dd.imageTextTile,
content: dd.imageTextUrl,
msgType: '7'
}
imgText.push(obj)
})
}
if (data.applet && data.applet.length) {
data.applet.forEach(cc => {
let obj = {
materialName: cc.appTile,
materialUrl: cc.appId,
content: cc.appPath,
coverUrl: cc.appPic,
msgType: '8'
}
applet.push(obj)
})
}
this.previewData.materialMsgList.push(...img)
this.previewData.materialMsgList.push(...imgText)
this.previewData.materialMsgList.push(...applet)
this.showPreviewDialog = true
// })
} }
this.$router.push({ path: 'welcomeAdd', query: query })
}, },
}, }
}
</script> </script>
<template>
<div>
<div class="mid-action">
<div></div>
<div>
<el-button
v-hasPermi="['wecom:tlp:add']"
type="primary"
size="mini"
@click="goRoute()"
>新建{{ wel[type] }}欢迎语</el-button
>
<el-input
placeholder="请输入内容"
prefix-icon="el-icon-search"
v-model="query.welcomeMsg"
style="width: 240px; margin-left: 10px;"
@change="getList(0)"
></el-input>
</div>
</div>
<el-table v-loading="loading" :data="list">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="欢迎语" align="center" prop="welcomeMsg" />
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime" />
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="goRoute(scope.row)"
v-hasPermi="['wecom:tlp:edit']"
>编辑</el-button
>
<el-button
size="mini"
type="text"
@click="remove(scope.row.id)"
v-hasPermi="['wecom:tlp:remove']"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
</div>
</template>
<style lang="scss" scoped></style> <style lang="scss" scoped>
.header {
padding: 0 20px;
}
.divider-content {
width: 100%;
height: 10px;
background-color: #f5f7fb;
}
.bottom {
display: flex;
justify-content: flex-end;
align-items: center;
}
</style>
<template> <template>
<div> <div>
<el-tabs :value="active"> <el-tabs :value="active">
<el-tab-pane :label="`活码欢迎语(${total1})`" name="1"> <el-tab-pane label="活码欢迎语" name="1">
<Tab ref="tab1" type="1" @total="totalChange"></Tab> <Tab ref="tab1" type="1" @total="totalChange"></Tab>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="`员工欢迎语(${total2})`" name="2"> <el-tab-pane label="员工欢迎语" name="2">
<Tab ref="tab2" type="2" @total="totalChange"></Tab> <Tab ref="tab2" type="2" @total="totalChange"></Tab>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="`入群欢迎语(${total3})`" name="3"> <el-tab-pane label="入群欢迎语" name="3">
<Tab ref="tab3" type="3" @total="totalChange"></Tab> <Tab ref="tab3" type="3" @total="totalChange"></Tab>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
...@@ -15,44 +15,48 @@ ...@@ -15,44 +15,48 @@
</template> </template>
<script> <script>
import Tab from './components/Tab' import Tab from './components/Tab'
export default { export default {
name: 'Welcome', name: 'Welcome',
components: { Tab }, components: { Tab },
props: {}, props: {},
data() { data () {
return { return {
active: '1', active: '1',
total1: 0, total1: 0,
total2: 0, total2: 0,
total3: 0 total3: 0
} }
}, },
watch: {}, watch: {},
computed: {}, computed: {},
created() {}, created () {
mounted() { if (this.$route.query.type) {
this.$store.dispatch( this.active = this.$route.query.type
'app/setBusininessDesc', }
` },
mounted () {
this.$store.dispatch(
'app/setBusininessDesc',
`
<div>活码欢迎语:客户通过员工活码添加员工时,系统自动回复欢迎语;新建活码时也可以从活码欢迎语模板中选择。</div> <div>活码欢迎语:客户通过员工活码添加员工时,系统自动回复欢迎语;新建活码时也可以从活码欢迎语模板中选择。</div>
<div>员工欢迎语:客户通过搜索手机号等非员工活码方式添加员工时,系统自动回复欢迎语。</div> <div>员工欢迎语:客户通过搜索手机号等非员工活码方式添加员工时,系统自动回复欢迎语。</div>
<div>入群欢迎语:客户加入群聊时,系统自动回复欢迎语。</div> <div>入群欢迎语:客户加入群聊时,系统自动回复欢迎语。</div>
` `
) )
}, },
// beforeRouteLeave(to, from, next) { // beforeRouteLeave(to, from, next) {
// // this.$store.dispatch(('app/setBusininessDesc', '')) // // this.$store.dispatch(('app/setBusininessDesc', ''))
// this.$store.state.app.busininessDesc = '' // this.$store.state.app.busininessDesc = ''
// next() // next()
// }, // },
methods: { methods: {
totalChange([type, total]) { totalChange ([type, total]) {
this['total' + type] = total this['total' + type] = total
}
} }
} }
}
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>
...@@ -85,6 +85,36 @@ ...@@ -85,6 +85,36 @@
</el-table> </el-table>
<pagination :total="total" :page.sync="query.pageNum" :limit.sync="query.pageSize" @pagination="getList()" /> <pagination :total="total" :page.sync="query.pageNum" :limit.sync="query.pageSize" @pagination="getList()" />
<SelectUser :visible.sync="dialogVisible" title="组织架构" :defaultValues="userArray" @success="getSelectUser"></SelectUser> <SelectUser :visible.sync="dialogVisible" title="组织架构" :defaultValues="userArray" @success="getSelectUser"></SelectUser>
<el-dialog title="详情" :visible.sync="detailDialogVisible" width="40%">
<el-form label-position="right" label-width="100px">
<el-form-item label="内容:">
{{detail.content}}
</el-form-item>
<el-form-item v-if="detail.otherContent" label=" ">
<template v-for="(data, index) in detail.otherContent">
<div style="display:inline-block;margin-right:10px;" v-if="data.annexType === 'image'">
<el-image style="width: 100px; height: 100px" :src="data.annexUrl"></el-image>
</div>
<div style="display:inline-block;margin-right:10px;" v-else-if="data.annexType === 'video'">
<video style="width: 100px; height: 100px" :src="data.annexUrl"></video>
</div>
<div style="display:inline-block;margin-right:10px;" v-else-if="data.annexType === 'link'">
<video style="width: 100px; height: 100px" :src="data.annexUrl"></video>
</div>
</template>
</el-form-item>
<el-form-item label="已发送员工" v-if="detail.addUserName">
<el-tag v-for="(data, key) in detail.addUserName.split(',')" :key="key">{{data}}</el-tag>
</el-form-item>
<el-form-item label="未发送员工" v-if="detail.noAddUserName">
<el-tag v-for="(data, key) in detail.noAddUserName.split(',')" :key="key">{{data}}</el-tag>
</el-form-item>
<span slot="footer" class="dialog-footer">
<el-button @click="detailDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="detailDialogVisible = false">确 定</el-button>
</span>
</el-form>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
...@@ -112,7 +142,9 @@ ...@@ -112,7 +142,9 @@
loading: false, loading: false,
tableData: [], tableData: [],
total: 0, total: 0,
lastSyncTime: '' lastSyncTime: '',
detailDialogVisible: false,
detail: {}
} }
}, },
methods: { methods: {
...@@ -121,7 +153,12 @@ ...@@ -121,7 +153,12 @@
this.query.endTime = moment(e[1]).format('YYYY-MM-DD') this.query.endTime = moment(e[1]).format('YYYY-MM-DD')
}, },
detailFn (id) { detailFn (id) {
getDetail(id) this.detailDialogVisible = true
getDetail(id).then(dd => {
if (dd.code === 200) {
this.detail = dd.data
}
})
}, },
syncFn () { syncFn () {
syncHMoments({ filterType: 0 }).then(res => { syncHMoments({ filterType: 0 }).then(res => {
......
<template> <template>
<div> <div>
员工动态 <div>
<el-form :model="query" label-position="left" ref="queryForm" :inline="true" label-width="100px" class="top-search">
<el-form-item label="选择创建人" prop="creator">
<el-input :value="query.creator" readonly @focus="dialogVisible = true" placeholder="请选择员工" />
</el-form-item>
<el-form-item label="时间范围">
<el-date-picker v-model="value1" format="yyyy-MM-dd" @change="setTimeChange" type="daterange" range-separator="——" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
</el-form-item>
<el-form-item label-width="0">
<!-- v-hasPermi="['wecom:code:list']" -->
<el-button type="primary" @click="getList(1)">查询
</el-button>
<el-button @click="resetQuery">清空</el-button>
</el-form-item>
</el-form>
</div>
<div>
<div style="margin:10px 0;display:flex;">
<el-button type="primary" size="mini" @click="syncFn">同步朋友圈</el-button>
<div class="time" v-if="lastSyncTime">最近同步:{{lastSyncTime}}</div>
<div class="time" v-else>暂无记录,请手动点击同步</div>
</div>
</div>
<el-table ref="table" v-loading="loading" :data="tableData" style="width: 100%">
<el-table-column show-overflow-tooltip prop="content" label="朋友圈内容">
<template slot-scope="{ row }">
<el-image v-if="row.contentType === 'image'" :src="row.content" fit="fit" :preview-src-list="[row.content]" style="width: 100px; height: 100px"></el-image>
<div v-else>{{row.content}}</div>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip prop="contentType" label="类型">
<template slot-scope="{ row }">
<!-- image:图片;text:文本;video:视频;link:图文 -->
<div>
{{row.contentType === 'image'?'图片':row.contentType === 'text'?'文本':row.contentType === 'video'?'视频':'图文'}}
</div>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip prop="creator" label="创建人"></el-table-column>
<el-table-column show-overflow-tooltip prop="createTime" width="170px" label="创建时间"></el-table-column>
<el-table-column show-overflow-tooltip prop="pointNum" label="点赞数"></el-table-column>
<el-table-column show-overflow-tooltip prop="commentNum" label="评论数"></el-table-column>
<el-table-column label="操作" align="center" width="100">
<template slot-scope="{ row }">
<el-button type="text" @click="detailFn(row.momentId)">详情</el-button>
</template>
</el-table-column>
</el-table>
<pagination :total="total" :page.sync="query.pageNum" :limit.sync="query.pageSize" @pagination="getList()" />
<SelectUser :visible.sync="dialogVisible" title="组织架构" :defaultValues="userArray" @success="getSelectUser"></SelectUser>
<el-dialog title="详情" :visible.sync="detailDialogVisible" width="40%">
<el-form label-position="right" label-width="100px">
<el-form-item label="内容:">
{{detail.content}}
</el-form-item>
<el-form-item v-if="detail.otherContent" label=" ">
<template v-for="(data, index) in detail.otherContent">
<div style="display:inline-block;margin-right:10px;" v-if="data.annexType === 'image'">
<el-image style="width: 100px; height: 100px" :src="data.annexUrl"></el-image>
</div>
<div style="display:inline-block;margin-right:10px;" v-else-if="data.annexType === 'video'">
<video style="width: 100px; height: 100px" :src="data.annexUrl"></video>
</div>
<div style="display:inline-block;margin-right:10px;" v-else-if="data.annexType === 'link'">
<video style="width: 100px; height: 100px" :src="data.annexUrl"></video>
</div>
</template>
</el-form-item>
<el-form-item label="点赞客户:" v-if="detail.pointCustomerName">
<el-tag v-for="(data, key) in detail.pointCustomerName.split(',')" :key="key">{{data}}</el-tag>
</el-form-item>
<el-form-item label="评论客户:" v-if="detail.momentCustomerName">
<el-tag v-for="(data, key) in detail.momentCustomerName.split(',')" :key="key">{{data}}</el-tag>
</el-form-item>
<span slot="footer" class="dialog-footer">
<el-button @click="detailDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="detailDialogVisible = false">确 定</el-button>
</span>
</el-form>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import SelectUser from '@/components/SelectUser'
import moment from 'moment'
import { getEnterpriceList, syncHMoments, getDetail } from '@/api/circle'
export default { export default {
name: 'friend-index', name: 'friend-index',
components: {
SelectUser
},
data () { data () {
return { return {
value1: [],
dialogVisible: false,
userArray: [],
query: {
pageSize: 10,
pageNum: 1,
beginTime: '',
endTime: '',
creator: '',
type: 1
},
loading: false,
tableData: [],
total: 0,
lastSyncTime: '',
detailDialogVisible: false,
detail: {}
} }
}, },
methods: { methods: {
setTimeChange (e) {
this.query.beginTime = moment(e[0]).format('YYYY-MM-DD')
this.query.endTime = moment(e[1]).format('YYYY-MM-DD')
},
detailFn (id) {
this.detailDialogVisible = true
getDetail(id).then(dd => {
if (dd.code === 200) {
this.detail = dd.data
}
})
},
syncFn () {
syncHMoments({ filterType: 1 }).then(res => {
if (res.code === 200) {
this.msgSuccess(res.msg)
this.getList()
}
})
},
getSelectUser (data) {
this.userArray = data
this.query.creator = this.userArray.map(function (obj, index) {
return obj.name
}).join(",")
},
resetQuery () {
this.query = {
pageSize: 10,
pageNum: 1,
beginTime: '',
endTime: '',
creator: '',
type: 1
},
this.userArray = []
this.value1 = []
this.getList()
},
getList (type) {
type && (this.query.pageNum = type)
this.loading = true
getEnterpriceList(this.query)
.then(res => {
this.tableData = res.rows
this.lastSyncTime = res.lastSyncTime
this.total = Number(res.total)
this.loading = false
})
.catch(() => {
this.loading = false
})
},
},
mounted () {
this.query.beginTime = moment(this.value1[0]).format('YYYY-MM-DD')
this.query.endTime = moment(this.value1[1]).format('YYYY-MM-DD')
}, },
created () { created () {
this.value1[1] = moment(new Date()).format('YYYY-MM-DD')
this.value1[0] = moment(new Date()).subtract(1, 'months').format('YYYY-MM-DD')
this.getList()
} }
} }
</script>
\ No newline at end of file \ No newline at end of file
</script>
<style lang="scss" scoped>
.time {
margin-left: 20px;
color: #999;
font-size: 12px;
align-self: flex-end;
}
</style>
<template>
<div>
</div>
</template>
<script>
export default {
name: "circle-publish",
data () {
return {}
}
}
</script>
<style lang="scss" scoped>
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!