Commit bee4f39d by test

接口调整

1 parent 3d5fcb69
......@@ -4,16 +4,10 @@ const service = window.CONFIG.services.wecom + '/tlp'
/**
* 获取欢迎语列表
* @param {*} params
{
"pageNum": "当前页",
"pageSize": "每页显示条数",
"welcomeMsg": "欢迎语关键词",
"welcomeMsgTplType": " 欢迎语模板类型:1:员工欢迎语;2:部门员工欢迎语;3:客户群欢迎语"
}
*/
export function getList(params) {
export function getList (params) {
return request({
url: service + '/list',
url: '/wecom/tlp/list',
params
})
}
......@@ -22,7 +16,7 @@ export function getList(params) {
* 根据欢迎语模板id获取模板使用范围
* @param {*} id
*/
export function getScop(id) {
export function getScop (id) {
return request({
url: service + '/scop/' + id
})
......@@ -49,9 +43,9 @@ export function getScop(id) {
"userIds":"ShengXiYong,SunXiWang" //员工欢迎语使用范围,员工id用逗号隔开
}
*/
export function addOrUpdate(data) {
export function addOrUpdate (data) {
return request({
url: service + '/addorUpdate',
url: '/wecom/tlp/addorUpdate',
method: 'POST',
data
})
......@@ -81,17 +75,17 @@ export function addOrUpdate(data) {
* 删除欢迎语
* @param {*} ids
*/
export function remove(ids) {
export function remove (ids) {
return request({
url: service + '/' + ids,
url: '/wecom/tlp/remove/' + ids,
method: 'DELETE'
})
}
// 预览数据
export function getPreview(id) {
export function getPreview (id) {
return request({
url: service + '/tlp/preview',
url: '/wecom/tlp/preview',
params: {
id
}
......
......@@ -33,7 +33,7 @@
<!-- 附件 -->
<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 v-if="showMorMaterial" class="algin" @click="onChooseMaterial(item.msgType, index)">
<img style="margin-right: 3px" :src="require('@/assets/drainageCode/code-add.png')" alt="" />从素材中选择
......@@ -47,7 +47,7 @@
</el-form-item>
</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 v-if="showMorMaterial" class="algin" @click="onChooseMaterial(item.msgType, index)">
<img style="margin-right: 3px" :src="require('@/assets/drainageCode/code-add.png')" alt="" />从素材中选择
......@@ -61,7 +61,7 @@
</el-form-item>
</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 v-if="showMorMaterial" class="algin" @click="onChooseMaterial(item.msgType, index)">
<img style="margin-right: 3px" :src="require('@/assets/drainageCode/code-add.png')" alt="" />从素材中选择
......@@ -81,7 +81,7 @@
</el-form-item>
</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 v-if="showMorMaterial" class="algin" @click="onChooseMaterial(item.msgType, index)">
<img style="margin-right: 3px" :src="require('@/assets/drainageCode/code-add.png')" alt="" />从素材中选择
......@@ -119,13 +119,13 @@
<!-- <el-dropdown-item :command="4">
<el-button type="text">文字</el-button>
</el-dropdown-item> -->
<el-dropdown-item :command="0">
<el-dropdown-item :command="'0'">
<el-button type="text">图片</el-button>
</el-dropdown-item>
<el-dropdown-item :command="7">
<el-dropdown-item :command="'7'">
<el-button type="text">图文</el-button>
</el-dropdown-item>
<el-dropdown-item :command="8">
<el-dropdown-item :command="'8'">
<el-button type="text">小程序</el-button>
</el-dropdown-item>
</el-dropdown-menu>
......@@ -165,7 +165,6 @@
<el-button type="primary" @click="selectWelcome">确 定</el-button>
</div>
</el-dialog>
<SelectUser :defaultValues="selectedUserList" :visible.sync="dialogVisibleSelectUser" title="选择使用员工" @success="selectedUser"></SelectUser>
</div>
</template>
......@@ -228,6 +227,7 @@
},
watch: {
baseData (val) {
console.log(2222)
if (val.welcomeMsg) {
this.form = val
}
......@@ -336,21 +336,21 @@
let materialList = this.form.materialMsgList
const validateFields = {
4: [
'4': [
{
checkField: 'content',
errorField: 'contentError',
errorMsg: '请输入文本'
}
],
0: [
'0': [
{
checkField: 'materialUrl',
errorField: 'materialUrlError',
errorMsg: '请上传图片'
}
],
7: [
'7': [
{
checkField: 'materialName',
errorField: 'materialNameError',
......@@ -362,7 +362,7 @@
errorMsg: '请输入图文链接'
}
],
8: [
'8': [
{
checkField: 'materialName',
errorField: 'materialNameError',
......@@ -427,14 +427,14 @@
if (checkMaterialResult) {
let goto = true
this.form.materialMsgList.forEach((dd) => {
if (dd.msgType === 7) {
if (dd.msgType === '7') {
let reUrl = /(http|https):\/\/([\w.]+\/?)\S*/
if (!reUrl.test(dd.content)) {
goto = false
dd.contentError = '必须以 http://或 https://开头'
}
}
if (dd.msgType === 8) {
if (dd.msgType === '8') {
let htm = /^.*html$/
if (!htm.test(dd.content)) {
goto = false
......
......@@ -12,17 +12,17 @@
</div>
<div class="item" v-for="(data, key) in list.materialMsgList" :key="key">
<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">
{{data.content}}
</div>
</div>
<div class="msg" v-if="data.msgType === 0">
<div class="msg" v-if="data.msgType === '0'">
<div class="image">
<img :src="data.materialUrl" />
<img :src="data.materialUrl" />
</div>
</div>
<div class="msg" v-if="data.msgType === 7">
<div class="msg" v-if="data.msgType === '7'">
<div class="word-and-image">
<div>
{{data.materialName}}
......@@ -37,16 +37,14 @@
</div>
</div>
</div>
<div class="msg" v-if="data.msgType === 8">
<div class="msg" v-if="data.msgType === '8'">
<div class="miniprogram">
<div class="mini-header">
<img src="../assets/drainageCode/miniprogram-icon.png" alt="">
{{data.materialName}}
<img src="../assets/drainageCode/miniprogram-icon.png" alt=""> {{data.materialName}}
</div>
<img class="mini-img" :src="data.coverUrl" >
<img class="mini-img" :src="data.coverUrl">
<div class="mini-footer">
<img src="../assets/drainageCode/miniprogram-link.png" />
小程序
<img src="../assets/drainageCode/miniprogram-link.png" /> 小程序
</div>
</div>
</div>
......@@ -93,7 +91,7 @@
</div>
</div>
</div> -->
</div>
</div>
</template>
......@@ -111,157 +109,150 @@
default: {}
}
},
data() {
data () {
return {}
},
watch: {
},
computed: {},
created() {},
mounted() {},
created () { },
mounted () { },
methods: {},
}
</script>
<style lang="scss" scoped>
.preview {
margin: 0 auto;
position: relative;
width: 300px;
height: 640px;
background: url(../assets/drainageCode/preview-bg.png);
background-repeat: no-repeat;
background-size: 100% 100%;
margin: 0 auto;
position: relative;
width: 300px;
height: 640px;
background: url(../assets/drainageCode/preview-bg.png);
background-repeat: no-repeat;
background-size: 100% 100%;
.title {
position: absolute;
top: 37px;
left: 50%;
transform: translateX(-50%);
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
}
.title {
position: absolute;
top: 37px;
left: 50%;
transform: translateX(-50%);
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
}
.content {
position: absolute;
height: 545px;
width: 280px;
overflow-y: auto;
top: 70px;
left: 50%;
transform: translateX(-50%);
border-bottom-left-radius: 20px;
border-bottom-right-radius: 20px;
padding: 20px;
.content {
position: absolute;
height: 545px;
width: 280px;
overflow-y: auto;
top: 70px;
left: 50%;
transform: translateX(-50%);
border-bottom-left-radius: 20px;
border-bottom-right-radius: 20px;
padding: 20px;
.item {
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #666666;
display: flex;
margin-top: 20px;
.item {
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #666666;
display: flex;
margin-top: 20px;
&:first-child {
margin-top: 0;
}
&:first-child {
margin-top: 0;
}
.avatar {
// align-self: center;
margin-right: 5px;
}
.avatar {
// align-self: center;
margin-right: 5px;
}
.msg {
position: relative;
min-height: 26px;
background: #FFFFFF;
box-shadow: 0px 2px 6px 0px rgba(60, 136, 240, 0.1);
border: 1px solid #E1EDFC;
display: inline-block;
border-radius: 4px;
box-sizing: border-box;
word-break: break-all;
margin-left: 5px;
.msg {
position: relative;
min-height: 26px;
background: #ffffff;
box-shadow: 0px 2px 6px 0px rgba(60, 136, 240, 0.1);
border: 1px solid #e1edfc;
display: inline-block;
border-radius: 4px;
box-sizing: border-box;
word-break: break-all;
margin-left: 5px;
&:before {
content: ' ';
display: block;
position: absolute;
left: -5px;
box-shadow: 0px 2px 6px 0px rgba(60, 136, 240, 0.1);
border-width: 5px;
border-left: 0;
width: 0;
border-style: solid;
border-color: transparent;
border-right-color: #fff;
top: 8px;
z-index: 888;
}
&:before {
content: " ";
display: block;
position: absolute;
left: -5px;
box-shadow: 0px 2px 6px 0px rgba(60, 136, 240, 0.1);
border-width: 5px;
border-left: 0;
width: 0;
border-style: solid;
border-color: transparent;
border-right-color: #fff;
top: 8px;
z-index: 888;
}
.word {
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;
}
}
}
}
}
.word {
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;
}
}
}
}
}
}
}
</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>
import { addOrUpdate, getPreview } from '@/api/drainageCode/welcome'
import SelectMaterial from '@/components/SelectMaterial'
import WelcomeContent from '@/components/WelcomeContent.vue'
export default {
components: {
SelectMaterial,
WelcomeContent
},
props: {},
data() {
return {
materialData: {
welcomeMsg: '',
materialMsgList: []
},
dialogVisible: false,
dialogVisibleSelectMaterial: false,
form: {
// id: '',
welcomeMsgTplType: '',
welcomeMsg: '',
materialUrl: ''
import {
addOrUpdate, getPreview
} from '@/api/drainageCode/welcome'
import SelectMaterial from '@/components/SelectMaterial'
import WelcomeContent from '@/components/WelcomeContent.vue'
export default {
components: {
SelectMaterial,
WelcomeContent
},
props: {},
data () {
return {
name: '活码',
type: '新建',
materialData: {
welcomeMsg: '',
materialMsgList: []
},
dialogVisible: false,
dialogVisibleSelectMaterial: false,
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()
},
// 遮罩层
loading: false
}
},
watch: {},
computed: {},
created() {
this.form = Object.assign(this.form, this.$route.query)
this.$route.meta.title = (this.form.id ? '编辑' : '新建') + '欢迎语'
this.form.id && this.getData()
},
mounted() {},
methods: {
getWelData(data) {
let form = this.form
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 //图文路径
getData () {
// getPreview(this.form.id).then(({ data }) => {
this.materialData = this.form
console.log(this.materialData)
this.materialData.materialMsgList = []
let img = []
let imgText = []
let applet = []
if (this.form.picUrl) {
this.form.picUrl.split(',').forEach(dd => {
let obj = {
materialUrl: dd,
msgType: '0',
}
img.push(obj)
})
} else if (element.msgType == 8) {
;(form.applet || (form.applet = [])).push({
appTile: element.materialName, //小程序标题
appId: element.materialUrl, //小程序id
appPath: element.content, //小程序路径
appPic: element.coverUrl //小程序封面
}
if (this.form.imageText && this.form.imageText.length) {
this.form.imageText.forEach(dd => {
let obj = {
materialName: dd.imageTextTile,
content: dd.imageTextUrl,
msgType: '7'
}
imgText.push(obj)
})
}
})
if (form.welcomeMsgTplType === '1') {
form.userIds = data.users.map((e) => e.userId) + ''
}
form.picUrl += ''
this.submit()
},
getData() {
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
if (this.form.applet && this.form.applet.length) {
this.form.applet.forEach(cc => {
let obj = {
materialName: cc.appTile,
materialUrl: cc.appId,
content: cc.appPath,
coverUrl: cc.appPic,
msgType: '8'
}
applet.push(obj)
})
})
.catch(() => {
this.loading = false
})
},
insertName() {
this.form.welcomeMsg += '#客户昵称#'
},
// 选择素材确认按钮
submitSelectMaterial(text, image, file) {
this.form.mediaId = image.id
this.form.materialUrl = image.materialUrl
this.dialogVisibleSelectMaterial = false
}
this.materialData.materialMsgList.push(...img)
this.materialData.materialMsgList.push(...imgText)
this.materialData.materialMsgList.push(...applet)
this.$forceUpdate()
// })
},
submit () {
addOrUpdate(this.form)
.then(({
data
}) => {
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>
<template>
<welcome-content
:showTemplate="false"
:showMember="form.welcomeMsgTplType == 2"
:showMorMaterial="true"
:baseData="materialData"
@submit="getWelData"
></welcome-content>
</template>
<style lang="scss" scoped>
.page {
padding: 30px;
background-color: #fff;
border-radius: 8px;
}
.form {
width: 50%;
max-width: 500px;
}
.page {
padding: 30px;
background-color: #fff;
border-radius: 8px;
}
.form {
width: 50%;
max-width: 500px;
}
.filter-wrap {
justify-content: space-between;
}
.filter-wrap {
justify-content: space-between;
}
.list-wrap {
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>
<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>
import * as api from '@/api/drainageCode/welcome'
export default {
name: 'Tab',
components: {},
props: {
type: {
type: Number | String,
default: '1',
import PreviewClient from '@/components/previewInMobileClient.vue'
import { getList, remove } from '@/api/drainageCode/welcome'
export default {
name: 'Tab',
components: {
PreviewClient
},
},
data() {
return {
// 查询参数
query: {
pageNum: 1,
pageSize: 10,
welcomeMsg: undefined,
welcomeMsgTplType: 1,
props: {
type: {
type: Number | String,
default: '1',
},
loading: false,
total: 0,
list: [],
wel: {
1: '活码',
2: '员工',
3: '入群',
},
data () {
return {
ids: [],
// 查询参数
query: {
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)
},
}
},
watch: {},
computed: {},
created() {
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 }) => {
/** 查询 */
getList (page) {
page && (this.query.pageNum = page)
this.loading = true
getList(this.query).then(({ rows, total }) => {
this.list = rows
this.total = +total
this.loading = false
this.$emit('total', [this.type, this.total])
})
.catch(() => {
this.loading = false
.catch(() => {
this.loading = false
})
},
/** 删除按钮操作 */
remove (id) {
// const operIds = id || this.ids + "";
this.$confirm('是否确认删除吗?', '警告', {
type: 'warning',
})
},
/** 删除按钮操作 */
remove(id) {
// const operIds = id || this.ids + "";
this.$confirm('是否确认删除吗?', '警告', {
type: 'warning',
})
.then(function() {
return api.remove(id)
.then(() => {
return remove(id)
})
.then(() => {
this.getList()
this.msgSuccess('删除成功')
})
},
removeMult () {
if (!this.ids.length) {
this.msgInfo('请勾选需要删除的项!')
return
}
this.$confirm('是否确认删除吗?', '警告', {
type: 'warning',
})
.then(() => {
this.getList()
this.msgSuccess('删除成功')
.then(() => {
return remove(this.ids.join(','))
})
.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) {
let query = {}
if (data) {
let { id, welcomeMsgTplType, welcomeMsg, materialUrl } = data
query = { id, welcomeMsgTplType, welcomeMsg, materialUrl }
} else {
query.welcomeMsgTplType = this.type
},
showPreview (data) {
// getPreview(data.id).then(res => {
this.previewData = data
this.previewData.materialMsgList = []
let img = []
let imgText = []
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>
<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>
<div>
<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>
</el-tab-pane>
<el-tab-pane :label="`员工欢迎语(${total2})`" name="2">
<el-tab-pane label="员工欢迎语" name="2">
<Tab ref="tab2" type="2" @total="totalChange"></Tab>
</el-tab-pane>
<el-tab-pane :label="`入群欢迎语(${total3})`" name="3">
<el-tab-pane label="入群欢迎语" name="3">
<Tab ref="tab3" type="3" @total="totalChange"></Tab>
</el-tab-pane>
</el-tabs>
......@@ -15,44 +15,48 @@
</template>
<script>
import Tab from './components/Tab'
import Tab from './components/Tab'
export default {
name: 'Welcome',
components: { Tab },
props: {},
data() {
return {
active: '1',
total1: 0,
total2: 0,
total3: 0
}
},
watch: {},
computed: {},
created() {},
mounted() {
this.$store.dispatch(
'app/setBusininessDesc',
`
export default {
name: 'Welcome',
components: { Tab },
props: {},
data () {
return {
active: '1',
total1: 0,
total2: 0,
total3: 0
}
},
watch: {},
computed: {},
created () {
if (this.$route.query.type) {
this.active = this.$route.query.type
}
},
mounted () {
this.$store.dispatch(
'app/setBusininessDesc',
`
<div>活码欢迎语:客户通过员工活码添加员工时,系统自动回复欢迎语;新建活码时也可以从活码欢迎语模板中选择。</div>
<div>员工欢迎语:客户通过搜索手机号等非员工活码方式添加员工时,系统自动回复欢迎语。</div>
<div>入群欢迎语:客户加入群聊时,系统自动回复欢迎语。</div>
`
)
},
// beforeRouteLeave(to, from, next) {
// // this.$store.dispatch(('app/setBusininessDesc', ''))
// this.$store.state.app.busininessDesc = ''
// next()
// },
methods: {
totalChange([type, total]) {
this['total' + type] = total
)
},
// beforeRouteLeave(to, from, next) {
// // this.$store.dispatch(('app/setBusininessDesc', ''))
// this.$store.state.app.busininessDesc = ''
// next()
// },
methods: {
totalChange ([type, total]) {
this['total' + type] = total
}
}
}
}
</script>
<style lang="scss" scoped></style>
......@@ -85,6 +85,36 @@
</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.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>
</template>
<script>
......@@ -112,7 +142,9 @@
loading: false,
tableData: [],
total: 0,
lastSyncTime: ''
lastSyncTime: '',
detailDialogVisible: false,
detail: {}
}
},
methods: {
......@@ -121,7 +153,12 @@
this.query.endTime = moment(e[1]).format('YYYY-MM-DD')
},
detailFn (id) {
getDetail(id)
this.detailDialogVisible = true
getDetail(id).then(dd => {
if (dd.code === 200) {
this.detail = dd.data
}
})
},
syncFn () {
syncHMoments({ filterType: 0 }).then(res => {
......
<template>
<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>
</template>
<script>
import SelectUser from '@/components/SelectUser'
import moment from 'moment'
import { getEnterpriceList, syncHMoments, getDetail } from '@/api/circle'
export default {
name: 'friend-index',
components: {
SelectUser
},
data () {
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: {
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 () {
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
</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!