zx 3 years ago
parent d928b21d60
commit 30cf181472

@ -34,4 +34,9 @@ for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component('svg-icon', SvgIcon);
app.mount('#app');
//静态地址
app.config.globalProperties.$ImgUrl = (src) => {
return 'http://cdn.sws010.com'+ src;
}

@ -51,7 +51,23 @@ export default defineComponent({
activeId
}
},
mounted() {
this.getApi()
},
methods: {
getApi() {
if(this.$route.params.id) {
this.proxy.$post("/rewardRuleTemplate/detail", {id: this.$route.params.id}).then(res => {
this.form.title = res.data.title;
let arr = [];
res.data.ruleList.forEach(ele => {
let obj = {min: ele.min, max: ele.max, reward: ele.reward};
arr.push(obj)
});
this.form.rewardRuleList = arr;
}).catch(() => {});
}
},
addRule() {
this.form.rewardRuleList.push({min: 0,max: 0,reward: 0})
},
@ -59,10 +75,18 @@ export default defineComponent({
this.form.rewardRuleList = [{min: 0, max: 0, reward: 0}]
},
confirm() {
this.proxy.$post("/rewardRuleTemplate/add", this.form).then(res => {
this.$message.success(res.data)
this.$router.go(-1);
}).catch(() => {});
if(this.$route.params.id) {
let obj = Object.assign(this.form, {id: this.$route.params.id})
this.proxy.$post("/rewardRuleTemplate/upd", obj).then(res => {
this.$message.success(res.data)
this.$router.go(-1);
}).catch(() => {});
} else {
this.proxy.$post("/rewardRuleTemplate/add", this.form).then(res => {
this.$message.success(res.data)
this.$router.go(-1);
}).catch(() => {});
}
},
}
})

@ -90,7 +90,7 @@ export default defineComponent({
getData() {
let obj = Object.assign({pageNum: this.pagination.current,pageSize: this.pagination.pageSize})
this.proxy.$post("/rewardRuleTemplate/list", obj).then(res => {
const data = res.data;
const data = res.data.records;
this.tableData.data = data;
}).catch(() => {});
},
@ -98,7 +98,7 @@ export default defineComponent({
},
handlerEdit(value) {
this.$router.push({name: 'AddReward', params:{id:value}})
},
goAdd() {
this.$router.push({name: 'AddReward'})

@ -130,7 +130,7 @@ export default defineComponent({
this.$router.push({ name: "QuestRelease" })
},
goEdit(value) {
this.$router.push({ name: "QuestRelease",params:{id:value}})
this.$router.push({ name: "QuestRelease", params:{id:value}})
},
}
})

@ -50,7 +50,7 @@
</el-form-item>
<el-form-item label="奖励规则">
<el-select v-model="form.rewardRuleTemplateId" @change="ruleChange">
<el-option v-for="(item,index) in ruleData" :key="index" :value="item.id" :label="item.title">
<el-option v-for="(item) in ruleData" :key="item.id" :value="item.id" :label="item.title">
</el-option>
</el-select>
<el-table :data="ruleTable.data" border style="margin-top: 16px">
@ -81,7 +81,7 @@ export default defineComponent({
start: '',
end: '',
coverUrl: '',
rewardRuleTemplateId: undefined,
rewardRuleTemplateId: null,
brandList: [],
tagList: [],
referenceList: []
@ -104,7 +104,6 @@ export default defineComponent({
},
mounted() {
this.getApi();
this.activeId.value = this.$route.params.id;
},
methods: {
getApi() {
@ -115,11 +114,26 @@ export default defineComponent({
this.brandData = res.data.records;
}).catch(() => {});
this.proxy.$post("/rewardRuleTemplate/list", {}).then(res => {
this.ruleData = res.data;
this.ruleData = res.data.records;
}).catch(() => {});
this.proxy.$post("/reference/list", {}).then(res => {
this.refData = res.data.records;
}).catch(() => {});
if(this.$route.params.id) {
this.proxy.$post("/task/detail", {id: this.$route.params.id}).then(res => {
this.form.title = res.data.title;
this.form.subtitle = res.data.subtitle;
this.form.start = res.data.start;
this.form.end = res.data.end;
this.form.coverUrl = res.data.coverUrl;
this.selTime = [res.data.start,res.data.end]
this.form.rewardRuleTemplateId = res.data.rewardRuleTemplateId;
this.ruleChange(res.data.rewardRuleTemplateId);
res.data.referenceList.forEach(ele => {this.form.referenceList.push(ele.id)})
res.data.brandList.forEach(ele => {this.form.brandList.push(ele.id)})
res.data.tagList.forEach(ele => {this.form.tagList.push(ele.id)})
}).catch(() => {});
}
},
selectAll(value) {
if(value == true) {
@ -134,10 +148,18 @@ export default defineComponent({
}).catch(() => {});
},
confirm() {
this.proxy.$post("/task/add", this.form).then(res => {
this.$message.success(res.data);
this.$router.go(-1);
}).catch(() => {});
if(this.$route.params.id) {
let obj = Object.assign(this.form, {id: this.$route.params.id})
this.proxy.$post("/task/upd", obj).then(res => {
this.$message.success(res.data);
this.$router.go(-1);
}).catch(() => {});
} else {
this.proxy.$post("/task/add", this.form).then(res => {
this.$message.success(res.data);
this.$router.go(-1);
}).catch(() => {});
}
},
timeChange(val) {
this.form.start = val[0];

@ -19,8 +19,7 @@
<el-table-column prop="type" label="动态类型" :formatter="statusFormatter" width="100"></el-table-column>
<el-table-column prop="cover" label="封面" >
<template #default="scope">
<!-- {{'cdn.sws010.com' + scope.row.cover}} -->
<img :src="'cdn.sws010.com'+scope.row.cover" />
<img style="width: 200px;height: 100px" :src="$ImgUrl(scope.row.cover)" />
</template>
</el-table-column>
<el-table-column prop="action" label="操作" fixed="right" width="240">

Loading…
Cancel
Save