Commit 3dbdd89a by 怪兽?别跑

企微配置增加默认欢迎语配置

1 parent 7ea2e9e9
......@@ -8,7 +8,7 @@ const service = window.lwConfig.services.wecom + '/corp'
export function getList(params) {
return request({
url: service + '/list',
params,
params
})
}
......@@ -30,7 +30,7 @@ export function add(data) {
return request({
url: service,
method: 'post',
data,
data
})
}
/**
......@@ -56,7 +56,7 @@ export function update(data) {
return request({
url: service,
method: 'put',
data,
data
})
}
......@@ -67,14 +67,14 @@ export function update(data) {
export function start(corpId) {
return request({
url: service + '/startVailWeCorpAccount/' + corpId,
method: 'put',
method: 'put'
})
}
// 获取当前企业相关参数
export function getDetail() {
return request({
url: service + '/findCurrentCorpAccount',
url: service + '/findCurrentCorpAccount'
})
}
......@@ -83,6 +83,22 @@ export function addOrUpdate(data) {
return request({
url: service + '/addOrUpdate',
method: 'post',
data,
data
})
}
// 获取欢迎语配置
export function getWecomeTemplate() {
return request({
url: service + '/findDefaultWelcomeMsg'
})
}
// 保存欢迎语配置
export function setWecomeTemplate(data) {
return request({
url: service + '/editWelComeMsg',
method: 'post',
data
})
}
......@@ -2,7 +2,13 @@
<div>
<el-tabs v-model="active">
<el-tab-pane v-for="(item, key) in tabs" :key="key" :label="item" :name="key">
<component :is="'part' + key" :ref="'part' + key" @submit="savePart" :data="form"></component>
<component
:is="'part' + key"
:ref="'part' + key"
@submit="savePart"
:data="form"
:initData="welcome"
></component>
</el-tab-pane>
</el-tabs>
<div class="g-footer-sticky">
......@@ -11,77 +17,61 @@
</div>
</template>
<script>
import * as api from '@/api/enterpriseId'
import part1 from './part1.vue'
import part2 from './part2.vue'
import part3 from './part3.vue'
import part4 from './part4.vue'
import part5 from './part5.vue'
import part6 from './part6.vue'
import part7 from './part7.vue'
export default {
components: {
part1,
part2,
part3,
part4,
part5,
part6,
part7,
},
props: {},
data() {
return {
active: this.$route.query.index || '1',
tabs: {
1: '基础配置',
2: '应用配置',
3: '客服配置',
4: '支付配置',
5: '公众号配置',
6: '直播配置',
7: '小程序配置',
},
form: {},
loading: false,
}
},
watch: {},
computed: {},
created() {
this.getDetail()
},
mounted() {},
methods: {
savePart(data) {
api
.addOrUpdate(data)
.then(() => {
this.msgSuccess('操作成功')
// this.dialogVisible = false
this.getDetail()
})
.catch(() => {
// this.dialogVisible = false
})
import * as api from '@/api/enterpriseId'
import part1 from './part1.vue'
import part2 from './part2.vue'
import part3 from './part3.vue'
import part4 from './part4.vue'
import part5 from './part5.vue'
import part6 from './part6.vue'
import part7 from './part7.vue'
import part8 from './part8.vue'
export default {
components: {
part1,
part2,
part3,
part4,
part5,
part6,
part7,
part8
},
getDetail() {
this.loading = true
api
.getDetail()
.then(({ data }) => {
this.form = data
this.loading = false
})
.catch(() => {
this.loading = false
})
props: {},
data() {
return {
active: this.$route.query.index || '1',
tabs: {
1: '基础配置',
2: '应用配置',
3: '客服配置',
4: '支付配置',
5: '公众号配置',
6: '直播配置',
7: '小程序配置',
8: '欢迎语配置'
},
form: {},
loading: false,
welcome: []
}
},
watch: {},
computed: {},
created() {
this.getDetail()
},
submit() {
this.$refs['form'].validate((valid) => {
if (valid) {
mounted() {},
methods: {
savePart(data) {
if (this.active == 8) {
api.setWecomeTemplate(data).then(() => {
this.msgSuccess('操作成功')
this.getDetail()
})
} else {
api
.addOrUpdate(this.form)
.addOrUpdate(data)
.then(() => {
this.msgSuccess('操作成功')
// this.dialogVisible = false
......@@ -91,21 +81,58 @@ export default {
// this.dialogVisible = false
})
}
})
},
// start(corpId) {
// api.start(corpId).then(({ rows, total }) => {
// this.msgSuccess('操作成功')
// this.getList()
// })
// },
},
}
},
getDetail() {
this.loading = true
api
.getDetail()
.then(({ data }) => {
this.form = data
this.loading = false
})
.catch(() => {
this.loading = false
})
api.getWecomeTemplate().then(({ data }) => {
this.welcome = data
})
},
submit() {
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.active == 8) {
api.setWecomeTemplate(this.welcome).then(() => {
this.msgSuccess('操作成功')
this.getDetail()
})
} else {
api
.addOrUpdate(this.form)
.then(() => {
this.msgSuccess('操作成功')
// this.dialogVisible = false
this.getDetail()
})
.catch(() => {
// this.dialogVisible = false
})
}
}
})
}
// start(corpId) {
// api.start(corpId).then(({ rows, total }) => {
// this.msgSuccess('操作成功')
// this.getList()
// })
// },
}
}
</script>
<style lang="scss" scoped>
.tips {
color: var(--font-black-7);
font-size: 12px;
}
.tips {
color: var(--font-black-7);
font-size: 12px;
}
</style>
<template>
<div>
<div class="flex">
<div style="width: calc(100% - 425px); padding-right: var(--card-margin);">
<el-form :model="form" :rules="rules" ref="form" label-width="140px">
<el-row class="g-card">
<el-col>
<Attachment
@phoneData="getPhoneData"
@success="getAttentment"
@changeInfo="changeInfo"
:baseData="attachmentsData"
:showModle="false"
></Attachment>
</el-col>
</el-row>
</el-form>
</div>
<div class="g-card" style="width: 425px; margin-top: 0;">
<PreviewInPhone :list="previewData" :templateInfo="templateInfo"></PreviewInPhone>
</div>
</div>
</div>
</template>
<script>
import Attachment from './Attachment.vue'
import PreviewInPhone from '@/components/ContentCenter/PreviewInPhone'
export default {
props: {
initData: {
type: Object,
default: {}
}
},
components: {
Attachment,
PreviewInPhone
},
data() {
return {
previewData: [],
templateInfo: '',
attachmentsData: {
templateInfo: '',
attachments: []
},
form: []
}
},
mounted() {},
watch: {
initData: {
deep: true,
immediate: true,
handler(newData, old) {
this.form = JSON.parse(JSON.stringify(this.initData))
this.setData()
}
}
},
methods: {
changeInfo(data) {
this.templateInfo = data
},
getAttentment(data) {
this.form = data
},
getPhoneData(data) {
this.previewData = data
},
// 提交
submit() {
if (!this.templateInfo) {
this.msgError('欢迎语不能为空!')
return
}
let arr = JSON.parse(JSON.stringify(this.form))
arr.unshift({
content: this.templateInfo,
msgType: 'text'
})
this.$emit('submit', arr)
this.setData()
},
setData() {
if (this.form) {
let arr = []
this.form.forEach((dd) => {
if (dd.msgType == 'text') {
this.templateInfo = dd.content
} else {
arr.push(dd)
}
})
this.form = arr
let data = this.setAttachments(arr)
;(this.attachmentsData = {
templateInfo: this.templateInfo,
attachments: data
}),
(this.previewData = data)
console.log(this.attachmentsData)
}
// this.$forceUpdate()
},
setAttachments(list) {
let arr = []
if (list && list.length) {
list.forEach((dd) => {
if (dd.msgType === 'image') {
let obj = {
id: dd.materialId,
mediaType: '0',
materialUrl: dd.picUrl
}
arr.push(obj)
} else if (dd.msgType === 'video') {
let obj = {
id: dd.materialId,
mediaType: '2',
materialUrl: dd.fileUrl,
coverUrl: dd.picUrl,
digest: dd.description,
materialName: dd.title
}
arr.push(obj)
} else if (dd.msgType === 'file') {
let obj = {
id: dd.materialId,
mediaType: '3',
materialUrl: dd.fileUrl,
digest: dd.description,
materialName: dd.title
}
arr.push(obj)
} else if (dd.msgType === 'text') {
let obj = {
id: dd.materialId,
mediaType: '4',
content: dd.content
}
arr.push(obj)
} else if (dd.msgType === 'link') {
let obj = {
id: dd.materialId,
mediaType: '9',
content: dd.content,
coverUrl: dd.picUrl,
materialUrl: dd.linkUrl,
materialName: dd.title
}
arr.push(obj)
} else if (dd.msgType === 'miniprogram') {
let ff = {
id: dd.materialId,
mediaType: '11',
digest: dd.appId,
materialName: dd.title,
coverUrl: dd.picUrl,
materialUrl: dd.fileUrl
}
arr.push(ff)
} else if (dd.msgType === 'news') {
let ff = {
id: dd.materialId,
mediaType: '12',
digest: dd.description,
materialUrl: dd.fileUrl,
coverUrl: dd.picUrl,
content: dd.content,
materialName: dd.title
}
arr.push(ff)
} else if (dd.msgType === 'posters') {
let obj = {
id: dd.materialId,
mediaType: '5',
materialUrl: dd.fileUrl,
materialName: dd.title
}
arr.push(obj)
}
})
}
return arr
}
}
}
</script>
<style scoped lang="scss">
.sub-des {
font-size: 12px;
font-weight: 400;
color: var(--font-black-6);
}
::v-deep .image-uploader {
.uploader-icon {
width: 80px;
height: 80px;
line-height: 80px;
}
.upload-img {
width: 80px;
height: 80px;
}
}
::v-deep .image-uploader2 {
.uploader-icon {
width: 120px;
height: 120px;
line-height: 120px;
}
.upload-img {
width: 120px;
height: 120px;
}
}
.el-form-item {
margin-bottom: 30px;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!