From 0a24ffeb3eff074c8f11e9f94fdf2c2cb4929799 Mon Sep 17 00:00:00 2001 From: quanyawei <401863037@qq.com> Date: Fri, 10 Nov 2023 13:08:29 +0800 Subject: [PATCH] fix:小程序详情修改 --- pages/actionChange/workOrderDetails/index.vue | 30 +++++-- pages/actionChange/agencyPage/index.vue | 46 +++++----- pages/actionChange/newPage/index.vue | 5 pages/actionChange/components/rectificationInfor.vue | 2 App.vue | 105 ++++++++++++-------------- pages/actionChange/components/basicInfor.vue | 35 +------- pages/index/index.vue | 11 +- 7 files changed, 108 insertions(+), 126 deletions(-) diff --git a/App.vue b/App.vue index 3c6773b..442e41d 100644 --- a/App.vue +++ b/App.vue @@ -3,7 +3,6 @@ getDic } from '@/utils/login.js' // ������������ import store from '@/store/index.js' - import routingIntercept from '@/utils/permission.js' import { httpPost, httpGet @@ -13,22 +12,22 @@ console.log('optionsonShow', options) if (options.scene === 1007 || options.scene === 1014 || options.scene === 1008) { // ������������������������������������ - this.getWXCode() + // this.getWXCode() } }, onLaunch() { // ������������������ let token = uni.getStorageSync('token') - console.log('apptoken', token) + console.log('apptoken1', !token) if (!token) { uni.login({ provider: 'weixin', success: loginRes => { - console.log('loginRes', loginRes) + console.log('loginRes1', loginRes) httpGet('/AppUser/wx/login', { 'code': loginRes.code }).then(result => { - routingIntercept() + console.log('AppUser1', result) try { if (result.data.code === 0) { uni.clearStorageSync() @@ -79,59 +78,53 @@ * */ getWXCode() { - let token = uni.getStorageSync('token') - console.log('apptoken', token) - if (!token) { - uni.login({ - provider: 'weixin', - success: loginRes => { - console.log('loginRes', loginRes) - httpGet('/AppUser/wx/login', { - 'code': loginRes.code - }).then(result => { - routingIntercept() - try { - if (result.data.code === 0) { - uni.clearStorageSync() - uni.setStorageSync('userInfor', JSON.stringify(result.data)) - uni.setStorageSync('tonken', result.data.token) - uni.setStorageSync('openId', result.data.openId) - getDic() - this.$isResolve() - } else { - uni.clearStorageSync() - uni.setStorageSync('openId', result.data.openId) - uni.showModal({ - title: '���������', - content: '������������������������������������������', - showCancel: false, - confirmText: '������', - success: res => { - if (res.confirm) { - uni.reLaunch({ - url: '/pages/login/login', - }) - } - }, - }) - this.$isResolve() - } - } catch (e) { - console.error(e) + uni.login({ + provider: 'weixin', + success: loginRes => { + console.log('loginRes2', loginRes) + httpGet('/AppUser/wx/login', { + 'code': loginRes.code + }).then(result => { + console.log('AppUser2', result) + try { + if (result.data.code === 0) { + uni.clearStorageSync() + uni.setStorageSync('userInfor', JSON.stringify(result.data)) + uni.setStorageSync('tonken', result.data.token) + uni.setStorageSync('openId', result.data.openId) + getDic() + this.$isResolve() + } else { + uni.clearStorageSync() + uni.setStorageSync('openId', result.data.openId) + uni.showModal({ + title: '���������', + content: '������������������������������������������', + showCancel: false, + confirmText: '������', + success: res => { + if (res.confirm) { + uni.reLaunch({ + url: '/pages/login/login', + }) + } + }, + }) + this.$isResolve() } - }).catch(errors => { - console.log('appdddd', errors) - uni.showToast({ - title: errors, - icon: 'none', - }) - this.$isResolve() + } catch (e) { + console.error(e) + } + }).catch(errors => { + console.log('appdddd2', errors) + uni.showToast({ + title: errors, + icon: 'none', }) - } - }) - } else { - this.$isResolve() - } + this.$isResolve() + }) + } + }) }, getLogin(data) { // ������������������������code������������������������ diff --git a/pages/actionChange/agencyPage/index.vue b/pages/actionChange/agencyPage/index.vue index fd65512..cb67a5d 100644 --- a/pages/actionChange/agencyPage/index.vue +++ b/pages/actionChange/agencyPage/index.vue @@ -24,7 +24,7 @@ <uni-datetime-picker v-model="range" type="daterange" rangeSeparator="���" /> </view> <view> - <u-button type="primary" size="small" text="������" @click="getWorkOrder"></u-button> + <u-button type="primary" size="small" text="������" @click="getSearch" throttleTime='500'></u-button> </view> </view> <view :key="index" v-for="(item, index) in workOderList" class="workOrderDetail" @@ -107,11 +107,7 @@ <view class="wholeLine"> <text class="rowTipContenetLabel">������������:</text> <text class="rowTipContenetAll"> - {{ unitList.find( - (a) => - item && parseInt(a.unitId) === item.escalationUnitId - ).unitName - }} + {{ item.escalationUnitName}} </text> </view> </view> @@ -285,8 +281,17 @@ currentPage: 1, pageSize: 10 } + this.workOderList = [] this.startTime = '' this.endTime = '' + uni.$u.throttle(this.getWorkOrder, 500) + }, + getSearch() { + this.workOderList = [] + this.page = { + currentPage: 1, + pageSize: 10 + } this.getWorkOrder() }, // ������������������list @@ -332,29 +337,24 @@ this.isLoading = true this.status = 'loadmore' } - if (this.page.currentPage === res.data.page.currentPage) { - this.workOderList = res.data.list - } else { - res.data.list.forEach(el => { - this.workOderList.push(el) - }) - } + res.data.list.forEach(el => { + this.workOderList.push(el) + }) } else { this.status = 'nomore' } }) }, handleClick(e, pageState) { - this.$http.httpGet('/allocation/detail', { - id: e.allocationId - }).then(res => { - let data = res.data - data.pageState = e.stateName === '���������' ? pageState : 'view' - data.stateName = e.stateName - let myData = JSON.stringify(data) - uni.navigateTo({ - url: '/pages/actionChange/workOrderDetails/index?infor=' + myData + '&type=jump', - }) + let data = {} + data.pageState = e.stateName === '���������' ? pageState : 'view' + data.stateName = e.stateName + data.allocationId = e.allocationId + data.state = e.state + data.allocationNum = e.allocationNum + let myData = JSON.stringify(data) + uni.navigateTo({ + url: '/pages/actionChange/workOrderDetails/index?infor=' + myData + '&type=jump', }) }, }, diff --git a/pages/actionChange/components/basicInfor.vue b/pages/actionChange/components/basicInfor.vue index 02d62e3..441f890 100644 --- a/pages/actionChange/components/basicInfor.vue +++ b/pages/actionChange/components/basicInfor.vue @@ -38,7 +38,7 @@ <view class="wholeLine"> <text class="rowTipContenetLabel">������������:</text> <text class="rowTipContenetAll"> - {{ unitName }} + {{ basicInfor.unitName }} </text> </view> </view> @@ -46,7 +46,7 @@ <view class="wholeLine"> <text class="rowTipContenetLabel">������������:</text> <text class="rowTipContenetAll"> - {{ polluteType }} + {{ basicInfor.polluteTypeName }} </text> </view> </view> @@ -76,7 +76,7 @@ <view class="wholeLine"> <text class="rowTipContenetLabel">������������:</text> <text class="rowTipContenetAll"> - {{ escalationUnitName }} + {{ basicInfor.escalationUnitName }} </text> </view> </view> @@ -119,34 +119,7 @@ baseUrl: this.$storage.get('baseUrl'), } }, - computed: { - unitName() { - let data = '' - if (this.basicInfor.unitId && this.unitList.length > 0) { - data = this.unitList && this.unitList.find(a => Number(a.unitId) === Number(this.basicInfor.unitId)) - .unitName - } - return data - }, - escalationUnitName() { - let data = '' - if (this.basicInfor.unitId && this.unitList.length > 0) { - data = this.unitList && this.unitList.find(a => Number(a.unitId) === Number(this.basicInfor - .escalationUnitId)).unitName - } - return data - }, - polluteType() { - let data = '' - console.log('this.polluteList', this.polluteList) - console.log('this.basicInfor.polluteType', this.basicInfor.polluteType) - if (String(this.basicInfor.polluteType) && this.polluteList.length > 0) { - data = this.polluteList.find(a => Number(a.dataKey) === Number(this.basicInfor.polluteType)).dataValue - } - console.log('data', data) - return data - } - }, + computed: {}, watch: { basicInfor: { handler: function(newValue, oldValue) { diff --git a/pages/actionChange/components/rectificationInfor.vue b/pages/actionChange/components/rectificationInfor.vue index 61e5a2f..109d740 100644 --- a/pages/actionChange/components/rectificationInfor.vue +++ b/pages/actionChange/components/rectificationInfor.vue @@ -33,7 +33,7 @@ <u-form-item label="������������:" :required="!pageState" :border-bottom="false"> <u-radio-group v-model="form.isChange" @change="radioGroupChange"> <u-radio :key="index" v-for="(item, index) in list" - :custom-style="{marginRight: '8px'}" :label="item.name" + :custom-style="{marginRight: '16px'}" :label="item.name" :name="item.value" /> </u-radio-group> </u-form-item> diff --git a/pages/actionChange/newPage/index.vue b/pages/actionChange/newPage/index.vue index 691a507..897b1bc 100644 --- a/pages/actionChange/newPage/index.vue +++ b/pages/actionChange/newPage/index.vue @@ -62,8 +62,9 @@ </view> </u-form-item> </u-form> - <u-picker :show="showCheckBox" keyName="label" :columns="actionOptionList" @cancel="showCheckBox = false" - :immediateChange='true' @confirm="selectBack"></u-picker> + <u-picker v-if="showCheckBox" :show="showCheckBox" keyName="label" :columns="actionOptionList" + @cancel="showCheckBox = false" :default-selector="[0]" :immediateChange='true' + @confirm="selectBack"></u-picker> <!-- <u-action-sheet v-if="actionOptionList.length > 0" :actions="actionOptionList" :show="showCheckBox" title="���������" @close="showCheckBox = false" @select="selectBack" /> --> <view class="bunts"> diff --git a/pages/actionChange/workOrderDetails/index.vue b/pages/actionChange/workOrderDetails/index.vue index de61d5b..550a248 100644 --- a/pages/actionChange/workOrderDetails/index.vue +++ b/pages/actionChange/workOrderDetails/index.vue @@ -2,10 +2,10 @@ <view class="mainContent"> <basicInfor :basic-infor="basicInfor" v-if="isShow" /> <rectificationInfor ref="rectificationInfor" :basic-infor="basicInfor" - v-if="!(pageState === 'view' && basicInfor.state === 20)" /> - <approvalnfor ref="approvalnfor" v-if="basicInfor.state >= 30 && basicInfor.stateName!=='���������'" + v-if="!(pageState === 'view' && basicInfor.state === 20)&&isShow" /> + <approvalnfor ref="approvalnfor" v-if="basicInfor.state >= 30 && basicInfor.stateName!=='���������' && isShow" :basic-infor="basicInfor" /> - <view class="bunts"> + <view class="bunts" v-if="isShow"> <view class="but butRight"> <u-button shape="square" @click="refuse" type="error" v-if="pageState==='edit'&& basicInfor.state >= 30">������</u-button> @@ -34,7 +34,7 @@ basicInfor: {}, unitListL: [], userInfor: null, - show: false, + show: true, isShow: false, option: {} } @@ -47,7 +47,7 @@ created() { this.getUnitList() }, - onLoad: function(option) { + onLoad(option) { //option���object������������������������������������������������ this.basicInfor = JSON.parse(option.infor) // let type = JSON.parse(option.type) @@ -55,8 +55,8 @@ this.option = option }, async mounted() { - //������������������ await this.$onLaunched + //������������������ this.userInfor = JSON.parse(uni.getStorageSync('userInfor') || 'null') console.log('������������������������', this.userInfor) if (this.option.type === 'share' && this.userInfor) { @@ -83,12 +83,12 @@ // ������������ this.basicInfor.pageState = 'edit' this.basicInfor.stateName = res.data.name - this.isShow = true + this.getData() } else if (res.data.code === 2) { // ��������� - this.isShow = true this.basicInfor.pageState = 'view' this.basicInfor.stateName = res.data.name + this.getData() } }).catch(errors => { console.log('���������������������', errors) @@ -96,11 +96,23 @@ }) } else { this.isShow = true + this.getData() } console.log('this.basicInfor123', this.basicInfor) }, methods: { - closePop() {}, + getData() { + this.$http.httpGet('/allocation/detail', { + id: this.basicInfor.allocationId + }).then(res => { + this.isShow = true + this.show = false + this.basicInfor = { + ...this.basicInfor, + ...res.data + } + }) + }, getUnitList() { this.$http.httpGet('/allocation/unit').then(res => { this.unitList = res.data diff --git a/pages/index/index.vue b/pages/index/index.vue index 603ec4c..0c2d839 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -27,18 +27,20 @@ myInfor, tabBar }, - onLoad(option) {}, + async onLoad() { + await this.$onLaunched + this.getData() + }, onReady() {}, onShow() { this.currIndex = '0' this.showTabBar = true }, - async mounted() { + mounted() { //������������������ - await this.$onLaunched this.token = uni.getStorageSync('tonken') + console.log('������������index���������', this.token) this.loading = false - this.getData() uni.$on('currIndex', data => { console.log('currIndexOn', data) this.currIndex = data.data.index @@ -49,6 +51,7 @@ }, methods: { getData() { + console.log('������������') this.$refs.agencyPage.getContaminateList() }, handleChangeTabe(index) { -- Gitblit v1.8.0