update:英文版代码备份

This commit is contained in:
2026-11-05 14:49:42 +08:00
parent 419cefd00e
commit 53ac4473f9
142 changed files with 1777 additions and 1604 deletions
+43 -41
View File
@@ -1,4 +1,6 @@
<script setup>
import { t } from "@/locales";
import { ref, computed, watch, onMounted, onUnmounted } from "vue";
import { onLoad, onShow } from "@dcloudio/uni-app";
import { storeToRefs } from "pinia";
@@ -54,7 +56,7 @@ const firmwareMessage = ref("");
let countdownTimer = null;
let wifiConnectRequestId = 0;
let wifiStatusRequestId = 0;
const WIFI_CONNECT_FAILED_TEXT = "连接失败,请检查WiFi密码或WiFi状态";
const WIFI_CONNECT_FAILED_TEXT = t('connection_failed_check_the_wi_fi_password_and_network_status');
// 与 Container 的可滚动区域保持一致,底部说明在长短屏上都能贴近安全区。
const windowInfo = uni.getWindowInfo();
const contentMinHeight = Math.max(
@@ -78,7 +80,7 @@ const {
} = useOtaUpdate();
const countdownButtonText = computed(
() => `${Math.max(1, countdownSeconds.value)}秒后开始`
() => t('starts_in_values', { p0: Math.max(1, countdownSeconds.value) })
);
// 判断 WiFi 列表失败是否由用户拒绝授权引起(兼容 errno:103 及各平台 errMsg 变体)。
@@ -97,7 +99,7 @@ const showLocationPermission = () => {
// 已拒绝授权时进入小程序设置;首次授权则重新扫描以触发系统权限流程。
const handleReauthorize = () => {
if (uni.getSystemSetting().locationEnabled === false) {
uni.showToast({ title: "请先开启手机定位服务", icon: "none" });
uni.showToast({ title: t('please_enable_location_services_on_your_phone_first'), icon: "none" });
return;
}
uni.getSetting({
@@ -281,7 +283,7 @@ const hasChinese = (str) => /[\u4e00-\u9fa5]/.test(str);
const ssidWarning = computed(() => {
if (connectMode.value === "manual" && hasChinese(connectInput.value.ssid)) {
return "网络名称仅支持英文字符及数字,请连接英文名网络或把网络改为英文";
return t('network_names_support_only_english_characters_and_numbers_use_or');
}
return "";
});
@@ -332,11 +334,11 @@ const cancelWifiConnectWaiting = () => {
// 把接口失败和传输异常转换为连接弹窗内的用户提示。
const getWifiConnectErrorText = (error) => {
const message = error?.message || "";
if (message.includes("请先开启智能弓")) return "请先开启智能弓";
if (message.includes("请先开启智能弓")) return t('please_turn_on_your_smart_bow_first');
if (message.includes("超时") || error?.errMsg?.includes("timeout")) {
return "等待设备响应超时,请重试";
return t('device_response_timed_out_please_retry');
}
if (error?.errMsg) return "网络异常,请检查网络后重试";
if (error?.errMsg) return t('network_error_check_your_connection_and_retry');
return message || WIFI_CONNECT_FAILED_TEXT;
};
@@ -346,9 +348,9 @@ const submitDeviceWifiConfig = async ({ ssid, password }) => {
wifiConnectRequestId += 1;
const requestId = wifiConnectRequestId;
isSubmittingWifi.value = true;
connectStatusText.value = "WiFi连接中...";
connectStatusText.value = t('connecting_to_wi_fi');
uni.showLoading({
title: "WiFi连接中",
title: t('connecting_to_wi_fi_518'),
mask: true,
});
try {
@@ -414,19 +416,19 @@ const startFirmwareUpdate = async () => {
if (!detail || device.value.deviceId !== deviceId) throw new Error("设备详情已失效");
const otaInfo = getOtaInfoFromDetail(detail);
if (!otaInfo.needUpdate) {
firmwareMessage.value = "当前已是最新版本";
firmwareMessage.value = t('already_up_to_date_520');
firmwareMessageVisible.value = true;
return;
}
if (!otaInfo.versionNumber) {
firmwareMessage.value = "缺少固件目标版本,请返回后重试";
firmwareMessage.value = t('target_firmware_version_is_missing_go_back_and_retry');
firmwareMessageVisible.value = true;
return;
}
// WiFi 连接可能耗时较长,以更新前的最新设备详情为准。
routeOtaVersionNumber.value = otaInfo.versionNumber;
} catch (error) {
firmwareMessage.value = "获取设备详情失败,请返回后重试";
firmwareMessage.value = t('could_not_load_device_details_go_back_and_retry');
firmwareMessageVisible.value = true;
return;
}
@@ -519,7 +521,7 @@ onUnmounted(() => {
<Container :scroll="false">
<!-- WiFi 不可用 Banner -->
<view v-if="showWifiBanner" class="wifi-banner">
<text class="wifi-banner-text">请先开启 WiFi 后刷新重试</text>
<text class="wifi-banner-text">{{ t('please_enable_wi_fi_then_refresh_and_retry') }}</text>
</view>
<!-- 扫描、候选网络与设备已连接网络共用页面主体 -->
@@ -535,13 +537,13 @@ onUnmounted(() => {
mode="aspectFit"
/>
</view>
<text class="page-title">智能弓箭连接无线网络</text>
<text class="page-subtitle">提醒:本操作将为智能弓箭连接WIFI网络,不会影响手机自身连接的WIFI网络。</text>
<text class="page-title">{{ t('connect_your_smart_bow_to_wi_fi') }}</text>
<text class="page-subtitle">{{ t('this_connects_your_smart_bow_to_wi_fi_it_will_not_change_the_wi_') }}</text>
<view class="network-sections">
<!-- 仅设备 WebSocket 状态为 WiFi 时显示;此卡片不触发密码输入。 -->
<view v-if="isDeviceOnWifi && connectedWifiName" class="network-section connected-section">
<text class="section-label">已连接</text>
<text class="section-label">{{ t('connected') }}</text>
<view class="connected-wifi-card">
<text class="wifi-ssid">{{ connectedWifiName }}</text>
<image
@@ -554,7 +556,7 @@ onUnmounted(() => {
<view class="network-section">
<view class="section-label-row">
<text class="section-label">选择网络</text>
<text class="section-label">{{ t('select_network') }}</text>
<image
class="refresh-icon"
src="https://static.shelingxingqiu.com/shootmini/static/sicon/refresh.png"
@@ -572,7 +574,7 @@ onUnmounted(() => {
>
<view class="network-copy">
<text class="wifi-ssid">{{ wifiList[0].SSID }}</text>
<text class="network-desc">手机当前连接的网络</text>
<text class="network-desc">{{ t('your_phone_s_current_network') }}</text>
</view>
<image
class="signal-icon"
@@ -582,8 +584,8 @@ onUnmounted(() => {
</view>
<view class="ios-network-card manual-network-card" @click="selectOther">
<view class="network-copy">
<text class="wifi-ssid">手动连接其他网络</text>
<text class="network-desc">由于权限限制,无法获取附近网络列表,如需连接其他网络请手动输入网络名称与密码进行连接。</text>
<text class="wifi-ssid">{{ t('connect_to_another_network_manually') }}</text>
<text class="network-desc">{{ t('permissions_prevent_nearby_networks_from_being_listed_to_connect') }}</text>
</view>
<image
class="signal-icon"
@@ -621,13 +623,13 @@ onUnmounted(() => {
</view>
</view>
<view class="android-network-item manual-network-item" @click="selectOther">
<text class="wifi-ssid">手动连接其他网络</text>
<text class="wifi-ssid">{{ t('connect_to_another_network_manually') }}</text>
</view>
</scroll-view>
</view>
</view>
<text class="wifi-footer">智能弓箭目前仅支持保存一条网络信息,若连接新的网络将删除上一条网络信息。</text>
<text class="wifi-footer">{{ t('your_smart_bow_can_save_only_one_network_connecting_to_a_new_net') }}</text>
</view>
<!-- Android 定位权限不足时的整页引导状态 -->
@@ -644,9 +646,9 @@ onUnmounted(() => {
/>
<view class="location-shadow"></view>
</view>
<text class="location-desc">请授权允许获取定位信息,并开启定位功能,以查找附近可用无线网络。</text>
<text class="location-desc">{{ t('allow_location_access_and_enable_location_services_to_find_nearb') }}</text>
<view class="location-button" @click="handleReauthorize">
<text>授权获取定位信息</text>
<text>{{ t('allow_location_access') }}</text>
</view>
</view>
@@ -662,7 +664,7 @@ onUnmounted(() => {
<view class="sheet-nav-btn" @click="closeConnectSheet">
<image src="https://static.shelingxingqiu.com/shootmini/static/sicon/arrow-left.png" mode="aspectFit" style="width: 40rpx; height: 40rpx;" />
</view>
<text class="sheet-title">加入"{{ connectInput.ssid }}"</text>
<text class="sheet-title">{{ t('join_533') }}{{ connectInput.ssid }}"</text>
<view
class="sheet-nav-btn"
:class="{ 'nav-disabled': joinDisabled }"
@@ -672,13 +674,13 @@ onUnmounted(() => {
</view>
</view>
<view class="input-row-card">
<text class="input-label">密码</text>
<text class="input-label">{{ t('password') }}</text>
<input
class="input-field"
:password="!showPassword"
:adjust-position="false"
v-model="connectInput.password"
placeholder="输入网络密码"
:placeholder="t('enter_network_password')"
placeholder-class="input-placeholder"
confirm-type="done"
@confirm="joinNetwork"
@@ -702,13 +704,13 @@ onUnmounted(() => {
<view class="sheet-nav-btn" @click="closeConnectSheet">
<image src="https://static.shelingxingqiu.com/shootmini/static/sicon/arrow-left.png" mode="aspectFit" style="width: 40rpx; height: 40rpx;" />
</view>
<text class="sheet-title">加入"{{ connectInput.ssid }}"</text>
<text class="sheet-title">{{ t('join_533') }}{{ connectInput.ssid }}"</text>
<view class="sheet-nav-btn" @click="joinNetwork">
<image src="https://static.shelingxingqiu.com/shootmini/static/sicon/check.png" mode="aspectFit" style="width: 28rpx; height: 24rpx;" />
</view>
</view>
<text v-if="connectStatusText" class="connect-status">{{ connectStatusText }}</text>
<text v-else class="sheet-hint">该网络为开放网络,点击 ✓ 加入</text>
<text v-else class="sheet-hint">{{ t('this_is_an_open_network_tap_to_join') }}</text>
<text v-if="connectError" class="connect-error">{{ connectError }}</text>
</block>
@@ -718,7 +720,7 @@ onUnmounted(() => {
<view class="sheet-nav-btn" @click="closeConnectSheet">
<image src="https://static.shelingxingqiu.com/shootmini/static/sicon/arrow-left.png" mode="aspectFit" style="width: 40rpx; height: 40rpx;" />
</view>
<text class="sheet-title">加入无线网络</text>
<text class="sheet-title">{{ t('join_wi_fi_network') }}</text>
<view
class="sheet-nav-btn"
:class="{ 'nav-disabled': joinDisabled }"
@@ -728,22 +730,22 @@ onUnmounted(() => {
</view>
</view>
<view class="input-row-card">
<text class="input-label">名称</text>
<text class="input-label">{{ t('name') }}</text>
<input
class="input-field"
v-model="connectInput.ssid"
placeholder="输入网络名称"
:placeholder="t('enter_network_name')"
placeholder-class="input-placeholder"
/>
</view>
<view class="input-row-card">
<text class="input-label">密码</text>
<text class="input-label">{{ t('password') }}</text>
<input
class="input-field"
:password="!showPassword"
:adjust-position="false"
v-model="connectInput.password"
placeholder="输入网络密码"
:placeholder="t('enter_network_password')"
placeholder-class="input-placeholder"
confirm-type="done"
@confirm="joinNetwork"
@@ -768,16 +770,16 @@ onUnmounted(() => {
<ModalDialog
:show="wifiSuccessVisible"
content="WIFI连接成功"
confirmText="确定"
:content="t('wi_fi_connected')"
:confirmText="t('confirm_134')"
:showCancel="false"
:onConfirm="confirmWifiSuccess"
></ModalDialog>
<ModalDialog
:show="countdownVisible"
title="WiFi连接成功"
content="3秒后将自动开始更新"
:title="t('wi_fi_connected_541')"
:content="t('the_update_will_start_automatically_in_3_seconds')"
:confirmText="countdownButtonText"
:showCancel="false"
:confirmDisabled="true"
@@ -800,16 +802,16 @@ onUnmounted(() => {
:show="otaResultVisible && otaResultStatus === 'failed'"
:title="otaResultTitle"
:content="otaResultContent"
confirmText="关闭"
:confirmText="t('close')"
:showCancel="false"
:onConfirm="closeOtaResult"
></ModalDialog>
<ModalDialog
:show="firmwareMessageVisible"
title="固件更新"
:title="t('firmware_update')"
:content="firmwareMessage"
confirmText="关闭"
:confirmText="t('close')"
:showCancel="false"
:onConfirm="() => (firmwareMessageVisible = false)"
></ModalDialog>