优化中英文切换功能

This commit is contained in:
qiaocl 2025-04-30 16:47:18 +08:00
parent 50ee190427
commit 5ed080d09e
92 changed files with 384 additions and 335 deletions

64
App.vue
View File

@ -3,22 +3,20 @@
let SystemVersion = ""
export default {
data() {
return {}
return {
list: [{
key: "en",
value: "en"
},
{
key: "zh",
value: "zh-Hans"
}
]
}
},
onLaunch: function() {
let that = this
uni.setTabBarItem({
index: 0,
text: that.$t('common.titleHome')
})
uni.setTabBarItem({
index: 1,
text: that.$t('common.titleNews')
})
uni.setTabBarItem({
index: 2,
text: that.$t('common.titleMe')
})
// #ifdef APP-PLUS
//
uni.getSystemInfo({
@ -35,7 +33,6 @@
uni.reLaunch({
url: '/pageTwo/login/login'
})
console.log("有网络连接", res.isConnected)
}
});
}
@ -55,6 +52,7 @@
console.log('on login-sucesss')
that.handleUserList()
that.handleBannerList()
that.handleTabBarItem()
setTimeout(() => {
uni.reLaunch({
url: '/pages/home/home'
@ -74,10 +72,10 @@
that.handleoginversion()
that.handleCityList()
that.handleCooperationUrl()
console.log('App Launch', uni.getLocale())
},
onShow: function() {
console.log('App Show')
let that = this
that.handleTabBarItem()
},
onHide: function() {
// #ifdef APP-PLUS
@ -95,22 +93,29 @@
}).then(res => {
that.$store.commit('changeLanguage', res.data.language_arr)
if (res.code == 0) {
// uni.setLocale(res.data.language)
that.$i18n.locale = res.data.language
uni.setStorageSync('language', res.data.language)
that.$store.commit('changeLocale', res.data.language)
uni.$emit('login-sucesss');
console.log("已登录手机语言", res.data.language)
} else {
uni.getSystemInfo({
success(e) {
let language = uni.getStorageSync('language') ? uni.getStorageSync(
'language') : e.language.indexOf("zh") != -1 ? "zh-Hans" : e
.language
uni.setLocale(language)
let locale = ""
that.list.forEach(ite => {
if (e.language.indexOf(ite.key) != -1) {
locale = ite.value
}
})
let language = uni.getStorageSync('language') ? uni.getStorageSync('language') : locale
that.$i18n.locale = language
uni.setStorageSync('language', language)
that.$store.commit('changeLocale', language)
uni.$emit('need-login');
console.log("未登录手机语言", language)
console.log("未登录手机语言", language, uni.getStorageSync('language'), locale)
}
})
}
// #ifdef APP-PLUS||APP
that.$store.commit('changePhoneInfo', {
@ -255,6 +260,21 @@
})
})
},
handleTabBarItem() {
let that = this
uni.setTabBarItem({
index: 0,
text: that.$t('common.titleHome')
})
uni.setTabBarItem({
index: 1,
text: that.$t('common.titleNews')
})
uni.setTabBarItem({
index: 2,
text: that.$t('common.titleMe')
})
}
}
}
</script>

View File

@ -523,7 +523,7 @@
"inheritHeighet.tips4": "A child's postnatal growth environment is conducive to their growth in height. Please continue to maintain and strengthen the management of acquired factors. When the child reaches adulthood, they can be more than 10cm taller than the standard.",
"contrast.time": "time (days)",
"index.ideal": "ideal",
"index.ideal": "Current age and ideal ",
"contrast.weightdiff": "reduce weight",

View File

@ -8,4 +8,5 @@ export default {
ja, //日语
"zh-Hans": zh, //中文
'zh-Hant': zhHant, //繁体
"en-CN": en
}

View File

@ -156,7 +156,8 @@
"searchBluetoothFail": "重新搜索",
"Nodevicefound": "没有搜索到蓝牙设备",
"onDeviceMeasureTips": "请确定设备是开机状态",
"openDeviceeMeasureTips": "请确定手机蓝牙及位置信息已打开",
"openDeviceeMeasureTips": "请确定手机蓝牙已打开",
"openDeviceeMeasureTips2":"请确定手机位置信息已打开",
"deviceDisconnection": "测量过程中已与设备连接中断,请重新连接设备再开始测量",
"offBluetooth": "蓝牙已关闭,请重新打开蓝牙后再开始测量",
"remeasure": "重新测量",

