feat:v1.4前端更新

This commit is contained in:
超凡
2025-06-24 14:43:09 +08:00
parent bdb4503456
commit 59800954f2
1026 changed files with 118424 additions and 56490 deletions

View File

@@ -5,11 +5,7 @@
</template>
<script>
export default {
}
export default {};
</script>
<style lang="sass" scoped>
</style>
<style lang="sass" scoped></style>

View File

@@ -5,11 +5,7 @@
</template>
<script>
export default {
}
export default {};
</script>
<style lang="sass" scoped>
</style>
<style lang="sass" scoped></style>

View File

@@ -1,25 +1,25 @@
<template>
<div class="divBox">
<el-card class="box-card">
<router-link v-show="$route.path.indexOf('keyword') !== -1" :to="{path: '/appSetting/publicAccount/wxReply/keyword'}">
<el-button size="mini" class="mr20 mb20" icon="el-icon-back">返回</el-button>
<router-link
v-show="$route.path.indexOf('keyword') !== -1"
:to="{ path: '/appSetting/publicAccount/wxReply/keyword' }"
>
<el-button class="mr20 mb20" icon="el-icon-back">返回</el-button>
</router-link>
<el-row :gutter="30" v-loading="loading">
<el-row :gutter="30" v-loading="loading">
<el-col v-bind="grid" class="acea-row">
<div class="left mb15 ml40">
<img class="top" src="@/assets/imgs/mobilehead.png">
<img class="bottom" src="@/assets/imgs/mobilefoot.png">
<img class="top" src="@/assets/imgs/mobilehead.png" />
<img class="bottom" src="@/assets/imgs/mobilefoot.png" />
<div class="centent">
<div class="time-wrapper"><span class="time">9:36</span></div>
<div v-if="formValidate.type !== 'news'" class="view-item text-box clearfix">
<div class="avatar fl"><img src="@/assets/imgs/head.gif"></div>
<div class="avatar fl"><img src="@/assets/imgs/head.gif" /></div>
<div class="box-content fl">
<span
v-if="formValidate.type === 'text'"
v-text="formValidate.contents.content"
/>
<span v-if="formValidate.type === 'text'" v-text="formValidate.contents.content" />
<div v-if="formValidate.contents.mediaId" class="box-content_pic">
<img v-if="formValidate.type === 'image'" :src="formValidate.contents.srcUrl">
<img v-if="formValidate.type === 'image'" :src="formValidate.contents.srcUrl" />
<i class="el-icon-service" v-else></i>
</div>
</div>
@@ -27,7 +27,18 @@
<div v-if="formValidate.type === 'news'">
<div class="newsBox">
<!--<div class="news_pic mb15" style="backgroundImage: url('@/assets/imgs/mobilefoot.png');backgroundSize:'100% 100%'}" />-->
<div class="news_pic mb15" :style="{backgroundImage: 'url(' + (formValidate.contents.articleData.imageInput?formValidate.contents.articleData.imageInput:'') + ')',backgroundSize:'100% 100%'}" />
<div
class="news_pic mb15"
:style="{
backgroundImage:
'url(' +
(formValidate.contents.articleData.imageInput
? formValidate.contents.articleData.imageInput
: '') +
')',
backgroundSize: '100% 100%',
}"
/>
<span class="news_sp">{{ formValidate.contents.articleData.title }}</span>
</div>
</div>
@@ -54,14 +65,14 @@
class="mr5"
:disable-transitions="false"
@close="handleClose(item)"
>{{ item }}
>{{ item }}
</el-tag>
<el-input
v-model="val"
size="mini"
class="arrbox_ip"
placeholder="输入后回车"
style="width: 90%;"
style="width: 90%"
@change="addlabel"
/>
</div>
@@ -76,7 +87,7 @@
<el-select
v-model="formValidate.type"
placeholder="请选择规则状态"
style="width: 90%;"
style="width: 90%"
@change="RuleFactor(formValidate.type)"
>
<el-option label="文字消息" value="text">文字消息</el-option>
@@ -89,16 +100,16 @@
<el-input
v-model="formValidate.contents.content"
placeholder="请填写规则内容"
style="width: 90%;"
style="width: 90%"
@input="change($event)"
/>
</el-form-item>
<el-form-item v-if="formValidate.type === 'news'" label="选取图文:">
<el-button size="mini" type="primary" @click="changePic">选择图文消息</el-button>
<el-button type="primary" @click="changePic">选择图文消息</el-button>
</el-form-item>
<el-form-item
v-if="formValidate.type === 'image' || formValidate.type === 'voice'"
:label="formValidate.type === 'image'?'图片地址:':'语音地址:'"
:label="formValidate.type === 'image' ? '图片地址:' : '语音地址:'"
prop="mediaId"
>
<div class="acea-row row-middle">
@@ -106,7 +117,7 @@
v-model="formValidate.contents.mediaId"
readonly="readonly"
placeholder="default size"
style="width: 75%;"
style="width: 75%"
class="mr10"
/>
<el-upload
@@ -117,11 +128,13 @@
:show-file-list="false"
multiple
>
<el-button size="mini" type="primary">点击上传</el-button>
<el-button type="primary">点击上传</el-button>
</el-upload>
</div>
<span v-show="formValidate.type === 'image'">文件最大2Mb支持bmp/png/jpeg/jpg/gif格式</span>
<span v-show="formValidate.type === 'voice'">文件最大2Mb支持mp3/wma/wav/amr格式,播放长度不超过60s</span>
<span v-show="formValidate.type === 'image'">文件最大5Mb支持bmp/png/jpeg/jpg/gif格式</span>
<span v-show="formValidate.type === 'voice'"
>文件最大5Mb支持mp3/wma/wav/amr格式,播放长度不超过60s</span
>
</el-form-item>
</el-form>
</div>
@@ -132,7 +145,7 @@
class="ml50"
@click="submenus('formValidate')"
v-hasPermi="['admin:wechat:keywords:reply:update']"
>保存并发布
>保存并发布
</el-button>
</div>
</el-col>
@@ -143,37 +156,37 @@
</template>
<script>
import { getToken } from '@/utils/auth'
import { replySaveApi, replyEditApi, replyInfoApi, replyListApi, keywordsInfoApi, replyUpdateApi } from '@/api/wxApi'
import { wechatUploadApi } from '@/api/systemSetting'
import {Debounce} from '@/utils/validate'
import { getToken } from '@/utils/auth';
import { replySaveApi, replyEditApi, replyInfoApi, replyListApi, keywordsInfoApi, replyUpdateApi } from '@/api/wxApi';
import { wechatUploadApi } from '@/api/systemSetting';
import { Debounce } from '@/utils/validate';
export default {
name: 'Index',
components: { },
components: {},
data() {
const validateContent = (rule, value, callback) => {
if (this.formValidate.type === 'text') {
if (this.formValidate.contents.content === '') {
callback(new Error('请填写规则内容'))
callback(new Error('请填写规则内容'));
} else {
callback()
callback();
}
}
}
};
const validateSrc = (rule, value, callback) => {
if (this.formValidate.type === 'image' && this.formValidate.contents.mediaId === '') {
callback(new Error('请上传'))
callback(new Error('请上传'));
} else {
callback()
callback();
}
}
};
const validateVal = (rule, value, callback) => {
if (this.labelarr.length === 0) {
callback(new Error('请输入后回车'))
callback(new Error('请输入后回车'));
} else {
callback()
callback();
}
}
};
return {
loading: false,
visible: false,
@@ -182,7 +195,7 @@ export default {
lg: 12,
md: 10,
sm: 24,
xs: 24
xs: 24,
},
delfromData: {},
isShow: false,
@@ -201,423 +214,435 @@ export default {
keywords: '',
contents: {
content: '',
articleData:{},
articleData: {},
mediaId: '',
srcUrl: '',
articleId: null
articleId: null,
},
id: null
id: null,
},
ruleValidate: {
val: [
{ required: true, validator: validateVal, trigger: 'blur' }
],
type: [
{ required: true, message: '请选择消息类型', trigger: 'change' }
],
content: [
{ required: true, validator: validateContent, trigger: 'blur' }
],
mediaId: [
{ required: true, validator: validateSrc, trigger: 'change' }
]
val: [{ required: true, validator: validateVal, trigger: 'blur' }],
type: [{ required: true, message: '请选择消息类型', trigger: 'change' }],
content: [{ required: true, validator: validateContent, trigger: 'blur' }],
mediaId: [{ required: true, validator: validateSrc, trigger: 'change' }],
},
labelarr: [],
myHeaders: { 'X-Token': getToken() }
}
myHeaders: { 'X-Token': getToken() },
};
},
computed: {
fileUrl() {
return https + `/wechat/reply/upload/image`
return https + `/wechat/reply/upload/image`;
},
voiceUrl() {
return https + `/wechat/reply/upload/voice`
return https + `/wechat/reply/upload/voice`;
},
httpsURL() {
return process.env.VUE_APP_BASE_API.replace('api/', '')
}
return process.env.VUE_APP_BASE_API.replace('api/', '');
},
},
watch: {
$route(to, from) {
if (this.$route.params.id) {
// this.formValidate.keywords = this.$route.params.key
this.details()
this.details();
} else {
// this.labelarr = []
// this.$refs['formValidate'].resetFields()
}
}
},
},
mounted() {
if (this.$route.params.id) {
this.details()
this.details();
}
if (this.$route.path.indexOf('keyword') === -1) {
this.followDetails()
this.followDetails();
}
},
methods: {
change (e) {
this.$forceUpdate()
change(e) {
this.$forceUpdate();
},
// 上传
handleUploadForm(param){
const formData = new FormData()
formData.append('media', param.file)
handleUploadForm(param) {
const formData = new FormData();
formData.append('media', param.file);
let loading = this.$loading({
lock: true,
text: '上传中,请稍候...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
wechatUploadApi(formData, {type: this.formValidate.type === 'image'?'image':'voice'}).then(res => {
loading.close()
this.formValidate.contents.mediaId = res.mediaId
this.formValidate.contents.srcUrl = res.url
this.$message.success('上传成功')
}).catch(() => {
loading.close()
})
background: 'rgba(0, 0, 0, 0.7)',
});
wechatUploadApi(formData, { type: this.formValidate.type === 'image' ? 'image' : 'voice' })
.then((res) => {
loading.close();
this.formValidate.contents.mediaId = res.mediaId;
this.formValidate.contents.srcUrl = res.url;
this.$message.success('上传成功');
})
.catch(() => {
loading.close();
});
},
changePic() {
const _this = this
this.$modalArticle(function(row) {
_this.formValidate.contents.articleData ={
const _this = this;
this.$modalArticle(function (row) {
_this.formValidate.contents.articleData = {
title: row.title,
imageInput : row.imageInput
}
_this.formValidate.contents.articleId = row.id
})
imageInput: row.imageInput,
};
_this.formValidate.contents.articleId = row.id;
});
},
handleClosePic() {
this.visible = false
this.visible = false;
},
// 详情
details() {
this.loading = true
replyInfoApi({id:this.$route.params.id}).then(async res => {
const info = res || null
this.formValidate = {
status: info.status,
type: info.type,
keywords: info.keywords,
id: info.id,
contents: {
content: JSON.parse(info.data).content,
mediaId: JSON.parse(info.data).mediaId,
srcUrl: JSON.parse(info.data).srcUrl,
articleData: JSON.parse(info.data).articleData
}
}
this.labelarr = info.keywords.split(',') || []
this.loading = false
}).catch(() => {
this.loading = false
})
this.loading = true;
replyInfoApi({ id: this.$route.params.id })
.then(async (res) => {
const info = res || null;
this.formValidate = {
status: info.status,
type: info.type,
keywords: info.keywords,
id: info.id,
contents: {
content: JSON.parse(info.data).content,
mediaId: JSON.parse(info.data).mediaId,
srcUrl: JSON.parse(info.data).srcUrl,
articleData: JSON.parse(info.data).articleData,
},
};
this.labelarr = info.keywords.split(',') || [];
this.loading = false;
})
.catch(() => {
this.loading = false;
});
},
// 关注回复,无效关键词详情
followDetails() {
this.loading = true
keywordsInfoApi({ keywords: this.$route.path.indexOf('follow') !== -1 ? 'subscribe' : 'default'}).then(async res => {
const info = res || null
this.formValidate = {
status: info.status,
type: info.type,
keywords: info.keywords,
data: '',
id: info.id,
contents: {
content: JSON.parse(info.data).content || '',
mediaId: JSON.parse(info.data).mediaId || '',
srcUrl: JSON.parse(info.data).srcUrl || '',
articleData: JSON.parse(info.data).articleData || {},
}
}
this.loading = false
}).catch(() => {
this.loading = false
// if (res.message === '数据不存在') return
// this.$message.error(res.message)
})
this.loading = true;
keywordsInfoApi({ keywords: this.$route.path.indexOf('follow') !== -1 ? 'subscribe' : 'default' })
.then(async (res) => {
const info = res || null;
this.formValidate = {
status: info.status,
type: info.type,
keywords: info.keywords,
data: '',
id: info.id,
contents: {
content: JSON.parse(info.data).content || '',
mediaId: JSON.parse(info.data).mediaId || '',
srcUrl: JSON.parse(info.data).srcUrl || '',
articleData: JSON.parse(info.data).articleData || {},
},
};
this.loading = false;
})
.catch(() => {
this.loading = false;
// if (res.message === '数据不存在') return
// this.$message.error(res.message)
});
},
// 下拉选择
RuleFactor(type) {
switch (type) {
case 'text':
this.formValidate.contents.mediaId = ''
this.formValidate.contents.srcUrl = ''
this.formValidate.contents.articleData = {}
break
this.formValidate.contents.mediaId = '';
this.formValidate.contents.srcUrl = '';
this.formValidate.contents.articleData = {};
break;
case 'news':
this.formValidate.contents.mediaId = ''
this.formValidate.contents.content = ''
this.formValidate.contents.srcUrl = ''
this.formValidate.contents.articleData = {}
break
this.formValidate.contents.mediaId = '';
this.formValidate.contents.content = '';
this.formValidate.contents.srcUrl = '';
this.formValidate.contents.articleData = {};
break;
default:
this.formValidate.contents.content = ''
this.formValidate.contents.mediaId = ''
this.formValidate.contents.articleData = {}
this.formValidate.contents.content = '';
this.formValidate.contents.mediaId = '';
this.formValidate.contents.articleData = {};
}
// this.$refs['formValidate'].resetFields();
},
handleClose(tag) {
const index = this.labelarr.indexOf(tag)
this.labelarr.splice(index, 1)
const index = this.labelarr.indexOf(tag);
this.labelarr.splice(index, 1);
},
addlabel() {
const count = this.labelarr.indexOf(this.val)
const count = this.labelarr.indexOf(this.val);
if (count === -1) {
this.labelarr.push(this.val)
this.labelarr.push(this.val);
}
this.val = ''
this.val = '';
},
// 保存
submenus:Debounce(function(name) {
submenus: Debounce(function (name) {
this.$refs[name].validate((valid) => {
if (valid) {
this.formValidate.keywords = this.labelarr.join(',')
this.formValidate.data = JSON.stringify(this.formValidate.contents)
this.formValidate.keywords = this.labelarr.join(',');
this.formValidate.data = JSON.stringify(this.formValidate.contents);
if (this.$route.path.indexOf('keyword') !== -1) {
this.$route.params.id ? replyUpdateApi({id:this.$route.params.id}, this.formValidate).then(async res => {
this.operation()
}).catch(res => {
this.$message.error(res.message)
}) : replySaveApi(this.formValidate).then(async res => {
this.operation()
}).catch(res => {
this.$message.error(res.message)
})
this.$route.params.id
? replyUpdateApi({ id: this.$route.params.id }, this.formValidate)
.then(async (res) => {
this.operation();
})
.catch((res) => {
this.$message.error(res.message);
})
: replySaveApi(this.formValidate)
.then(async (res) => {
this.operation();
})
.catch((res) => {
this.$message.error(res.message);
});
} else {
this.$route.path.indexOf('follow') !== -1 ? this.formValidate.keywords = 'subscribe' : this.formValidate.keywords ='default'
this.formValidate.id !== null ? replyUpdateApi({id:this.formValidate.id}, this.formValidate).then(async res => {
this.$message.success('操作成功')
}) : replySaveApi(this.formValidate).then(async res => {
this.operation()
}).catch(res => {
this.$message.error(res.message)
})
this.$route.path.indexOf('follow') !== -1
? (this.formValidate.keywords = 'subscribe')
: (this.formValidate.keywords = 'default');
this.formValidate.id !== null
? replyUpdateApi({ id: this.formValidate.id }, this.formValidate).then(async (res) => {
this.$message.success('操作成功');
})
: replySaveApi(this.formValidate)
.then(async (res) => {
this.operation();
})
.catch((res) => {
this.$message.error(res.message);
});
}
} else {
return false
return false;
}
})
});
}),
// 保存成功操作
operation() {
this.$modalSure('继续添加').then(() => {
setTimeout(() => {
this.labelarr = []
this.val = ''
this.$refs['formValidate'].resetFields()
this.formValidate.contents.mediaId = ''
}, 1000)
}).catch(() => {
setTimeout(() => {
this.$router.push({ path: `/appSetting/publicAccount/wxReply/keyword` })
}, 500)
})
}
}
}
this.$modalSure('继续添加')
.then(() => {
setTimeout(() => {
this.labelarr = [];
this.val = '';
this.$refs['formValidate'].resetFields();
this.formValidate.contents.mediaId = '';
}, 1000);
})
.catch(() => {
setTimeout(() => {
this.$router.push({ path: `/appSetting/publicAccount/wxReply/keyword` });
}, 500);
});
},
},
};
</script>
<style scoped lang="scss">
.newsBox{
background: #fff;
.newsBox {
background: #fff;
}
.arrbox {
background-color: white;
font-size: 12px;
border: 1px solid #dcdee2;
border-radius: 6px;
margin-bottom: 0px;
padding: 0 5px;
text-align: left;
box-sizing: border-box;
width: 90%;
}
.news_sp {
font-size: 12px;
color: #000000;
background: #fff;
width: 100%;
height: 38px;
line-height: 38px;
padding: 0 12px;
box-sizing: border-box;
display: block;
}
.arrbox_ip {
font-size: 12px;
border: none;
box-shadow: none;
outline: none;
background-color: transparent;
padding: 0;
margin: 0;
width: auto !important;
max-width: inherit;
min-width: 80px;
vertical-align: top;
color: #34495e;
margin: 2px;
}
.left {
min-width: 390px;
min-height: 550px;
position: relative;
padding-left: 40px;
}
.top {
position: absolute;
top: 0px;
}
.bottom {
position: absolute;
bottom: 0px;
}
.centent {
background: #f4f5f9;
min-height: 545px;
width: 320px;
padding: 15px;
box-sizing: border-box;
}
.right {
background: #fff;
min-height: 300px;
}
.box-content {
position: relative;
max-width: 60%;
min-height: 40px;
margin-left: 15px;
padding: 10px;
box-sizing: border-box;
border: 1px solid #ccc;
word-break: break-all;
word-wrap: break-word;
line-height: 1.5;
border-radius: 5px;
}
.box-content_pic {
width: 100%;
}
.box-content_pic img {
width: 100%;
height: auto;
}
.box-content:before {
content: '';
position: absolute;
left: -13px;
top: 11px;
display: block;
width: 0;
height: 0;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-top: 10px solid #ccc;
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
}
.box-content:after {
content: '';
content: '';
position: absolute;
left: -12px;
top: 11px;
display: block;
width: 0;
height: 0;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-top: 10px solid #f5f5f5;
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
}
.time-wrapper {
margin-bottom: 10px;
text-align: center;
margin-top: 62px;
}
.time {
display: inline-block;
color: #f5f5f5;
background: rgba(0, 0, 0, 0.3);
padding: 3px 8px;
border-radius: 3px;
font-size: 12px;
}
.text-box {
display: flex;
}
.avatar {
width: 40px;
height: 40px;
}
.avatar img {
width: 100%;
height: 100%;
}
.modelBox {
.ivu-modal-body {
padding: 0 16px 16px 16px !important;
}
.arrbox {
background-color: white;
font-size: 12px;
border: 1px solid #dcdee2;
border-radius: 6px;
margin-bottom: 0px;
padding:0 5px;
text-align: left;
box-sizing: border-box;
width: 90%;
}
.news_sp{
}
.news_pic {
width: 100%;
height: 150px;
overflow: hidden;
position: relative;
background-size: 100%;
background-position: center center;
border-radius: 5px 5px 0 0;
padding: 10px;
box-sizing: border-box;
display: flex;
flex-direction: column;
align-items: flex-end;
}
.news_cent {
width: 100%;
height: auto;
background: #fff;
border-top: 1px dashed #eee;
display: flex;
padding: 10px;
box-sizing: border-box;
justify-content: space-between;
.news_sp1 {
font-size: 12px;
color: #000000;
background: #fff;
width: 100%;
height: 38px;
line-height: 38px;
padding: 0 12px;
box-sizing: border-box;
display: block;
width: 71%;
}
.arrbox_ip {
font-size: 12px;
border: none;
box-shadow: none;
outline: none;
background-color: transparent;
padding: 0;
margin: 0;
width: auto !important;
max-width: inherit;
min-width: 80px;
vertical-align: top;
color: #34495e;
margin: 2px;
}
.left {
min-width: 390px;
min-height: 550px;
position: relative;
padding-left: 40px;
}
.top {
position: absolute;
top: 0px;
}
.bottom {
position: absolute;
bottom: 0px;
}
.centent {
background: #F4F5F9;
min-height: 545px;
width: 320px;
padding: 15px;
box-sizing: border-box;
}
.right {
background: #fff;
min-height: 300px;
}
.box-content {
position: relative;
max-width: 60%;
min-height: 40px;
margin-left: 15px;
padding: 10px;
box-sizing: border-box;
border: 1px solid #ccc;
word-break: break-all;
word-wrap: break-word;
line-height: 1.5;
border-radius: 5px;
}
.box-content_pic {
width: 100%;
}
.box-content_pic img {
width: 100%;
height: auto;
}
.box-content:before {
content: '';
position: absolute;
left: -13px;
top: 11px;
display: block;
width: 0;
height: 0;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-top: 10px solid #ccc;
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
}
.box-content:after {
content: '';
content: '';
position: absolute;
left: -12px;
top: 11px;
display: block;
width: 0;
height: 0;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-top: 10px solid #f5f5f5;
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
}
.time-wrapper {
margin-bottom: 10px;
text-align: center;
margin-top: 62px;
}
.time {
display: inline-block;
color: #f5f5f5;
background: rgba(0, 0, 0, .3);
padding: 3px 8px;
border-radius: 3px;
font-size: 12px;
}
.text-box {
display: flex;
}
.avatar {
width: 40px;
height: 40px;
}
.avatar img {
width: 100%;
height: 100%;
}
.modelBox{
.ivu-modal-body{
padding: 0 16px 16px 16px !important;
}
}
.news_pic{
width: 100%;
height: 150px;
.news_cent_img {
width: 81px;
height: 46px;
border-radius: 6px;
overflow: hidden;
position: relative;
background-size: 100%;
background-position: center center;
border-radius: 5px 5px 0 0;
padding: 10px;
box-sizing: border-box;
display: flex;
flex-direction: column;
align-items: flex-end;
}
.news_cent{
width: 100%;
height: auto;
background: #fff;
border-top: 1px dashed #eee;
display: flex;
padding: 10px;
box-sizing: border-box;
justify-content: space-between;
.news_sp1{
font-size: 12px;
color: #000000;
width: 71%;
}
.news_cent_img{
width: 81px;
height: 46px;
border-radius: 6px;
overflow: hidden;
img{
width: 100%;
height: 100%;
}
img {
width: 100%;
height: 100%;
}
}
}
</style>

View File

@@ -1,60 +1,54 @@
<template>
<div class="divBox">
<el-card class="box-card">
<el-card :bordered="false" shadow="never" class="ivu-mt" :body-style="{ padding: 0 }">
<div class="padding-add">
<el-form size="small" :inline="true">
<el-form-item label="回复类型:">
<el-select v-model="tableFrom.type" placeholder="请选择类型" @change="seachList" class="selWidth" clearable>
<el-option label="文本消息" value="text"></el-option>
<el-option label="图片消息" value="image"></el-option>
<el-option label="图文消息" value="news"></el-option>
<el-option label="音频消息" value="voice"></el-option>
</el-select>
</el-form-item>
<el-form-item label="关键字:">
<el-input
v-model="tableFrom.keywords"
placeholder="请输入关键字"
class="selWidth"
size="small"
clearable
></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="seachList" v-hasPermi="['admin:wechat:keywords:reply:info:keywords']"
>搜索</el-button
>
<el-button size="small" @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="box-card mt14">
<div slot="header" class="clearfix">
<div class="container">
<el-form size="small" :inline="true">
<el-form-item label="回复类型:">
<el-select v-model="tableFrom.type" placeholder="请选择类型" @change="seachList" class="selWidth" clearable>
<el-option label="文本消息" value="text"></el-option>
<el-option label="图片消息" value="image"></el-option>
<el-option label="图文消息" value="news"></el-option>
<el-option label="音频消息" value="voice"></el-option>
</el-select>
</el-form-item>
<el-form-item label="关键字:">
<el-input v-model="tableFrom.keywords" placeholder="请输入关键字" class="selWidth" size="small" clearable>
<el-button slot="append" icon="el-icon-search" size="small" @click="seachList" v-hasPermi="['admin:wechat:keywords:reply:info:keywords']" />
</el-input>
</el-form-item>
</el-form>
<router-link :to="{path: '/appSetting/publicAccount/wxReply/keyword/save'}">
<el-button size="small" type="primary" v-hasPermi="['admin:wechat:keywords:reply:save']">添加关键字</el-button>
<router-link :to="{ path: '/appSetting/publicAccount/wxReply/keyword/save' }">
<el-button type="primary" v-hasPermi="['admin:wechat:keywords:reply:save']">添加关键字</el-button>
</router-link>
</div>
</div>
<el-table
v-loading="listLoading"
:data="tableData.data"
style="width: 100%"
size="small"
highlight-current-row
>
<el-table-column
prop="id"
label="ID"
width="60"
/>
<el-table-column
prop="keywords"
label="关键字"
min-width="150"
/>
<el-table-column
label="回复类型"
min-width="100"
>
</div>
<el-table v-loading="listLoading" :data="tableData.data" style="width: 100%" size="small" highlight-current-row>
<el-table-column prop="id" label="ID" width="60" />
<el-table-column prop="keywords" label="关键字" min-width="150" />
<el-table-column label="回复类型" min-width="100">
<template slot-scope="scope">
<span>{{ scope.row.type | keywordStatusFilter}}</span>
<span>{{ scope.row.type | keywordStatusFilter }}</span>
</template>
</el-table-column>
<el-table-column
prop="status"
label="是否显示"
min-width="100"
>
<template slot-scope="scope" v-if="checkPermi(['admin:wechat:keywords:reply:status'])">
<el-table-column prop="status" label="是否显示" min-width="100">
<template slot-scope="scope">
<el-switch
v-if="checkPermi(['admin:wechat:keywords:reply:status'])"
v-model="scope.row.status"
:active-value="true"
:inactive-value="false"
@@ -62,16 +56,31 @@
inactive-text="隐藏"
@change="onchangeIsShow(scope.row)"
/>
<span v-else>{{ scope.row.status ? '显示' : '隐藏' }}</span>
</template>
</el-table-column>
<el-table-column label="操作" min-width="100">
<el-table-column label="操作" width="100">
<template slot-scope="scope">
<router-link :to="{path: '/appSetting/publicAccount/wxReply/keyword/save/' + scope.row.id}">
<el-button type="text" size="small"
v-if="scope.row.keywords !=='subscribe' && scope.row.keywords !=='default'"
v-hasPermi="['admin:wechat:keywords:reply:info']">编辑</el-button>
<router-link :to="{ path: '/appSetting/publicAccount/wxReply/keyword/save/' + scope.row.id }">
<el-button
class="list-btn"
type="text"
size="small"
:disabled="scope.row.keywords === 'subscribe' || scope.row.keywords === 'default'"
v-hasPermi="['admin:wechat:keywords:reply:info']"
>编辑</el-button
>
</router-link>
<el-button type="text" size="small" @click="handleDelete(scope.row.id, scope.$index)" v-hasPermi="['admin:wechat:keywords:reply:delete']">删除</el-button>
<el-divider direction="vertical"></el-divider>
<el-button
class="list-btn"
:disabled="scope.row.keywords === 'subscribe' || scope.row.keywords === 'default'"
type="text"
size="small"
@click="handleDelete(scope.row.id, scope.$index)"
v-hasPermi="['admin:wechat:keywords:reply:delete']"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
@@ -84,6 +93,7 @@
:total="tableData.total"
@size-change="handleSizeChange"
@current-change="pageChange"
background
/>
</div>
</el-card>
@@ -91,75 +101,87 @@
</template>
<script>
import { replyListApi, replyDeleteApi, replyUpdateApi, replyStatusApi } from '@/api/wxApi'
import { getToken } from '@/utils/auth'
import { checkPermi } from "@/utils/permission";
import { replyListApi, replyDeleteApi, replyUpdateApi, replyStatusApi } from '@/api/wxApi';
import { getToken } from '@/utils/auth';
import { checkPermi } from '@/utils/permission';
export default {
name: 'WechatKeyword',
data() {
return {
tableData: {
data: [],
total: 0
total: 0,
},
tableFrom: {
page: 1,
limit: 20,
keywords: '',
type: ''
type: '',
},
listLoading: true
}
listLoading: true,
};
},
created() {
this.getList()
this.getList();
},
methods: {
checkPermi,
//重置
handleReset() {
this.tableFrom.type = '';
this.tableFrom.keywords = '';
this.getList();
},
seachList() {
this.tableFrom.page = 1
this.getList()
this.tableFrom.page = 1;
this.getList();
},
onchangeIsShow(row) {
replyStatusApi({id:row.id, status:row.status}).then(() => {
this.$message.success('修改成功');
this.getList();
}).catch(()=>{
row.status = !row.status
})
replyStatusApi({ id: row.id, status: row.status })
.then(() => {
this.$message.success('修改成功');
this.getList();
})
.catch(() => {
row.status = !row.status;
});
},
// 列表
getList() {
this.listLoading = true
replyListApi(this.tableFrom).then(res => {
this.tableData.data = res.list
this.tableData.total = res.total
this.listLoading = false
}).catch(res => {
this.listLoading = false
})
this.listLoading = true;
replyListApi(this.tableFrom)
.then((res) => {
this.tableData.data = res.list;
this.tableData.total = res.total;
this.listLoading = false;
})
.catch((res) => {
this.listLoading = false;
});
},
pageChange(page) {
this.tableFrom.page = page
this.getList()
this.tableFrom.page = page;
this.getList();
},
handleSizeChange(val) {
this.tableFrom.limit = val
this.getList()
this.tableFrom.limit = val;
this.getList();
},
// 删除
handleDelete(id, idx) {
this.$modalSure().then(() => {
replyDeleteApi({id: id}).then(() => {
this.$message.success('删除成功')
this.getList()
})
})
}
}
}
replyDeleteApi({ id: id }).then(() => {
this.$message.success('删除成功');
this.getList();
});
});
},
},
};
</script>
<style scoped>
.list-btn {
padding: 0 !important;
}
</style>

