Kaynağa Gözat

键盘监听事件 控制按钮显示隐藏

Qukatie 1 hafta önce
ebeveyn
işleme
cec515bcf2
3 değiştirilmiş dosya ile 75 ekleme ve 46 silme
  1. 2 2
      manifest.json
  2. 47 34
      pages/home/insurance/details.vue
  3. 26 10
      pages/login/index.vue

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "库比森轮胎",
     "appid" : "__UNI__421BF74",
     "description" : "",
-    "versionName" : "1.0.17",
-    "versionCode" : 1017,
+    "versionName" : "1.0.30",
+    "versionCode" : 1030,
     "transformPx" : false,
     "plus" : {
         "distribute" : {

+ 47 - 34
pages/home/insurance/details.vue

@@ -71,8 +71,8 @@
 					<uni-forms-item name="tyreNo" label="胎号" required>
 						<view style="display: flex;align-items: center;">
 							<uni-easyinput v-model="item.tyreNo" class="right-align"
-								placeholder-class="placeholder-right" :placeholder="form.status>0?' ':'请输入胎号'" :inputBorder="false"
-								:disabled="form.status>0" :clearable="false"
+								placeholder-class="placeholder-right" :placeholder="form.status>0?' ':'请输入胎号'"
+								:inputBorder="false" :disabled="form.status>0" :clearable="false"
 								@change="getMaterialDetail($event,activeTab)"></uni-easyinput>
 							<uni-icons v-if="!form.status>0" type="scan" size="24" color='#03803B'
 								@click="allClick('识别胎号',activeTab)"></uni-icons>
@@ -135,7 +135,7 @@
 			:autoChange="true"></u-keyboard>
 		<view class="nav-bottom-height">
 		</view>
-		<view class="goods-nav-bottom">
+		<view v-show="!keyboardShow" class="goods-nav-bottom">
 			<uni-goods-nav v-if="!form.id" :fill="true" :options="[]" :buttonGroup="buttonGroup"
 				@buttonClick="buttonClick" />
 			<uni-goods-nav v-if="form.status==0" :fill="true" :options="[]" :buttonGroup="buttonGroup2"
@@ -188,6 +188,7 @@
 	export default {
 		data() {
 			return {
+				keyboardShow: false,
 				buttonGroup: [{
 					text: '提交',
 					backgroundColor: '#03803B',
@@ -291,6 +292,18 @@
 				this.getDetail(this.form.id)
 				uni.removeStorageSync('isClainUpdate')
 			}
+			// 监听键盘高度变化
+			uni.onKeyboardHeightChange((res) => {
+				// 根据键盘高度调整布局
+				if (res.height > 0) {
+					this.keyboardShow = true
+				} else {
+					this.keyboardShow = false
+				}
+			});
+		},
+		onUnload() {
+			uni.offKeyboardHeightChange();
 		},
 		watch: {
 			// 监听附件明细
@@ -313,17 +326,17 @@
 		methods: {
 			buttonClick(e) {
 				console.log(e)
-				if(e.index==0){
+				if (e.index == 0) {
 					this.submit()
 				}
 				// this.options[2].info++
 			},
 			buttonClick2(e) {
 				console.log(e)
-				if(e.index==0){
+				if (e.index == 0) {
 					this.submit()
 				}
-				if(e.index==1){
+				if (e.index == 1) {
 					this.allClick('查看二维码')
 				}
 				// this.options[2].info++
@@ -783,33 +796,33 @@
 				if (!this.carNoVerify(this.form.vehicleNumber)) {
 					return
 				}
-        let tyreNoList = []
-        console.info(this.form.tireInsuranceFilesList)
+				let tyreNoList = []
+				console.info(this.form.tireInsuranceFilesList)
 				for (let item of this.form.tireInsuranceFilesList) {
-          if (!item.tyreNo) {
-            return uni.showToast({
-              title: `请输入轮胎${item.affiliatedWithGroup }的胎号`,
-              icon: 'none'
-            });
-          }
-          if (!item.tyreSpecs) {
-            return uni.showToast({
-              title: `轮胎${item.affiliatedWithGroup }的胎号没有规格信息,请检查胎号是否正确`,
-              icon: 'none'
-            });
-          }
-          let existData = tyreNoList.find(i => i.tyreNo === item.tyreNo)
-          if (existData && Number(existData.index) !== Number(item.affiliatedWithGroup)) {
-            return uni.showToast({
-              title: `轮胎${item.affiliatedWithGroup }的胎号重复,请检查轮胎${item.affiliatedWithGroup }的胎号是否正确`,
-              icon: 'none'
-            });
-          } else {
-            tyreNoList.push({
-              tyreNo: item.tyreNo,
-              index: item.affiliatedWithGroup
-            });
-          }
+					if (!item.tyreNo) {
+						return uni.showToast({
+							title: `请输入轮胎${item.affiliatedWithGroup }的胎号`,
+							icon: 'none'
+						});
+					}
+					if (!item.tyreSpecs) {
+						return uni.showToast({
+							title: `轮胎${item.affiliatedWithGroup }的胎号没有规格信息,请检查胎号是否正确`,
+							icon: 'none'
+						});
+					}
+					let existData = tyreNoList.find(i => i.tyreNo === item.tyreNo)
+					if (existData && Number(existData.index) !== Number(item.affiliatedWithGroup)) {
+						return uni.showToast({
+							title: `轮胎${item.affiliatedWithGroup }的胎号重复,请检查轮胎${item.affiliatedWithGroup }的胎号是否正确`,
+							icon: 'none'
+						});
+					} else {
+						tyreNoList.push({
+							tyreNo: item.tyreNo,
+							index: item.affiliatedWithGroup
+						});
+					}
 					if (item.fileUrl == null) {
 						return uni.showToast({
 							title: `请上传轮胎${item.affiliatedWithGroup }的${+ item.fileProperties == 1 ?
@@ -834,7 +847,7 @@
 							});
 						}, 10);
 						uni.setStorageSync('isUpdate', true)
-            this.getDetail(res.code === 601 ? this.form.id : res.data.id)
+						this.getDetail(res.code === 601 ? this.form.id : res.data.id)
 					})
 					.catch(() => {
 						uni.hideLoading()
@@ -1125,4 +1138,4 @@
 		pointer-events: none !important;
 		touch-action: none !important;
 	}
-</style>
+</style>

+ 26 - 10
pages/login/index.vue

@@ -18,7 +18,7 @@
 									<image style="width: 23rpx;height: 32rpx;" src="/static/images/login/login (3).png">
 									</image>
 									<uni-easyinput type="number" name="phone" placeholder="请输入手机号" maxlength="11"
-										v-model="phone" :inputBorder="false"  :clearable="false"/>
+										v-model="phone" :inputBorder="false" :clearable="false" />
 								</view>
 								<view style="height: 2rpx;background: #E4E4E4;">
 								</view>
@@ -28,7 +28,7 @@
 									<image style="width: 25rpx;height: 30rpx;" src="/static/images/login/login (4).png">
 									</image>
 									<uni-easyinput type="number" name="code" maxlength="6" placeholder="请输入验证码"
-										v-model="code" :inputBorder="false" :clearable="false"/>
+										v-model="code" :inputBorder="false" :clearable="false" />
 									<view v-if="showText" class="code" @tap="getCode()">获取验证码</view>
 									<view v-else class="code">重新发送({{ second }})
 									</view>
@@ -37,7 +37,8 @@
 								</view>
 							</view>
 							<view style="margin:80rpx 0 50rpx;display: flex;justify-content: center;">
-								<debounce-button style="width: 474rpx;" bgColor='#03803B' @tap="login()" :loading="loading">登 录</debounce-button>
+								<debounce-button style="width: 474rpx;" bgColor='#03803B' @tap="login()"
+									:loading="loading">登 录</debounce-button>
 							</view>
 						</form>
 					</view>
@@ -46,11 +47,11 @@
 
 
 		</view>
-		<view class="pact">
+		<view class="pact" v-show="!keyboardShow">
 			<view class="pact-a">
 				<radio value="pactChecked" activeBackgroundColor="#3ba662" activeBorderColor="#3ba662"
 					borderColor="#3ba662" color="#fff" @click="pactChange" />
-				<view>我已阅读并同意<text @click="toPact">《用户协议》</text>和<text @click="toPact">《隐私协议》</text></view>
+				<view>我已阅读并同意<text>《用户协议》</text>和<text>《隐私协议》</text></view>
 			</view>
 		</view>
 	</view>
@@ -65,17 +66,31 @@
 	export default {
 		data() {
 			return {
+				keyboardShow:false,
 				loading: false,
 				pactChecked: false,
 				second: 60, //默认60秒
 				showText: true, //判断短信是否发送
-				phone:uni.getStorageSync('phone'), //手机号码
+				phone: uni.getStorageSync('phone'), //手机号码
 				code: '', //验证码
 				uuid: uuidv4(),
-				sendBtn:false,
+				sendBtn: false,
 			};
 		},
-		onLoad() {},
+		onShow() {
+			// 监听键盘高度变化
+			uni.onKeyboardHeightChange((res) => {
+				// 根据键盘高度调整布局
+				if (res.height > 0) {
+					this.keyboardShow=true
+				} else {
+					this.keyboardShow=false
+				}
+			});
+		},
+		onUnload() {
+		  uni.offKeyboardHeightChange();
+		},
 		methods: {
 			pactChange() {
 				this.pactChecked = true
@@ -269,14 +284,15 @@
 		line-height: 50rpx;
 		padding: 0 25rpx;
 	}
-	.code{
+
+	.code {
 		width: 160rpx;
 		text-align: center;
 		font-size: 26rpx;
 		color: #FFF;
 		border-radius: 8rpx;
 		border: 1rpx solid #FFFFFF;
-		padding:3rpx 4rpx ;
+		padding: 3rpx 4rpx;
 	}
 
 	.pact {