From 8c1c003c60d2f27b3c55e248451caeec7f2b5631 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期四, 28 一月 2021 19:06:28 +0800
Subject: [PATCH] 活动管理界面完善

---
 service-daylucky/src/main/resources/static/activity-add.html |  175 ++++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 157 insertions(+), 18 deletions(-)

diff --git a/service-daylucky/src/main/resources/static/activity-add.html b/service-daylucky/src/main/resources/static/activity-add.html
index 8a2a996..c174a4f 100644
--- a/service-daylucky/src/main/resources/static/activity-add.html
+++ b/service-daylucky/src/main/resources/static/activity-add.html
@@ -89,6 +89,28 @@
 
         }
 
+        .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>
@@ -112,8 +134,6 @@
                                         <img class="layui-upload-img poster" id="poster">
                                     </div>
                                 </div>
-
-
                             </div>
                         </div>
 
@@ -140,7 +160,28 @@
 
                             </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>
 
@@ -195,7 +236,8 @@
                             </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>
 
 
@@ -289,6 +331,19 @@
 
                     <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="姝f暣鏁�">&nbsp;浜�
+                            </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>
@@ -310,7 +365,8 @@
                         </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>
@@ -391,9 +447,15 @@
         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("璇峰~鍐欐纭殑澶╂暟");
@@ -404,6 +466,12 @@
             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");
@@ -468,6 +536,10 @@
     var posterFileList;
     var bannerFileList;
     common.initLayui(function () {
+
+
+
+
         //layui鐩稿叧鍒濆鍖栨垚鍔�
         app.initData();
 
@@ -554,12 +626,14 @@
     var app = new Vue({
         el: '#main',
         data: {
-            activity: {},
-            tempAwardsList: [],
-            openInfo: {
+            activity: {
+                tags: []
             },
+            tempAwardsList: [],
+            openInfo: {},
             joinInfo: {
-                adInfo: {}},
+                adInfo: {}
+            },
             temp: {//涓存椂鏁版嵁锛岀敤浜庢彁浜ゅ埌鏈嶅姟绔�
 
             },
@@ -570,10 +644,12 @@
         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();
                 });
             }
@@ -593,9 +669,67 @@
                 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));
+                }
+
                 /**************鍒濆鍖栨娊濂栦俊鎭�************/
 
                 //鍒犻櫎鎵�鏈夐�夋嫨鐨勬枃浠�
@@ -643,6 +777,7 @@
                 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;
@@ -758,10 +893,10 @@
             },
 
             //娣诲姞
-            requestAdd: function (data,type) {
+            requestAdd: function (data, type) {
                 var params = {
                     data: data,
-                    type:type
+                    type: type
                 }
 
                 //鍙戝紓姝ワ紝鎶婃暟鎹彁浜ょ粰php
@@ -771,7 +906,7 @@
                                 icon: 6
                             },
                             function () {
-                             layer.close(this);
+                                layer.close(this);
                             });
                     } else {
                         layer.msg(res.msg);
@@ -797,12 +932,16 @@
                     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"
                 }
             },
 

--
Gitblit v1.8.0