View File

@ -1,157 +1,163 @@
{
"name" : "Reedaw",
"appid" : "__UNI__20604F1",
"description" : "面向儿童青少年的健康体质测量APP",
"versionName" : "1.3.4",
"versionCode" : 134,
"transformPx" : false,
/* 5+App */
"app-plus" : {
"usingComponents" : true,
"nvueStyleCompiler" : "uni-app",
"compilerVersion" : 3,
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : true,
"autoclose" : true,
"delay" : 0
},
"template" : "index.html",
/* */
"modules" : {
"Bluetooth" : {}
},
"compattible" : {
"ignoreVersion" : true // true
},
/* */
"distribute" : {
/* android */
"android" : {
"permissions" : [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
],
"abiFilters" : [ "arm64-v8a", "x86" ]
},
/* ios */
"ios" : {
"dSYMs" : false,
"idfa" : false,
"privacyDescription" : {
"NSBluetoothAlwaysUsageDescription" : "需要蓝牙权限来连接设备",
"NSBluetoothPeripheralUsageDescription" : "使用蓝牙与外设通信"
}
},
/* SDK */
"sdkConfigs" : {
"share" : {},
"ad" : {},
"geolocation" : {
"system" : {
"__platform__" : [ "ios" ]
}
}
},
"icons" : {
"android" : {
"hdpi" : "unpackage/res/icons/72x72.png",
"xhdpi" : "unpackage/res/icons/96x96.png",
"xxhdpi" : "unpackage/res/icons/144x144.png",
"xxxhdpi" : "unpackage/res/icons/192x192.png"
},
"ios" : {
"appstore" : "unpackage/res/icons/1024x1024.png",
"ipad" : {
"app" : "unpackage/res/icons/76x76.png",
"app@2x" : "unpackage/res/icons/152x152.png",
"notification" : "unpackage/res/icons/20x20.png",
"notification@2x" : "unpackage/res/icons/40x40.png",
"proapp@2x" : "unpackage/res/icons/167x167.png",
"settings" : "unpackage/res/icons/29x29.png",
"settings@2x" : "unpackage/res/icons/58x58.png",
"spotlight" : "unpackage/res/icons/40x40.png",
"spotlight@2x" : "unpackage/res/icons/80x80.png"
},
"iphone" : {
"app@2x" : "unpackage/res/icons/120x120.png",
"app@3x" : "unpackage/res/icons/180x180.png",
"notification@2x" : "unpackage/res/icons/40x40.png",
"notification@3x" : "unpackage/res/icons/60x60.png",
"settings@2x" : "unpackage/res/icons/58x58.png",
"settings@3x" : "unpackage/res/icons/87x87.png",
"spotlight@2x" : "unpackage/res/icons/80x80.png",
"spotlight@3x" : "unpackage/res/icons/120x120.png"
}
}
},
"splashscreen" : {
"androidStyle" : "common",
"android" : {
"hdpi" : "static/logo.png",
"xhdpi" : "static/logo.png",
"xxhdpi" : "static/logo.png"
},
"useOriginalMsgbox" : true
}
}
},
"permissions" : {
"Android" : [
{
"name" : "android.permission.READ_EXTERNAL_STORAGE",
"desc" : "读取外部存储"
},
{
"name" : "android.permission.WRITE_EXTERNAL_STORAGE",
"desc" : "写入外部存储"
}
]
},
/* */
"quickapp" : {},
/* */
"mp-weixin" : {
"appid" : "wx9c0b7a436ada6d1e",
"setting" : {
"urlCheck" : false,
"postcss" : true,
"minified" : true
},
"usingComponents" : true
},
"mp-alipay" : {
"usingComponents" : true
},
"mp-baidu" : {
"usingComponents" : true
},
"mp-toutiao" : {
"usingComponents" : true
},
"uniStatistics" : {
"enable" : false,
"version" : "2"
},
"vueVersion" : "2",
"locale" : "zh-Hans",
"h5" : {
"template" : "index.html"
},
"fallbackLocale" : "zh-Hans"
"name": "Reedaw",
"appid": "__UNI__20604F1",
"description": "面向儿童青少年的健康体质测量APP",
"versionName": "1.3.4",
"versionCode": 134,
"transformPx": false,
/* 5+App */
"app-plus": {
"usingComponents": true,
"nvueStyleCompiler": "uni-app",
"compilerVersion": 3,
"splashscreen": {
"alwaysShowBeforeRender": true,
"waiting": true,
"autoclose": true,
"delay": 0
},
"template": "index.html",
/* */
"modules": {
"Bluetooth": {}
},
"compattible": {
"ignoreVersion": true // true
},
/* */
"distribute": {
/* android */
"android": {
"permissions": [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
],
"abiFilters": ["arm64-v8a", "x86"]
},
/* ios */
"ios": {
"dSYMs": false,
"idfa": false,
"privacyDescription": {
"NSBluetoothAlwaysUsageDescription": "需要蓝牙权限来连接设备",
"NSBluetoothPeripheralUsageDescription": "使用蓝牙与外设通信"
}
},
/* SDK */
"sdkConfigs": {
"share": {},
"ad": {},
"geolocation": {
"system": {
"__platform__": ["ios"]
}
}
},
"icons": {
"android": {
"hdpi": "unpackage/res/icons/72x72.png",
"xhdpi": "unpackage/res/icons/96x96.png",
"xxhdpi": "unpackage/res/icons/144x144.png",
"xxxhdpi": "unpackage/res/icons/192x192.png"
},
"ios": {
"appstore": "unpackage/res/icons/1024x1024.png",
"ipad": {
"app": "unpackage/res/icons/76x76.png",
"app@2x": "unpackage/res/icons/152x152.png",
"notification": "unpackage/res/icons/20x20.png",
"notification@2x": "unpackage/res/icons/40x40.png",
"proapp@2x": "unpackage/res/icons/167x167.png",
"settings": "unpackage/res/icons/29x29.png",
"settings@2x": "unpackage/res/icons/58x58.png",
"spotlight": "unpackage/res/icons/40x40.png",
"spotlight@2x": "unpackage/res/icons/80x80.png"
},
"iphone": {
"app@2x": "unpackage/res/icons/120x120.png",
"app@3x": "unpackage/res/icons/180x180.png",
"notification@2x": "unpackage/res/icons/40x40.png",
"notification@3x": "unpackage/res/icons/60x60.png",
"settings@2x": "unpackage/res/icons/58x58.png",
"settings@3x": "unpackage/res/icons/87x87.png",
"spotlight@2x": "unpackage/res/icons/80x80.png",
"spotlight@3x": "unpackage/res/icons/120x120.png"
}
}
},
"splashscreen": {
"androidStyle": "common",
"android": {
"hdpi": "static/logo.png",
"xhdpi": "static/logo.png",
"xxhdpi": "static/logo.png"
},
"useOriginalMsgbox": true
}
// "i18n": {
// "enable": true,
// "paths": {
// "en": "/locale/en.json",
// "zh": "/locale/zh.json",
// "zh-Hans": "/locale/zh.json",
// }
// }
}
},
"permissions": {
"Android": [{
"name": "android.permission.READ_EXTERNAL_STORAGE",
"desc": "读取外部存储"
},
{
"name": "android.permission.WRITE_EXTERNAL_STORAGE",
"desc": "写入外部存储"
}
]
},
/* */
"quickapp": {},
/* */
"mp-weixin": {
"appid": "wx9c0b7a436ada6d1e",
"setting": {
"urlCheck": false,
"postcss": true,
"minified": true
},
"usingComponents": true
},
"mp-alipay": {
"usingComponents": true
},
"mp-baidu": {
"usingComponents": true
},
"mp-toutiao": {
"usingComponents": true
},
"uniStatistics": {
"enable": false,
"version": "2"
},
"vueVersion": "2",
"locale": "zh-Hans",
"h5": {
"template": "index.html"
},
"fallbackLocale": "zh-Hans"
}
/* SDK */