View File

@@ -4,26 +4,23 @@
<el-row :gutter="30">
<el-col v-bind="grid" class="left mb15 ml40">
<div>
<img class="top" src="@/assets/imgs/mobilehead.png">
<img class="bottom" src="@/assets/imgs/mobilefoot.png">
<div
style="background: #F4F5F9; min-height: 438px; position: absolute;
top: 63px; width: 320px; "
/>
<img class="top" src="@/assets/imgs/mobilehead.png" />
<img class="bottom" src="@/assets/imgs/mobilefoot.png" />
<div style="background: #f4f5f9; min-height: 438px; position: absolute; top: 63px; width: 320px" />
<div class="textbot">
<div v-for="(item,indx) in list" :key="indx" class="li" :class="{active:item === formValidate}">
<div v-for="(item, indx) in list" :key="indx" class="li" :class="{ active: item === formValidate }">
<div>
<div class="add" @click="add(item,indx)">
<div class="add" @click="add(item, indx)">
<i class="el-icon-plus" />
<div class="arrow" />
</div>
<div class="tianjia">
<div
v-for="(j,index) in item.sub_button"
v-for="(j, index) in item.sub_button"
:key="index"
class="addadd menuBox"
:class="{active:j === formValidate}"
@click="gettem(j,index,indx)"
:class="{ active: j === formValidate }"
@click="gettem(j, index, indx)"
>
<el-tooltip class="item" effect="dark" :content="j.name" placement="top-start">
<el-button>{{ j.name || '二级菜单' }}</el-button>
@@ -31,7 +28,7 @@
</div>
</div>
</div>
<div class="text menuBox" @click="gettem(item,indx,null)">
<div class="text menuBox" @click="gettem(item, indx, null)">
<el-tooltip class="item" effect="dark" :content="item.name" placement="top-start">
<el-button>{{ item.name || '一级菜单' }}</el-button>
</el-tooltip>
@@ -47,18 +44,26 @@
<div v-if="checkedMenuId !== null">
<div class="dividerTitle acea-row row-between row-bottom">
<span class="title">菜单信息</span>
<el-button slot="extra" size="small" type="danger" @click="deltMenus" v-hasPermi="['admin:wechat:menu:public:delete']">删除</el-button>
<el-button
slot="extra"
size="small"
type="danger"
@click="deltMenus"
v-hasPermi="['admin:wechat:menu:public:delete']"
>删除</el-button
>
<el-divider />
</div>
<el-col :span="24" class="userAlert">
<div class="box-card right">
<el-alert
class="mb15"
title="已添加子菜单,仅可设置菜单名称"
type="success"
show-icon
/>
<el-form ref="formValidate" :model="formValidate" :rules="ruleValidate" label-width="100px" class="mt20">
<el-alert class="mb15" title="已添加子菜单,仅可设置菜单名称" type="success" show-icon />
<el-form
ref="formValidate"
:model="formValidate"
:rules="ruleValidate"
label-width="100px"
class="mt20"
>
<el-form-item label="菜单名称" prop="name">
<el-input v-model="formValidate.name" placeholder="请填写菜单名称" class="spwidth" />
</el-form-item>
@@ -95,10 +100,13 @@
</el-col>
</div>
<el-col v-if="isTrue" :span="24">
<el-button size="mini" type="primary"
style="display: block;margin: 10px auto;"
@click="submenus('formValidate')"
v-hasPermi="['admin:wechat:menu:public:create']">保存并发布</el-button>
<el-button
type="primary"
style="display: block; margin: 10px auto"
@click="submenus('formValidate')"
v-hasPermi="['admin:wechat:menu:public:create']"
>保存并发布</el-button
>
</el-col>
</el-col>
</el-row>
@@ -107,320 +115,310 @@
</template>
<script>
import { wechatMenuApi, wechatMenuAddApi } from '@/api/wxApi'
import {Debounce} from '@/utils/validate'
export default {
name: 'WechatMenus',
data() {
return {
grid: {
xl: 8,
lg: 8,
md: 8,
sm: 8,
xs: 24
},
grid2: {
xl: 16,
lg: 16,
md: 16,
sm: 16,
xs: 24
},
modal2: false,
formValidate: {
name: '',
type: 'click',
appid: '',
url: '',
key: '',
pagepath: '',
id: 0
},
ruleValidate: {
name: [
{ required: true, message: '请填写菜单名称', trigger: 'blur' }
],
key: [
{ required: true, message: '请填写关键字', trigger: 'blur' }
],
appid: [
{ required: true, message: '请填写appid', trigger: 'blur' }
],
pagepath: [
{ required: true, message: '请填写小程序路径', trigger: 'blur' }
],
url: [
{ required: true, message: '请填写跳转地址', trigger: 'blur' }
],
type: [
{ required: true, message: '请选择规则状态', trigger: 'change' }
]
},
parentMenuId: null,
list: [],
checkedMenuId: null,
isTrue: false
}
},
mounted() {
this.getMenus()
if (this.list.length) {
this.formValidate = this.list[this.activeClass]
} else {
return this.formValidate
}
},
methods: {
// 添加一级字段函数
defaultMenusData() {
return {
type: 'click',
name: '',
sub_button: []
}
import { wechatMenuApi, wechatMenuAddApi } from '@/api/wxApi';
import { Debounce } from '@/utils/validate';
export default {
name: 'WechatMenus',
data() {
return {
grid: {
xl: 8,
lg: 8,
md: 8,
sm: 8,
xs: 24,
},
// 添加二级字段函数
defaultChildData() {
return {
type: 'click',
name: ''
}
grid2: {
xl: 16,
lg: 16,
md: 16,
sm: 16,
xs: 24,
},
// 获取 菜单
getMenus() {
wechatMenuApi().then(async res => {
const data = res.menu
this.list = data.button
})
modal2: false,
formValidate: {
name: '',
type: 'click',
appid: '',
url: '',
key: '',
pagepath: '',
id: 0,
},
// 点击保存提交
submenus:Debounce(function(name) {
if (this.isTrue && !this.checkedMenuId && this.checkedMenuId !== 0) {
this.putData()
} else {
this.$refs[name].validate((valid) => {
if (valid) {
this.putData()
} else {
if (!this.check()) return false
}
})
}
}),
// 新增data
putData() {
const data = {
button: this.list
}
wechatMenuAddApi(data).then(async res => {
this.$message.success('提交成功')
this.checkedMenuId = null
this.formValidate = {}
this.isTrue = false
})
ruleValidate: {
name: [{ required: true, message: '请填写菜单名称', trigger: 'blur' }],
key: [{ required: true, message: '请填写关键字', trigger: 'blur' }],
appid: [{ required: true, message: '请填写appid', trigger: 'blur' }],
pagepath: [{ required: true, message: '请填写小程序路径', trigger: 'blur' }],
url: [{ required: true, message: '请填写跳转地址', trigger: 'blur' }],
type: [{ required: true, message: '请选择规则状态', trigger: 'change' }],
},
// 点击元素
gettem(item, index, pid) {
this.checkedMenuId = index
this.formValidate = item
this.parentMenuId = pid
this.isTrue = true
},
// 增加二级
add(item, index) {
if (!this.check()) return false
if (item.sub_button.length < 5) {
const data = this.defaultChildData()
const id = item.sub_button.length
item.sub_button.push(data)
this.formValidate = data
this.checkedMenuId = id
this.parentMenuId = index
this.isTrue = true
}
},
// 增加一级
addtext() {
if (!this.check()) return false
const data = this.defaultMenusData()
const id = this.list.length
this.list.push(data)
this.formValidate = data
this.checkedMenuId = id
this.parentMenuId = null
this.isTrue = true
},
// 判断函数
check: function() {
const reg = /[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?/
if (this.checkedMenuId === null) return true
if (!this.isTrue) return true
if (!this.formValidate.name) {
this.$message.warning('请输入按钮名称!')
return false
}
if (this.formValidate.type === 'click' && !this.formValidate.key) {
this.$message.warning('请输入关键字!')
return false
}
if (this.formValidate.type === 'view' && !(reg.test(this.formValidate.url))) {
this.$message.warning('请输入正确的跳转地址!')
return false
}
if (this.formValidate.type === 'miniprogram' &&
(!this.formValidate.appid ||
!this.formValidate.pagepath ||
!this.formValidate.url)) {
this.$message.warning('请填写完整小程序配置!')
return false
}
return true
},
// 删除
deltMenus() {
if (this.isTrue) {
this.$modalSure().then(() => {
this.del()
})
} else {
this.$message.warning('请选择菜单!')
}
},
// 确认删除
del() {
this.parentMenuId === null ? this.list.splice(this.checkedMenuId, 1) : this.list[this.parentMenuId].sub_button.splice(this.checkedMenuId, 1)
this.parentMenuId = null
this.formValidate = {
name: '',
type: 'click',
appid: '',
url: '',
key: '',
pagepath: '',
id: 0
}
this.isTrue = false
this.modal2 = false
this.checkedMenuId = null
this.$refs['formValidate'].resetFields()
this.submenus('formValidate')
}
parentMenuId: null,
list: [],
checkedMenuId: null,
isTrue: false,
};
},
mounted() {
this.getMenus();
if (this.list.length) {
this.formValidate = this.list[this.activeClass];
} else {
return this.formValidate;
}
}
},
methods: {
// 添加一级字段函数
defaultMenusData() {
return {
type: 'click',
name: '',
sub_button: [],
};
},
// 添加二级字段函数
defaultChildData() {
return {
type: 'click',
name: '',
};
},
// 获取 菜单
getMenus() {
wechatMenuApi().then(async (res) => {
const data = res.menu;
this.list = data.button;
});
},
// 点击保存提交
submenus: Debounce(function (name) {
if (this.isTrue && !this.checkedMenuId && this.checkedMenuId !== 0) {
this.putData();
} else {
this.$refs[name].validate((valid) => {
if (valid) {
this.putData();
} else {
if (!this.check()) return false;
}
});
}
}),
// 新增data
putData() {
const data = {
button: this.list,
};
wechatMenuAddApi(data).then(async (res) => {
this.$message.success('提交成功');
this.checkedMenuId = null;
this.formValidate = {};
this.isTrue = false;
});
},
// 点击元素
gettem(item, index, pid) {
this.checkedMenuId = index;
this.formValidate = item;
this.parentMenuId = pid;
this.isTrue = true;
},
// 增加二级
add(item, index) {
if (!this.check()) return false;
if (item.sub_button.length < 5) {
const data = this.defaultChildData();
const id = item.sub_button.length;
item.sub_button.push(data);
this.formValidate = data;
this.checkedMenuId = id;
this.parentMenuId = index;
this.isTrue = true;
}
},
// 增加一级
addtext() {
if (!this.check()) return false;
const data = this.defaultMenusData();
const id = this.list.length;
this.list.push(data);
this.formValidate = data;
this.checkedMenuId = id;
this.parentMenuId = null;
this.isTrue = true;
},
// 判断函数
check: function () {
const reg = /[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?/;
if (this.checkedMenuId === null) return true;
if (!this.isTrue) return true;
if (!this.formValidate.name) {
this.$message.warning('请输入按钮名称!');
return false;
}
if (this.formValidate.type === 'click' && !this.formValidate.key) {
this.$message.warning('请输入关键字!');
return false;
}
if (this.formValidate.type === 'view' && !reg.test(this.formValidate.url)) {
this.$message.warning('请输入正确的跳转地址!');
return false;
}
if (
this.formValidate.type === 'miniprogram' &&
(!this.formValidate.appid || !this.formValidate.pagepath || !this.formValidate.url)
) {
this.$message.warning('请填写完整小程序配置!');
return false;
}
return true;
},
// 删除
deltMenus() {
if (this.isTrue) {
this.$modalSure().then(() => {
this.del();
});
} else {
this.$message.warning('请选择菜单!');
}
},
// 确认删除
del() {
this.parentMenuId === null
? this.list.splice(this.checkedMenuId, 1)
: this.list[this.parentMenuId].sub_button.splice(this.checkedMenuId, 1);
this.parentMenuId = null;
this.formValidate = {
name: '',
type: 'click',
appid: '',
url: '',
key: '',
pagepath: '',
id: 0,
};
this.isTrue = false;
this.modal2 = false;
this.checkedMenuId = null;
this.$refs['formValidate'].resetFields();
this.submenus('formValidate');
},
},
};
</script>
<style scoped lang="scss">
.menuBox{
::v-deep.el-button{
border: none;
background: bottom;
padding: 0 !important;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
width: 100%;
}
}
*{
-moz-user-select: none; /*火狐*/
-webkit-user-select: none; /*webkit浏览器*/
-ms-user-select: none; /*IE10*/
-khtml-user-select: none; /*早期浏览器*/
user-select: none;
}
.title{
margin-bottom: -19px !important;
padding-bottom: 17px !important;
}
.left {
min-width: 390px;
min-height: 550px;
position: relative;
padding-left: 40px;
.menuBox {
::v-deepel-button {
border: none;
background: bottom;
padding: 0 !important;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 100%;
}
}
* {
-moz-user-select: none; /*火狐*/
-webkit-user-select: none; /*webkit浏览器*/
-ms-user-select: none; /*IE10*/
-khtml-user-select: none; /*早期浏览器*/
user-select: none;
}
.title {
margin-bottom: -19px !important;
padding-bottom: 17px !important;
}
.left {
min-width: 390px;
min-height: 550px;
position: relative;
padding-left: 40px;
}
.top {
position: absolute;
top: 0px;
}
.top {
position: absolute;
top: 0px;
}
.bottom {
position: absolute;
bottom: 0px;
}
.bottom {
position: absolute;
bottom: 0px;
}
.textbot {
position: absolute;
bottom: 0px;
left: 59px;
width: 100%;
}
.active {
border: 1px solid #44B549 !important;
color: #44B549 !important;
}
.li {
float: left;
width: 93px;
line-height: 48px;
border: 1px solid #E7E7EB;
background: #FAFAFA;
text-align: center;
cursor: pointer;
color: #999;
position: relative;
}
.text{
height: 50px;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
}
.text:hover {
color: #000;
}
.textbot {
position: absolute;
bottom: 0px;
left: 59px;
width: 100%;
}
.active {
border: 1px solid #44b549 !important;
color: #44b549 !important;
}
.li {
float: left;
width: 93px;
line-height: 48px;
border: 1px solid #e7e7eb;
background: #fafafa;
text-align: center;
cursor: pointer;
color: #999;
position: relative;
}
.text {
height: 50px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.text:hover {
color: #000;
}
.add {
position: absolute;
bottom: 65px;
width: 100%;
line-height: 48px;
border: 1px solid #E7E7EB;
background: #FAFAFA;
}
.arrow {
position: absolute;
bottom: -16px;
left: 36px;
/* 圆角的位置需要细心调试哦 */
width: 0;
height: 0;
font-size: 0;
border: solid 8px;
border-color:#fff #F4F5F9 #F4F5F9 #F4F5F9;
}
.tianjia {
position: absolute;
bottom: 115px;
width: 100%;
line-height: 48px;
background: #FAFAFA;
}
.addadd {
width: 100%;
line-height: 48px;
border: 1px solid #E7E7EB;
background: #FAFAFA;
height: 48px;
padding: 0 5px;
box-sizing: border-box;
}
.right {
background: #fff;
min-height: 400px;
}
.spwidth{
width: 100%;
}
.add {
position: absolute;
bottom: 65px;
width: 100%;
line-height: 48px;
border: 1px solid #e7e7eb;
background: #fafafa;
}
.arrow {
position: absolute;
bottom: -16px;
left: 36px;
/* 圆角的位置需要细心调试哦 */
width: 0;
height: 0;
font-size: 0;
border: solid 8px;
border-color: #fff #f4f5f9 #f4f5f9 #f4f5f9;
}
.tianjia {
position: absolute;
bottom: 115px;
width: 100%;
line-height: 48px;
background: #fafafa;
}
.addadd {
width: 100%;
line-height: 48px;
border: 1px solid #e7e7eb;
background: #fafafa;
height: 48px;
padding: 0 5px;
box-sizing: border-box;
}
.right {
background: #fff;
min-height: 400px;
}
.spwidth {
width: 100%;
}
</style>

View File

@@ -1,5 +1,3 @@
<template>
<div>
</div>
</template>
<div></div>
</template>