Authored by yyq

lottery

@@ -125,20 +125,72 @@ @@ -125,20 +125,72 @@
125 <form class="form-horizontal" id="publish-form"> 125 <form class="form-horizontal" id="publish-form">
126 <div class="form-group"> 126 <div class="form-group">
127 <span class="control-label col-md-2 col-xs-12">APP</span> 127 <span class="control-label col-md-2 col-xs-12">APP</span>
128 - <div class="col-md-6 col-sm-6 col-xs-12"> 128 + <div class="col-md-9 col-sm-6 col-xs-12">
129 <input type="text" class="form-control" name="app" placeholder="请输入抽奖码"> 129 <input type="text" class="form-control" name="app" placeholder="请输入抽奖码">
130 </div> 130 </div>
131 </div> 131 </div>
  132 +
132 <div class="form-group"> 133 <div class="form-group">
133 <span class="control-label col-md-2 col-xs-12">小程序</span> 134 <span class="control-label col-md-2 col-xs-12">小程序</span>
134 - <div class="col-md-6 col-sm-6 col-xs-12">  
135 - <input type="text" class="form-control" name="miniapp" placeholder="请输入文案"> 135 + <div class="col-md-9 col-sm-6 col-xs-12">
  136 + <select class="form-control col-md-4 notice-btn-select" name="miniapptype">
  137 + <option value="0">默认</option>
  138 + <option value="1">关注</option>
  139 + <option value="2">跳转</option>
  140 + </select>
  141 + </div>
  142 + </div>
  143 +
  144 + <div class="input-switch-group">
  145 + <div class="form-group tip-group">
  146 + <span class="control-label col-md-2 col-xs-12"></span>
  147 + <div class="col-md-9 col-sm-6 col-xs-12">
  148 + <input type="text" class="form-control" name="miniapptip" placeholder="请输入弹窗内容">
  149 + </div>
  150 + </div>
  151 + <div class="form-group tip-group">
  152 + <span class="control-label col-md-2 col-xs-12"></span>
  153 + <div class="col-md-9 col-sm-6 col-xs-12">
  154 + <input type="text" class="form-control" name="miniappcopy" placeholder="请输入点击复制内容">
  155 + </div>
  156 + </div>
  157 + <div class="form-group link-group">
  158 + <span class="control-label col-md-2 col-xs-12"></span>
  159 + <div class="col-md-9 col-sm-6 col-xs-12">
  160 + <input type="text" class="form-control" name="miniapplink" placeholder="请输入跳转链接">
  161 + </div>
136 </div> 162 </div>
137 </div> 163 </div>
  164 +
138 <div class="form-group"> 165 <div class="form-group">
139 <span class="control-label col-md-2 col-xs-12">H5</span> 166 <span class="control-label col-md-2 col-xs-12">H5</span>
140 - <div class="col-md-6 col-sm-6 col-xs-12">  
141 - <input type="text" class="form-control" name="h5" placeholder="请输入跳转的H5链接"> 167 + <div class="col-md-9 col-sm-6 col-xs-12">
  168 + <select class="form-control notice-btn-select" name="h5type">
  169 + <option value="0">默认</option>
  170 + <option value="1">关注</option>
  171 + <option value="2">跳转</option>
  172 + </select>
  173 + </div>
  174 + </div>
  175 +
  176 + <div class="input-switch-group">
  177 + <div class="form-group tip-group">
  178 + <span class="control-label col-md-2 col-xs-12"></span>
  179 + <div class="col-md-9 col-sm-6 col-xs-12">
  180 + <input type="text" class="form-control" name="h5tip" placeholder="请输入弹窗内容">
  181 + </div>
  182 + </div>
  183 + <div class="form-group tip-group">
  184 + <span class="control-label col-md-2 col-xs-12"></span>
  185 + <div class="col-md-9 col-sm-6 col-xs-12">
  186 + <input type="text" class="form-control" name="h5copy" placeholder="请输入点击复制内容">
  187 + </div>
  188 + </div>
  189 + <div class="form-group link-group">
  190 + <span class="control-label col-md-2 col-xs-12"></span>
  191 + <div class="col-md-9 col-sm-6 col-xs-12">
  192 + <input type="text" class="form-control" name="h5link" placeholder="请输入跳转链接">
  193 + </div>
