区号自动获取
This commit is contained in:
parent
0d6a2329d4
commit
c73f45d27e
@ -1022,17 +1022,22 @@ export async function getaddr() {
|
|||||||
const res = await get<any>('ip');
|
const res = await get<any>('ip');
|
||||||
const gj = res.data.address.split("|")[0];
|
const gj = res.data.address.split("|")[0];
|
||||||
const lan = getValue("Lanvuage");
|
const lan = getValue("Lanvuage");
|
||||||
|
const qh = await get<any>('countryCode', {
|
||||||
|
longitude: res.data.content.point.x,
|
||||||
|
latitude: res.data.content.point.y
|
||||||
|
});
|
||||||
|
console.log(qh)
|
||||||
if(lan != null && lan){
|
if(lan != null && lan){
|
||||||
if(gj == "CN"){
|
if(gj == "CN"){
|
||||||
return ['人民币¥'];
|
return {hb: '人民币¥', qh};
|
||||||
}else {
|
}else {
|
||||||
return [ '美元$']
|
return {hb: '美元$'}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(gj == "CN"){
|
if(gj == "CN"){
|
||||||
return ["zh", "中文", '人民币¥'];
|
return {yy: "zh", yyx: "中文", hb: '人民币¥', qh};
|
||||||
}else {
|
}else {
|
||||||
return ['en', 'English', '美元$']
|
return {yy: 'en', yyx: 'English', hb: '美元$', qh}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { getaddr, userinfo } from '@/api';
|
import { getaddr, userinfo } from '@/api';
|
||||||
import { setLanvuage } from '@/api/base';
|
import { setLanvuage } from '@/api/base';
|
||||||
import { getValue, saveValue } from '@/utils/common';
|
import { getValue, saveValue } from '@/utils/common';
|
||||||
|
import { geti18n } from '@/utils/i18n';
|
||||||
import { isProxy } from 'vue';
|
import { isProxy } from 'vue';
|
||||||
import { createStore } from 'vuex'
|
import { createStore } from 'vuex'
|
||||||
|
|
||||||
@ -62,6 +63,11 @@ export default createStore({
|
|||||||
symbol: "",
|
symbol: "",
|
||||||
timeCeiling: "",
|
timeCeiling: "",
|
||||||
timeLowerLimit: "",
|
timeLowerLimit: "",
|
||||||
|
},
|
||||||
|
qh: {
|
||||||
|
code: "86",
|
||||||
|
ename: "China",
|
||||||
|
name: "中国",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
@ -81,19 +87,20 @@ export default createStore({
|
|||||||
const split = new Date().toString().split(" ");
|
const split = new Date().toString().split(" ");
|
||||||
const timeZoneFormatted = split[split.length - 2] + " " + split[split.length - 1];
|
const timeZoneFormatted = split[split.length - 2] + " " + split[split.length - 1];
|
||||||
const lan = getValue("Lanvuage");
|
const lan = getValue("Lanvuage");
|
||||||
|
state.qh = data.qh.data;
|
||||||
if(lan != null && lan){
|
if(lan != null && lan){
|
||||||
// state.userinfo.language = data[1] // English 中文
|
// state.userinfo.language = data[1] // English 中文
|
||||||
// state.userinfo.languageValue = data[0] // 'en' 'zh'
|
// state.userinfo.languageValue = data[0] // 'en' 'zh'
|
||||||
state.userinfo.zoneStr = timeZoneFormatted;
|
state.userinfo.zoneStr = timeZoneFormatted;
|
||||||
state.userinfo.currency = data[0];
|
state.userinfo.currency = data.hb;
|
||||||
}else{
|
}else{
|
||||||
console.log(data, 111)
|
console.log(data, 111)
|
||||||
state.userinfo.language = data[1] // English 中文
|
state.userinfo.language = data.yyx // English 中文
|
||||||
state.userinfo.languageValue = data[0] // 'en' 'zh'
|
state.userinfo.languageValue = data.yy // 'en' 'zh'
|
||||||
state.userinfo.zoneStr = timeZoneFormatted;
|
state.userinfo.zoneStr = timeZoneFormatted;
|
||||||
state.userinfo.currency = data[2];
|
state.userinfo.currency = data.hb;
|
||||||
saveValue("Lanvuage", data[0]);
|
saveValue("Lanvuage", data.yx);
|
||||||
if( data[0] != 'zh'){
|
if( data.yx != geti18n().$s()){
|
||||||
location.reload()
|
location.reload()
|
||||||
}
|
}
|
||||||
// setLanvuage(data[0]);
|
// setLanvuage(data[0]);
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
</a-select-option>
|
</a-select-option>
|
||||||
<a-select-option value="Jiangsu"> Jiangsu </a-select-option>
|
<a-select-option value="Jiangsu"> Jiangsu </a-select-option>
|
||||||
</a-select> -->
|
</a-select> -->
|
||||||
<a-select :default-value="quhaolist[0].name + '+' + quhaolist[0].code" size="small" option-label-prop="label" @change="getquhao" class="getcode" show-search >
|
<a-select :default-value="mrqh.name + '+' + mrqh.code" size="small" option-label-prop="label" @change="getquhao" class="getcode" show-search >
|
||||||
<a-select-option v-for="(i,j) in quhaolist" :key="j" :value="i.name + '+' + i.code" :label="'+' + i.code">
|
<a-select-option v-for="(i,j) in quhaolist" :key="j" :value="i.name + '+' + i.code" :label="'+' + i.code">
|
||||||
{{i.name}}+{{i.code}}
|
{{i.name}}+{{i.code}}
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
@ -117,13 +117,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, onMounted, reactive, ref } from "vue";
|
import { computed, defineComponent, onMounted, reactive, ref } from "vue";
|
||||||
import LoginTab from "@/components/login/LoginTab.vue";
|
import LoginTab from "@/components/login/LoginTab.vue";
|
||||||
import NavTop from "@/components/NavTop.vue"
|
import NavTop from "@/components/NavTop.vue"
|
||||||
import { checksmscode, getquhaolist, getwebvideolist, loginpass, sendsms } from '@/api';
|
import { checksmscode, getquhaolist, getwebvideolist, loginpass, sendsms } from '@/api';
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
import router from '@/router';
|
import router from '@/router';
|
||||||
import { useI18n } from '@/utils/i18n';
|
import { useI18n } from '@/utils/i18n';
|
||||||
|
import store from '@/store';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "Login",
|
name: "Login",
|
||||||
@ -146,6 +147,7 @@ export default defineComponent({
|
|||||||
phone: '13152639856',
|
phone: '13152639856',
|
||||||
password: '123456'
|
password: '123456'
|
||||||
})
|
})
|
||||||
|
const mrqh = computed(() => store.state.qh)
|
||||||
const quhaolist = ref<any>([
|
const quhaolist = ref<any>([
|
||||||
{
|
{
|
||||||
code: "86",
|
code: "86",
|
||||||
@ -281,7 +283,8 @@ export default defineComponent({
|
|||||||
tovideoxq,
|
tovideoxq,
|
||||||
navto,
|
navto,
|
||||||
lan,
|
lan,
|
||||||
slogin
|
slogin,
|
||||||
|
mrqh
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
>
|
>
|
||||||
<a-input-group compact>
|
<a-input-group compact>
|
||||||
<a-select
|
<a-select
|
||||||
:default-value="quhaolist[0].name + '+' + quhaolist[0].code"
|
:default-value="mrqh.name + '+' + mrqh.code"
|
||||||
size="small"
|
size="small"
|
||||||
@change="getquhao"
|
@change="getquhao"
|
||||||
class="getcode"
|
class="getcode"
|
||||||
@ -221,7 +221,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, onMounted, reactive, ref, toRaw } from "vue";
|
import { computed, defineComponent, onMounted, reactive, ref, toRaw } from "vue";
|
||||||
import NavTop from "@/components/NavTop.vue";
|
import NavTop from "@/components/NavTop.vue";
|
||||||
import {
|
import {
|
||||||
checksmscode,
|
checksmscode,
|
||||||
@ -235,6 +235,7 @@ import {
|
|||||||
import { message } from "ant-design-vue";
|
import { message } from "ant-design-vue";
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
import { useI18n } from "@/utils/i18n";
|
import { useI18n } from "@/utils/i18n";
|
||||||
|
import store from '@/store';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "Sign",
|
name: "Sign",
|
||||||
@ -260,6 +261,7 @@ export default defineComponent({
|
|||||||
jiaoshou: "",
|
jiaoshou: "",
|
||||||
});
|
});
|
||||||
const willsay = ref<any>();
|
const willsay = ref<any>();
|
||||||
|
const mrqh = computed(() => store.state.qh)
|
||||||
const quhaolist = ref<any>([
|
const quhaolist = ref<any>([
|
||||||
{
|
{
|
||||||
code: "86",
|
code: "86",
|
||||||
@ -426,7 +428,8 @@ export default defineComponent({
|
|||||||
navto,
|
navto,
|
||||||
lan,
|
lan,
|
||||||
quhaolist,
|
quhaolist,
|
||||||
getquhao
|
getquhao,
|
||||||
|
mrqh
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -383,7 +383,7 @@
|
|||||||
<!-- <a-input size="small" v-model:value="bindPhone.number" /> -->
|
<!-- <a-input size="small" v-model:value="bindPhone.number" /> -->
|
||||||
<a-input-group compact class="telbox">
|
<a-input-group compact class="telbox">
|
||||||
<a-select
|
<a-select
|
||||||
:default-value="quhaolist[0].name + '+' + quhaolist[0].code"
|
:default-value="mrqh.name + '+' + mrqh.code"
|
||||||
size="small"
|
size="small"
|
||||||
@change="getquhao"
|
@change="getquhao"
|
||||||
option-label-prop="label"
|
option-label-prop="label"
|
||||||
@ -574,6 +574,8 @@ export default defineComponent({
|
|||||||
const chiveslist = ref<any>([[], []]);
|
const chiveslist = ref<any>([[], []]);
|
||||||
const languages = ref<unknown>([]);
|
const languages = ref<unknown>([]);
|
||||||
const quhaolist = ref<any>([]);
|
const quhaolist = ref<any>([]);
|
||||||
|
const mrqh = computed(() => store.state.qh)
|
||||||
|
|
||||||
const myquhao = ref<string>("");
|
const myquhao = ref<string>("");
|
||||||
|
|
||||||
const mynewtel = ref<string>("");
|
const mynewtel = ref<string>("");
|
||||||
@ -1056,7 +1058,8 @@ export default defineComponent({
|
|||||||
isdisabled,
|
isdisabled,
|
||||||
setname,
|
setname,
|
||||||
video,
|
video,
|
||||||
imgs
|
imgs,
|
||||||
|
mrqh
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user