feat(徽章配置管理): 配置新增徽章选项
This commit is contained in:
parent
22232def5d
commit
8c98f90fb9
@ -91,7 +91,8 @@
|
|||||||
)
|
)
|
||||||
"
|
"
|
||||||
@click.native="handleUpdate(item)"
|
@click.native="handleUpdate(item)"
|
||||||
>编辑规则</el-dropdown-item>
|
>编辑规则</el-dropdown-item
|
||||||
|
>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
v-if="
|
v-if="
|
||||||
buttonPermissions.includes(
|
buttonPermissions.includes(
|
||||||
@ -99,13 +100,15 @@
|
|||||||
)
|
)
|
||||||
"
|
"
|
||||||
@click.native="clickEditSource(item)"
|
@click.native="clickEditSource(item)"
|
||||||
>编辑资源</el-dropdown-item>
|
>编辑资源</el-dropdown-item
|
||||||
|
>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
v-if="
|
v-if="
|
||||||
buttonPermissions.includes('content:manager:badge:del')
|
buttonPermissions.includes('content:manager:badge:del')
|
||||||
"
|
"
|
||||||
@click.native="handlDel(item.id)"
|
@click.native="handlDel(item.id)"
|
||||||
>删除</el-dropdown-item>
|
>删除</el-dropdown-item
|
||||||
|
>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</div>
|
</div>
|
||||||
@ -228,22 +231,22 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { badgeTable, updateBadge, deleteBadge, addBadge } from '@/api/badge'
|
import { badgeTable, updateBadge, deleteBadge, addBadge } from "@/api/badge";
|
||||||
import Pagination from '@/components/Pagination'
|
import Pagination from "@/components/Pagination";
|
||||||
import SourceEdit from './source-edit'
|
import SourceEdit from "./source-edit";
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from "vuex";
|
||||||
function getFormData() {
|
function getFormData() {
|
||||||
return {
|
return {
|
||||||
id: '',
|
id: "",
|
||||||
badgeName: '',
|
badgeName: "",
|
||||||
type: '',
|
type: "",
|
||||||
badgeKey: '',
|
badgeKey: "",
|
||||||
badgeLevel: '',
|
badgeLevel: "",
|
||||||
milestone: ''
|
milestone: ""
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
export default {
|
export default {
|
||||||
name: 'BadgeRule',
|
name: "BadgeRule",
|
||||||
components: { Pagination, SourceEdit },
|
components: { Pagination, SourceEdit },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -251,18 +254,25 @@ export default {
|
|||||||
sourceEditRow: null,
|
sourceEditRow: null,
|
||||||
badgeGroups: [
|
badgeGroups: [
|
||||||
{
|
{
|
||||||
label: '用户',
|
label: "用户",
|
||||||
options: [
|
options: [
|
||||||
{ label: '成就', value: 'ACHIEVEMENT' },
|
{ label: "成就", value: "ACHIEVEMENT" },
|
||||||
{ label: '管理员', value: 'ADMINISTRATOR' },
|
{ label: "管理员", value: "ADMINISTRATOR" },
|
||||||
{ label: '活动', value: 'ACTIVITY' }
|
{ label: "活动", value: "ACTIVITY" }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '房间',
|
label: "荣誉",
|
||||||
options: [{ label: '成就', value: 'ROOM_ACHIEVEMENT' }]
|
options: [
|
||||||
},
|
{ label: "成就", value: "HONOR_ACHIEVEMENT" },
|
||||||
{ label: '家族', options: [{ label: '等级', value: 'FAMILY' }] }
|
{ label: "活动", value: "HONOR_ACTIVITY" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
// {
|
||||||
|
// label: '房间',
|
||||||
|
// options: [{ label: '成就', value: 'ROOM_ACHIEVEMENT' }]
|
||||||
|
// },
|
||||||
|
// { label: '家族', options: [{ label: '等级', value: 'FAMILY' }] }
|
||||||
],
|
],
|
||||||
pushTextHistoryLoading: false,
|
pushTextHistoryLoading: false,
|
||||||
pushTextHistoryVisible: false,
|
pushTextHistoryVisible: false,
|
||||||
@ -273,157 +283,157 @@ export default {
|
|||||||
listQuery: {
|
listQuery: {
|
||||||
cursor: 1,
|
cursor: 1,
|
||||||
limit: 20,
|
limit: 20,
|
||||||
badgeName: '',
|
badgeName: "",
|
||||||
badgeKey: '',
|
badgeKey: "",
|
||||||
type: 'ACHIEVEMENT'
|
type: "ACHIEVEMENT"
|
||||||
},
|
},
|
||||||
formVisible: false,
|
formVisible: false,
|
||||||
textOptTitle: '',
|
textOptTitle: "",
|
||||||
form: getFormData(),
|
form: getFormData(),
|
||||||
submitLoading: false,
|
submitLoading: false,
|
||||||
rules: {
|
rules: {
|
||||||
type: [{ required: true, message: '请选择类型', trigger: 'blur' }],
|
type: [{ required: true, message: "请选择类型", trigger: "blur" }],
|
||||||
badgeName: [
|
badgeName: [
|
||||||
{ required: true, message: '请填写徽章名称', trigger: 'blur' }
|
{ required: true, message: "请填写徽章名称", trigger: "blur" }
|
||||||
],
|
],
|
||||||
badgeKey: [
|
badgeKey: [
|
||||||
{ required: true, message: '请填写徽章key', trigger: 'blur' }
|
{ required: true, message: "请填写徽章key", trigger: "blur" }
|
||||||
],
|
],
|
||||||
badgeLevel: [
|
badgeLevel: [
|
||||||
{ required: true, message: '请填写等级', trigger: 'blur' }
|
{ required: true, message: "请填写等级", trigger: "blur" }
|
||||||
],
|
],
|
||||||
milestone: [
|
milestone: [
|
||||||
{ required: true, message: '请填写可领取里程碑', trigger: 'blur' }
|
{ required: true, message: "请填写可领取里程碑", trigger: "blur" }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
listLoading: true
|
listLoading: true
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['buttonPermissions']),
|
...mapGetters(["buttonPermissions"]),
|
||||||
isShowOperationBut() {
|
isShowOperationBut() {
|
||||||
return (
|
return (
|
||||||
this.buttonPermissions.includes('content:manager:badge:edit:rule') ||
|
this.buttonPermissions.includes("content:manager:badge:edit:rule") ||
|
||||||
this.buttonPermissions.includes('content:manager:badge:edit:source') ||
|
this.buttonPermissions.includes("content:manager:badge:edit:source") ||
|
||||||
this.buttonPermissions.includes('content:manager:badge:del')
|
this.buttonPermissions.includes("content:manager:badge:del")
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.renderData()
|
this.renderData();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
renderData(isClean) {
|
renderData(isClean) {
|
||||||
const that = this
|
const that = this;
|
||||||
if (isClean === true) {
|
if (isClean === true) {
|
||||||
that.listQuery.cursor = 1
|
that.listQuery.cursor = 1;
|
||||||
}
|
}
|
||||||
that.listLoading = true
|
that.listLoading = true;
|
||||||
badgeTable(that.listQuery).then(res => {
|
badgeTable(that.listQuery).then(res => {
|
||||||
const { body } = res
|
const { body } = res;
|
||||||
that.total = body.total || 0
|
that.total = body.total || 0;
|
||||||
that.list = body.records
|
that.list = body.records;
|
||||||
that.listLoading = false
|
that.listLoading = false;
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
handleSearch() {
|
handleSearch() {
|
||||||
this.renderData()
|
this.renderData();
|
||||||
},
|
},
|
||||||
renderDataSuccess() {
|
renderDataSuccess() {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: 'Successful',
|
message: "Successful",
|
||||||
type: 'success'
|
type: "success"
|
||||||
})
|
});
|
||||||
this.renderData()
|
this.renderData();
|
||||||
},
|
},
|
||||||
queryUserDetails(row) {
|
queryUserDetails(row) {
|
||||||
this.userDeatilsDrawer = true
|
this.userDeatilsDrawer = true;
|
||||||
this.thatSelectedUserId = row.id
|
this.thatSelectedUserId = row.id;
|
||||||
},
|
},
|
||||||
submitForm() {
|
submitForm() {
|
||||||
const that = this
|
const that = this;
|
||||||
that.$refs.form.validate(valid => {
|
that.$refs.form.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
that.submitLoading = true
|
that.submitLoading = true;
|
||||||
if (that.form.id) {
|
if (that.form.id) {
|
||||||
updateBadge(that.form)
|
updateBadge(that.form)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
that.submitLoading = false
|
that.submitLoading = false;
|
||||||
that.formVisible = false
|
that.formVisible = false;
|
||||||
that.form = getFormData()
|
that.form = getFormData();
|
||||||
that.fileList = []
|
that.fileList = [];
|
||||||
that.renderData()
|
that.renderData();
|
||||||
})
|
})
|
||||||
.catch(er => {
|
.catch(er => {
|
||||||
that.submitLoading = false
|
that.submitLoading = false;
|
||||||
that.$emit('fial', er)
|
that.$emit("fial", er);
|
||||||
})
|
});
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
addBadge(that.form)
|
addBadge(that.form)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
that.submitLoading = false
|
that.submitLoading = false;
|
||||||
that.formVisible = false
|
that.formVisible = false;
|
||||||
that.form = getFormData()
|
that.form = getFormData();
|
||||||
that.fileList = []
|
that.fileList = [];
|
||||||
that.renderData()
|
that.renderData();
|
||||||
})
|
})
|
||||||
.catch(er => {
|
.catch(er => {
|
||||||
that.submitLoading = false
|
that.submitLoading = false;
|
||||||
console.error(er)
|
console.error(er);
|
||||||
that.$emit('fial', er)
|
that.$emit("fial", er);
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
console.error('error submit!!')
|
console.error("error submit!!");
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
// 删除
|
// 删除
|
||||||
handlDel(id) {
|
handlDel(id) {
|
||||||
this.$confirm('确认删除吗?', '提示', {
|
this.$confirm("确认删除吗?", "提示", {
|
||||||
type: 'warning'
|
type: "warning"
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.listLoading = true
|
this.listLoading = true;
|
||||||
deleteBadge(id).then(res => {
|
deleteBadge(id).then(res => {
|
||||||
this.listLoading = false
|
this.listLoading = false;
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '删除成功',
|
message: "删除成功",
|
||||||
type: 'success'
|
type: "success"
|
||||||
})
|
});
|
||||||
this.renderData()
|
this.renderData();
|
||||||
})
|
});
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {});
|
||||||
},
|
},
|
||||||
handleClose() {
|
handleClose() {
|
||||||
// 去除校验
|
// 去除校验
|
||||||
this.$refs.form.clearValidate()
|
this.$refs.form.clearValidate();
|
||||||
this.fileList = []
|
this.fileList = [];
|
||||||
this.formVisible = false
|
this.formVisible = false;
|
||||||
},
|
},
|
||||||
handleCreate() {
|
handleCreate() {
|
||||||
this.formVisible = true
|
this.formVisible = true;
|
||||||
this.textOptTitle = '添加'
|
this.textOptTitle = "添加";
|
||||||
this.form = getFormData()
|
this.form = getFormData();
|
||||||
},
|
},
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.textOptTitle = '修改'
|
this.textOptTitle = "修改";
|
||||||
this.formVisible = true
|
this.formVisible = true;
|
||||||
this.form = Object.assign(this.form, row)
|
this.form = Object.assign(this.form, row);
|
||||||
},
|
},
|
||||||
clickEditSource(row) {
|
clickEditSource(row) {
|
||||||
this.sourceEditVisible = true
|
this.sourceEditVisible = true;
|
||||||
this.sourceEditRow = row
|
this.sourceEditRow = row;
|
||||||
},
|
},
|
||||||
editSourceClose() {
|
editSourceClose() {
|
||||||
this.sourceEditVisible = false
|
this.sourceEditVisible = false;
|
||||||
this.sourceEditRow = null
|
this.sourceEditRow = null;
|
||||||
this.renderData()
|
this.renderData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.box-card {
|
.box-card {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user