yuhongqi 11 ساعت پیش
والد
کامیت
f6a2e66a1f
1فایلهای تغییر یافته به همراه14 افزوده شده و 24 حذف شده
  1. 14 24
      src/views/system/config/integralConfig.vue

+ 14 - 24
src/views/system/config/integralConfig.vue

@@ -229,10 +229,10 @@
             <el-select
               v-model="scope.row.scopes"
               multiple
-              placeholder="请选择展示端"
+              clearable
+              placeholder="为空表示各端均不展示"
               size="small"
               style="width: 200px"
-              @change="handleLogTypeScopeChange(scope.row)"
             >
               <el-option label="APP" value="app" />
               <el-option label="小程序" value="mini" />
@@ -250,10 +250,10 @@
             <el-select
               v-model="scope.row.scopes"
               multiple
-              placeholder="请选择展示端"
+              clearable
+              placeholder="为空表示各端均不展示"
               size="small"
               style="width: 200px"
-              @change="handleTaskScopeChange(scope.row)"
             >
               <el-option label="APP" value="app" />
               <el-option label="小程序" value="mini" />
@@ -278,11 +278,11 @@ const DEFAULT_TASK_DISPLAY_ROWS = [
   { code: 'REGISTER', name: '首次注册登录', typeLabel: '新手', defaultScopes: ['app', 'mini'], tip: '完成手机号绑定注册' },
   { code: 'DOWNLOAD_APP', name: '首次下载APP', typeLabel: '新手', defaultScopes: ['app'], tip: '仅 APP 端可完成' },
   { code: 'FIRST_PURCHASE', name: '首次完成购物', typeLabel: '新手', defaultScopes: ['app', 'mini'], tip: '全渠道首购奖励' },
-  { code: 'INVITED', name: '填写朋友邀请码', typeLabel: '新手', defaultScopes: ['app', 'mini'], tip: '被邀请奖励' },
   { code: 'SHARE', name: '分享得积分', typeLabel: '每日', defaultScopes: ['app', 'mini'], tip: 'APP+小程序合计日限' },
   { code: 'COURSE', name: '学习首页课程', typeLabel: '每日', defaultScopes: ['app'], tip: '默认仅 APP 展示' },
   { code: 'BROWSE_MALL', name: '浏览商城60秒', typeLabel: '每日', defaultScopes: ['app', 'mini'], tip: '浏览商城任务' },
-  { code: 'INVITE', name: '邀好友享积分', typeLabel: '每日', defaultScopes: ['app', 'mini'], tip: '邀请新用户' }
+  { code: 'INVITE', name: '邀好友享积分', typeLabel: '每日', defaultScopes: ['app', 'mini'], tip: '邀请新用户' },
+  { code: 'INVITED', name: '填写朋友邀请码', typeLabel: '每日', defaultScopes: ['app', 'mini'], tip: '被邀请奖励,仅可完成一次' }
 ]
 
 const LOG_TYPE_SCOPE_OVERRIDES = {
@@ -358,14 +358,16 @@ export default {
         return true
       }
       const row = this.logTypeDisplayRows.find(item => item.code === String(code))
-      const scopes = row ? row.scopes : this.getDefaultLogTypeScopes(String(code))
-      return scopes.includes(platform)
+      if (!row || !row.scopes || row.scopes.length === 0) {
+        return false
+      }
+      return row.scopes.includes(platform)
     },
     initLogTypeDisplayRows(logTypeDisplayScope = {}, dictOptions = []) {
       const rows = (dictOptions || []).map(dict => {
         const code = String(dict.dictValue)
         const savedScope = logTypeDisplayScope[code]
-        const scopes = savedScope
+        const scopes = savedScope != null
           ? savedScope.split(',').filter(Boolean)
           : this.getDefaultLogTypeScopes(code)
         return {
@@ -377,26 +379,20 @@ export default {
       rows.sort((a, b) => Number(a.code) - Number(b.code))
       this.logTypeDisplayRows = rows
     },
-    handleLogTypeScopeChange(row) {
-      if (!row.scopes || row.scopes.length === 0) {
-        row.scopes = this.getDefaultLogTypeScopes(row.code)
-        this.msgWarning('至少选择一个展示端,已恢复默认配置')
-      }
-    },
     handleLogTypePreviewChange() {
       // 仅影响上方「单日可获总积分类型」下拉预览,不改已保存值
     },
     buildLogTypeDisplayScope() {
       const logTypeDisplayScope = {}
       this.logTypeDisplayRows.forEach(row => {
-        logTypeDisplayScope[row.code] = (row.scopes || this.getDefaultLogTypeScopes(row.code)).join(',')
+        logTypeDisplayScope[row.code] = (row.scopes || []).join(',')
       })
       return logTypeDisplayScope
     },
     initTaskDisplayRows(taskDisplayScope = {}) {
       this.taskDisplayRows = DEFAULT_TASK_DISPLAY_ROWS.map(item => {
         const savedScope = taskDisplayScope[item.code]
-        const scopes = savedScope
+        const scopes = savedScope != null
           ? savedScope.split(',').filter(Boolean)
           : [...item.defaultScopes]
         return {
@@ -405,16 +401,10 @@ export default {
         }
       })
     },
-    handleTaskScopeChange(row) {
-      if (!row.scopes || row.scopes.length === 0) {
-        row.scopes = [...row.defaultScopes]
-        this.msgWarning('至少选择一个展示端,已恢复默认配置')
-      }
-    },
     buildTaskDisplayScope() {
       const taskDisplayScope = {}
       this.taskDisplayRows.forEach(row => {
-        taskDisplayScope[row.code] = (row.scopes || row.defaultScopes).join(',')
+        taskDisplayScope[row.code] = (row.scopes || []).join(',')
       })
       return taskDisplayScope
     },