Authored by huangyi

Merge branch 'feature/wheel-surf' of http://git.yoho.cn/fe/yoho-activity-platfor…

…m into feature/wheel-surf
... ... @@ -103,8 +103,12 @@ const whSurfController = {
btm_tip_one: {type: 'string', empty: true},
btm_tip_two: {type: 'string', empty: true},
my_prize_btn_bg: {type: 'string', empty: true},
jump_url_left: {type: 'string', empty: true},
jump_url_right: {type: 'string', empty: true},
jump_btn_left_url: {type: 'string', empty: true},
jump_btn_middle_url: {type: 'string', empty: true},
jump_btn_right_url: {type: 'string', empty: true},
jump_btn_left_bg: {type: 'string', empty: true},
jump_btn_middle_bg: {type: 'string', empty: true},
jump_btn_right_bg: {type: 'string', empty: true},
win_prize_bg: {type: 'string', empty: true},
try_again_bg: {type: 'string', empty: true},
status: {type: 'number', empty: true}
... ...
... ... @@ -36,6 +36,7 @@ module.exports = {
}
},
corsAllowOrigin: [
'http://localhost:8080',
'http://localhost:8081',
'http://localhost:8888',
'http://localhost:1234',
... ...
... ... @@ -73,14 +73,30 @@ module.exports = function(Sequelize, DataTypes) {
type: DataTypes.STRING(300),
allowNull: true
},
jump_url_left: {
jump_btn_left_url: {
type: DataTypes.STRING(500),
allowNull: true
},
jump_url_right: {
jump_btn_middle_url: {
type: DataTypes.STRING(500),
allowNull: true
},
jump_btn_right_url: {
type: DataTypes.STRING(500),
allowNull: true
},
jump_btn_left_bg: {
type: DataTypes.STRING(300),
allowNull: true
},
jump_btn_middle_bg: {
type: DataTypes.STRING(300),
allowNull: true
},
jump_btn_right_bg: {
type: DataTypes.STRING(300),
allowNull: true
},
win_prize_bg: {
type: DataTypes.STRING(300),
allowNull: true
... ...
... ... @@ -27,8 +27,12 @@ CREATE TABLE IF NOT EXISTS act_wheel_surf_conf (
`btm_tip_one` VARCHAR(60) DEFAULT '' COMMENT '活动提示文案1',
`btm_tip_two` VARCHAR(60) DEFAULT '' COMMENT '活动提示文案2',
`my_prize_btn_bg` VARCHAR(300) DEFAULT '' COMMENT '我的奖品',
`jump_url_left` VARCHAR(500) DEFAULT '' COMMENT '跳转链接左',
`jump_url_right` VARCHAR(500) DEFAULT '' COMMENT '跳转链接右',
`jump_btn_left_bg` VARCHAR(300) DEFAULT '' COMMENT '跳转按钮1背景图',
`jump_btn_left_url` VARCHAR(500) DEFAULT '' COMMENT '跳转按钮1链接',
`jump_btn_middle_bg` VARCHAR(300) DEFAULT '' COMMENT '跳转按钮2背景图',
`jump_btn_middle_url` VARCHAR(500) DEFAULT '' COMMENT '跳转按钮2链接',
`jump_btn_right_bg` VARCHAR(300) DEFAULT '' COMMENT '跳转按钮3背景图',
`jump_btn_right_url` VARCHAR(500) DEFAULT '' COMMENT '跳转按钮3链接',
`win_prize_bg` VARCHAR(300) DEFAULT '' COMMENT '提示中奖背景图',
`try_again_bg` VARCHAR(300) DEFAULT '' COMMENT '再来一次按钮',
`status` INT(8) DEFAULT 0 COMMENT '预览状态0, 发布状态1',
... ...
... ... @@ -3,12 +3,8 @@
<TabPane label="基础配置">
<div class="base-conf">
<div class="base-left">
<Form ref="confForm" :models="conf" :rules="confRules" :label-width="120">
<FormItem label="活动规则" prop="rule">
<Input type="textarea" v-model="conf.rule"
placeholder="请输入活动规则" :maxlength="2000"></Input>
</FormItem>
<FormItem label="分享链接" prop="rule">
<Form ref="confForm" :model="conf" :rules="confRules" :label-width="120">
<FormItem label="分享按钮链接" prop="share_url">
<Input type="text" v-model="conf.share_url"
placeholder="活动分享链接"></Input>
</FormItem>
... ... @@ -20,87 +16,145 @@
<Input type="text" v-model="conf.btm_tip_two"
placeholder="提示文案(下)"></Input>
</FormItem>
<FormItem label="跳转链接(左)" prop="jump_url_left">
<Input type="text" v-model="conf.jump_url_left"
placeholder="活动底部链接(左)"></Input>
<FormItem label="底部按钮1链接" prop="jump_btn_left_url">
<Input type="text" v-model="conf.jump_btn_left_url"
placeholder="底部按钮1链接"></Input>
</FormItem>
<FormItem label="底部按钮2链接" prop="jump_btn_middle_url">
<Input type="text" v-model="conf.jump_btn_middle_url"
placeholder="底部按钮2链接"></Input>
</FormItem>
<FormItem label="跳转链接(右)" prop="jump_url_right">
<Input type="text" v-model="conf.jump_url_right"
placeholder="活动底部链接(右)"></Input>
<FormItem label="底部按钮3链接" prop="jump_btn_right_url">
<Input type="text" v-model="conf.jump_btn_right_url"
placeholder="底部按钮3链接"></Input>
</FormItem>
<FormItem label="活动次数限制" prop="times_type">
<Select v-model="conf.times_type">
<Option :value="0">只限制每天最大参与次数</Option>
<Option :value="1">只限制每人参与活动最大次数</Option>
<Option :value="0">只限制每天最大抽奖次数</Option>
<Option :value="1">只限制每人参与活动最大抽奖次数</Option>
<Option :value="2">同时限制以上两种</Option>
</Select>
</FormItem>
<FormItem label="活动最大参与次数" prop="act_total_times">
<Input type="text" v-model="conf.act_total_times"
placeholder="活动最大参与次数"></Input>
</FormItem>
<FormItem label="每天最大抽奖次数" prop="day_limit_times">
<Input type="text" v-model="conf.day_limit_times"
placeholder="每天最大抽奖次数"></Input>
</FormItem>
<FormItem label="每人参与活动最大抽奖次数" prop="act_total_times">
<Input type="text" v-model="conf.act_total_times"
placeholder="每人参与活动最大抽奖次数"></Input>
</FormItem>
</Form>
</div>
<div class="base-middle">
<Form :label-width="120">
<FormItem label="主背景图" prop="main_bg">
<img class="preview-img" v-show="conf.main_bg" :src="conf.main_bg">
<div class="preview-wrap" v-show="conf.main_bg">
<Icon type="ios-close" class="del-img" @click="delPreview" img-key="main_bg"/>
<img class="preview-img" :src="conf.main_bg">
</div>
<Button v-show="!conf.main_bg">
<span ref="upload_img_mainBg" img-key="main_bg">添加</span>
</Button>
</FormItem>
<FormItem label="转盘背景图" prop="wheel_bg">
<img class="preview-img" v-show="conf.wheel_bg" :src="conf.wheel_bg">
<div class="preview-wrap" v-show="conf.wheel_bg">
<Icon type="ios-close" class="del-img" @click="delPreview" img-key="wheel_bg"/>
<img class="preview-img" :src="conf.wheel_bg">
</div>
<Button v-show="!conf.wheel_bg">
<span ref="upload_img_wheelBg" img-key="wheel_bg">添加</span>
</Button>
</FormItem>
<FormItem label="活动规则按钮" prop="rule_btn_bg">
<img class="preview-img" v-show="conf.rule_btn_bg" :src="conf.rule_btn_bg">
<div class="preview-wrap" v-show="conf.rule_btn_bg">
<Icon type="ios-close" class="del-img" @click="delPreview" img-key="rule_btn_bg"/>
<img class="preview-img" :src="conf.rule_btn_bg">
</div>
<Button v-show="!conf.rule_btn_bg">
<span ref="upload_img_ruleBg" img-key="rule_btn_bg">添加</span>
</Button>
</FormItem>
<FormItem label="分享按钮" prop="share_btn_bg">
<img class="preview-img" v-show="conf.share_btn_bg" :src="conf.share_btn_bg">
<div class="preview-wrap" v-show="conf.share_btn_bg">
<Icon type="ios-close" class="del-img" @click="delPreview" img-key="share_btn_bg"/>
<img class="preview-img" :src="conf.share_btn_bg">
</div>
<Button v-show="!conf.share_btn_bg">
<span ref="upload_img_shareBg" img-key="share_btn_bg">添加</span>
</Button>
</FormItem>
<FormItem label="抽奖按钮" prop="prize_btn_bg">
<img class="preview-img" v-show="conf.prize_btn_bg" :src="conf.prize_btn_bg">
<div class="preview-wrap" v-show="conf.prize_btn_bg">
<Icon type="ios-close" class="del-img" @click="delPreview" img-key="prize_btn_bg"/>
<img class="preview-img" :src="conf.prize_btn_bg">
</div>
<Button v-show="!conf.prize_btn_bg">
<span ref="upload_img_tryBg" img-key="prize_btn_bg">添加</span>
</Button>
</FormItem>
<FormItem label="底部按钮1" prop="jump_btn_left_bg">
<div class="preview-wrap" v-show="conf.jump_btn_left_bg">
<Icon type="ios-close" class="del-img" @click="delPreview" img-key="jump_btn_left_bg"/>
<img class="preview-img" :src="conf.jump_btn_left_bg">
</div>
<Button v-show="!conf.jump_btn_left_bg">
<span ref="upload_img_jumpBtnLeftBg" img-key="jump_btn_left_bg">添加</span>
</Button>
</FormItem>
<FormItem label="底部按钮2" prop="jump_btn_middle_bg">
<div class="preview-wrap" v-show="conf.jump_btn_middle_bg">
<Icon type="ios-close" class="del-img" @click="delPreview" img-key="jump_btn_middle_bg"/>
<img class="preview-img" :src="conf.jump_btn_middle_bg">
</div>
<Button v-show="!conf.jump_btn_middle_bg">
<span ref="upload_img_jumpBtnMiddleBg" img-key="jump_btn_middle_bg">添加</span>
</Button>
</FormItem>
<FormItem label="底部按钮3" prop="jump_btn_right_bg">
<div class="preview-wrap" v-show="conf.jump_btn_right_bg">
<Icon type="ios-close" class="del-img" @click="delPreview" img-key="jump_btn_right_bg"/>
<img class="preview-img" :src="conf.jump_btn_right_bg">
</div>
<Button v-show="!conf.jump_btn_right_bg">
<span ref="upload_img_jumpBtnRightBg" img-key="jump_btn_right_bg">添加</span>
</Button>
</FormItem>
</Form>
</div>
<div class="base-right">
<Form :label-width="120">
<FormItem label="次数上限背景图" prop="day_over_limit_bg">
<img class="preview-img" v-show="conf.day_over_limit_bg" :src="conf.day_over_limit_bg">
<div class="preview-wrap" v-show="conf.day_over_limit_bg">
<Icon type="ios-close" class="del-img" @click="delPreview" img-key="day_over_limit_bg"/>
<img class="preview-img" :src="conf.day_over_limit_bg">
</div>
<Button v-show="!conf.day_over_limit_bg">
<span ref="upload_img_overBg" img-key="day_over_limit_bg">添加</span>
</Button>
</FormItem>
<FormItem label="我的奖品" prop="my_prize_btn_bg">
<img class="preview-img" v-show="conf.my_prize_btn_bg" :src="conf.my_prize_btn_bg">
<div class="preview-wrap" v-show="conf.my_prize_btn_bg">
<Icon type="ios-close" class="del-img" @click="delPreview" img-key="my_prize_btn_bg"/>
<img class="preview-img" :src="conf.my_prize_btn_bg">
</div>
<Button v-show="!conf.my_prize_btn_bg">
<span ref="upload_img_myPrizeBg" img-key="my_prize_btn_bg">添加</span>
</Button>
</FormItem>
<FormItem label="提示中奖背景图" prop="win_prize_bg">
<img class="preview-img" v-show="conf.win_prize_bg" :src="conf.win_prize_bg">
<div class="preview-wrap" v-show="conf.win_prize_bg">
<Icon type="ios-close" class="del-img" @click="delPreview" img-key="win_prize_bg"/>
<img class="preview-img" :src="conf.win_prize_bg">
</div>
<Button v-show="!conf.win_prize_bg">
<span ref="upload_img_winPrizeBg" img-key="win_prize_bg">添加</span>
</Button>
</FormItem>
<FormItem label="再来一次按钮" prop="try_again_bg">
<img class="preview-img" v-show="conf.try_again_bg" :src="conf.try_again_bg">
<div class="preview-wrap" v-show="conf.try_again_bg">
<Icon type="ios-close" class="del-img" @click="delPreview" img-key="try_again_bg"/>
<img class="preview-img" :src="conf.try_again_bg">
</div>
<Button v-show="!conf.try_again_bg">
<span ref="upload_img_tryAgainBg" img-key="try_again_bg">添加</span>
</Button>
... ... @@ -135,8 +189,12 @@
act_total_times: '',
btm_tip_one: '',
btm_tip_two: '',
jump_url_left: '',
jump_url_right: '',
jump_btn_left_url: '',
jump_btn_middle_url: '',
jump_btn_right_url: '',
jump_btn_left_bg: '',
jump_btn_middle_bg: '',
jump_btn_right_bg: '',
wheel_bg: '',
main_bg: '',
prize_btn_bg: '',
... ... @@ -151,20 +209,23 @@
rule: [
{ required: true, message: '活动规则不能为空', trigger: 'blur' }
],
name: [
{ required: true, message: '奖品名称不能为空', trigger: 'blur' }
],
type: [
{ required: true}
share_url: [
{ required: true, message: '分享链接不能为空', trigger: 'blur' }
],
value: [
day_limit_times: [
{ required: true, message: '奖品值不能为空', trigger: 'blur' }
],
total: [
act_total_times: [
{ required: true, message: '奖品总数不能为空', trigger: 'blur' }
],
chance: [
{ required: true, message: '中奖概率不能为空', trigger: 'blur' }
btm_tip_one: [
{ required: true, message: '提示文案(上)不能为空', trigger: 'blur' }
],
btm_tip_two: [
{ required: true, message: '提示文案(下)不能为空', trigger: 'blur' }
],
times_type: [
{ required: true}
]
}
}
... ... @@ -197,6 +258,9 @@
}
});
},
delPreview(e) {
this.conf[e.currentTarget.getAttribute('img-key')] = '';
},
bindUpload() {
Object.keys(this.$refs)
.filter(key => /^upload_img_/ig.test(key))
... ... @@ -224,6 +288,7 @@
<style lang="scss">
.ivu-tabs {
height: 100%;
overflow-y: auto;
}
.bottom-btn {
... ... @@ -261,6 +326,25 @@
}
}
.preview-wrap {
position: relative;
.del-img {
position: absolute;
top: -10px;
left: -4px;
font-size: 24px;
font-weight: bold;
cursor: pointer;
border-radius: 50%;
background-color: #000;
opacity: 0.3;
width: 24px;
height: 24px;
color: #ffffff;
}
}
.preview-img {
height: 60px;
width: auto;
... ...