lilei 4 yıl önce
ebeveyn
işleme
6b98d11352
2 değiştirilmiş dosya ile 32 ekleme ve 15 silme
  1. 31 14
      pages/index/index.vue
  2. 1 1
      pages/userAuth/userAuth.vue

+ 31 - 14
pages/index/index.vue

@@ -1,8 +1,10 @@
 <template>
 	<view class="content">
-		<view class="cz-box" :class="loading?'turn':''" @click="toWork">
-			<u-image width="100rpx" height="100rpx" src="/static/chengzhong.png"></u-image>
-			<view class="tits">投放称重</view>
+		<view class="cz-box" @click="toWork">
+			<view :class="loading?'turn':''">
+				<u-image width="100rpx" height="100rpx" src="/static/chengzhong.png"></u-image>
+				<view class="tits">投放称重</view>
+			</view>
 		</view>
 		<view class="bindDev" @click="toInit">
 			{{statusStr}}
@@ -45,18 +47,28 @@
 		methods: {
 			// 去认证用户并开始称重
 			toWork(){
+				let _this = this
 				// 连接成功
 				if(this.connectStatus){
 					uni.navigateTo({
 						url: '/pages/userAuth/userAuth'
 					})
 				}else{
+					let hasDev = this.deviceList.length
 					uni.showModal({
 						title:'提示',
-						content:'请先绑定并连接电子秤',
-						showCancel: false,
+						content:hasDev ? '请先连接设备':'请先绑定设备',
+						confirmText: hasDev ? '确定':'去绑定',
 						complete(e) {
 							console.log(e)
+							if(e.confirm){
+								if(hasDev == 1){
+									_this.connectBlue(_this.deviceList[0])
+								}
+								if(hasDev == 0){
+									_this.toInit()
+								}
+							}
 						}
 					})
 				}
@@ -70,7 +82,7 @@
 					_this.onBluetoothAdapterStateChange()
 					setTimeout(()=>{
 						_this.toFindDev()
-					},500)
+					},1000)
 				  },
 				  fail(err){
 					  console.log(err,'openBluetoothAdapter error')
@@ -370,11 +382,13 @@
 	.cz-box{
 		text-align: center;
 		background: #fff;
-		padding: 50rpx 50rpx 30rpx;
 		border-radius: 300rpx;
 		box-shadow: 3rpx 3rpx 10rpx rgba(0,0,0,0.4);
+	}
+	.cz-box > view{
 		width: 250rpx;
 		height: 250rpx;
+		padding: 50rpx 50rpx 30rpx;
 		display: flex;
 		align-items: center;
 		justify-content: center;
@@ -389,29 +403,32 @@
 		padding:10rpx 30rpx;
 	}
 	.bindDev{
-		margin: 30rpx 0;
-		padding: 10rpx 40rpx;
-		box-shadow: 2rpx 2rpx 8rpx rgba(0,0,0,0.3);
+		margin: 20rpx 0;
+		padding: 20rpx 40rpx;
+		background: rgba(255,255,255,0.8);
+		box-shadow: 2rpx 2rpx 8rpx rgba(0,0,0,0.2);
 		border-radius: 100rpx;
-		color: #fff;
+		color: #666666;
 	}
 	.devList > view{
 		display: flex;
 		align-items: center;
-		color: #00aaff;
-		border-radius: 100rpx;
+		color: #666666;
+		border-radius: 20rpx;
 		background: rgba(255,255,255,0.8);
-		padding: 15rpx 40rpx;
 		box-shadow: 2rpx 2rpx 5rpx rgba(0,0,0,0.2);
 	}
 	.devList > view .names{
 		flex-grow: 1;
+		padding: 15rpx 40rpx;
 	}
 	.devList > view .texts{
 		font-size: 24rpx;
 	}
 	.devList > view .btns{
 		text-align: center;
+		padding: 15rpx 40rpx;
+		color: #ff5500;
 	}
 	.turn{
 		animation:turn 1s linear infinite;

+ 1 - 1
pages/userAuth/userAuth.vue

@@ -11,7 +11,7 @@
 			<view class="form-row form-flex">
 				<view><text class="red">*</text>投递手机号</view>
 				<view>
-					<u-input v-modal="formData.phone" type="number" input-align="right" :custom-style="{color: '#666'}" :maxlength="11" placeholder="请输入手机号码"></u-input>
+					<u-input v-model="formData.phone" type="number" input-align="right" :custom-style="{color: '#666'}" :maxlength="11" placeholder="请输入手机号码"></u-input>
 				</view>
 			</view>
 			<view class="form-row">