feat: 修复环境的问题
This commit is contained in:
@@ -5,11 +5,14 @@ import { refreshToken } from "@/hooks/useGoLogin";
|
||||
import { getAccessToken } from "@/constant/token";
|
||||
|
||||
onLaunch(async () => {
|
||||
await getEvnUrl({ versionValue: "1.0.3" });
|
||||
/// 获取环境配置
|
||||
await getEvnUrl();
|
||||
|
||||
/// 获取token
|
||||
const token = getAccessToken();
|
||||
|
||||
if (token) {
|
||||
/// 刷新token
|
||||
refreshToken();
|
||||
}
|
||||
});
|
||||
@@ -21,6 +24,7 @@ onShow(() => {
|
||||
onHide(() => {
|
||||
console.log("App Hide");
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
@@ -12,7 +12,7 @@ import rawConfigs from '../../client-configs.json' with { type: 'json' };
|
||||
export const CLIENT_CONFIGS = rawConfigs;
|
||||
|
||||
// 获取当前用户端配置
|
||||
export const getCurrentConfig = () => CLIENT_CONFIGS.duohua;
|
||||
export const getCurrentConfig = () => CLIENT_CONFIGS.zhinian;
|
||||
export const clientId = getCurrentConfig().clientId;
|
||||
export const appId = getCurrentConfig().appId;
|
||||
|
||||
@@ -42,4 +42,4 @@ export const currentClientType = () => {
|
||||
};
|
||||
|
||||
// 环境配置 - 智念客户端使用测试环境,其他客户端使用生产环境
|
||||
export const isProd = currentClientType() !== ClientType.ZHINIAN;
|
||||
export const isZhiNian = currentClientType() === ClientType.ZHINIAN;
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
朵花:wx23f86d809ae80259
|
||||
*/
|
||||
"mp-weixin": {
|
||||
"appid": "wx23f86d809ae80259",
|
||||
"appid": "wx5e79df5996572539",
|
||||
"setting": {
|
||||
"urlCheck": false,
|
||||
"minified": true
|
||||
|
||||
@@ -1,10 +1,25 @@
|
||||
import request from "../base/request";
|
||||
import { isProd } from "@/constant/base";
|
||||
import { isZhiNian } from "@/constant/base";
|
||||
import { useAppStore } from "@/store";
|
||||
import { devUrl, proUrl, wssDevUrl } from "../base/baseUrl";
|
||||
|
||||
/// 版本号, 每次发版本前增加
|
||||
const versionValue = "1.0.3";
|
||||
|
||||
// 获取服务地址
|
||||
const getEvnUrl = async (args) => {
|
||||
const res = await request.post("https://biz.nianxx.cn/hotelBiz/mainScene/getServiceUrl", args)
|
||||
const getEvnUrl = async () => {
|
||||
/// 智念客户端不需要获取环境地址
|
||||
if (isZhiNian) {
|
||||
const appStore = useAppStore();
|
||||
appStore.setServerConfig({
|
||||
baseUrl: devUrl, // 服务器基础地址
|
||||
wssUrl: wssDevUrl, // 服务器wss地址
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const apiUrl = proUrl + "/hotelBiz/mainScene/getServiceUrl";
|
||||
const res = await request.post(apiUrl, { versionValue: versionValue });
|
||||
if (res && res.code == 0 && res.data) {
|
||||
const appStore = useAppStore();
|
||||
appStore.setServerConfig(res.data);
|
||||
|
||||
@@ -1 +1,12 @@
|
||||
/// 生产环境基础地址
|
||||
export const proUrl = "https://biz.nianxx.cn";
|
||||
|
||||
/// 生产环境服务器wss地址
|
||||
export const wssProUrl = "wss://biz.nianxx.cn/ingress/agent/ws/chat";
|
||||
|
||||
/// 服务器基础地址
|
||||
export const devUrl = "https://onefeel.brother7.cn/ingress";
|
||||
|
||||
/// 测试服务器wss地址
|
||||
export const wssDevUrl = "wss://onefeel.brother7.cn/ingress/agent/ws/chat";
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { devUrl, wssDevUrl } from "../../request/base/baseUrl";
|
||||
|
||||
export const useAppStore = defineStore("app", {
|
||||
state() {
|
||||
@@ -6,10 +7,10 @@ export const useAppStore = defineStore("app", {
|
||||
title: "",
|
||||
sceneId: "", // 分身场景id
|
||||
previewImageData: [], // 预览图片数据
|
||||
serverConfig: {
|
||||
baseUrl: "https://onefeel.brother7.cn/ingress", // 服务器基础地址
|
||||
wssUrl: "wss://onefeel.brother7.cn/ingress/agent/ws/chat", // 服务器ws地址
|
||||
}, // 服务器配置
|
||||
serverConfig: { // 服务器配置
|
||||
baseUrl: devUrl, // 服务器基础地址
|
||||
wssUrl: wssDevUrl, // 服务器ws地址
|
||||
},
|
||||
};
|
||||
},
|
||||
getters: {},
|
||||
|
||||
Reference in New Issue
Block a user