|
|
|
|
@ -6,11 +6,11 @@
|
|
|
|
|
:model="welcome"
|
|
|
|
|
:rules="welcomeRules">
|
|
|
|
|
<FormItem label="欢迎语内容"
|
|
|
|
|
prop="description">
|
|
|
|
|
<i-input v-model="welcome.description"
|
|
|
|
|
prop="content">
|
|
|
|
|
<i-input v-model="welcome.content"
|
|
|
|
|
type="textarea"
|
|
|
|
|
style="height: 220px"
|
|
|
|
|
:autosize="{minRows: 10,maxRows: 10}"
|
|
|
|
|
:autosize="{ minRows: 10, maxRows: 10 }"
|
|
|
|
|
placeholder="请输入欢迎语内容,最多100个字"></i-input>
|
|
|
|
|
</FormItem>
|
|
|
|
|
<Row style="margin-bottom: 10px"
|
|
|
|
|
@ -20,7 +20,9 @@
|
|
|
|
|
:key="index">
|
|
|
|
|
<div v-if="item.type == 3">
|
|
|
|
|
<i-col style="line-height: 32px"
|
|
|
|
|
:span="4"> APPID {{ index + 1 }} </i-col>
|
|
|
|
|
:span="4">
|
|
|
|
|
APPID {{ index + 1 }}
|
|
|
|
|
</i-col>
|
|
|
|
|
<i-col :span="6">
|
|
|
|
|
<i-input class="inputClass"
|
|
|
|
|
type="text"
|
|
|
|
|
@ -28,7 +30,9 @@
|
|
|
|
|
v-model="item.defaultVal"></i-input>
|
|
|
|
|
</i-col>
|
|
|
|
|
<i-col style="line-height: 32px"
|
|
|
|
|
:span="4"> URI {{ index + 1 }} </i-col>
|
|
|
|
|
:span="4">
|
|
|
|
|
URI {{ index + 1 }}
|
|
|
|
|
</i-col>
|
|
|
|
|
<i-col :span="6">
|
|
|
|
|
<i-input class="inputClass"
|
|
|
|
|
type="text"
|
|
|
|
|
@ -38,7 +42,9 @@
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else>
|
|
|
|
|
<i-col style="line-height: 32px"
|
|
|
|
|
:span="4"> {{item.name}}{{ index + 1 }} </i-col>
|
|
|
|
|
:span="4">
|
|
|
|
|
{{ item.name }}{{ index + 1 }}
|
|
|
|
|
</i-col>
|
|
|
|
|
<i-col :span="16">
|
|
|
|
|
<i-input class="inputClass"
|
|
|
|
|
type="text"
|
|
|
|
|
@ -53,12 +59,12 @@
|
|
|
|
|
</Row>
|
|
|
|
|
<FormItem>
|
|
|
|
|
<Button type="text"
|
|
|
|
|
@click="() => showMessageTypes = true"
|
|
|
|
|
@click="() => (showMessageTypes = true)"
|
|
|
|
|
icon="md-add">添加图片/网页/小程序消息</Button>
|
|
|
|
|
</FormItem>
|
|
|
|
|
<FormItem label="配置范围: ">
|
|
|
|
|
<span v-if="welcome.stores.length > 0">
|
|
|
|
|
{{welcome.stores[0].name}}等{{welcome.stores.length}}家店铺
|
|
|
|
|
{{ welcome.stores[0].name }}等{{ welcome.stores.length }}家店铺
|
|
|
|
|
</span>
|
|
|
|
|
<Button type="text"
|
|
|
|
|
@click="showStores"
|
|
|
|
|
@ -156,18 +162,19 @@
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
import axios from "axios";
|
|
|
|
|
import { isURL } from '../../utils/Common';
|
|
|
|
|
import store from "../../store"
|
|
|
|
|
import selectStoreStep from '../activity/selectStoreStep';
|
|
|
|
|
import axios from 'axios'
|
|
|
|
|
import { isURL } from '../../utils/Common'
|
|
|
|
|
import store from '../../store'
|
|
|
|
|
import selectStoreStep from '../activity/selectStoreStep'
|
|
|
|
|
import ActivityManager from "../../services/ActivityManager/ActivityManager";
|
|
|
|
|
const validateUrl = (rule, value, callback) => {
|
|
|
|
|
const is = isURL(value)
|
|
|
|
|
if (is) {
|
|
|
|
|
callback();
|
|
|
|
|
callback()
|
|
|
|
|
} else {
|
|
|
|
|
callback(new Error('URL非法,请以http或https开头'));
|
|
|
|
|
callback(new Error('URL非法,请以http或https开头'))
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export default {
|
|
|
|
|
data () {
|
|
|
|
|
return {
|
|
|
|
|
@ -177,154 +184,186 @@ export default {
|
|
|
|
|
id: 0,
|
|
|
|
|
showMessageTypes: false,
|
|
|
|
|
welcome: {
|
|
|
|
|
description: "",
|
|
|
|
|
content: '',
|
|
|
|
|
params: [],
|
|
|
|
|
companys: [],
|
|
|
|
|
name: "欢迎语",
|
|
|
|
|
stores: []
|
|
|
|
|
company: [],
|
|
|
|
|
stores: [],
|
|
|
|
|
},
|
|
|
|
|
welcomeRules: {
|
|
|
|
|
description: [
|
|
|
|
|
{ required: true, message: "请输入欢迎语内容", trigger: "blur" },
|
|
|
|
|
{ type: 'string', max: 100, message: '欢迎语最长100个字符', trigger: 'blur' },]
|
|
|
|
|
content: [
|
|
|
|
|
{ required: true, message: '请输入欢迎语内容', trigger: 'blur' },
|
|
|
|
|
{
|
|
|
|
|
type: 'string',
|
|
|
|
|
max: 100,
|
|
|
|
|
message: '欢迎语最长100个字符',
|
|
|
|
|
trigger: 'blur',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
webFormRules: {
|
|
|
|
|
url: [
|
|
|
|
|
{ required: true, message: "请输入url", trigger: "blur" },
|
|
|
|
|
{ validator: validateUrl, trigger: 'blur' }]
|
|
|
|
|
{ required: true, message: '请输入url', trigger: 'blur' },
|
|
|
|
|
{ validator: validateUrl, trigger: 'blur' },
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
webForm: { url: "" },
|
|
|
|
|
webForm: { url: '' },
|
|
|
|
|
miniFormRules: {
|
|
|
|
|
appid: [
|
|
|
|
|
{ required: true, message: "请输入url", trigger: "blur" },],
|
|
|
|
|
uri: [
|
|
|
|
|
{ required: true, message: "请输入url", trigger: "blur" },]
|
|
|
|
|
appid: [{ required: true, message: '请输入url', trigger: 'blur' }],
|
|
|
|
|
uri: [{ required: true, message: '请输入url', trigger: 'blur' }],
|
|
|
|
|
},
|
|
|
|
|
miniForm: { appid: "", uri: "" }
|
|
|
|
|
miniForm: { appid: '', uri: '' },
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created () {
|
|
|
|
|
this.id = this.$route.query.id
|
|
|
|
|
store.commit('SET_useData', { ...store.getters.useData, ...this.welcome })
|
|
|
|
|
console.log(this.$route)
|
|
|
|
|
if (this.id) {
|
|
|
|
|
this.getDetail(this.id)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
components: {
|
|
|
|
|
selectStoreStep
|
|
|
|
|
selectStoreStep,
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
doShow () {
|
|
|
|
|
this.showStoreCheck = false
|
|
|
|
|
this.welcome = store.getters.useData
|
|
|
|
|
console.log(this.welcome)
|
|
|
|
|
},
|
|
|
|
|
showStores () {
|
|
|
|
|
store.commit("SET_useData", { ...store.getters.useData, ...this.welcome })
|
|
|
|
|
this.showStoreCheck = true;
|
|
|
|
|
getDetail (instanceId) {
|
|
|
|
|
let _this = this;
|
|
|
|
|
ActivityManager.instanceDetail(
|
|
|
|
|
{
|
|
|
|
|
instanceId
|
|
|
|
|
},
|
|
|
|
|
res => {
|
|
|
|
|
_this.welcome = res.data.results;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
uploadImgSuccess (res, file) {
|
|
|
|
|
|
|
|
|
|
showStores () {
|
|
|
|
|
console.log({ ...store.getters.useData, ...this.welcome })
|
|
|
|
|
store.commit('SET_useData', { ...store.getters.useData, ...this.welcome })
|
|
|
|
|
this.showStoreCheck = true
|
|
|
|
|
},
|
|
|
|
|
uploadImgSuccess (res, file) { },
|
|
|
|
|
cancelWeb () {
|
|
|
|
|
this.showWeb = false;
|
|
|
|
|
this.showWeb = false
|
|
|
|
|
},
|
|
|
|
|
doShowWeb () {
|
|
|
|
|
this.showWeb = true;
|
|
|
|
|
this.webForm = { url: "" };
|
|
|
|
|
this.showWeb = true
|
|
|
|
|
this.webForm = { url: '' }
|
|
|
|
|
},
|
|
|
|
|
doShowMini () {
|
|
|
|
|
this.showMini = true;
|
|
|
|
|
this.showMini = true
|
|
|
|
|
this.miniForm = {
|
|
|
|
|
appid: "", uri: ""
|
|
|
|
|
};
|
|
|
|
|
appid: '',
|
|
|
|
|
uri: '',
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
cancelMini () {
|
|
|
|
|
this.showMini = false;
|
|
|
|
|
this.showMini = false
|
|
|
|
|
},
|
|
|
|
|
okWeb () {
|
|
|
|
|
let _this = this;
|
|
|
|
|
this.$refs["webForm"].validate((valid) => {
|
|
|
|
|
let _this = this
|
|
|
|
|
this.$refs['webForm'].validate((valid) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
_this.welcome.params.push({
|
|
|
|
|
attr: "url",
|
|
|
|
|
attr: 2,
|
|
|
|
|
defaultVal: this.webForm.url,
|
|
|
|
|
description: this.webForm.url,
|
|
|
|
|
isRequired: 1,
|
|
|
|
|
key: "url",
|
|
|
|
|
key: 'url',
|
|
|
|
|
limitLower: null,
|
|
|
|
|
limitUpper: null,
|
|
|
|
|
name: "网页",
|
|
|
|
|
type: 2
|
|
|
|
|
});
|
|
|
|
|
this.showWeb = false;
|
|
|
|
|
this.showMessageTypes = false;
|
|
|
|
|
name: '网页',
|
|
|
|
|
type: 2,
|
|
|
|
|
})
|
|
|
|
|
this.showWeb = false
|
|
|
|
|
this.showMessageTypes = false
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
okMini () {
|
|
|
|
|
let _this = this;
|
|
|
|
|
this.$refs["miniForm"].validate((valid) => {
|
|
|
|
|
let _this = this
|
|
|
|
|
this.$refs['miniForm'].validate((valid) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
_this.welcome.params.push({
|
|
|
|
|
attr: "mini",
|
|
|
|
|
attr: 2,
|
|
|
|
|
defaultVal: this.miniForm.appid,
|
|
|
|
|
description: this.miniForm.uri,
|
|
|
|
|
isRequired: 1,
|
|
|
|
|
key: "mini",
|
|
|
|
|
key: 'mini',
|
|
|
|
|
limitLower: null,
|
|
|
|
|
limitUpper: null,
|
|
|
|
|
name: "小程序消息",
|
|
|
|
|
type: 3
|
|
|
|
|
});
|
|
|
|
|
this.showMini = false;
|
|
|
|
|
this.showMessageTypes = false;
|
|
|
|
|
name: '小程序消息',
|
|
|
|
|
type: 3,
|
|
|
|
|
})
|
|
|
|
|
this.showMini = false
|
|
|
|
|
this.showMessageTypes = false
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
delActivityInput (index) {
|
|
|
|
|
this.welcome.params.splice(index, 1);
|
|
|
|
|
this.$forceUpdate();
|
|
|
|
|
this.welcome.params.splice(index, 1)
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
},
|
|
|
|
|
handleBeforeUpload (res) {
|
|
|
|
|
const me = this;
|
|
|
|
|
let data = new FormData();
|
|
|
|
|
data.append("file", res);
|
|
|
|
|
const me = this
|
|
|
|
|
let data = new FormData()
|
|
|
|
|
data.append('file', res)
|
|
|
|
|
axios({
|
|
|
|
|
method: "post",
|
|
|
|
|
url: "/upload",
|
|
|
|
|
method: 'post',
|
|
|
|
|
url: '/upload',
|
|
|
|
|
data: data,
|
|
|
|
|
headers: {
|
|
|
|
|
"Content-Type": "multipart/form-data",
|
|
|
|
|
'Content-Type': 'multipart/form-data',
|
|
|
|
|
},
|
|
|
|
|
}).then(function (res) {
|
|
|
|
|
if (res.data.success) {
|
|
|
|
|
// me.formValidate.logo = res.data.results;
|
|
|
|
|
me.welcome.params.push({
|
|
|
|
|
attr: "image",
|
|
|
|
|
attr: 2,
|
|
|
|
|
defaultVal: res.data.results,
|
|
|
|
|
description: res.data.results,
|
|
|
|
|
isRequired: 1,
|
|
|
|
|
key: "image",
|
|
|
|
|
key: 'image',
|
|
|
|
|
limitLower: null,
|
|
|
|
|
limitUpper: null,
|
|
|
|
|
name: "图片",
|
|
|
|
|
type: 1
|
|
|
|
|
});
|
|
|
|
|
me.showMessageTypes = false;
|
|
|
|
|
name: '图片',
|
|
|
|
|
type: 1,
|
|
|
|
|
})
|
|
|
|
|
me.showMessageTypes = false
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return false;
|
|
|
|
|
})
|
|
|
|
|
return false
|
|
|
|
|
},
|
|
|
|
|
submit () {
|
|
|
|
|
let _this = this;
|
|
|
|
|
let _this = this
|
|
|
|
|
if (this.welcome.params.length <= 0) {
|
|
|
|
|
_this.$Message.error("请添加图片/网页/小程序消息");
|
|
|
|
|
_this.$Message.error('请添加图片/网页/小程序消息')
|
|
|
|
|
}
|
|
|
|
|
if (this.welcome.stores.length <= 0) {
|
|
|
|
|
_this.$Message.error("请至少选择一个店铺");
|
|
|
|
|
_this.$Message.error('请至少选择一个店铺')
|
|
|
|
|
}
|
|
|
|
|
this.$refs["welcomeForm"].validate((valid) => {
|
|
|
|
|
this.$refs['welcomeForm'].validate((valid) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
console.log(_this.welcome)
|
|
|
|
|
let data = _this.welcome
|
|
|
|
|
data.isGetActivityInfo = true
|
|
|
|
|
axios({
|
|
|
|
|
method: 'post',
|
|
|
|
|
url: '/activity/instance/saveWelcome',
|
|
|
|
|
data: data,
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'applications/json',
|
|
|
|
|
},
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
console.log(res)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|