Authored by 李奇

活动配置修改

... ... @@ -103,7 +103,8 @@ const whSurfController = {
btm_tip_one: {type: 'string', empty: true},
btm_tip_two: {type: 'string', empty: true},
my_prize_btn: {type: 'string', empty: true},
jump_url: {type: 'string', empty: true},
jump_url_left: {type: 'string', empty: true},
jump_url_right: {type: 'string', empty: true},
win_prize_bg: {type: 'string', empty: true},
try_again_bg: {type: 'string', empty: true},
status: {type: 'number', empty: true}
... ...
... ... @@ -65,7 +65,11 @@ module.exports = function(Sequelize, DataTypes) {
type: DataTypes.STRING(300),
allowNull: true
},
jump_url: {
jump_url_left: {
type: DataTypes.STRING(500),
allowNull: true
},
jump_url_right: {
type: DataTypes.STRING(500),
allowNull: true
},
... ...
... ... @@ -26,7 +26,8 @@ CREATE TABLE IF NOT EXISTS act_wheel_surf_conf (
`btm_tip_one` VARCHAR(60) DEFAULT 0 COMMENT '活动提示文案1',
`btm_tip_two` VARCHAR(60) DEFAULT 0 COMMENT '活动提示文案2',
`my_prize_btn` VARCHAR(300) DEFAULT 0 COMMENT '我的奖品',
`jump_url` VARCHAR(500) DEFAULT 0 COMMENT '跳转链接',
`jump_url_left` VARCHAR(500) DEFAULT 0 COMMENT '跳转链接左',
`jump_url_right` VARCHAR(500) DEFAULT 0 COMMENT '跳转链接右',
`win_prize_bg` VARCHAR(300) DEFAULT 0 COMMENT '提示中奖背景图',
`try_again_bg` VARCHAR(300) DEFAULT 0 COMMENT '再来一次按钮',
`status` INT(8) DEFAULT 0 COMMENT '预览状态0, 发布状态1',
... ...
... ... @@ -31,7 +31,8 @@
.vue-app-inner-view {
padding: 0 10px 10px 10px;
max-height: 100%;
height: 100%;
overflow: auto;
box-sizing: border-box;
}
</style>
... ...
<template>
<div class="prize-add">
<div class="demo-split">
<div class="add-area-split">
<Split v-model="split">
<div slot="left" class="split-pane">
<Form ref="formValidate" :label-width="120">
... ... @@ -52,7 +52,7 @@
};
export default {
name: 'PrizeItem',
name: 'AddPrize',
data () {
return {
actId: 0,
... ... @@ -69,7 +69,6 @@
{
title: '奖品类型',
render: (h, {row}) => {
return h('span', {}, pirzeType[row.type]);
}
},
... ... @@ -118,7 +117,7 @@
}
],
prize: {
act_id: 20,
act_id: '',
name: '',
type: 1,
value: '',
... ... @@ -183,12 +182,13 @@
},
mounted() {
this.actId = this.$route.query.actId;
this.prize.act_id = this.actId;
this.bindUpload();
this.prizeList();
}
}
</script>
<style lang="scss">
<style lang="scss" scoped>
.split-pane {
padding: 10px;
... ...
<template>
<Tabs size="small">
<TabPane label="基础配置">
<Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="120">
<FormItem label="活动规则" required>
<Input type="textarea" :autosize="{minRows: 2,maxRows: 30}"
placeholder="请输入活动规则" :maxlength="2000"></Input>
</FormItem>
<FormItem label="分享链接" required>
<Input type="text"
placeholder="活动分享链接"></Input>
</FormItem>
<FormItem label="提示文案(上)" required>
<Input type="text"
placeholder="提示文案(上)"></Input>
</FormItem>
<FormItem label="提示文案(下)" required>
<Input type="text"
placeholder="提示文案(下)"></Input>
</FormItem>
<FormItem label="跳转链接(左)" required>
<Input type="text"
placeholder="活动底部链接(左)"></Input>
</FormItem>
<FormItem label="跳转链接(右)" required>
<Input type="text"
placeholder="活动底部链接(右)"></Input>
</FormItem>
<FormItem label="活动最大参与次数" required>
<Input type="text"
placeholder="活动最大参与次数"></Input>
</FormItem>
<FormItem label="每天最大抽奖次数" required>
<Input type="text"
placeholder="每天最大抽奖次数"></Input>
</FormItem>
<FormItem>
<Button type="primary" @click="handleSubmit('formValidate')">保存</Button>
<Button type="warning" @click="handleSubmit('formValidate')">预览</Button>
</FormItem>
</Form>
<div class="base-conf">
<div class="base-left">
<Form :label-width="120">
<FormItem label="活动规则" required>
<Input type="textarea" v-model="conf.rule"
placeholder="请输入活动规则" :maxlength="2000"></Input>
</FormItem>
<FormItem label="分享链接" required>
<Input type="text" v-model="conf.share_url"
placeholder="活动分享链接"></Input>
</FormItem>
<FormItem label="提示文案(上)" required>
<Input type="text" v-model="conf.btm_tip_one"
placeholder="提示文案(上)"></Input>
</FormItem>
<FormItem label="提示文案(下)" required>
<Input type="text" v-model="conf.btm_tip_two"
placeholder="提示文案(下)"></Input>
</FormItem>
<FormItem label="跳转链接(左)" required>
<Input type="text" v-model="conf.jump_url_left"
placeholder="活动底部链接(左)"></Input>
</FormItem>
<FormItem label="跳转链接(右)" required>
<Input type="text" v-model="conf.jump_url_right"
placeholder="活动底部链接(右)"></Input>
</FormItem>
<FormItem label="活动最大参与次数" required>
<Input type="text" v-model="conf.act_total_times"
placeholder="活动最大参与次数"></Input>
</FormItem>
<FormItem label="每天最大抽奖次数" required>
<Input type="text" v-model="conf.day_limit_times"
placeholder="每天最大抽奖次数"></Input>
</FormItem>
</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>
... ...