Browse Source

fix:默认头像问题

super-yimizi 1 month ago
parent
commit
1178566f50

+ 1 - 1
README.md

@@ -16,7 +16,7 @@ truncate fa_shop_order_aftersales;
 truncate fa_shop_order_express;
 truncate fa_shop_order_express_log;
 truncate fa_shop_order_express_log;
-
+truncate fa_shop_comment;
 # 支付数据
 truncate fa_shop_pay;
 # 验货端数据

+ 4 - 0
application/admin/controller/marketing/Discount.php

@@ -8,6 +8,7 @@ use Exception;
 use think\exception\DbException;
 use think\exception\PDOException;
 use think\exception\ValidateException;
+use app\common\Enum\ChannelEnum;
 /**
  * 营销活动表(整体活动)
  *
@@ -26,6 +27,9 @@ class Discount extends Backend
     {
         parent::_initialize();
         $this->model = new \app\admin\model\marketing\discount\Discount;
+         // 渠道配置
+         $this->view->assign("channelList", ChannelEnum::getChannelMap());
+         $this->assignconfig("channelList", json_encode(ChannelEnum::getChannelMap()));
     }
 
     /**

+ 12 - 20
application/admin/view/marketing/discount/add.html

@@ -27,28 +27,20 @@
             </div>
         </div>
     </div>
-
     <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('活动渠道')}:</label>
+        <label class="control-label col-xs-12 col-sm-2">活动渠道:</label>
         <div class="col-xs-12 col-sm-8">
-            <label class="checkbox-inline">
-                <input type="checkbox" name="row[channels][]" value="wechat"> 微信公众号
-            </label>
-            <label class="checkbox-inline">
-                <input type="checkbox" name="row[channels][]" value="miniapp"> 微信小程序
-            </label>
-            <label class="checkbox-inline">
-                <input type="checkbox" name="row[channels][]" value="h5"> 手机浏览器H5
-            </label>
-            <label class="checkbox-inline">
-                <input type="checkbox" name="row[channels][]" value="tiktok"> 头条/抖音小程序
-            </label>
-            <label class="checkbox-inline">
-                <input type="checkbox" name="row[channels][]" value="app"> APP
-            </label>
-            <label class="checkbox-inline">
-                <input type="checkbox" name="row[channels][]" value="pc"> PC版
-            </label>
+            <!-- 渠道选择 -->
+            <div class="channel-list">
+                {foreach name="channelList" item="vo" key="key"}
+                <label class="checkbox-inline">
+                    <input type="checkbox" name="row[channels][]" value="{$key}" data-rule="checked" data-rule-message="请至少选择一个活动渠道"{/if}> 
+                    {$vo}
+                </label>
+                {/foreach}
+            </div>
+            
+            <span class="help-block">请选择本次活动投放的渠道,至少选择一个</span>
         </div>
     </div>
 

+ 12 - 19
application/admin/view/marketing/discount/edit.html

@@ -29,26 +29,19 @@
     </div>
 
     <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('活动渠道')}:</label>
+        <label class="control-label col-xs-12 col-sm-2">活动渠道:</label>
         <div class="col-xs-12 col-sm-8">
-            <label class="checkbox-inline">
-                <input type="checkbox" name="row[channels][]" value="wechat" {in name="'wechat'|explode($row.channels)" value="wechat"}checked{/in}> 微信公众号
-            </label>
-            <label class="checkbox-inline">
-                <input type="checkbox" name="row[channels][]" value="miniapp" {in name="'miniapp'|explode($row.channels)" value="miniapp"}checked{/in}> 微信小程序
-            </label>
-            <label class="checkbox-inline">
-                <input type="checkbox" name="row[channels][]" value="h5" {in name="'h5'|explode($row.channels)" value="h5"}checked{/in}> 手机浏览器H5
-            </label>
-            <label class="checkbox-inline">
-                <input type="checkbox" name="row[channels][]" value="tiktok" {in name="'tiktok'|explode($row.channels)" value="tiktok"}checked{/in}> 头条/抖音小程序
-            </label>
-            <label class="checkbox-inline">
-                <input type="checkbox" name="row[channels][]" value="app" {in name="'app'|explode($row.channels)" value="app"}checked{/in}> APP
-            </label>
-            <label class="checkbox-inline">
-                <input type="checkbox" name="row[channels][]" value="pc" {in name="'pc'|explode($row.channels)" value="pc"}checked{/in}> PC版
-            </label>
+            <!-- 渠道选择 -->
+            <div class="channel-list">
+                {foreach name="channelList" item="vo" key="key"}
+                <label class="checkbox-inline">
+                    <input type="checkbox" name="row[channels][]" value="{$key}" {if condition="is_array($row.channels) && in_array($key, $row.channels)"}checked{/if}> 
+                    {$vo}
+                </label>
+                {/foreach}
+            </div>
+            
+            <span class="help-block">请选择本次活动投放的渠道,至少选择一个</span>
         </div>
     </div>
 

+ 16 - 0
public/assets/js/backend/marketing/discount.js

@@ -1092,6 +1092,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
             });
         },
         api: {
+            // 解析Config中的JSON字符串的辅助函数
+            parseConfigJson: function(configKey, defaultValue) {
+                var configValue = Config[configKey] || defaultValue || {};
+                
+                // 如果是字符串,尝试解析JSON
+                if (typeof configValue === 'string') {
+                    try {
+                        return JSON.parse(configValue);
+                    } catch (e) {
+                        return defaultValue || {};
+                    }
+                }
+                
+                return configValue;
+            },
+            
             bindevent: function () {
                 Form.api.bindevent($("form[role=form]"));