| | |
| | | |
| | | } |
| | | |
| | | .tag-contaner { |
| | | display: flex; |
| | | word-break: break-word; |
| | | } |
| | | |
| | | .tag-contaner .tag { |
| | | padding: 3px 5px; |
| | | border-radius: 5px; |
| | | font-size: 14px; |
| | | margin-right: 10px; |
| | | position: relative; |
| | | } |
| | | |
| | | .tag-contaner .tag .del { |
| | | position: absolute; |
| | | top: -8px; |
| | | right: -8px; |
| | | width: 16px; |
| | | height: 16px; |
| | | |
| | | } |
| | | |
| | | |
| | | </style> |
| | | </head> |
| | |
| | | <img class="layui-upload-img poster" id="poster"> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | |
| | | </div> |
| | | </div> |
| | | <button class="layui-btn layui-btn-radius layui-btn-normal hidden" |
| | | |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_appName" class="layui-form-label"> |
| | | 活动标签</label> |
| | | <div class="layui-input-inline"> |
| | | <div class="tag-contaner" id="tags"> |
| | | |
| | | <div v-for="(item,index) in activity.tags" class="tag" |
| | | v-bind:style="{'color':item.tagFontColor,'background':item.tagBgColor}"> |
| | | {{item.tagName}} |
| | | <img class="del" src="img/ic_close_img.png" v-on:click="delTag(index)"> |
| | | |
| | | </div> |
| | | |
| | | <div class="layui-btn layui-btn-xs" v-on:click="addTag">添加标签</div> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <button class="layui-btn layui-btn-radius layui-btn-normal" |
| | | id="saveActivityInfo" lay-submit="">保存 |
| | | </button> |
| | | |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <button class="layui-btn layui-btn-radius layui-btn-normal hidden" id="saveAwardInfo" lay-submit="">保存 |
| | | <button class="layui-btn layui-btn-radius layui-btn-normal hidden" id="saveAwardInfo" lay-submit=""> |
| | | 保存 |
| | | </button> |
| | | |
| | | |
| | |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label"> |
| | | <span class="x-red">*</span>最大参与人数</label> |
| | | <div class="layui-input-inline"> |
| | | <label class="desc">最少1000人,最多100000人,默认5000人</label> |
| | | <div class="flex-row flex-center"> |
| | | <input type="text" name="maxPersonCount" required="" lay-verify="integer" |
| | | autocomplete="off" class="layui-input input-small" placeholder="正整数"> 人 |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label"> |
| | | <span class="x-red">*</span>开奖时间/活动有效期</label> |
| | | <div class="layui-input-inline"> |
| | | <label class="desc">至少1天,最多7天,默认3天(活动发布时起)</label> |
| | |
| | | </div> |
| | | </div> |
| | | |
| | | <button class="layui-btn layui-btn-radius layui-btn-normal hidden" id="saveOpenInfo" lay-submit="">保存 |
| | | <button class="layui-btn layui-btn-radius layui-btn-normal hidden" id="saveOpenInfo" lay-submit=""> |
| | | 保存 |
| | | </button> |
| | | </form> |
| | | </div> |
| | |
| | | console.log(field); |
| | | |
| | | if (!parseInt(field.minPersonCount)) { |
| | | common.notify.error("请填写正确的参与人数"); |
| | | common.notify.error("请填写正确的最小参与人数"); |
| | | return false; |
| | | } |
| | | |
| | | if (!parseInt(field.maxPersonCount)) { |
| | | common.notify.error("请填写正确的最大参与人数"); |
| | | return false; |
| | | } |
| | | |
| | | |
| | | if (!parseInt(field.day)) { |
| | | common.notify.error("请填写正确的天数"); |
| | |
| | | common.notify.error("至少参与人数的范围为:1000-100000"); |
| | | return false; |
| | | } |
| | | |
| | | if (parseInt(field.maxPersonCount) < 1000 || parseInt(field.maxPersonCount) > 100000) { |
| | | common.notify.error("至多参与人数的范围为:1000-100000"); |
| | | return false; |
| | | } |
| | | |
| | | |
| | | if (parseInt(field.day) < 1 || parseInt(field.day) > 7) { |
| | | common.notify.error("活动有效期的范围为:1-7"); |
| | |
| | | var posterFileList; |
| | | var bannerFileList; |
| | | common.initLayui(function () { |
| | | |
| | | |
| | | |
| | | |
| | | //layui相关初始化成功 |
| | | app.initData(); |
| | | |
| | |
| | | var app = new Vue({ |
| | | el: '#main', |
| | | data: { |
| | | activity: {}, |
| | | tempAwardsList: [], |
| | | openInfo: { |
| | | activity: { |
| | | tags: [] |
| | | }, |
| | | tempAwardsList: [], |
| | | openInfo: {}, |
| | | joinInfo: { |
| | | adInfo: {}}, |
| | | adInfo: {} |
| | | }, |
| | | temp: {//临时数据,用于提交到服务端 |
| | | |
| | | }, |
| | |
| | | watch: { |
| | | tempAwardsList: function () { |
| | | setTimeout(function () { |
| | | // layui.use(['form'], function () { |
| | | // form = layui.form; |
| | | // form.render(); |
| | | // }) |
| | | if (common.layuiForm) |
| | | common.layuiForm.render(); |
| | | }); |
| | | }, |
| | | activity: function () { |
| | | setTimeout(function () { |
| | | common.layuiForm.render(); |
| | | }); |
| | | } |
| | |
| | | this.openInfo = _.cloneDeep(temp.openInfo); |
| | | this.joinInfo = _.cloneDeep(temp.joinInfo); |
| | | }, |
| | | addTag: function () { |
| | | $this = this; |
| | | layer.open({ |
| | | type: 1 //Page层类型 |
| | | , |
| | | btn: ["确定", "取消"] |
| | | , |
| | | title: '添加标签' |
| | | , |
| | | skin: 'layui-layer-prompt' |
| | | , |
| | | content: "<div><input id='transfer-msg' type='text' class='layui-layer-input' value='' placeholder='标签内容'><input style='margin-top:10px;' type='text' class='layui-layer-input' value='' placeholder='标签背景颜色,如#FF0000'><input style='margin-top:10px;' type='text' class='layui-layer-input' value='' placeholder='标签字体颜色,如#FF0000'></div>" |
| | | , |
| | | yes: function (index, layero) { |
| | | //按钮【按钮一】的回调 |
| | | const tagName = $(layero).find("input").eq(0).val(); |
| | | const tagBgColor = $(layero).find("input").eq(1).val(); |
| | | const tagFontColor = $(layero).find("input").eq(2).val(); |
| | | if (tagName && tagBgColor && tagFontColor) { |
| | | if ($this.activity.tags == null) { |
| | | $this.activity.tags = []; |
| | | } |
| | | |
| | | for (var i = 0; i < $this.activity.tags.length; i++) { |
| | | |
| | | if ($this.activity.tags[i].tagName == tagName) { |
| | | common.notify.error("请不要添加相同的标签"); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | |
| | | $this.activity.tags.push({ |
| | | tagName: tagName, |
| | | tagBgColor: tagBgColor, |
| | | tagFontColor: tagFontColor, |
| | | }); |
| | | |
| | | layer.close(index) |
| | | } else { |
| | | common.notify.error("请将数据补充完整"); |
| | | |
| | | } |
| | | |
| | | } |
| | | }); |
| | | |
| | | |
| | | }, |
| | | delTag: function (index) { |
| | | this.activity.tags.splice(index, 1); |
| | | }, |
| | | //初始化数据 |
| | | initData() { |
| | | $this = this; |
| | | //获取是否有缓存 |
| | | var tempActivity = common.getTempData("activity"); |
| | | if (tempActivity) { |
| | | $this.setTempData(JSON.parse(tempActivity)); |
| | | } |
| | | |
| | | /**************初始化抽奖信息************/ |
| | | |
| | | //删除所有选择的文件 |
| | |
| | | common.layuiForm.on('submit(form-activity-info)', |
| | | function (data) { |
| | | field = common.layuiForm.val('form-activity-info'); |
| | | console.log(field) |
| | | if (!validManager.verifyActivityInfo()) { |
| | | app.finishSubmit(); |
| | | return false; |
| | |
| | | }, |
| | | |
| | | //添加 |
| | | requestAdd: function (data,type) { |
| | | requestAdd: function (data, type) { |
| | | var params = { |
| | | data: data, |
| | | type:type |
| | | type: type |
| | | } |
| | | |
| | | //发异步,把数据提交给php |
| | |
| | | icon: 6 |
| | | }, |
| | | function () { |
| | | layer.close(this); |
| | | layer.close(this); |
| | | }); |
| | | } else { |
| | | layer.msg(res.msg); |
| | |
| | | layer.close(app.submitLoading) |
| | | } |
| | | //所有数据已经取完 |
| | | var temp = JSON.stringify(this.temp); |
| | | if (finish) { |
| | | console.log("获取到的结果"); |
| | | console.log(this.temp); |
| | | // app.setTempData(this.temp); |
| | | // app.initData(); |
| | | this.requestAdd(JSON.stringify(this.temp),'publish'); |
| | | // this.requestAdd(JSON.stringify(this.temp), 'publish'); |
| | | //保存内容 |
| | | common.saveTempData("activity", temp); |
| | | window.location.href = "activity-preview.html" |
| | | } |
| | | }, |
| | | |