|
|
<template>
|
|
|
<Tabs size="small">
|
|
|
<TabPane label="基础配置">
|
|
|
<Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="120">
|
|
|
<div class="base-conf">
|
|
|
<div class="base-left">
|
|
|
<Form :label-width="120">
|
|
|
<FormItem label="活动规则" required>
|
|
|
<Input type="textarea" :autosize="{minRows: 2,maxRows: 30}"
|
|
|
<Input type="textarea" v-model="conf.rule"
|
|
|
placeholder="请输入活动规则" :maxlength="2000"></Input>
|
|
|
</FormItem>
|
|
|
<FormItem label="分享链接" required>
|
|
|
<Input type="text"
|
|
|
<Input type="text" v-model="conf.share_url"
|
|
|
placeholder="活动分享链接"></Input>
|
|
|
</FormItem>
|
|
|
<FormItem label="提示文案(上)" required>
|
|
|
<Input type="text"
|
|
|
<Input type="text" v-model="conf.btm_tip_one"
|
|
|
placeholder="提示文案(上)"></Input>
|
|
|
</FormItem>
|
|
|
<FormItem label="提示文案(下)" required>
|
|
|
<Input type="text"
|
|
|
<Input type="text" v-model="conf.btm_tip_two"
|
|
|
placeholder="提示文案(下)"></Input>
|
|
|
</FormItem>
|
|
|
<FormItem label="跳转链接(左)" required>
|
|
|
<Input type="text"
|
|
|
<Input type="text" v-model="conf.jump_url_left"
|
|
|
placeholder="活动底部链接(左)"></Input>
|
|
|
</FormItem>
|
|
|
<FormItem label="跳转链接(右)" required>
|
|
|
<Input type="text"
|
|
|
<Input type="text" v-model="conf.jump_url_right"
|
|
|
placeholder="活动底部链接(右)"></Input>
|
|
|
</FormItem>
|
|
|
<FormItem label="活动最大参与次数" required>
|
|
|
<Input type="text"
|
|
|
<Input type="text" v-model="conf.act_total_times"
|
|
|
placeholder="活动最大参与次数"></Input>
|
|
|
</FormItem>
|
|
|
<FormItem label="每天最大抽奖次数" required>
|
|
|
<Input type="text"
|
|
|
<Input type="text" v-model="conf.day_limit_times"
|
|
|
placeholder="每天最大抽奖次数"></Input>
|
|
|
</FormItem>
|
|
|
<FormItem>
|
|
|
<Button type="primary" @click="handleSubmit('formValidate')">保存</Button>
|
|
|
<Button type="warning" @click="handleSubmit('formValidate')">预览</Button>
|
|
|
</Form>
|
|
|
</div>
|
|
|
<div class="base-right">
|
|
|
<Form :label-width="120">
|
|
|
<FormItem label="主背景图" prop="prize_bg" required>
|
|
|
<img class="win-prize-bg" v-show="conf.main_bg" :src="conf.main_bg">
|
|
|
<Button v-show="!conf.main_bg">
|
|
|
<span ref="winPrizeBg">添加</span>
|
|
|
</Button>
|
|
|
</FormItem>
|
|
|
<FormItem label="转盘背景图" prop="prize_bg" required>
|
|
|
<img class="win-prize-bg" v-show="conf.wheel_bg" :src="conf.wheel_bg">
|
|
|
<Button v-show="!conf.wheel_bg">
|
|
|
<span ref="winPrizeBg">添加</span>
|
|
|
</Button>
|
|
|
</FormItem>
|
|
|
</Form>
|
|
|
</div>
|
|
|
<div class="bottom-btn">
|
|
|
<Button type="primary" @click="save" class="save">保存</Button>
|
|
|
<Button type="warning" @click="save" class="preview">预览</Button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</TabPane>
|
|
|
<TabPane label="奖品配置">
|
|
|
<add-prize v-for="item in prizes" :key="item"></add-prize>
|
|
|
<add-prize></add-prize>
|
|
|
</TabPane>
|
|
|
</Tabs>
|
|
|
</template>
|
...
|
...
|
@@ -51,44 +71,112 @@ |
|
|
export default {
|
|
|
data () {
|
|
|
return {
|
|
|
formValidate: {
|
|
|
name: '',
|
|
|
mail: '',
|
|
|
city: '',
|
|
|
gender: '',
|
|
|
interest: [],
|
|
|
date: '',
|
|
|
time: '',
|
|
|
desc: ''
|
|
|
},
|
|
|
ruleValidate: {
|
|
|
|
|
|
},
|
|
|
prizes: [1]
|
|
|
actId: 0,
|
|
|
confId: 0,
|
|
|
prizes: [1],
|
|
|
conf: {
|
|
|
act_id: 0,
|
|
|
id: 0,
|
|
|
rule: '',
|
|
|
share_url: '',
|
|
|
day_limit_times: '',
|
|
|
act_total_times: '',
|
|
|
btm_tip_one: '',
|
|
|
btm_tip_two: '',
|
|
|
jump_url_left: '',
|
|
|
jump_url_right: '',
|
|
|
wheel_bg: '',
|
|
|
main_bg: '',
|
|
|
prize_btn_bg: '',
|
|
|
rule_btn_bg: '',
|
|
|
share_btn_bg: '',
|
|
|
day_over_limit_bg: '',
|
|
|
my_prize_btn: ''
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
handleSubmit (name) {
|
|
|
this.$refs[name].validate((valid) => {
|
|
|
if (valid) {
|
|
|
this.$Message.success('Success!');
|
|
|
bindUpload() {
|
|
|
window.qn_dynamic_el_upload(this.$refs.winPrizeBg, url => {
|
|
|
this.prize.prize_bg = url;
|
|
|
});
|
|
|
},
|
|
|
save() {
|
|
|
$.ajax({
|
|
|
method: 'post',
|
|
|
url: '/admin/wheelSurf/api/config/modify',
|
|
|
contentType: 'application/json',
|
|
|
data: JSON.stringify(Object.assign(this.conf, {act_id: this.actId}))
|
|
|
}).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
this.$Message.success('奖品新增成功');
|
|
|
this.prizeList();
|
|
|
} else {
|
|
|
this.$Message.error('Fail!');
|
|
|
this.$Message.error(res.msg);
|
|
|
}
|
|
|
})
|
|
|
});
|
|
|
},
|
|
|
handleReset (name) {
|
|
|
this.$refs[name].resetFields();
|
|
|
getConf() {
|
|
|
$.ajax({
|
|
|
url: '/admin/wheelSurf/api/config/detail',
|
|
|
data: {act_id: this.actId}
|
|
|
}).then(res => {
|
|
|
if (res.code === 200 && res.data && res.data.id) {
|
|
|
this.conf = res.data;
|
|
|
} else {
|
|
|
this.$Message.error(res.msg);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
this.actId = this.$route.query.actId;
|
|
|
this.bindUpload();
|
|
|
this.getConf();
|
|
|
},
|
|
|
components: {
|
|
|
AddPrize
|
|
|
},
|
|
|
mounted() {
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="scss">
|
|
|
.ivu-tabs {
|
|
|
height: 100%;
|
|
|
}
|
|
|
|
|
|
.bottom-btn {
|
|
|
position: absolute;
|
|
|
bottom: 0;
|
|
|
left: 0;
|
|
|
right: 0;
|
|
|
text-align: center;
|
|
|
}
|
|
|
|
|
|
.base-conf {
|
|
|
font-size: 0;
|
|
|
padding-bottom: 40px;
|
|
|
|
|
|
.base-left, .base-right {
|
|
|
display: inline-block;
|
|
|
width: 50%;
|
|
|
box-sizing: border-box;
|
|
|
}
|
|
|
|
|
|
.base-left {
|
|
|
padding-right: 20px;
|
|
|
}
|
|
|
|
|
|
.base-right {
|
|
|
font-size: 16px;
|
|
|
vertical-align: top;
|
|
|
}
|
|
|
|
|
|
.save {
|
|
|
margin-right: 20px;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|
|
|
...
|
...
|
|