142 </div> 194 </div>
143 </div> 195 </div>
144 </form> 196 </form>
@@ -5,8 +5,8 @@ @@ -5,8 +5,8 @@
5 */ 5 */
6 #注意:GO;分割执行块 6 #注意:GO;分割执行块
7 ALTER TABLE act_prize_product ADD ( 7 ALTER TABLE act_prize_product ADD (
8 - `notice` VARCHAR(500) DEFAULT '' comment '公告',  
9 - `lottery_info` VARCHAR(800) DEFAULT '' comment '开奖信息', 8 + `notice` VARCHAR(1000) DEFAULT '' comment '公告',
  9 + `lottery_info` VARCHAR(1000) DEFAULT '' comment '开奖信息',
10 `lottery_time` int(10) NOT NULL DEFAULT 0 comment '开奖时间' 10 `lottery_time` int(10) NOT NULL DEFAULT 0 comment '开奖时间'
11 ); 11 );
12 GO; 12 GO;
@@ -72,22 +72,35 @@ function bindListPageEvent() { @@ -72,22 +72,35 @@ function bindListPageEvent() {
72 const publishFn = function() { 72 const publishFn = function() {
73 let t = $publishForm.serializeArray(); 73 let t = $publishForm.serializeArray();
74 let tips = {}; 74 let tips = {};
75 - let error; 75 + let tipsVal = {};
76 76
77 $.each(t, function() { 77 $.each(t, function() {
78 - if (!this.value) {  
79 - error = true;  
80 - return;  
81 - }  
82 -  
83 tips[this.name] = this.value; 78 tips[this.name] = this.value;
84 }); 79 });
85 80
86 - // 暂时不限制必填  
87 - // if (error) {  
88 - // alert('请填写完整各端提示信息后进行开奖');  
89 - // return;  
90 - // } 81 + tipsVal.app = tips.app;
  82 +
  83 + tipsVal.miniappType = +tips.miniapptype;
  84 +
  85 + if (tipsVal.miniappType) {
  86 + if (tipsVal.miniappType === 1) {
  87 + tipsVal.miniappTip = tips.miniapptip;
  88 + tipsVal.miniappCopy = tips.miniappcopy;
  89 + } else {
  90 + tipsVal.miniappLink = tips.miniapplink;
  91 + }
  92 + }
  93 +
  94 + tipsVal.h5Type = +tips.h5type;
  95 +
  96 + if (tipsVal.h5Type) {
  97 + if (tipsVal.h5Type === 1) {
  98 + tipsVal.h5Tip = tips.h5tip;
  99 + tipsVal.h5Copy = tips.h5copy;
  100 + } else {
  101 + tipsVal.h5Link = tips.h5link;
  102 + }
  103 + }
91 104
92 $.ajax({ 105 $.ajax({
93 method: 'post', 106 method: 'post',
@@ -95,7 +108,7 @@ function bindListPageEvent() { @@ -95,7 +108,7 @@ function bindListPageEvent() {
95 data: { 108 data: {
96 id: $confirm.data('id'), 109 id: $confirm.data('id'),
97 channel: $confirm.data('channel'), 110 channel: $confirm.data('channel'),
98 - lotteryInfo: JSON.stringify(tips) 111 + lotteryInfo: JSON.stringify(tipsVal)
99 } 112 }
100 }).then(res => { 113 }).then(res => {
101 if (res.code === 200) { 114 if (res.code === 200) {
@@ -116,7 +129,6 @@ function bindListPageEvent() { @@ -116,7 +129,6 @@ function bindListPageEvent() {
116 notice[this.name] = this.value; 129 notice[this.name] = this.value;
117 }); 130 });
118 131
119 -  
120 noticeVal.content = notice.content; 132 noticeVal.content = notice.content;
121 133
122 noticeVal.miniappBtnName = notice.miniappbtn; 134 noticeVal.miniappBtnName = notice.miniappbtn;
@@ -173,11 +185,14 @@ function bindListPageEvent() { @@ -173,11 +185,14 @@ function bindListPageEvent() {
173 const noticeBtnTypeChangeFn = function() { 185 const noticeBtnTypeChangeFn = function() {
174 let $this = $(this); 186 let $this = $(this);
175 let $dom = $this.closest('.form-group').next('.input-switch-group'); 187 let $dom = $this.closest('.form-group').next('.input-switch-group');
  188 + let val = +$this.val();
176 189
177 - if (+$this.val() === 1) {  
178 - $dom.removeClass('type-link'); 190 + if (val === 0) {
  191 + $dom.removeClass('type-link type-tip');
  192 + } else if (val === 1) {
  193 + $dom.removeClass('type-link').addClass('type-tip');
179 } else { 194 } else {
180 - $dom.addClass('type-link'); 195 + $dom.removeClass('type-tip').addClass('type-link');
181 } 196 }
182 }; 197 };
183 198
@@ -189,6 +204,9 @@ function bindListPageEvent() { @@ -189,6 +204,9 @@ function bindListPageEvent() {
189 $('.btn-switch-close').on('click', switchFn); 204 $('.btn-switch-close').on('click', switchFn);
190 $('.btn-export').on('click', exportFn); 205 $('.btn-export').on('click', exportFn);
191 $('.btn-publish').on('click', function() { 206 $('.btn-publish').on('click', function() {
  207 + $('input', $confirm).val('');
  208 + $('select', $confirm).val(0).change();
  209 +
192 $confirm.data('id', $(this).data('id')); 210 $confirm.data('id', $(this).data('id'));
193 $confirm.data('channel', $(this).data('channel')); 211 $confirm.data('channel', $(this).data('channel'));
194 $confirm.modal('show'); 212 $confirm.modal('show');
@@ -81,12 +81,13 @@ @@ -81,12 +81,13 @@
81 display: block; 81 display: block;
82 } 82 }
83 83
  84 +.input-switch-group .tip-group,
84 .input-switch-group .link-group{ 85 .input-switch-group .link-group{
85 display: none; 86 display: none;
86 } 87 }
87 88
88 -.input-switch-group.type-link .tip-group{  
89 - display: none; 89 +.input-switch-group.type-tip .tip-group{
  90 + display: block;
90 } 91 }
91 92
92 .input-switch-group.type-link .link-group{ 93 .input-switch-group.type-link .link-group{