禁止之后也访问
This commit is contained in:
@@ -27,6 +27,7 @@ export default defineComponent({
|
||||
if(getValue('token')){
|
||||
console.log("token")
|
||||
store.commit("login", true)
|
||||
store.dispatch("getcode");
|
||||
store.dispatch("setUserInfo");
|
||||
}else{
|
||||
|
||||
|
||||
@@ -1040,7 +1040,7 @@ export async function luzhi(roomid: string){
|
||||
}
|
||||
|
||||
export function getaddr() {
|
||||
return new Promise((r)=>{
|
||||
return new Promise(async (r)=>{
|
||||
console.log("开始定位")
|
||||
const lan = getValue("Lanvuage");
|
||||
if ("geolocation" in navigator) {
|
||||
@@ -1065,11 +1065,45 @@ export function getaddr() {
|
||||
r({yy: 'en', yyx: 'English', hb: '美元$', qh})
|
||||
}
|
||||
}
|
||||
},(err) => {
|
||||
message.error(err.message)
|
||||
console.log(err, 'err')
|
||||
},async () => {
|
||||
const qh = await get<any>('countryCode', {
|
||||
|
||||
});
|
||||
console.log(qh)
|
||||
if(lan != null && lan){
|
||||
if(qh.data.ename == "China"){
|
||||
r({hb: '人民币¥', qh});
|
||||
}else {
|
||||
r({hb: '美元$'})
|
||||
}
|
||||
}else{
|
||||
if(qh.data.ename == "China"){
|
||||
r({yy: "zh", yyx: "中文", hb: '人民币¥', qh});
|
||||
}else {
|
||||
r({yy: 'en', yyx: 'English', hb: '美元$', qh})
|
||||
}
|
||||
}
|
||||
// message.error(err.message)
|
||||
// console.log(err, 'err')
|
||||
})
|
||||
} else {
|
||||
const qh = await get<any>('countryCode', {
|
||||
|
||||
});
|
||||
console.log(qh)
|
||||
if(lan != null && lan){
|
||||
if(qh.data.ename == "China"){
|
||||
r({hb: '人民币¥', qh});
|
||||
}else {
|
||||
r({hb: '美元$'})
|
||||
}
|
||||
}else{
|
||||
if(qh.data.ename == "China"){
|
||||
r({yy: "zh", yyx: "中文", hb: '人民币¥', qh});
|
||||
}else {
|
||||
r({yy: 'en', yyx: 'English', hb: '美元$', qh})
|
||||
}
|
||||
}
|
||||
/* 地理位置服务不可用 */
|
||||
console.log("无法定位")
|
||||
}
|
||||
|
||||
@@ -110,6 +110,9 @@ export default createStore({
|
||||
}
|
||||
|
||||
},
|
||||
setquhao(state, data){
|
||||
state.qh = data.qh.data;
|
||||
},
|
||||
setWlan(state){
|
||||
const lan = getValue("Lanvuage");
|
||||
if(lan != null && lan){
|
||||
@@ -134,6 +137,11 @@ export default createStore({
|
||||
const info = await getaddr();
|
||||
console.log(info,11256445);
|
||||
commit("setLanguage", info)
|
||||
},
|
||||
async getcode({ commit }){
|
||||
const info = await getaddr();
|
||||
console.log(info,11256445);
|
||||
commit("setquhao", info)
|
||||
}
|
||||
},
|
||||
modules: {
|
||||
|
||||
Reference in New Issue
Block a user