View File

@ -8,7 +8,7 @@
<th>姓名</th>
<td>{{info.nickname}}</td>
<th>性别</th>
<td>{{info.gender==0?"未知":info.sex==1?"男":"女"}}</td>
<td>{{info.gender==0?"未知":info.gender==1?"男":"女"}}</td>
</tr>
<tr>
<th>出生年月</th>

View File

@ -117,6 +117,7 @@
...mapState(["languageList"]),
},
onLoad() {
let that = this
// #ifdef MP-WEIXIN
that.login()
// #endif
@ -124,7 +125,6 @@
onReady() {
let that = this
that.language = uni.getStorageSync('language') ? uni.getStorageSync('language') : uni.getLocale()
console.log("language", that.language, uni.getStorageSync('language'), uni.getLocale())
that.nowlanguage = that.languageList.find(ite => ite.key == that.language).value
},
methods: {
@ -261,9 +261,9 @@
that.language = ite.key
that.nowlanguage = ite.value
that.Islanguage = false
uni.setLocale(ite.key)
that.$i18n.locale = ite.key
uni.setStorageSync('language', ite.key)
console.log("ite", ite.key)
that.$store.commit('changeLocale', ite.key)
},
handleToggle() {
this.phone = ""

View File

@ -412,7 +412,6 @@
uni.onBluetoothAdapterStateChange(function(res) {
that.$store.commit("changeBluetooth", res.available);
})
console.log("token", uni.getStorageSync('token'))
if (uni.getStorageSync('token')) {
that.openBluetoothAdapter()
}
@ -427,7 +426,6 @@
watch: {
isConnected: function() {
let that = this
console.log("isConnected", that.isConnected)
if (!that.isConnected) {
that.textLink = that.$t("linkBluetooth.startlinkBluetooth")
that.islink = -1
@ -435,23 +433,22 @@
},
isBluetoothTyle: function() {
let that = this
console.log("isBluetoothTyle", that.isBluetoothTyle)
if (!that.isBluetoothTyle) {
that.textLink = that.$t("linkBluetooth.startlinkBluetooth")
that.islink = -1
}
},
}
},
onShow() {
let that = this
that.language = uni.getStorageSync('language')
console.log("onshow首页", that.language)
uni.onBluetoothAdapterStateChange(function(res) {
that.$store.commit("changeBluetooth", res.available);
})
if (uni.getStorageSync('isBle') && uni.getStorageSync('isBle') == true) {
that.openBluetoothAdapter()
uni.setStorageSync('isBle', false)
console.log("首次添加玩用户后初始化蓝牙", uni.getStorageSync('isBle'))
}
},
methods: {
@ -886,10 +883,13 @@
display: flex;
flex-wrap: wrap;
font-size: 14px;
text-align: right;
.lixiang {
width: 100%;
display: flex;
align-items: baseline;
justify-content: flex-end;
// justify-content: space-between;
view {

View File

@ -115,17 +115,14 @@
},
onLoad() {
let that = this
uni.setNavigationBarTitle({
title: that.$t('common.titleMe')
})
that.language = uni.getStorageSync('language')
that.index = that.languageList.findIndex(ite => ite.key == that.language)
console.log("language", that.language, that.index)
that.token = uni.getStorageSync('token')
that.handleAccountNumber()
},
onReady() {
uni.setNavigationBarTitle({
title: this.$t('common.titleMe'),
})
},
watch: {
nickname() {
this.user = {}
@ -179,10 +176,10 @@
that.$model.getSetLanguage({
language: that.languageList[that.index].key,
}).then(res => {
console.log("qqqqqqqqqqq", res)
that.language = that.languageList[that.index].key
uni.setLocale(that.languageList[that.index].key)
that.$i18n.locale = that.languageList[that.index].key
uni.setStorageSync('language', that.languageList[that.index].key)
that.$store.commit('changeLocale', that.languageList[that.index].key)
uni.$emit('login-sucesss');
})
},
navTo(url) {

View File

@ -388,11 +388,11 @@
width: 100%;
text-align: center;
position: absolute;
top: -23px;
top: 8px;
}
.span {
margin-top: 8px;
margin-top: -25px;
position: absolute;
right: -8px;
}

View File

@ -94,7 +94,8 @@ export default new Vuex.Store({
pop: [],
isCoupon: false
},
languageList: []
languageList: [],
setLocale: ""
},
// mutations: Store中更改state数据状态的唯一方法(必须是同步函数)
mutations: {
@ -168,6 +169,11 @@ export default new Vuex.Store({
changeLungLevel(state, newData) {
state.lungLevel = newData
},
// 设置语言
changeLocale(state, newData) {
console.log("changeLocale", newData)
state.setLocale = newData
},
//获取家庭成员
changeFamilay(state, newData) {
if (newData.length == 0) {

View File

@ -2,7 +2,8 @@ import $store from '@/store'
import $Bluetooth from '@/toolJs/Bluetooth.js'
import $tools from '@/toolJs/tools.js'
import messages from '@/locale/index.js'
let $t = messages[uni.getLocale()]
// let Language = $store.state.setLocale
// let $t = messages[Language]
let myTime;
let devicesList = []
export default {
@ -35,6 +36,8 @@ function openBluetoothAdapter() {
// 开始搜寻附近的蓝牙外围设备
function startBluetoothDeviceDiscovery() {
let Language = $store.state.setLocale
let $t = messages[Language]
devicesList = []
uni.startBluetoothDevicesDiscovery({
allowDuplicatesKey: true,
@ -164,6 +167,8 @@ function handleDevicesMac(device, acd_id) {
}
// 蓝牙连接失败
function getBluetoothAdapter(err) {
let Language = $store.state.setLocale
let $t = messages[Language]
if (err.errMsg == "openBluetoothAdapter:fail auth denied" || err.errMsg ===
"openBluetoothAdapter:fail auth deny" ||
err.errMsg === "openBluetoothAdapter:fail authorize no response"
@ -180,7 +185,8 @@ function getBluetoothAdapter(err) {
uni.openBluetoothAdapter({
success: e => {
uni.showToast({
title:$t.linkBluetooth.openBluetoothSuccess,
title: $t.linkBluetooth
.openBluetoothSuccess,
icon: "none"
})
$store.commit("changeBluetooth", true);

View File

@ -1,8 +1,6 @@
import $store from '@/store'
import $tools from '@/toolJs/tools.js'
import messages from '@/locale/index.js'
let Language = uni.getStorageSync("language")
let $t = messages[Language]
export default {
msg,
toHex,
@ -261,6 +259,9 @@ function checkPrivacyAgreement() {
function getBluetoothAdapter(err) {
let textLink = ""
let Language = $store.state.setLocale
let $t = messages[Language]
console.log("tools", $store.state.setLocale)
if (err.errMsg == "openBluetoothAdapter:fail auth denied" || err.errMsg ===
"openBluetoothAdapter:fail auth deny" ||
err.errMsg === "openBluetoothAdapter:fail authorize no response"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -43,7 +43,7 @@ _vue.default.prototype.$model = _model.default;
// 语言
var i18nConfig = {
locale: uni.getStorageSync('language') ? uni.getStorageSync('language') : uni.getLocale(),
locale: uni.getStorageSync('language') || "zh-Hans",
messages: _index.default
};
@ -140,18 +140,6 @@ var _default = {
},
onLaunch: function onLaunch() {
var that = this;
uni.setTabBarItem({
index: 0,
text: that.$t('common.titleHome')
});
uni.setTabBarItem({
index: 1,
text: that.$t('common.titleNews')
});
uni.setTabBarItem({
index: 2,
text: that.$t('common.titleMe')
});
that.updataWeiXin(); //小程序版本更新
//订阅登录成功事件
@ -159,6 +147,7 @@ var _default = {
console.log('on login-sucesss');
that.handleUserList();
that.handleBannerList();
that.handleTabBarItem();
setTimeout(function () {
uni.reLaunch({
url: '/pages/home/home'
@ -178,10 +167,10 @@ var _default = {
that.handleoginversion();
that.handleCityList();
that.handleCooperationUrl();
console.log('App Launch', uni.getLocale());
},
onShow: function onShow() {
console.log('App Show');
var that = this;
that.handleTabBarItem();
},
onHide: function onHide() {},
methods: {
@ -193,16 +182,18 @@ var _default = {
}).then(function (res) {
that.$store.commit('changeLanguage', res.data.language_arr);
if (res.code == 0) {
// uni.setLocale(res.data.language)
that.$i18n.locale = res.data.language;
uni.setStorageSync('language', res.data.language);
that.$store.commit('changeLocale', res.data.language);
uni.$emit('login-sucesss');
console.log("已登录手机语言", res.data.language);
} else {
uni.getSystemInfo({
success: function success(e) {
var language = uni.getStorageSync('language') ? uni.getStorageSync('language') : e.language.indexOf("zh") != -1 ? "zh-Hans" : e.language;
uni.setLocale(language);
that.$i18n.locale = language;
uni.setStorageSync('language', language);
that.$store.commit('changeLocale', language);
uni.$emit('need-login');
console.log("未登录手机语言", language);
}
@ -321,6 +312,21 @@ var _default = {
content: '请退出并移除小程序,重新打开...'
});
});
},
handleTabBarItem: function handleTabBarItem() {
var that = this;
uni.setTabBarItem({
index: 0,
text: that.$t('common.titleHome')
});
uni.setTabBarItem({
index: 1,
text: that.$t('common.titleNews')
});
uni.setTabBarItem({
index: 2,
text: that.$t('common.titleMe')
});
}
}
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -208,7 +208,6 @@ var _default = {
onReady: function onReady() {
var that = this;
that.language = uni.getStorageSync('language') ? uni.getStorageSync('language') : uni.getLocale();
console.log("language", that.language, uni.getStorageSync('language'), uni.getLocale());
that.nowlanguage = that.languageList.find(function (ite) {
return ite.key == that.language;
}).value;
@ -345,9 +344,9 @@ var _default = {
that.language = ite.key;
that.nowlanguage = ite.value;
that.Islanguage = false;
uni.setLocale(ite.key);
that.$i18n.locale = ite.key;
uni.setStorageSync('language', ite.key);
console.log("ite", ite.key);
that.$store.commit('changeLocale', ite.key);
},
handleToggle: function handleToggle() {
this.phone = "";

View File

@ -332,10 +332,10 @@
width: 100%;
text-align: center;
position: absolute;
top: -23px;
top: 8px;
}
.report .desc .statuevue .item .span.data-v-7bb9ca46 {
margin-top: 8px;
margin-top: -25px;
position: absolute;
right: -8px;
}

View File

@ -463,7 +463,6 @@ var _default = {
uni.onBluetoothAdapterStateChange(function (res) {
that.$store.commit("changeBluetooth", res.available);
});
console.log("token", uni.getStorageSync('token'));
if (uni.getStorageSync('token')) {
that.openBluetoothAdapter();
}
@ -478,7 +477,6 @@ var _default = {
watch: {
isConnected: function isConnected() {
var that = this;
console.log("isConnected", that.isConnected);
if (!that.isConnected) {
that.textLink = that.$t("linkBluetooth.startlinkBluetooth");
that.islink = -1;
@ -486,7 +484,6 @@ var _default = {
},
isBluetoothTyle: function isBluetoothTyle() {
var that = this;
console.log("isBluetoothTyle", that.isBluetoothTyle);
if (!that.isBluetoothTyle) {
that.textLink = that.$t("linkBluetooth.startlinkBluetooth");
that.islink = -1;
@ -496,13 +493,13 @@ var _default = {
onShow: function onShow() {
var that = this;
that.language = uni.getStorageSync('language');
console.log("onshow首页", that.language);
uni.onBluetoothAdapterStateChange(function (res) {
that.$store.commit("changeBluetooth", res.available);
});
if (uni.getStorageSync('isBle') && uni.getStorageSync('isBle') == true) {
that.openBluetoothAdapter();
uni.setStorageSync('isBle', false);
console.log("首次添加玩用户后初始化蓝牙", uni.getStorageSync('isBle'));
}
},
methods: {

View File

@ -332,10 +332,10 @@
width: 100%;
text-align: center;
position: absolute;
top: -23px;
top: 8px;
}
.report .desc .statuevue .item .span.data-v-92bb8f34 {
margin-top: 8px;
margin-top: -25px;
position: absolute;
right: -8px;
}

View File

@ -211,19 +211,16 @@ var _default = {
}),
onLoad: function onLoad() {
var that = this;
uni.setNavigationBarTitle({
title: that.$t('common.titleMe')
});
that.language = uni.getStorageSync('language');
that.index = that.languageList.findIndex(function (ite) {
return ite.key == that.language;
});
console.log("language", that.language, that.index);
that.token = uni.getStorageSync('token');
that.handleAccountNumber();
},
onReady: function onReady() {
uni.setNavigationBarTitle({
title: this.$t('common.titleMe')
});
},
watch: {
nickname: function nickname() {
this.user = {};
@ -277,10 +274,10 @@ var _default = {
that.$model.getSetLanguage({
language: that.languageList[that.index].key
}).then(function (res) {
console.log("qqqqqqqqqqq", res);
that.language = that.languageList[that.index].key;
uni.setLocale(that.languageList[that.index].key);
that.$i18n.locale = that.languageList[that.index].key;
uni.setStorageSync('language', that.languageList[that.index].key);
that.$store.commit('changeLocale', that.languageList[that.index].key);
uni.$emit('login-sucesss');
});
},
navTo: function navTo(url) {