|
@@ -1,6 +1,6 @@
|
|
<template>
|
|
<template>
|
|
<el-form :model="formCallback" label-width="120px" ref="form" v-loading="loading" class="pr-4">
|
|
<el-form :model="formCallback" label-width="120px" ref="form" v-loading="loading" class="pr-4">
|
|
- <el-form-item label="关键词" prop="is_roi" :rules="[{ required: true, message: '关键词必须填写' }]" label-width="120px">
|
|
|
|
|
|
+ <el-form-item label="关键词" prop="keyword" :rules="[{ required: true, message: '关键词必须填写' }]" label-width="120px">
|
|
<template #label>
|
|
<template #label>
|
|
<div class="flex items-center">
|
|
<div class="flex items-center">
|
|
<el-tooltip placement="top">
|
|
<el-tooltip placement="top">
|
|
@@ -14,16 +14,16 @@
|
|
<span>关键词</span>
|
|
<span>关键词</span>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
- <el-input v-model="formCallback.key" placeholder="请输入关键词" />
|
|
|
|
|
|
+ <el-input :disabled="props.primary?.look" v-model="formCallback.keyword" placeholder="请输入关键词" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="消息内容" prop="type" :rules="[{ required: true, message: '消息类型必须填写' }]" label-width="120px">
|
|
<el-form-item label="消息内容" prop="type" :rules="[{ required: true, message: '消息类型必须填写' }]" label-width="120px">
|
|
- <el-radio-group v-model="formCallback.type">
|
|
|
|
- <el-radio :label="2">文本消息</el-radio>
|
|
|
|
|
|
+ <el-radio-group v-model="formCallback.type" :disabled="props.primary?.look">
|
|
|
|
+ <el-radio label="txt">文本消息</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="" label-width="120px">
|
|
|
|
|
|
+ <el-form-item label="" label-width="120px" prop="content" :rules="[{ required: true, message: '消息内容必须插入' }]">
|
|
<el-card class="box-card" style="width:500px;">
|
|
<el-card class="box-card" style="width:500px;">
|
|
- <template #header>
|
|
|
|
|
|
+ <template #header v-if="!props.primary?.look">
|
|
<div class="card-header">
|
|
<div class="card-header">
|
|
<el-popover placement="right" :visible="popoverVisible" trigger="click">
|
|
<el-popover placement="right" :visible="popoverVisible" trigger="click">
|
|
<template #reference>
|
|
<template #reference>
|
|
@@ -36,10 +36,26 @@
|
|
</el-popover>
|
|
</el-popover>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
- <div v-for="o in 4" :key="o" class="text item">{{ 'List item ' + o }}</div>
|
|
|
|
|
|
+ <div class="insert-content">
|
|
|
|
+ <div v-for="(item, index) in formCallback.content" :key="index">
|
|
|
|
+ <el-button type="primary" link v-if="item.url" @click="linkClick({ index, ...item })">
|
|
|
|
+ {{ item.title }}
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-input style="boder:none;" :disabled="props.primary?.look" v-else v-model="item.title"
|
|
|
|
+ clearable></el-input>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
</el-card>
|
|
</el-card>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <Dialog v-model="insertVisible" :title="insertTitle" destroy-on-close>
|
|
|
|
|
|
+ <div class="flex justify-end" v-if="!props.primary?.look">
|
|
|
|
+ <el-button type="primary" @click="submitForm(form)">{{
|
|
|
|
+ $t('system.confirm')
|
|
|
|
+ }}</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </el-form>
|
|
|
|
+
|
|
|
|
+ <Dialog v-model="insertVisible" :title="insertTitle" destroy-on-close @update:modelValue="formCallbackinsert = {}">
|
|
|
|
+ <el-form :model="formCallbackinsert" label-width="120px" ref="insertform" v-loading="loading" class="pr-4">
|
|
<div v-if="insertType == 'link'">
|
|
<div v-if="insertType == 'link'">
|
|
<div class="withdraw-popup-warn">
|
|
<div class="withdraw-popup-warn">
|
|
<span>需先</span>
|
|
<span>需先</span>
|
|
@@ -47,30 +63,29 @@
|
|
target="_blank">关联小程序</el-link>
|
|
target="_blank">关联小程序</el-link>
|
|
<span>,已关联的小程序可被使用在自定义菜单、模板消息和附近的小程序等场景中</span>
|
|
<span>,已关联的小程序可被使用在自定义菜单、模板消息和附近的小程序等场景中</span>
|
|
</div>
|
|
</div>
|
|
- <el-form-item label="标题" prop="account_id" :rules="[{ required: true, message: '标题必须填写' }]" label-width="120px">
|
|
|
|
- <el-input style="width:300px;" v-model="formCallback.account_id" auto-complete="off"
|
|
|
|
- placeholder="请输入标题"></el-input>
|
|
|
|
|
|
+ <el-form-item label="标题" prop="title" :rules="[{ required: true, message: '标题必须填写' }]" label-width="120px">
|
|
|
|
+ <el-input style="width:300px;" :disabled="props.primary?.look" v-model="formCallbackinsert.title"
|
|
|
|
+ auto-complete="off" placeholder="请输入标题"></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="链接" prop="account_id" :rules="[{ required: true, message: '链接必须填写' }]" label-width="120px">
|
|
|
|
- <el-input style="width:300px;" v-model="formCallback.account_id" auto-complete="off"
|
|
|
|
- placeholder="请输入链接"></el-input>
|
|
|
|
- <el-button type="primary" link :icon="Plus" @click="linkVisible = true" class="mr-6">插入链接</el-button>
|
|
|
|
|
|
+ <el-form-item label="链接" prop="url" :rules="[{ required: true, message: '链接必须填写' }]" label-width="120px">
|
|
|
|
+ <el-input style="width:300px;" :disabled="props.primary?.look" v-model="formCallbackinsert.url"
|
|
|
|
+ auto-complete="off" placeholder="请输入链接"></el-input>
|
|
|
|
+ <el-button v-if="!props.primary?.look" type="primary" link :icon="Plus" @click="linkVisible = true"
|
|
|
|
+ class="mr-6">插入链接</el-button>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</div>
|
|
</div>
|
|
<div v-else>
|
|
<div v-else>
|
|
- <el-form-item label="标题" prop="account_id" :rules="[{ required: true, message: '标题必须填写' }]" label-width="120px">
|
|
|
|
- <el-input style="width:300px;" type="textarea" v-model="formCallback.account_id" auto-complete="off"
|
|
|
|
- placeholder="请输入标题"></el-input>
|
|
|
|
|
|
+ <el-form-item label="标题" prop="title" :rules="[{ required: true, message: '标题必须填写' }]" label-width="120px">
|
|
|
|
+ <el-input style="width:300px;" :disabled="props.primary?.look" type="textarea"
|
|
|
|
+ v-model="formCallbackinsert.title" auto-complete="off" placeholder="请输入标题"></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</div>
|
|
</div>
|
|
- </Dialog>
|
|
|
|
|
|
+ <div class="flex justify-end" v-if="!props.primary?.look">
|
|
|
|
+ <el-button type="primary" @click="insertSubmitChange(insertform)">确定</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </el-form>
|
|
|
|
+ </Dialog>
|
|
|
|
|
|
- <div class="flex justify-end">
|
|
|
|
- <el-button type="primary" @click="submitForm(form)">{{
|
|
|
|
- $t('system.confirm')
|
|
|
|
- }}</el-button>
|
|
|
|
- </div>
|
|
|
|
- </el-form>
|
|
|
|
<Dialog v-model="linkVisible" title="选择链接" destroy-on-close>
|
|
<Dialog v-model="linkVisible" title="选择链接" destroy-on-close>
|
|
<generateLink @close="linkClose" />
|
|
<generateLink @close="linkClose" />
|
|
</Dialog>
|
|
</Dialog>
|
|
@@ -80,9 +95,13 @@
|
|
import { Plus, InfoFilled } from '@element-plus/icons-vue';
|
|
import { Plus, InfoFilled } from '@element-plus/icons-vue';
|
|
import { FormInstance } from 'element-plus';
|
|
import { FormInstance } from 'element-plus';
|
|
import { useRouter, useRoute } from 'vue-router'
|
|
import { useRouter, useRoute } from 'vue-router'
|
|
|
|
+import { wechatPlatformKeywordAdd, wechatPlatformKeywordEdit } from '@/api/officialAccount/keywordReply/index'
|
|
import generateLink from './generateLink.vue'
|
|
import generateLink from './generateLink.vue'
|
|
|
|
+import Cache from '@/support/cache';
|
|
const router = useRouter()
|
|
const router = useRouter()
|
|
const route = useRoute()
|
|
const route = useRoute()
|
|
|
|
+const insertform = ref()
|
|
|
|
+const form = ref()
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
primary: Object | null,
|
|
primary: Object | null,
|
|
});
|
|
});
|
|
@@ -91,7 +110,8 @@ const loading = ref(false)
|
|
const linkVisible = ref(false)
|
|
const linkVisible = ref(false)
|
|
const popoverVisible = ref(false)
|
|
const popoverVisible = ref(false)
|
|
const insertVisible = ref(false)
|
|
const insertVisible = ref(false)
|
|
-const formCallback = ref({ type: 1 })
|
|
|
|
|
|
+const formCallback = ref({ type: 'txt', content: [] })
|
|
|
|
+const formCallbackinsert = ref({})
|
|
const insertType = ref()
|
|
const insertType = ref()
|
|
const insertTitle = computed(() => insertType.value == 'link' ? '插入小程序链接' : '插入纯文本')
|
|
const insertTitle = computed(() => insertType.value == 'link' ? '插入小程序链接' : '插入纯文本')
|
|
const insertChange = (type: string) => {
|
|
const insertChange = (type: string) => {
|
|
@@ -99,7 +119,29 @@ const insertChange = (type: string) => {
|
|
insertVisible.value = true;
|
|
insertVisible.value = true;
|
|
popoverVisible.value = false;
|
|
popoverVisible.value = false;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+const linkClick = (row: object) => {
|
|
|
|
+ formCallbackinsert.value = row
|
|
|
|
+ insertVisible.value = true
|
|
|
|
+ insertType.value = 'link'
|
|
|
|
+}
|
|
|
|
+const insertSubmitChange = (formEl: FormInstance | undefined) => {
|
|
|
|
+ if (!formEl) return;
|
|
|
|
+ if (!formEl) return;
|
|
|
|
+ formEl
|
|
|
|
+ .validate(valid => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ if (formCallbackinsert.value.index != undefined) {
|
|
|
|
+ formCallback.value.content[formCallbackinsert.value?.index] = formCallbackinsert.value
|
|
|
|
+ } else {
|
|
|
|
+ formCallback.value.content?.push(formCallbackinsert.value)
|
|
|
|
+ }
|
|
|
|
+ insertVisible.value = false
|
|
|
|
+ formCallbackinsert.value = {}
|
|
|
|
+ } else {
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .then(() => { });
|
|
|
|
+}
|
|
|
|
|
|
const linkClose = (e: any) => {
|
|
const linkClose = (e: any) => {
|
|
console.log(e);
|
|
console.log(e);
|
|
@@ -112,7 +154,28 @@ const submitForm = (formEl: FormInstance | undefined) => {
|
|
formEl
|
|
formEl
|
|
.validate(valid => {
|
|
.validate(valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
-
|
|
|
|
|
|
+ let params = {
|
|
|
|
+ type: formCallback.value.type,
|
|
|
|
+ keyword: formCallback.value.keyword,
|
|
|
|
+ miniprogram_id: formCallback.value.miniprogram_id,
|
|
|
|
+ content: formCallback.value.content,
|
|
|
|
+ }
|
|
|
|
+ if (props.primary?.id) {
|
|
|
|
+ params.id = props.primary?.id
|
|
|
|
+ wechatPlatformKeywordEdit(props.primary?.id, params).then(res => {
|
|
|
|
+ ElMessage.success(res.message)
|
|
|
|
+ emit('close')
|
|
|
|
+ }).catch(e => {
|
|
|
|
+ loading.value = false;
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ wechatPlatformKeywordAdd(params).then(res => {
|
|
|
|
+ ElMessage.success(res.message)
|
|
|
|
+ emit('close')
|
|
|
|
+ }).catch(e => {
|
|
|
|
+ loading.value = false;
|
|
|
|
+ })
|
|
|
|
+ }
|
|
loading.value = false;
|
|
loading.value = false;
|
|
} else {
|
|
} else {
|
|
loading.value = false;
|
|
loading.value = false;
|
|
@@ -123,9 +186,13 @@ const submitForm = (formEl: FormInstance | undefined) => {
|
|
|
|
|
|
|
|
|
|
if (props.primary) {
|
|
if (props.primary) {
|
|
|
|
+ console.log(props.primary, 'props.primary');
|
|
formCallback.value = JSON.parse(JSON.stringify(props.primary))
|
|
formCallback.value = JSON.parse(JSON.stringify(props.primary))
|
|
}
|
|
}
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
|
+ if (JSON.parse(Cache.get('nav_data'))?.app.id) {
|
|
|
|
+ formCallback.value.miniprogram_id = JSON.parse(Cache.get('nav_data'))?.app.id
|
|
|
|
+ }
|
|
});
|
|
});
|
|
</script>
|
|
</script>
|
|
|
|
|
|
@@ -136,4 +203,14 @@ onMounted(() => {
|
|
color: #666;
|
|
color: #666;
|
|
margin-bottom: 12px;
|
|
margin-bottom: 12px;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+.insert-content {
|
|
|
|
+ min-height: 200px;
|
|
|
|
+ max-height: 468px;
|
|
|
|
+ overflow: hidden;
|
|
|
|
+ overflow-y: auto;
|
|
|
|
+ line-height: 20px;
|
|
|
|
+ height: 20px;
|
|
|
|
+ padding: 10px;
|
|
|
|
+}
|
|
</style>
|
|
</style>
|