From e49e0e98c6776900bc3578ed2fe880bfceeb1c2c Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Wed, 08 Nov 2023 15:53:26 +0800
Subject: [PATCH] fix:查看详情权限修改

---
 pages/actionChange/workOrderDetails/index.vue |   13 ++
 utils/request.js                              |  145 ++++++++++++++++++------------------
 App.vue                                       |   67 +++++++++++++++-
 pages/actionChange/components/fileUpload.vue  |    1 
 pages/index/index.vue                         |    2 
 5 files changed, 143 insertions(+), 85 deletions(-)

diff --git a/App.vue b/App.vue
index 3380106..3c6773b 100644
--- a/App.vue
+++ b/App.vue
@@ -9,6 +9,13 @@
 		httpGet
 	} from '@/utils/http.js'
 	export default {
+		onShow: function(options) {
+			console.log('optionsonShow', options)
+			if (options.scene === 1007 || options.scene === 1014 || options.scene === 1008) {
+				// ������������������������������������
+				this.getWXCode()
+			}
+		},
 		onLaunch() {
 			// ������������������
 			let token = uni.getStorageSync('token')
@@ -72,13 +79,59 @@
 			 *
 			 */
 			getWXCode() {
-				let that = this
-				uni.login({
-					provider: 'weixin',
-					success(res) {
-						that.getLogin(res.code)
-					}
-				})
+				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)
+								}
+							}).catch(errors => {
+								console.log('appdddd', errors)
+								uni.showToast({
+									title: errors,
+									icon: 'none',
+								})
+								this.$isResolve()
+							})
+						}
+					})
+				} else {
+					this.$isResolve()
+				}
 			},
 			getLogin(data) {
 				// ������������������������code������������������������
diff --git a/pages/actionChange/components/fileUpload.vue b/pages/actionChange/components/fileUpload.vue
index 72461e8..b09c5b2 100644
--- a/pages/actionChange/components/fileUpload.vue
+++ b/pages/actionChange/components/fileUpload.vue
@@ -31,7 +31,6 @@
 		},
 		created() {
 			this.token = uni.getStorageSync('tonken')
-			console.log('tonken', this.token)
 		},
 		computed: {
 			uploadTermExcelUrl() {
diff --git a/pages/actionChange/workOrderDetails/index.vue b/pages/actionChange/workOrderDetails/index.vue
index 887b070..de61d5b 100644
--- a/pages/actionChange/workOrderDetails/index.vue
+++ b/pages/actionChange/workOrderDetails/index.vue
@@ -58,13 +58,15 @@
 			//������������������ 
 			await this.$onLaunched
 			this.userInfor = JSON.parse(uni.getStorageSync('userInfor') || 'null')
+			console.log('������������������������', this.userInfor)
 			if (this.option.type === 'share' && this.userInfor) {
 				let params = {
 					allocationNum: this.basicInfor.allocationNum,
 					userId: this.userInfor.userId
 				}
 				this.$http.httpGet('/allocationApp/authority', params).then(res => {
-					if (res.data === 3) {
+					console.log('������������������', res)
+					if (res.data.code === 3) {
 						uni.showModal({
 							content: '���������������������������������������������',
 							showCancel: false,
@@ -77,15 +79,20 @@
 								}
 							},
 						})
-					} else if (res.data === 1) {
+					} else if (res.data.code === 1) {
 						// ������������
 						this.basicInfor.pageState = 'edit'
+						this.basicInfor.stateName = res.data.name
 						this.isShow = true
-					} else if (res.data === 2) {
+					} else if (res.data.code === 2) {
 						// ���������
 						this.isShow = true
 						this.basicInfor.pageState = 'view'
+						this.basicInfor.stateName = res.data.name
 					}
+				}).catch(errors => {
+					console.log('���������������������', errors)
+					console.log('���������������������params', params)
 				})
 			} else {
 				this.isShow = true
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 76ce2ed..603ec4c 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -37,7 +37,6 @@
 			//������������������
 			await this.$onLaunched
 			this.token = uni.getStorageSync('tonken')
-			console.log('indextoken', this.token)
 			this.loading = false
 			this.getData()
 			uni.$on('currIndex', data => {
@@ -50,7 +49,6 @@
 		},
 		methods: {
 			getData() {
-				console.log('indextokengetContaminateList')
 				this.$refs.agencyPage.getContaminateList()
 			},
 			handleChangeTabe(index) {
diff --git a/utils/request.js b/utils/request.js
index d863cdf..72551c2 100644
--- a/utils/request.js
+++ b/utils/request.js
@@ -1,76 +1,77 @@
 import storage from './storage' // ������������
 import store from '../store/index.js'
 export default {
-    console(options) {
-        if (config.debug) {
-            console.log('<<===============================================>>')
-            // console.log("request start");
-            // console.log("header" + JSON.stringify(options.header));
-            // console.log("method: " + options.method + " URL: " + options.url);
-            // console.log(options.data);
-            // console.log("request end");
-            // console.log("<<===============================================>>");
-        }
-    },
-    domain() {
-        return config.uni_app_web_api_url.replace('api', '')
-    },
-    send(options = {}, isLogin = true) {
-        const baseUrl = process.uniEnv.baseUrl
-        storage.set('baseUrl', baseUrl)
-        // loading������
-        uni.showLoading({ title: '���������', })
-        // ���������������������������������������������
-        // uni.showLoading({ title: baseUrl, })
-        options.url = baseUrl + '' + options.url
-        // ������������
-        options.method = options.method || 'GET'
-        // ������������������
-        if (isLogin) {
-            let token = uni.getStorageSync('tonken')
-            console.log('token', token)
-            if (token !== null) {
-                // options.header["token"] = token;
-                options.header = {
-                    token: token,
-                    Authorization: token,
-                }
-            }
-        }
-        // this.console(options); // ���������������������������������������������������
-        // ������Promise������
-        return new Promise((resolve, reject) => {
-            uni.request(options).then(data => {
-                var [error, res] = data
-                if (error !== null) {
-                    reject(error)
-                } else {
-                    // ���������������������������������������������������������������������������
-                    if (res.data.code === 0) {
-                        uni.hideLoading()
-                        // uni.navigateTo({
-                        //   url: "/pages/Login/login/login",
-                        // });
-                        resolve(res.data)
-                    } else {
-                        uni.hideLoading()
-                        reject(res.data.message)
-                    }
-                }
-            })
-        })
-    },
-    get(url = '', data = {}, isLogin = true) {
-        return this.send({
-            url: url,
-            data: data,
-        }, isLogin)
-    },
-    post(url = '', data = {}, isLogin = true) {
-        return this.send({
-            url: url,
-            data: data,
-            method: 'POST',
-        }, isLogin)
-    },
+	console(options) {
+		if (config.debug) {
+			console.log('<<===============================================>>')
+			// console.log("request start");
+			// console.log("header" + JSON.stringify(options.header));
+			// console.log("method: " + options.method + " URL: " + options.url);
+			// console.log(options.data);
+			// console.log("request end");
+			// console.log("<<===============================================>>");
+		}
+	},
+	domain() {
+		return config.uni_app_web_api_url.replace('api', '')
+	},
+	send(options = {}, isLogin = true) {
+		const baseUrl = process.uniEnv.baseUrl
+		storage.set('baseUrl', baseUrl)
+		// loading������
+		uni.showLoading({
+			title: '���������',
+		})
+		// ���������������������������������������������
+		// uni.showLoading({ title: baseUrl, })
+		options.url = baseUrl + '' + options.url
+		// ������������
+		options.method = options.method || 'GET'
+		// ������������������
+		if (isLogin) {
+			let token = uni.getStorageSync('tonken')
+			if (token !== null) {
+				// options.header["token"] = token;
+				options.header = {
+					token: token,
+					Authorization: token,
+				}
+			}
+		}
+		// this.console(options); // ���������������������������������������������������
+		// ������Promise������
+		return new Promise((resolve, reject) => {
+			uni.request(options).then(data => {
+				var [error, res] = data
+				if (error !== null) {
+					reject(error)
+				} else {
+					// ���������������������������������������������������������������������������
+					if (res.data.code === 0) {
+						uni.hideLoading()
+						// uni.navigateTo({
+						//   url: "/pages/Login/login/login",
+						// });
+						resolve(res.data)
+					} else {
+						uni.hideLoading()
+						reject(res.data.message)
+					}
+				}
+			})
+		})
+	},
+	get(url = '', data = {}, isLogin = true) {
+		return this.send({
+			url: url,
+			data: data,
+		}, isLogin)
+	},
+	post(url = '', data = {}, isLogin = true) {
+		return this.send({
+			url: url,
+			data: data,
+			method: 'POST',
+		}, isLogin)
+	},
 }
\ No newline at end of file

--
Gitblit v1.8.0