Browse Source

修改bug

“yueshang” 1 year ago
parent
commit
1705f47af8
2 changed files with 43 additions and 24 deletions
  1. 24 12
      pagesA/fire/check_inspection/check_inspection.vue
  2. 19 12
      utils/request.js

+ 24 - 12
pagesA/fire/check_inspection/check_inspection.vue

@@ -128,7 +128,8 @@
 						<view style="position: relative;width: 180rpx;float: left;margin: 10rpx 15rpx 0 0rpx;"
 							v-for="(items,indexs) in item.attUrl" :key="indexs">
 							<image :src="items" style="width: 160rpx;height: 160rpx;border-radius: 30rpx;float: left;">
-								<u-icon name="close" color="#4CB2B6" size="19" @click="closeImage(item,indexs,index)">
+								<u-icon name="close" color="#4CB2B6" size="19" @click="closeImage(item,indexs,index)"
+									class="icon-style">
 								</u-icon>
 						</view>
 					</view>
@@ -225,7 +226,8 @@
 						<view style="position: relative;width: 180rpx;float: left;margin: 10rpx 15rpx 0 0rpx;"
 							v-for="(items,indexs) in item.attUrl" :key="indexs">
 							<image :src="items" style="width: 160rpx;height: 160rpx;border-radius: 30rpx;float: left;">
-								<u-icon name="close" color="#4CB2B6" size="19" @click="closeImage(item,indexs,index)">
+								<u-icon name="close" color="#4CB2B6" size="19" @click="closeImage(item,indexs,index)"
+									class="icon-style">
 								</u-icon>
 						</view>
 					</view>
@@ -310,7 +312,7 @@
 	} from '@/api/fire_device';
 	import {
 		shijianc,
-			viewImgBig
+		viewImgBig
 	} from '@/utils/common.js'
 	//隐患弹框--
 	import {
@@ -496,15 +498,19 @@
 				})
 			},
 			closeImage(item, val, k) { //删除图片---5.25新加--未验证
-				if (this.manualPopup) { //手动检查
-					this.checkManualData[0].attUrl.splice(val, 1)
-				} else { //扫码添加
-					if (item.fpdType) {
-						this.insTypeData[k].attUrl.splice(val, 1)
-					}
-					// this.tableData[k].attUrl.splice(val, 1)
+		this.$nextTick(()=>{
+			if (this.manualPopup) { //手动检查
+				console.log(val, 'vvvvvvvvvvvvvvv');
+				this.checkManualData[0].attUrl.splice(val, 1)
+			
+			} else { //扫码添加
+				if (item.fpdType) {
+					this.insTypeData[k].attUrl.splice(val, 1)
 				}
-				that.$forceUpdate();
+				// this.tableData[k].attUrl.splice(val, 1)
+			}
+			this.$forceUpdate();
+		})
 			},
 			sexSelect(e) { //单位
 				this.formData.orgId = e.id;
@@ -843,7 +849,7 @@
 			checkPopupConfirm() { //弹出得到的那一条数据insTypeData的id    弹出保存
 				if (this.manualPopup) { //手动检查
 					this.saveImplement = this.checkManualData[0]
-					
+
 					this.saveImplement.dengerType = this.dengerType
 					this.saveImplement.hisResultCreateReqVOList = this.checkManualData[0].inspectSubDOList
 					this.saveImplement.dangerDescribe = this.dangerDescribe
@@ -1319,4 +1325,10 @@
 		background-color: #fff;
 		overflow-y: auto;
 	}
+
+	.icon-style {
+		position: absolute;
+		top: -8px;
+		right: 8px;
+	}
 </style>vh

+ 19 - 12
utils/request.js

@@ -66,25 +66,32 @@ const request = config => {
 							refreshToken({
 								refreshToken: getRefreshToken() // 刷新token的令牌存在token的对象里面,需要传给后端
 							}).then(reshRespore => {
+								console.log(reshRespore,
+									'reshResporereshResporereshRespore');
+								// 请求成功把新的token存到本地
 								setToken(reshRespore.data);
 								// 已经刷新了token,将所有队列中的请求进行重试
 								requests.forEach((item) => item(reshRespore.data
 									.accessToken))
 								requests = []
-								// 刷新完token后重新调用上一次的接口
-								resolve(uni.$u.http.request(config)) // 执行请求
-								if (reshRespore.code == 400||reshRespore.code == 500) {
-									showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => {
-										if (res.confirm) {
-											uni.navigateTo({
-												url: '/pages/login'
-											})
-										}
-									});
-								}
+								// 每个接口请求都要存入队列,等刷新完以后都需要执行
+								return new Promise((resolve) => {
+									// 将resolve放进队列,用一个函数形式来保存,等token刷新后直接执行
+									requests.push((token) => {
+										//这一步一定要有,刷新token,因为存入的信息是旧的token
+										response.config.header[
+												'Authorization'] =
+											'Bearer ' + token;
+										resolve(uni.$u.http.request(response
+											.config)) //执行请求
+
+									})
+								that.$forceUpdate()
+								})
 							})
-                           
+
 						} catch {
+							// 		uni.$u.toast('未知错误')
 							showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => {
 								if (res.confirm) {
 									uni.navigateTo({