From cb5ec12b4c3449870caa9addb4488ebf0ade52ae Mon Sep 17 00:00:00 2001 From: zhenghuang <236220500@qq.com> Date: Tue, 9 Jun 2020 08:51:35 +0800 Subject: [PATCH] 1 --- src/pages/recruit/BulletinIndex.vue | 145 +++++++++++++++------------- 1 file changed, 80 insertions(+), 65 deletions(-) diff --git a/src/pages/recruit/BulletinIndex.vue b/src/pages/recruit/BulletinIndex.vue index 6f7ad69..ec759de 100644 --- a/src/pages/recruit/BulletinIndex.vue +++ b/src/pages/recruit/BulletinIndex.vue @@ -3,47 +3,62 @@ + :schedule="welcome" + :show="showStoreCheck"> @@ -57,7 +72,7 @@ export default { components: { selectStoreStep, }, - data() { + data () { return { showStoreCheck: false, welcome: { @@ -66,78 +81,78 @@ export default { company: [], stores: [], }, - inidData:{}, - showUpload:false, - btnStr:'编辑', - imgUrl:'', - onWitch:false, - uploadUrl:"", - oldImg:"" + inidData: {}, + showUpload: false, + btnStr: '编辑', + imgUrl: '', + onWitch: false, + uploadUrl: "", + oldImg: "" }; }, - mounted: function() { - - }, - created() { + mounted: function () { + + }, + created () { this.initData(); }, inject: ['reload'], methods: { - witchChange(status) { + witchChange (status) { this.onWitch = status; }, - initData(){ + initData () { let that = this; bulletinService.getDetail({}, function (data) { console.log(data); - if(data.data.results.scheduleVO.params.length>0){ + if (data.data.results.scheduleVO.params.length > 0) { that.imgUrl = http.getBaseUrl() + data.data.results.scheduleVO.params[0].defaultVal; that.oldImg = http.getBaseUrl() + data.data.results.scheduleVO.params[0].defaultVal; } that.initData = data.data.results; - + that.welcome = { ...that.initData, company: [...that.initData.organizations] }; }, function (err) { - that.$Message.error("网络异常,请重试"); - that.setNoLoading(); + that.$Message.error("网络异常,请重试"); + that.setNoLoading(); }); }, doShow () { this.showStoreCheck = false this.welcome = store.getters.useData - console.log('@',this.welcome); + console.log('@', this.welcome); }, showStores () { - console.log({ ...store.getters.useData, ...this.welcome }) - store.commit('SET_useData', { ...store.getters.useData, ...this.welcome }) + console.log(this.welcome, { ...store.getters.useData, ...this.welcome, ...this.initData }) + store.commit('SET_useData', { ...store.getters.useData, ...this.welcome, ...this.initData }) this.showStoreCheck = true }, - onEdit(){ - if(this.btnStr == '编辑'){ + onEdit () { + if (this.btnStr == '编辑') { this.showUpload = true; this.btnStr = '保存' - }else{ - let _this = this; - this.initData.stores = this.welcome.stores; - this.initData.company = this.welcome.company; + } else { + let _this = this; + this.initData.stores = this.welcome.stores; + this.initData.company = this.welcome.company; let param = this.initData - if (param.stores.length <= 0) { - _this.$Message.error("请至少选择一个店铺"); - _this.loading = false; - return false; - } + if (param.stores.length <= 0) { + _this.$Message.error("请至少选择一个店铺"); + _this.loading = false; + return false; + } param.isGetActivityInfo = true; - if(this.onWitch){ + if (this.onWitch) { param.status = 1; param.stores.forEach(item => { item.status = 1; }) - }else{ + } else { param.status = 3; param.stores.forEach(item => { item.status = 2; }) } - if(this.uploadUrl != ""){ + if (this.uploadUrl != "") { param.scheduleVO.params.forEach(item => { item.defaultVal = item.description = this.uploadUrl; @@ -147,15 +162,15 @@ export default { console.log(data); _this.$Message.info("保存成功"); _this.btnStr = '编辑' - _this.showUpload = false; + _this.showUpload = false; }, function (err) { - _this.$Message.error("网络异常,请重试"); - _this.setNoLoading(); + _this.$Message.error("网络异常,请重试"); + _this.setNoLoading(); }); } }, - onCancel(){ - this.showUpload = false; + onCancel () { + this.showUpload = false; this.imgUrl = this.oldImg; this.btnStr = '编辑' },