diff --git a/src/main.js b/src/main.js index aa29e23..efa014e 100644 --- a/src/main.js +++ b/src/main.js @@ -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; +} + diff --git a/src/views/BasicSetting/_addReward/index.vue b/src/views/BasicSetting/_addReward/index.vue index d463934..475fd12 100644 --- a/src/views/BasicSetting/_addReward/index.vue +++ b/src/views/BasicSetting/_addReward/index.vue @@ -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(() => {}); + } }, } }) diff --git a/src/views/BasicSetting/_rewardRule/index.vue b/src/views/BasicSetting/_rewardRule/index.vue index 1330d69..ea90e99 100644 --- a/src/views/BasicSetting/_rewardRule/index.vue +++ b/src/views/BasicSetting/_rewardRule/index.vue @@ -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'}) diff --git a/src/views/QuestManage/_questList/index.vue b/src/views/QuestManage/_questList/index.vue index c66a5ee..3dc4344 100644 --- a/src/views/QuestManage/_questList/index.vue +++ b/src/views/QuestManage/_questList/index.vue @@ -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}}) }, } }) diff --git a/src/views/QuestManage/_questRelease/index.vue b/src/views/QuestManage/_questRelease/index.vue index f356970..14b9b9c 100644 --- a/src/views/QuestManage/_questRelease/index.vue +++ b/src/views/QuestManage/_questRelease/index.vue @@ -50,7 +50,7 @@ - + @@ -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]; diff --git a/src/views/StarwayInfo/index.vue b/src/views/StarwayInfo/index.vue index e1de6bf..7ebb873 100644 --- a/src/views/StarwayInfo/index.vue +++ b/src/views/StarwayInfo/index.vue @@ -19,8 +19,7 @@