From c73f45d27ef69e98963697a2ab1929cd05b93484 Mon Sep 17 00:00:00 2001 From: luyuan <1162963624@qq.com> Date: Wed, 18 Nov 2020 09:40:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BA=E5=8F=B7=E8=87=AA=E5=8A=A8=E8=8E=B7?= =?UTF-8?q?=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.ts | 13 +++++++++---- src/store/index.ts | 19 +++++++++++++------ src/views/login/Login.vue | 9 ++++++--- src/views/login/Sign.vue | 9 ++++++--- src/views/mine/Archives.vue | 7 +++++-- 5 files changed, 39 insertions(+), 18 deletions(-) diff --git a/src/api/index.ts b/src/api/index.ts index 3e83d88..aa2cfc0 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1022,17 +1022,22 @@ export async function getaddr() { const res = await get('ip'); const gj = res.data.address.split("|")[0]; const lan = getValue("Lanvuage"); + const qh = await get('countryCode', { + longitude: res.data.content.point.x, + latitude: res.data.content.point.y + }); + console.log(qh) if(lan != null && lan){ if(gj == "CN"){ - return ['人民币¥']; + return {hb: '人民币¥', qh}; }else { - return [ '美元$'] + return {hb: '美元$'} } }else{ if(gj == "CN"){ - return ["zh", "中文", '人民币¥']; + return {yy: "zh", yyx: "中文", hb: '人民币¥', qh}; }else { - return ['en', 'English', '美元$'] + return {yy: 'en', yyx: 'English', hb: '美元$', qh} } } diff --git a/src/store/index.ts b/src/store/index.ts index 8ca4f4d..5eed3e6 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -1,6 +1,7 @@ import { getaddr, userinfo } from '@/api'; import { setLanvuage } from '@/api/base'; import { getValue, saveValue } from '@/utils/common'; +import { geti18n } from '@/utils/i18n'; import { isProxy } from 'vue'; import { createStore } from 'vuex' @@ -62,6 +63,11 @@ export default createStore({ symbol: "", timeCeiling: "", timeLowerLimit: "", + }, + qh: { + code: "86", + ename: "China", + name: "中国", } }, mutations: { @@ -81,19 +87,20 @@ export default createStore({ const split = new Date().toString().split(" "); const timeZoneFormatted = split[split.length - 2] + " " + split[split.length - 1]; const lan = getValue("Lanvuage"); + state.qh = data.qh.data; if(lan != null && lan){ // state.userinfo.language = data[1] // English 中文 // state.userinfo.languageValue = data[0] // 'en' 'zh' state.userinfo.zoneStr = timeZoneFormatted; - state.userinfo.currency = data[0]; + state.userinfo.currency = data.hb; }else{ console.log(data, 111) - state.userinfo.language = data[1] // English 中文 - state.userinfo.languageValue = data[0] // 'en' 'zh' + state.userinfo.language = data.yyx // English 中文 + state.userinfo.languageValue = data.yy // 'en' 'zh' state.userinfo.zoneStr = timeZoneFormatted; - state.userinfo.currency = data[2]; - saveValue("Lanvuage", data[0]); - if( data[0] != 'zh'){ + state.userinfo.currency = data.hb; + saveValue("Lanvuage", data.yx); + if( data.yx != geti18n().$s()){ location.reload() } // setLanvuage(data[0]); diff --git a/src/views/login/Login.vue b/src/views/login/Login.vue index 1d88dd2..e8dc5ce 100644 --- a/src/views/login/Login.vue +++ b/src/views/login/Login.vue @@ -23,7 +23,7 @@ Jiangsu --> - + {{i.name}}+{{i.code}} @@ -117,13 +117,14 @@