Authored by 李奇

后台优化

... ... @@ -140,11 +140,24 @@ const whSurfController = {
msg: '参数为空'
});
}
let actInfo = await req.ctx(wheelSurfModel).actInfo(actId);
let result = await req.ctx(wheelSurfModel).configFindOne(actId);
let actStatus = 2; // 1: 活动未开始 2: 活动进行中 3:活动已过期
let now = parseInt(new Date().getTime() / 1000);
if (now < actInfo.startTime) {
actStatus = 1;
} else if (now > actInfo.endTime) {
actStatus = 3;
}
return res.json({
code: 200,
data: result
data: {
conf: result,
status: actStatus
}
});
},
... ...
... ... @@ -42,6 +42,10 @@ class ActWheelSurfModel extends global.yoho.BaseModel {
return ActWheelSurfConf.findOne({where: {act_id}});
}
actInfo(act_id) {
return Activity.findOne({where: {id: act_id}});
}
prizeCreate(arr) {
return ActWheelSurfPrize.bulkCreate(arr);
}
... ...
... ... @@ -182,7 +182,7 @@ var CURRENT_URL = window.location.href.split('#')[0].split('?')[0],
multi_selection: false,
filters: {
mime_types: [{
extensions: 'jpg,jpeg,png,mp4'
extensions: 'gif,jpg,jpeg,png,mp4'
}]
},
dragdrop: false,
... ...
... ... @@ -5,13 +5,15 @@
<div slot="left" class="split-pane">
<Form ref="prizeForm" :model="prize" :rules="prizeRules" :label-width="120">
<FormItem label="奖品位置" prop="prize_idx">
<Input v-model="prize.prize_idx" placeholder="奖品位置序号(竖直方向顺时针从1开始)" :maxlength="1"></Input>
<Input v-model="prize.prize_idx" :disabled="status == 2 || status == 3"
placeholder="奖品位置序号(竖直方向顺时针从1开始)" :maxlength="1"></Input>
</FormItem>
<FormItem label="奖品名称" prop="name">
<Input v-model="prize.name" placeholder="奖品名称" :maxlength="50"></Input>
<Input v-model="prize.name" placeholder="奖品名称" :maxlength="50"
:disabled="status == 2 || status == 3"></Input>
</FormItem>
<FormItem label="奖品类型" prop="type">
<Select v-model="prize.type" @on-change="typeChange">
<Select v-model="prize.type" @on-change="typeChange" :disabled="status == 2 || status == 3">
<Option :value="1">谢谢惠顾</Option>
<Option :value="2">红包</Option>
<Option :value="3">优惠券</Option>
... ... @@ -19,7 +21,9 @@
</Select>
</FormItem>
<FormItem label="奖品token" prop="value">
<Input v-model="prize.value" placeholder="红包优惠券token(实物奖品和谢谢惠顾不填)" :maxlenght="200"></Input>
<Input v-model="prize.value"
:disabled="status == 2 || status == 3"
placeholder="红包优惠券token(实物奖品和谢谢惠顾不填)" :maxlenght="200"></Input>
</FormItem>
<FormItem label="奖品总数" prop="total">
<Input v-model="prize.total" placeholder="奖品总数(不限量奖品可填9999999999)" number
... ... @@ -68,6 +72,9 @@
export default {
name: 'AddPrize',
props: {
status: Number
},
data: function () {
return {
actId: 0,
... ... @@ -129,8 +136,7 @@
h('Button', {
props: {
type: 'error',
size: 'small',
disabled: !!row.id
size: 'small'
},
style: {
margin: '2px'
... ...
... ... @@ -152,7 +152,7 @@
</div>
</TabPane>
<TabPane label="奖品配置">
<add-prize></add-prize>
<add-prize :status="actStatus"></add-prize>
</TabPane>
</Tabs>
</template>
... ... @@ -164,6 +164,7 @@
return {
actId: 0,
confId: 0,
actStatus: 2,
conf: {
act_id: 0,
id: 0,
... ... @@ -232,8 +233,9 @@
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;
this.actStatus = res.data.status;
if (res.code === 200 && res.data && res.data.conf && res.data.conf.id) {
this.conf = res.data.conf;
} else {
this.$Message.error(res.msg);
}
... ...