|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
- <el-form :model="form" ref="form" :rules="rules" label-width="auto" v-loading="loading">
|
|
|
+ <el-form :model="form" ref="form" :rules="rules" label-width="auto" v-loading="loading" :disabled="checkPermi(['registration:regConfig:change']) ? false : true">
|
|
|
<el-form-item label="签到标题:" prop="signTitle">
|
|
|
<el-input v-model="form.signTitle" placeholder="请输入签到标题" maxlength="50" show-word-limit />
|
|
|
</el-form-item>
|
|
@@ -35,8 +35,7 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center">
|
|
|
<template #header>
|
|
|
- <el-button type="text" icon="el-icon-plus" @click="handlerPush('签到奖励')"
|
|
|
- :disabled="continuePush">添加</el-button>
|
|
|
+ <el-button type="text" icon="el-icon-plus" @click="handlerPush('签到奖励')" :disabled="continuePush">添加</el-button>
|
|
|
</template>
|
|
|
<template slot-scope="scope">
|
|
|
<el-button type="delete" @click="getDeleteContinue(scope)">
|
|
@@ -90,7 +89,8 @@
|
|
|
placeholder="请输入签到规则" />
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
- <el-button type="primary" @click="getSubmit">确定</el-button>
|
|
|
+ <el-button type="primary" @click="getSubmit">确定
|
|
|
+ </el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
@@ -98,6 +98,7 @@
|
|
|
|
|
|
<script>
|
|
|
import { list, submit, removeContinue, removeListenGood } from '@/api/registration/regConfig'
|
|
|
+import { checkPermi } from '@/utils/permission'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
@@ -130,7 +131,9 @@ export default {
|
|
|
rewardOptions: [{
|
|
|
value: 4,
|
|
|
label: '积分'
|
|
|
- }]
|
|
|
+ }],
|
|
|
+ // 是否只读
|
|
|
+ disabled: false
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
@@ -174,101 +177,104 @@ export default {
|
|
|
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
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- // 判断连续签到天数是否大于签到周期天数
|
|
|
- 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
|
|
|
- }
|
|
|
- },
|
|
|
+ },
|
|
|
|
|
|
- // 删除连续签到奖励
|
|
|
- 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
|
|
|
- }
|
|
|
+ // 添加
|
|
|
+ handlerPush(key) {
|
|
|
+ if (key === '签到奖励') {
|
|
|
+ this.form.pointConfigContinueRList.push({
|
|
|
+ signDay: undefined,
|
|
|
+ rewardPoint: undefined,
|
|
|
+ status: 1,
|
|
|
})
|
|
|
- }
|
|
|
- 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
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ this.form.pointConfigListenGoodList.push({
|
|
|
+ listenTime: undefined,
|
|
|
+ rewardPoint: undefined,
|
|
|
+ type: this.form.notifyRewardType
|
|
|
})
|
|
|
}
|
|
|
- this.$message.success('删除成功!')
|
|
|
- this.form.pointConfigListenGoodList.splice(scope.$index, 1)
|
|
|
- }).catch(() => { })
|
|
|
+ },
|
|
|
|
|
|
- },
|
|
|
+ // 判断连续签到天数是否大于签到周期天数
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
- // 确定
|
|
|
- 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
|
|
|
+ // 判断收听播放奖励时是否填写重复的时间
|
|
|
+ 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(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(() => { })
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ // 确定
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // 监控权限
|
|
|
+ checkPermi
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|