Przeglądaj źródła

11.经销商APP 门店APP app获取验证码需要做防抖处理
12.经销商APP门店APP 网络中断中断时给提示 做全局封装
17.经销商APP 门店APP 小程序 按钮改为圆角

Qukatie 3 tygodni temu
rodzic
commit
2811367320

+ 4 - 4
components/debounce-button.vue

@@ -1,6 +1,6 @@
 <template>
-	<button :type="type" :class="['debounce-btn', disabled ? 'disabled' : '']"  :disabled="disabled"
-		@click="handleClick" :style="{backgroundColor:bgColor,color:color}" :loading="loading">
+	<button :type="type" :class="['debounce-btn', disabled ? 'disabled' : '']" :disabled="disabled" @click="handleClick"
+		:style="{backgroundColor:bgColor,color:color}" style="border-radius: 50px;" :loading="loading">
 		<slot>{{ text }}</slot>
 	</button>
 </template>
@@ -28,8 +28,8 @@
 				type: Number,
 				default: 2000
 			},
-			loading:{
-				type:Boolean,
+			loading: {
+				type: Boolean,
 				default: false
 			}
 		},

+ 37 - 3
http/api.js

@@ -10,7 +10,34 @@ import {
 } from '@/utils/base64.js';
 import Request from '@/utils/luch-request/index.js';
 const http = new Request(options);
-http.interceptors.request.use((config) => { // 可使用async await 做异步操作
+const checkNetworkStatus = () => {
+	return new Promise((resolve, reject) => {
+		uni.getNetworkType({
+			success: (res) => {
+				console.log(res)
+				if (res.networkType === 'none') {
+					reject(new Error('网络连接已断开'));
+				} else {
+					resolve(true);
+				}
+			},
+			fail: () => {
+				reject(new Error('网络状态检测失败'));
+			}
+		});
+	});
+};
+http.interceptors.request.use(async (config) => { // 可使用async await 做异步操作
+	try {
+		await checkNetworkStatus();
+	} catch (error) {
+		uni.showToast({
+			title: error.message,
+			icon: 'none',
+			duration: 3000
+		});
+		return Promise.reject(config);
+	}
 	// 假设有token值需要在头部需要携带
 	let accessToken = uni.getStorageSync('accessToken');
 	if (accessToken) {
@@ -55,7 +82,7 @@ http.interceptors.response.use((response) => {
 				title: response.data.msg,
 				icon: 'none'
 			});
-		}else if (response.data.code) {
+		} else if (response.data.code) {
 			return Promise.reject(response);
 		} else {
 			return response.data;
@@ -63,7 +90,14 @@ http.interceptors.response.use((response) => {
 	}
 	return response.data;
 }, (response) => {
-	console.log(response)
+	if (response.statusCode === 0 || !response.statusCode) {
+		uni.showToast({
+			title: '网络连接中断,请检查网络设置',
+			icon: 'none',
+			duration: 3000
+		});
+		return Promise.reject(response);
+	}
 	/*  对响应错误做点什么 (statusCode !== 200)*/
 	if (response.data.code === 401) {
 		uni.showModal({

+ 3 - 3
pages/home/claim/details.vue

@@ -27,7 +27,7 @@
 						<view style="display: flex;align-items: center;height: 36px;width: 100%;">
 							<view @click="handleInputFocus()" style="width: 100%;text-align: right;padding: 0 20rpx;"
 								:style="form.vehicleNumber?'color:#000;':'color:#B5B4B4;font-size: 24rpx;'">
-								{{form.vehicleNumber||'请输入车牌号'}}
+								{{form.vehicleNumber||form.auditStatus>0||form.claimSourceType>1?' ':'请输入车牌号'}}
 							</view>
 						</view>
 						<uni-icons v-if="!(form.auditStatus>0||form.claimSourceType>1)" type="camera" size="24"
@@ -37,7 +37,7 @@
 				<uni-forms-item name="tyreNo" label="胎号">
 					<view style="display: flex;align-items: center;">
 						<uni-easyinput v-model="form.tyreNo" class="right-align" placeholder-class="placeholder-right"
-							placeholder="请输入胎号" :inputBorder="false"
+							:placeholder="form.auditStatus>0||form.claimSourceType>1?' ':'请输入胎号'" :inputBorder="false"
 							:disabled="form.auditStatus>0||form.claimSourceType>1" :clearable="false"
 							@change="getMaterialDetail"></uni-easyinput>
 						<uni-icons v-if="!(form.auditStatus>0||form.claimSourceType>1)" type="scan" size="24"
@@ -69,7 +69,7 @@
 				</uni-forms-item>
 				<uni-forms-item name="claimReason" label="理赔原因">
 					<uni-easyinput v-model="form.claimReason" class="right-align" type="textarea"
-						placeholder-class="placeholder-right" placeholder="请输入内容" :inputBorder="false"
+						placeholder-class="placeholder-right" :placeholder="form.auditStatus>0||form.claimSourceType>1?' ':'请输入内容'" :inputBorder="false"
 						:del-icon="!(form.auditStatus>0||form.claimSourceType>1)"
 						:disabled="form.auditStatus>0||form.claimSourceType>1"></uni-easyinput>
 				</uni-forms-item>

+ 7 - 1
pages/login/index.vue

@@ -73,6 +73,7 @@
 				phone: uni.getStorageSync('phone'), //手机号码
 				code: '', //验证码
 				uuid: uuidv4(),
+				sendBtn: false,
 			};
 		},
 		onLoad() {
@@ -174,6 +175,9 @@
 					phone: this.phone,
 					uuid: this.uuid
 				}
+				if (this.sendBtn) return
+				this.sendBtn = true
+				console.log(11111)
 				getPhoneVerifyCode(obj).then(res => {
 					uni.showToast({
 						title: res.msg,
@@ -193,7 +197,9 @@
 							that.showText = true;
 						}, 60000);
 					}
-				})
+				}).finally(() => {
+					this.sendBtn = false
+				});
 			},
 			//等三方微信登录
 			wxLogin() {