Parcourir la source

修改bug,主动检查弹框样式还未修改成功

“yueshang” il y a 1 an
Parent
commit
d33f16b507

+ 33 - 29
main.js

@@ -28,35 +28,39 @@ const app = new Vue({
 	...App
 })
 app.$mount()
-var rsing=0
-rs()
-
-function rs(){
-	const nowTime = new Date().getTime()
-	if (rsing==0 && nowTime > (getExpiresTime()-10*1000)) {
-		rsing=1
-		console.log("===rs call")
-		refreshToken({
-			refreshToken: getRefreshToken()
-		}).then((res) => {
-			console.log(res.data, 'ressss')
-			setToken(res.data)
-			rsing=0
-		}).catch(() => {
-			/*
-			showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => {
-				if (res.confirm) {
-					uni.navigateTo({
-						url: '/pages/login'
-					})
-				}
-			})*/
-		})
-	}
-	 setTimeout(function(){
-		 rs()
-	 },1*1000)
-}
+console.log(getExpiresTime(),'getExpiresTime()');
+// var rsing=0
+// rs()
+// let isrefresh=false
+// function rs(){
+// 	const nowTime = new Date().getTime()
+// 	if (rsing==0 && nowTime > (getExpiresTime()-10*1000)&& !isrefresh) {
+// 		console.log("===rs call",)
+// 		refreshToken({
+// 			refreshToken: getRefreshToken()
+// 		}).then((res) => {
+// 			console.log(res.data, 'ressss')
+// 			setToken(res.data)
+// 			 isrefresh = true; // 设置标志变量为 true
+// 			rsing=0
+// 			setTimeout(function() {
+// 				isrefresh = false;
+// 			}, 11 * 1000)
+// 		}).catch(() => {
+// 			/*
+// 			showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => {
+// 				if (res.confirm) {
+// 					uni.navigateTo({
+// 						url: '/pages/login'
+// 					})
+// 				}
+// 			})*/
+// 		})
+// 	}
+// 	 setTimeout(function(){
+// 		 rs()
+// 	 },1*1000)
+// }
 // #ifdef H5
 Vue.mixin({
     mounted() {

+ 1 - 1
pages.json

@@ -343,7 +343,7 @@
 			}, {
 				"path": "fire/fire_station/people_fireStation/people_fireStation",
 				"style": {
-					"navigationBarTitleText": "编辑人员",
+					"navigationBarTitleText": "",
 					"enablePullDownRefresh": false,
 					"navigationStyle": "custom"
 				},

+ 3 - 2
pagesA/fire/check_active/check_implement/check_implement.vue

@@ -1022,7 +1022,7 @@
 													let imgUrl = JSON.parse(res
 														.data)
 													// that.imageList.push(imgUrl.data)
-													if (!val.fpdType && val
+													if (val
 														.inspType != 'fpd') {
 														that.tableData.map((i,
 															index) => {
@@ -1201,7 +1201,8 @@
 
 	.uni-grid-wraps {
 		margin-left: 60rpx;
-		margin-bottom: 40rpx;
+		// margin-bottom: 40rpx;
+		    margin-bottom: 480rpx !important;
 	}
 
 	/deep/.u-slide-up-enter-active[data-v-39e33bf2],

+ 65 - 52
pagesA/fire/check_inspection/check_inspection.vue

@@ -1,65 +1,65 @@
 <template>
 	<view class="uni-container uni-container-bg">
 		<view class="example container" :style="'height: ' + (screenHeight - 75) + 'px'">
-		<!-- 下拉框 -->
-		<view class="u-page__tag-item" style="margin-bottom: 26upx;width: 700upx;border-bottom: 2px solid #55cbbf;">
-			<u-form>
-				<u-form-item prop="orgName" @click="
+			<!-- 下拉框 -->
+			<view class="u-page__tag-item" style="margin-bottom: 26upx;width: 700upx;border-bottom: 2px solid #55cbbf;">
+				<u-form>
+					<u-form-item prop="orgName" @click="
 						showOrg = true;
 						hideKeyboard();
 					" label="单位选择:" labelWidth="120px">
-					<u--input border="none" disabled v-model="formData.orgName" placeholder="请选择所属单位"></u--input>
-					<u-icon slot="right" name="arrow-down" class="danwei"></u-icon>
-				</u-form-item>
-			</u-form>
-		</view>
-		<view class="tops" v-if="!getqrcode">
-			<view style="display: flex;flex-direction: column;">
-				<image :src="scan" class="tupian" @click="erWeiMa"></image>
-				<view style="margin-top: 20rpx;">设施扫码</view>
+						<u--input border="none" disabled v-model="formData.orgName" placeholder="请选择所属单位"></u--input>
+						<u-icon slot="right" name="arrow-down" class="danwei"></u-icon>
+					</u-form-item>
+				</u-form>
 			</view>
-			<!-- #ifdef H5 -->
-			<u-popup :show="qrScanShow" mode="center" @close="qrScanClose" @open="qrScanOpen" closeable
-				:safeAreaInsetTop="true" zoom>
-				<view class="qr-scan-containner">
-
-					<view class="qr-scan-middle">
-						<view class="qr-scan-title">
-							扫码
+			<view class="tops" v-if="!getqrcode">
+				<view style="display: flex;flex-direction: column;">
+					<image :src="scan" class="tupian" @click="erWeiMa"></image>
+					<view style="margin-top: 20rpx;">设施扫码</view>
+				</view>
+				<!-- #ifdef H5 -->
+				<u-popup :show="qrScanShow" mode="center" @close="qrScanClose" @open="qrScanOpen" closeable
+					:safeAreaInsetTop="true" zoom>
+					<view class="qr-scan-containner">
+
+						<view class="qr-scan-middle">
+							<view class="qr-scan-title">
+								扫码
+							</view>
+							<qrcode-stream class="qr-scan-view" @decode="onDecode" />
 						</view>
-						<qrcode-stream class="qr-scan-view" @decode="onDecode" />
 					</view>
-				</view>
-			</u-popup>
-			<!-- <view class="qrcode" v-if="qrcodeShow">
+				</u-popup>
+				<!-- <view class="qrcode" v-if="qrcodeShow">
 				<qrcode-stream @decode="onDecode" />
 			</view> -->
-			<!-- #endif -->
-			<view>
-				<image :src="Group" @click="
+				<!-- #endif -->
+				<view>
+					<image :src="Group" @click="
 						showMCheck = true;
 						hideKeyboard();
 					" class="tiantupian"></image>
-				<view style="margin-top: 20rpx;">手动添加</view>
-			</view>
-		</view>
-		<view class="cont" v-if="!getqrcode">
-			主动检查记录
-		</view>
-		<view v-if="!getqrcode" class="main-content">
-			<uni-card v-for="(item, index) in tableData" :key="index">
-				<view class="titles"><text class="name-align-task">检查项:</text>{{item.inspName}}
-					<u-icon v-if="item.isdenger==1" name="warning-fill" color="#ff5647" size="28"
-						:customStyle="{marginTop:'20px',backgroundColor:'#fff'}"></u-icon>
-				</view>
-				<view><text class="name-align-task">检查结果:</text>{{item.handleResult}}</view>
-				<view class="an-niu">
-					<text><text class="name-align-task">检查时间:</text>{{item.inspectTime}}</text>
-					<text @click="addClickDetail(item.id)" class="detail">查看详情</text>
+					<view style="margin-top: 20rpx;">手动添加</view>
 				</view>
-			</uni-card>
-		</view>
 			</view>
+			<view class="cont" v-if="!getqrcode">
+				主动检查记录
+			</view>
+			<view v-if="!getqrcode" class="main-content">
+				<uni-card v-for="(item, index) in tableData" :key="index">
+					<view class="titles"><text class="name-align-task">检查项:</text>{{item.inspName}}
+						<u-icon v-if="item.isdenger==1" name="warning-fill" color="#ff5647" size="28"
+							:customStyle="{marginTop:'20px',backgroundColor:'#fff'}"></u-icon>
+					</view>
+					<view><text class="name-align-task">检查结果:</text>{{item.handleResult}}</view>
+					<view class="an-niu">
+						<text><text class="name-align-task">检查时间:</text>{{item.inspectTime}}</text>
+						<text @click="addClickDetail(item.id)" class="detail">查看详情</text>
+					</view>
+				</uni-card>
+			</view>
+		</view>
 		<!-- 扫码弹出层 -->
 		<u-popup :show="maShow" :round="10" @close="maShow=false">
 			<view v-if="insTypeData!=''">
@@ -471,7 +471,10 @@
 			// ----扫码选择隐患
 			qrScanOpen() {},
 			async getInspect() {
-				const res = await getInspectInfo({pageNo:1,pageSize:100})
+				const res = await getInspectInfo({
+					pageNo: 1,
+					pageSize: 100
+				})
 				this.ManualData = res.data.list
 				this.actionsManual = res.data.list.filter(obj => obj.inspType !== 'fpd').map(obj => {
 					return {
@@ -525,6 +528,7 @@
 			},
 			SelectMCheck(e) { //手动选择
 				this.reselt()
+				this.loading = false
 				this.checkManualData = this.ManualData.filter(ManualDataItem => {
 					return ManualDataItem.id == e.id
 				})
@@ -1089,7 +1093,10 @@
 	::v-deep .u-icon__icon {
 		margin-right: 0px !important;
 	}
+	/deep/.u-popup__content {
+		overflow-y: auto;
 
+	}
 	.child {
 		margin: 20rpx 0 0 20rpx;
 		border-radius: 10rpx;
@@ -1161,7 +1168,8 @@
 
 	.uni-grid-wraps {
 		margin-left: 60rpx;
-		margin-bottom: 200rpx;
+		margin-bottom: 480rpx !important;
+		// margin-bottom: 200rpx;
 	}
 
 	/deep/.u-slide-up-enter-active[data-v-39e33bf2],
@@ -1243,9 +1251,12 @@
 	.manual {
 		font-size: 16px;
 		padding: 25rpx 0;
-		overflow-y: auto;
 	}
-
+    .manual:last-child{
+		font-size: 25px;
+		padding: 60rpx 0;
+		background-color: red;
+	}
 	.manual-hand {
 		margin-left: 30rpx;
 		display: flex;
@@ -1268,7 +1279,7 @@
 	//隐患弹框
 	/deep/.u-popup__content {
 		overflow-y: auto;
-	
+
 	}
 
 	.text-xl {
@@ -1285,11 +1296,13 @@
 		margin-bottom: 100rpx;
 
 	}
+
 	.example {
 		overflow-y: auto;
 	}
-	
+
 	/deep/.u-action-sheet {
+		height: 90%;
 		overflow-y: auto;
 	}
 </style>

+ 7 - 6
pagesA/fire/notice/inform_details/inform_details.vue

@@ -368,12 +368,12 @@
 													// that.imageList.push(imgUrl.data)
 													that.tableData.map((i,
 														index) => {
-															if (val == i.id) {
-																i.attUrl.push(
-																	imgUrl
-																	.data)
-															}
-														})
+														if (val == i.id) {
+															i.attUrl.push(
+																imgUrl
+																.data)
+														}
+													})
 													console.log(that.tableData,
 														'this.imageList');
 													that.$forceUpdate();
@@ -486,5 +486,6 @@
 
 	.uni-grid-wraps {
 		margin-left: 60rpx;
+		margin-bottom: 480rpx !important;
 	}
 </style>

+ 3 - 0
pagesB/fire/fireSpecial/addSpecial/index.vue

@@ -218,10 +218,13 @@
 				})
 			},
 			bindDateChange(e) {
+				console.log(e,'ssss');
 				this.formData.empBirthday = e.detail.value
+				this.$forceUpdate()
 			},
 			bindDateChange2(e) {
 				this.formData.issueDate = e.detail.value
+				this.$forceUpdate()
 			},
 			submit(ref) {
 				this.$refs[ref].validate().then(res => {

+ 51 - 10
utils/request.js

@@ -18,13 +18,16 @@ import {
 
 let timeout = 10000
 const baseUrl = config.baseUrl + config.baseApi;
-let isRefresh = false
+// 请求队列
+let requests = []
+// 是否正在刷新中
+let isRefreshing = false
 const request = async (config) => {
 	// 是否需要设置 token
 	const isToken = (config.headers || {}).isToken === false
 	config.header = config.header || {}
-	var hastoken=getAccessToken()
-	if ( hastoken!=null && !isToken) {
+	var hastoken = getAccessToken()
+	if (hastoken != null && !isToken) {
 		config.header['Authorization'] = 'Bearer ' + hastoken
 	}
 	// 设置租户 TODO 芋艿:强制 1 先
@@ -44,7 +47,7 @@ const request = async (config) => {
 				// header: config.header,
 				header: config.header,
 				dataType: 'json'
-			}).then(response => {
+			}).then(async response => {
 				let [error, res] = response
 				if (error) {
 					toast('后端接口连接异常')
@@ -54,13 +57,51 @@ const request = async (config) => {
 				const code = res.data.code || 200
 				const msg = errorCode[code] || res.data.msg || errorCode['default']
 				if (code === 401) {
-					showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => {
-						if (res.confirm) {
-							uni.navigateTo({
-								url: '/pages/login'
+					//token无效或已过期
+					if (!isRefreshing) {
+						// 是否已经执行刷新
+						isRefreshing = true
+						let token = getAccessToken(); // 获取到过期的token
+						try {
+							refreshToken({
+								refreshToken: getRefreshToken() // 刷新token的令牌存在token的对象里面,需要传给后端
+							}).then(reshRespore=>{
+								console.log(reshRespore, 'reshResporereshResporereshRespore');
+								// 请求成功把新的token存到本地
+								setToken(reshRespore.data);
+								// 已经刷新了token,将所有队列中的请求进行重试
+								requests.forEach((item) => item(reshRespore.data.accessToken))
+								requests = []
+								// 每个接口请求都要存入队列,等刷新完以后都需要执行
+								return new Promise((resolve) => {
+									// 将resolve放进队列,用一个函数形式来保存,等token刷新后直接执行
+									requests.push((token) => {
+										//这一步一定要有,刷新token,因为存入的信息是旧的token
+										response.config.header['Authorization'] =
+											'Bearer ' +
+											token;
+										resolve(uni.$u.http.request(response
+											.config)) //执行请求
+									})
+								})
 							})
+							
+						} catch {
+							uni.$u.toast('未知错误')
+							showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => {
+								if (res.confirm) {
+									uni.navigateTo({
+										url: '/pages/login'
+									})
+								}
+							});
+						} finally {
+							// 请求成功,开启刷新标识
+							isRefreshing = false
 						}
-					});
+					} else {
+					
+					}
 				} else if (code === 500) {
 					toast(msg)
 					reject('500')
@@ -87,4 +128,4 @@ const request = async (config) => {
 	})
 }
 
-export default request
+export default request