From 2af5f043b60c1f7ac38ecccc8f5bf44743134325 Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期五, 12 十二月 2025 18:08:00 +0800
Subject: [PATCH] test
---
pages/index/connect.vue | 74 ++++++++++++++++++++++--------------
1 files changed, 45 insertions(+), 29 deletions(-)
diff --git a/pages/index/connect.vue b/pages/index/connect.vue
index 9fddb1c..4809a1f 100644
--- a/pages/index/connect.vue
+++ b/pages/index/connect.vue
@@ -2,51 +2,51 @@
<view class="pages-vehicle-connect">
<view class="content" v-if="connectState == 1">
- <view class="title">杩炴帴涓�/view>
+ <view class="title">{{translate('connecting')}}</view>
<view class="content2">
<view class="auto-circle"></view>
- <view>杩炴帴涓�..</view>
+ <view>{{translate('connecting')}}...</view>
</view>
</view>
<view class="content" v-else-if="connectState == 2">
- <view class="title">杩炴帴鎴愬姛</view>
+ <view class="title">{{translate('connection_success')}}</view>
<view class="content2">
- <image class="img" src="/images/Frame_178.svg" alt=" 鍥剧墖" />
- <view>銆恵{connectedDevice}}銆戣繛鎺ユ垚鍔�/view>
+ <image class="img" src="/images/Frame_178.svg" alt=" picture" />
+ <view>銆恵{connectedDevice}}銆憑{translate('connection_success')}}</view>
</view>
</view>
<view class="content" v-else-if="connectState == 3">
- <view class="title">杩炴帴澶辫触</view>
+ <view class="title">{{translate('connection_failed')}}</view>
<view class="content2">
- <image class="img" src="/images/Frame_179.svg" alt=" 鍥剧墖" />
- <view class="title">鏃犳硶杩炴帴璁惧</view>
- <view>璇风‘淇濊溅杈嗗紑鏈轰笖鏈笌鍏朵粬缁堢閰嶅</view>
+ <image class="img" src="/images/Frame_179.svg" alt=" picture" />
+ <view class="title">{{translate('unable_connect_device')}}</view>
+ <view>{{translate('check_vehicle_not_paired_other_terminals')}}</view>
</view>
</view>
<view class="content" v-else-if="connectState == 4">
- <view class="title">杩炴帴鍑嗗</view>
+ <view class="title">{{translate('connection_preparation')}}</view>
<view class="content2">
- <view>1銆佽灏嗘墜鏈鸿繛鎺ュ埌鈥榹{ip}}鈥欑殑Wifi缃戠粶</view>
- <view>2銆佽繛鎺ュ悗鍥炲埌鏈簲鐢�/view>
- <image class="img-2" src="/images/Frame_180.svg" alt=" 鍥剧墖" />
+ <view>1銆亄{translate("connect_phone_to_this_ip_wifi",[ip]) }}</view>
+ <view>2銆亄{translate('after_connect_return_this')}}</view>
+ <image class="img-2" src="/images/Frame_180.svg" alt=" picture" />
</view>
</view>
<view class="content" v-else>
- <view class="title">杩炴帴鍑嗗</view>
+ <view class="title">{{translate('connection_preparation')}}</view>
</view>
<view v-if="connectState == 3" class="button-group">
<a-button type="primary" plain="true" class="button" @click="clickTry">
- {{reconnectFlag ? "閲嶆柊杩炴帴WiFi":"閲嶈瘯"}}
+ {{reconnectFlag ? translate('reconnect_wifi'):translate('retry')}}
</a-button>
- <a-button type="ghost" class="button" @click="clickCancel">鍙栨秷
+ <a-button type="ghost" class="button" @click="clickCancel">{{translate('cancel')}}
</a-button>
- <view class="link-text"> <a @click="clickStudyMore">瀛︿範鏇村...</a> </view>
+ <view class="link-text"> <a @click="clickStudyMore">{{translate('more')}}...</a> </view>
</view>
<view v-if="connectState == 4" class="button-group">
- <a-button type="primary" plain="true" class="button" @click="clickLinkWifi">鍘昏繛鎺�+ <a-button type="primary" plain="true" class="button" @click="clickLinkWifi">{{translate('go_connect')}}
</a-button>
- <a-button type="ghost" class="button" @click="clickTry">鍒囨崲鎵爜杩炴帴
+ <a-button type="ghost" class="button" @click="clickTry">{{translate('switch_scan_connection')}}
</a-button>
</view>
</view>
@@ -96,6 +96,7 @@
this.wifiPassword = option.passwpord || ""
this.reconnectFlag = option.reconnect ? true : false
this.unloadFlag = false
+
this.loadData()
},
onUnload() {
@@ -145,7 +146,7 @@
} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
}
},
checkConnectStatus() {
@@ -183,11 +184,11 @@
const result = res.result || ""
const arCode = result.split(";")
if (arCode.length != 3) {
- showInfo("鏃犳晥鐨勪簩缁寸爜锛�)
+ showToast(this.translate('invalid_qr_code'))
return
}
if (!arCode[0].trim() || !arCode[0].trim()) {
- showInfo("鏃犳晥鐨勪簩缁寸爜锛�)
+ showToast(this.translate('invalid_qr_code'))
return
}
that.ip = arCode[0]
@@ -236,7 +237,12 @@
console.log("connectWifi", ssid)
if (`"${this.wifiSID}"` != ssid && `${this.wifiSID}` != ssid) {
if (platform == "android" && osVersion < 10) {
- showModal(`銆�{app.globalData.deviceModel}銆戞兂鍔犲叆鏃犵嚎灞�煙缃戙�${this.wifiSID}銆戝悧锛焋, "璇㈤棶").then((res) => {
+ showModal({
+ content: `${this.translate('ask_join_wlan',[this.this.ip,this.wifiSID])}`,
+ confirmText: this.translate('join'),
+ cancelText: this.translate("cancel"),
+ }
+ ).then((res) => {
if (res) {
this.connectState = 1
@@ -291,9 +297,9 @@
this.connectState = 2
this.connectedSuccess()
} catch (ex) {
- console.log("connectVehicle faile",this.ip,ex)
+ console.log("connectVehicle faile", this.ip, ex)
this.connectState = 3
- // showError(ex)
+ // showError(ex,this.translate('error'))
}
},
@@ -344,8 +350,7 @@
if (this.unloadFlag) {
return
}
- if(sec <= 0)
- {
+ if (sec <= 0) {
this.connectState = 3
return
}
@@ -358,9 +363,20 @@
}
}).catch((ex) => {
setTimeout(() => {
- this.checkConnectVehicle(sec- 7)
+ this.checkConnectVehicle(sec - 7)
}, 2000)
})
+ },
+ translate(t, values) {
+ if (typeof this.$t == "function") {
+ const message = this.$t(`page.${t}`)
+ if (values) {
+ return message.replace(/{(\d+)}/g, (match, index) => {
+ const value = values[index]
+ return value !== undefined ? value : match
+ })
+ } else return message
+ } else return t;
},
}
}
@@ -438,7 +454,7 @@
.button {
margin: 20rpx !important;
- width: 320rpx !important;
+ width: 400rpx !important;
border-radius: 4rpx;
}
}
--
Gitblit v1.9.1