|
|
|
@ -1,109 +1,89 @@
|
|
|
|
|
<template>
|
|
|
|
|
<Modal v-model="dispalyModal"
|
|
|
|
|
width="1000"
|
|
|
|
|
:loading="true"
|
|
|
|
|
:mask-closable="false">
|
|
|
|
|
<p slot="header"
|
|
|
|
|
style="color:#f60;text-align:left">
|
|
|
|
|
<Modal v-model="dispalyModal" width="1000" :loading="true" :mask-closable="false">
|
|
|
|
|
<p slot="header" style="color:#f60;text-align:left">
|
|
|
|
|
<span>配置活动</span>
|
|
|
|
|
</p>
|
|
|
|
|
<div>基本配置</div>
|
|
|
|
|
<Form ref="formValidate"
|
|
|
|
|
:model="formValidate"
|
|
|
|
|
:rules="ruleValidate"
|
|
|
|
|
:label-width="80">
|
|
|
|
|
<Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="80">
|
|
|
|
|
<Row>
|
|
|
|
|
<i-col style="text-align: left;"
|
|
|
|
|
span="8">
|
|
|
|
|
<FormItem label=""
|
|
|
|
|
prop="logo">
|
|
|
|
|
<Upload ref="upload"
|
|
|
|
|
:show-upload-list="false"
|
|
|
|
|
:on-success="uploadImgSuccess"
|
|
|
|
|
:format="['jpg', 'jpeg', 'png']"
|
|
|
|
|
:max-size="2048"
|
|
|
|
|
:before-upload="handleBeforeUpload"
|
|
|
|
|
multiple
|
|
|
|
|
type="drag"
|
|
|
|
|
action=""
|
|
|
|
|
style="display: inline-block;">
|
|
|
|
|
<i-col style="text-align: left;" span="8">
|
|
|
|
|
<FormItem label prop="logo">
|
|
|
|
|
<Upload
|
|
|
|
|
ref="upload"
|
|
|
|
|
:show-upload-list="false"
|
|
|
|
|
:on-success="uploadImgSuccess"
|
|
|
|
|
:format="['jpg', 'jpeg', 'png']"
|
|
|
|
|
:max-size="2048"
|
|
|
|
|
:before-upload="handleBeforeUpload"
|
|
|
|
|
multiple
|
|
|
|
|
type="drag"
|
|
|
|
|
action
|
|
|
|
|
style="display: inline-block;"
|
|
|
|
|
>
|
|
|
|
|
<div style="width: 200px;height:200px;line-height: 200px;">
|
|
|
|
|
<span v-if="!formValidate.logo">请上传图片</span>
|
|
|
|
|
<img v-if="formValidate.logo"
|
|
|
|
|
:src="`/kiisoo-ic` + formValidate.logo"
|
|
|
|
|
alt=""
|
|
|
|
|
style="width: 100%; height: auto" />
|
|
|
|
|
<img
|
|
|
|
|
v-if="formValidate.logo"
|
|
|
|
|
:src="`/kiisoo-ic` + formValidate.logo"
|
|
|
|
|
alt
|
|
|
|
|
style="width: 100%; height: auto"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</Upload>
|
|
|
|
|
</FormItem>
|
|
|
|
|
</i-col>
|
|
|
|
|
<i-col span="15"
|
|
|
|
|
offset="1">
|
|
|
|
|
<FormItem label="活动名称"
|
|
|
|
|
prop="name">
|
|
|
|
|
<i-input type="text"
|
|
|
|
|
v-model="formValidate.name"
|
|
|
|
|
placeholder="请输入活动名称"></i-input>
|
|
|
|
|
<i-col span="15" offset="1">
|
|
|
|
|
<FormItem label="活动名称" prop="name">
|
|
|
|
|
<i-input type="text" v-model="formValidate.name" placeholder="请输入活动名称"></i-input>
|
|
|
|
|
</FormItem>
|
|
|
|
|
<Form-item label="活动描述"
|
|
|
|
|
prop="description">
|
|
|
|
|
<i-input v-model="formValidate.description"
|
|
|
|
|
type="textarea"
|
|
|
|
|
:autosize="{ minRows: 3 }"
|
|
|
|
|
placeholder="请输入活动描述"></i-input>
|
|
|
|
|
<Form-item label="活动描述" prop="description">
|
|
|
|
|
<i-input
|
|
|
|
|
v-model="formValidate.description"
|
|
|
|
|
type="textarea"
|
|
|
|
|
:autosize="{ minRows: 3 }"
|
|
|
|
|
placeholder="请输入活动描述"
|
|
|
|
|
></i-input>
|
|
|
|
|
</Form-item>
|
|
|
|
|
<FormItem label="APPID"
|
|
|
|
|
prop="appId">
|
|
|
|
|
<i-input type="text"
|
|
|
|
|
v-model="formValidate.appId"
|
|
|
|
|
placeholder="请输入appid"></i-input>
|
|
|
|
|
<Form-item label="欢迎语" prop="description">
|
|
|
|
|
<i-input
|
|
|
|
|
v-model="formValidate.welcome"
|
|
|
|
|
type="textarea"
|
|
|
|
|
:autosize="{ minRows: 3 }"
|
|
|
|
|
placeholder="请输入欢迎语"
|
|
|
|
|
></i-input>
|
|
|
|
|
</Form-item>
|
|
|
|
|
<FormItem label="APPID" prop="appId">
|
|
|
|
|
<i-input type="text" v-model="formValidate.appId" placeholder="请输入appid"></i-input>
|
|
|
|
|
</FormItem>
|
|
|
|
|
<FormItem label="URI"
|
|
|
|
|
prop="uri">
|
|
|
|
|
<i-input type="text"
|
|
|
|
|
v-model="formValidate.uri"
|
|
|
|
|
placeholder="请输入URI"></i-input>
|
|
|
|
|
<FormItem label="URI" prop="uri">
|
|
|
|
|
<i-input type="text" v-model="formValidate.uri" placeholder="请输入URI"></i-input>
|
|
|
|
|
</FormItem>
|
|
|
|
|
</i-col>
|
|
|
|
|
</Row>
|
|
|
|
|
</Form>
|
|
|
|
|
<div class="topic">活动类型</div>
|
|
|
|
|
<Row :gutter="10"
|
|
|
|
|
class="inputItem"
|
|
|
|
|
v-for="(item, index) in formValidate.params"
|
|
|
|
|
:key="index">
|
|
|
|
|
<i-col :span="2"> 类型{{ index + 1 }} </i-col>
|
|
|
|
|
<Row :gutter="10" class="inputItem" v-for="(item, index) in formValidate.params" :key="index">
|
|
|
|
|
<i-col :span="2">类型{{ index + 1 }}</i-col>
|
|
|
|
|
<i-col :span="9">
|
|
|
|
|
<i-input class="inputClass"
|
|
|
|
|
type="text"
|
|
|
|
|
v-model="item.name"
|
|
|
|
|
placeholder="请输入活动类型名称"></i-input>
|
|
|
|
|
<i-input class="inputClass" type="text" v-model="item.name" placeholder="请输入活动类型名称"></i-input>
|
|
|
|
|
</i-col>
|
|
|
|
|
<i-col :span="9">
|
|
|
|
|
<i-input class="inputClass"
|
|
|
|
|
type="text"
|
|
|
|
|
style="margin-left: 20px"
|
|
|
|
|
v-model="item.defaultVal"
|
|
|
|
|
placeholder="请输入参数"></i-input>
|
|
|
|
|
<i-input
|
|
|
|
|
class="inputClass"
|
|
|
|
|
type="text"
|
|
|
|
|
style="margin-left: 20px"
|
|
|
|
|
v-model="item.defaultVal"
|
|
|
|
|
placeholder="请输入参数"
|
|
|
|
|
></i-input>
|
|
|
|
|
</i-col>
|
|
|
|
|
<i-col :span="4">
|
|
|
|
|
<Button style="margin-left: 20px"
|
|
|
|
|
type="error"
|
|
|
|
|
@click="delActivityInput(index)">删除</Button>
|
|
|
|
|
<Button style="margin-left: 20px" type="error" @click="delActivityInput(index)">删除</Button>
|
|
|
|
|
</i-col>
|
|
|
|
|
</Row>
|
|
|
|
|
<Button style="margin-top: 10px"
|
|
|
|
|
type="primary"
|
|
|
|
|
@click="addActivityInput">+添加活动类型</Button>
|
|
|
|
|
<Button style="margin-top: 10px" type="primary" @click="addActivityInput">+添加活动类型</Button>
|
|
|
|
|
<div slot="footer">
|
|
|
|
|
<Button type="primary"
|
|
|
|
|
shape="circle"
|
|
|
|
|
:loading="modal_loading"
|
|
|
|
|
@click="cancel">取消</Button>
|
|
|
|
|
<Button type="primary"
|
|
|
|
|
shape="circle"
|
|
|
|
|
:loading="modal_loading"
|
|
|
|
|
@click="save">确定</Button>
|
|
|
|
|
<Button type="primary" shape="circle" :loading="modal_loading" @click="cancel">取消</Button>
|
|
|
|
|
<Button type="primary" shape="circle" :loading="modal_loading" @click="save">确定</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</Modal>
|
|
|
|
|
</template>
|
|
|
|
@ -112,7 +92,7 @@ import ActivityManager from "../../services/ActivityManager/ActivityManager";
|
|
|
|
|
import axios from "axios";
|
|
|
|
|
export default {
|
|
|
|
|
name: "addActivity",
|
|
|
|
|
data () {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
dispalyModal: false,
|
|
|
|
|
currentStep: 0,
|
|
|
|
@ -122,25 +102,26 @@ export default {
|
|
|
|
|
loading: true,
|
|
|
|
|
ruleValidate: {
|
|
|
|
|
name: [
|
|
|
|
|
{ required: true, message: "活动名称不能为空", trigger: "blur" },
|
|
|
|
|
{ required: true, message: "活动名称不能为空", trigger: "blur" }
|
|
|
|
|
],
|
|
|
|
|
description: [
|
|
|
|
|
{ required: true, message: "活动描述不能为空", trigger: "blur" },
|
|
|
|
|
{ required: true, message: "活动描述不能为空", trigger: "blur" }
|
|
|
|
|
],
|
|
|
|
|
appId: [{ required: true, message: "appId不能为空", trigger: "blur" }],
|
|
|
|
|
uri: [{ required: true, message: "URI不能为空", trigger: "blur" }],
|
|
|
|
|
welcome: [{ required: true, message: "请输入欢迎语", trigger: "blur" }]
|
|
|
|
|
// uploadImg: [
|
|
|
|
|
// { required: true, message: '请上传活动图片', trigger: 'blur' }
|
|
|
|
|
// ]
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
props: {
|
|
|
|
|
addActivityModal: Boolean,
|
|
|
|
|
id: String,
|
|
|
|
|
id: String
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
addActivityModal (val) {
|
|
|
|
|
addActivityModal(val) {
|
|
|
|
|
this.dispalyModal = val;
|
|
|
|
|
if (val === true && this.id) {
|
|
|
|
|
this.getActivityData();
|
|
|
|
@ -162,16 +143,16 @@ export default {
|
|
|
|
|
limitLower: "",
|
|
|
|
|
limitUpper: "",
|
|
|
|
|
name: "",
|
|
|
|
|
type: 0,
|
|
|
|
|
},
|
|
|
|
|
type: 0
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
this.$forceUpdate();
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted () { },
|
|
|
|
|
mounted() {},
|
|
|
|
|
methods: {
|
|
|
|
|
addActivityInput () {
|
|
|
|
|
addActivityInput() {
|
|
|
|
|
let params = [...this.formValidate.params];
|
|
|
|
|
params.push({
|
|
|
|
|
defaultVal: "",
|
|
|
|
@ -182,12 +163,12 @@ export default {
|
|
|
|
|
limitLower: "",
|
|
|
|
|
limitUpper: "",
|
|
|
|
|
name: "",
|
|
|
|
|
type: 0,
|
|
|
|
|
type: 0
|
|
|
|
|
});
|
|
|
|
|
this.$set(this.formValidate, "params", params);
|
|
|
|
|
this.$forceUpdate();
|
|
|
|
|
},
|
|
|
|
|
delActivityInput (index) {
|
|
|
|
|
delActivityInput(index) {
|
|
|
|
|
if (this.formValidate.params.length <= 1) {
|
|
|
|
|
this.$Message.error("至少需要填写一个活动类型!");
|
|
|
|
|
return;
|
|
|
|
@ -195,22 +176,22 @@ export default {
|
|
|
|
|
this.formValidate.params.splice(index, 1);
|
|
|
|
|
this.$forceUpdate();
|
|
|
|
|
},
|
|
|
|
|
cancel () {
|
|
|
|
|
cancel() {
|
|
|
|
|
this.$emit("dispalyAddActivityModal", false, false);
|
|
|
|
|
},
|
|
|
|
|
getActivityData () {
|
|
|
|
|
getActivityData() {
|
|
|
|
|
let that = this;
|
|
|
|
|
let data = {
|
|
|
|
|
id: that.id,
|
|
|
|
|
id: that.id
|
|
|
|
|
};
|
|
|
|
|
ActivityManager.getActivityInfo(data, function (data) {
|
|
|
|
|
ActivityManager.getActivityInfo(data, function(data) {
|
|
|
|
|
that.formValidate = data.data.results;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
uploadImgSuccess (res, file) {
|
|
|
|
|
uploadImgSuccess(res, file) {
|
|
|
|
|
this.imageName = file.name;
|
|
|
|
|
},
|
|
|
|
|
handleBeforeUpload (res) {
|
|
|
|
|
handleBeforeUpload(res) {
|
|
|
|
|
const me = this;
|
|
|
|
|
let data = new FormData();
|
|
|
|
|
data.append("file", res);
|
|
|
|
@ -219,18 +200,18 @@ export default {
|
|
|
|
|
url: "/upload",
|
|
|
|
|
data: data,
|
|
|
|
|
headers: {
|
|
|
|
|
"Content-Type": "multipart/form-data",
|
|
|
|
|
},
|
|
|
|
|
}).then(function (res) {
|
|
|
|
|
"Content-Type": "multipart/form-data"
|
|
|
|
|
}
|
|
|
|
|
}).then(function(res) {
|
|
|
|
|
if (res.data.success) {
|
|
|
|
|
// me.formValidate.logo = res.data.results;
|
|
|
|
|
me.$set(me.formValidate, "logo", res.data.results);
|
|
|
|
|
me.$set(me.formValidate, "logo", res.data.results.localPath);
|
|
|
|
|
console.log(me.formValidate.logo);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return false;
|
|
|
|
|
},
|
|
|
|
|
save () {
|
|
|
|
|
save() {
|
|
|
|
|
let that = this;
|
|
|
|
|
that.modal_loading = true;
|
|
|
|
|
let i = 0;
|
|
|
|
@ -264,13 +245,13 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.$refs["formValidate"].validate((valid) => {
|
|
|
|
|
this.$refs["formValidate"].validate(valid => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
// param = JSON.stringify(param)
|
|
|
|
|
let data = { ...that.formValidate, isGetActivityInfo: true };
|
|
|
|
|
data.categoryId = 0;
|
|
|
|
|
data.categoryCode = "promotion";
|
|
|
|
|
ActivityManager.addOreditActivity(data, function (data) {
|
|
|
|
|
ActivityManager.addOreditActivity(data, function(data) {
|
|
|
|
|
that.addActivityModal = false;
|
|
|
|
|
that.formValidate = {};
|
|
|
|
|
that.modal_loading = false;
|
|
|
|
@ -281,8 +262,8 @@ export default {
|
|
|
|
|
that.$Message.error("表单验证失败!");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|