Переглянути джерело

签到管理 签到配置 更改签到周期初始化连续签到奖励

DESKTOP-O04BTUJ\muzen 2 роки тому
батько
коміт
271baddd08
1 змінених файлів з 97 додано та 88 видалено
  1. 97 88
      src/views/registration/regConfig/index.vue

+ 97 - 88
src/views/registration/regConfig/index.vue

@@ -162,104 +162,113 @@ export default {
 
     // 签到周期改变 连续签到列表重置
     changeSignDay() {
+      let ids = ''
+      let arr = []
+      this.form.pointConfigContinueRList.map(i => {
+        if (i.id) {
+          arr.push(i.id)
+        }
+      })
+      ids = arr.join(',')
+      if (ids) {
+        removeContinue(ids).then(res => { })
+      }
       this.form.pointConfigContinueRList = []
-    },
+  },
 
-    // 添加
-    handlerPush(key) {
-      if (key === '签到奖励') {
-        this.form.pointConfigContinueRList.push({
-          signDay: undefined,
-          rewardPoint: undefined,
-          status: 1,
-        })
-      } else {
-        this.form.pointConfigListenGoodList.push({
-          listenTime: undefined,
-          rewardPoint: undefined,
-          type: this.form.notifyRewardType
-        })
-      }
-    },
+  // 添加
+  handlerPush(key) {
+    if (key === '签到奖励') {
+      this.form.pointConfigContinueRList.push({
+        signDay: undefined,
+        rewardPoint: undefined,
+        status: 1,
+      })
+    } else {
+      this.form.pointConfigListenGoodList.push({
+        listenTime: undefined,
+        rewardPoint: undefined,
+        type: this.form.notifyRewardType
+      })
+    }
+  },
 
-    // 判断连续签到天数是否大于签到周期天数
-    checkSignDay(e, index) {
-      if (e > this.form.signDay) {
-        this.$message.error('连续签到天数不可大于签到周期!')
-        this.form.pointConfigContinueRList[index].signDay = undefined
-      }
-      if (this.form.pointConfigContinueRList.filter(i => i.signDay === e).length === 2) {
-        this.$message.error('此天数已存在!')
-        this.form.pointConfigContinueRList[index].signDay = undefined
-      }
-    },
+  // 判断连续签到天数是否大于签到周期天数
+  checkSignDay(e, index) {
+    if (e > this.form.signDay) {
+      this.$message.error('连续签到天数不可大于签到周期!')
+      this.form.pointConfigContinueRList[index].signDay = undefined
+    }
+    if (this.form.pointConfigContinueRList.filter(i => i.signDay === e).length === 2) {
+      this.$message.error('此天数已存在!')
+      this.form.pointConfigContinueRList[index].signDay = undefined
+    }
+  },
 
-    // 判断收听播放奖励时是否填写重复的时间
-    checkListenTime(e, index) {
-      if (this.form.pointConfigListenGoodList.filter(i => i.listenTime === e).length === 2) {
-        this.$message.error('此时间已存在!')
-        this.form.pointConfigListenGoodList[index].listenTime = undefined
-      }
-    },
+  // 判断收听播放奖励时是否填写重复的时间
+  checkListenTime(e, index) {
+    if (this.form.pointConfigListenGoodList.filter(i => i.listenTime === e).length === 2) {
+      this.$message.error('此时间已存在!')
+      this.form.pointConfigListenGoodList[index].listenTime = undefined
+    }
+  },
 
-    // 删除连续签到奖励
-    getDeleteContinue(scope) {
-      let title = scope.row.signDay ? scope.row.signDay : '空'
-      this.$confirm(`是否删除 连续签到天数为${title} 的数据?`, '提示', {
-        type: 'warning'
-      }).then(() => {
-        if (scope.row.id) {
-          removeContinue({
-            id: scope.row.id
-          }).then(res => {
-            if (res.code !== 0) {
-              return false
-            }
-          })
-        }
-        this.$message.success('删除成功!')
-        this.form.pointConfigContinueRList.splice(scope.$index, 1)
-      }).catch(() => { })
-    },
+  // 删除连续签到奖励
+  getDeleteContinue(scope) {
+    let title = scope.row.signDay ? scope.row.signDay : '空'
+    this.$confirm(`是否删除 连续签到天数为${title} 的数据?`, '提示', {
+      type: 'warning'
+    }).then(() => {
+      if (scope.row.id) {
+        removeContinue(scope.row.id).then(res => {
+          if (res.code !== 0) {
+            return false
+          }
+        })
+      }
+      this.$message.success('删除成功!')
+      this.form.pointConfigContinueRList.splice(scope.$index, 1)
+    }).catch(() => { })
+  },
 
-    // 删除收听播放奖励
-    getDeleteListenGood(scope) {
-      let title = scope.row.listenTime ? scope.row.listenTime : '空'
-      this.$confirm(`是否删除 播放时间为${title} 的数据?`, '提示', {
-        type: 'warning'
-      }).then(() => {
-        if (scope.row.id) {
-          removeListenGood({
-            id: scope.row.id
-          }).then(res => {
-            if (res.code !== 0) {
-              return false
-            }
-          })
-        }
-        this.$message.success('删除成功!')
-        this.form.pointConfigListenGoodList.splice(scope.$index, 1)
-      }).catch(() => { })
+  // 删除收听播放奖励
+  getDeleteListenGood(scope) {
+    let title = scope.row.listenTime ? scope.row.listenTime : '空'
+    this.$confirm(`是否删除 播放时间为${title} 的数据?`, '提示', {
+      type: 'warning'
+    }).then(() => {
+      if (scope.row.id) {
+        removeListenGood({
+          id: scope.row.id
+        }).then(res => {
+          if (res.code !== 0) {
+            return false
+          }
+        })
+      }
+      this.$message.success('删除成功!')
+      this.form.pointConfigListenGoodList.splice(scope.$index, 1)
+    }).catch(() => { })
 
-    },
+  },
 
-    // 确定
-    getSubmit() {
-      this.$refs.form.validate((valid) => {
-        if (valid) {
-          submit(this.form).then(res => {
-            if (res.code === 0) {
-              this.$message.success('修改成功!')
-              this.getList()
-            }
-          })
-        } else {
-          return false
-        }
-      })
-    }
+  // 确定
+  getSubmit() {
+    this.$refs.form.validate((valid) => {
+      if (valid) {
+        submit(this.form).then(res => {
+          if (res.code === 0) {
+            this.$message.success('修改成功!')
+            this.getList()
+          }
+        })
+      } else {
+        return false
+      }
+    })
   }
 }
+}
 </script>
 
 <style lang="scss" scoped>