feat: 修复环境的问题
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"appid": "wx23f86d809ae80259",
|
"appid": "wx5e79df5996572539",
|
||||||
"compileType": "miniprogram",
|
"compileType": "miniprogram",
|
||||||
"libVersion": "3.8.10",
|
"libVersion": "3.8.10",
|
||||||
"packOptions": {
|
"packOptions": {
|
||||||
|
|||||||
@@ -200,6 +200,7 @@ function main() {
|
|||||||
console.log("\n🎉 所有文件更新完成!");
|
console.log("\n🎉 所有文件更新完成!");
|
||||||
console.log(`💡 已切换到 ${CLIENT_CONFIGS[clientName].name} 客户端配置`);
|
console.log(`💡 已切换到 ${CLIENT_CONFIGS[clientName].name} 客户端配置`);
|
||||||
console.log("💡 提示: 请检查文件内容确认更新正确");
|
console.log("💡 提示: 请检查文件内容确认更新正确");
|
||||||
|
console.log("\n💡 版本升级: 请到request/api/config.js文件中更新versionValue版本号\n");
|
||||||
} else {
|
} else {
|
||||||
console.log("\n❌ 部分文件更新失败,请检查错误信息");
|
console.log("\n❌ 部分文件更新失败,请检查错误信息");
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
|||||||
@@ -5,11 +5,14 @@ import { refreshToken } from "@/hooks/useGoLogin";
|
|||||||
import { getAccessToken } from "@/constant/token";
|
import { getAccessToken } from "@/constant/token";
|
||||||
|
|
||||||
onLaunch(async () => {
|
onLaunch(async () => {
|
||||||
await getEvnUrl({ versionValue: "1.0.3" });
|
/// 获取环境配置
|
||||||
|
await getEvnUrl();
|
||||||
|
|
||||||
|
/// 获取token
|
||||||
const token = getAccessToken();
|
const token = getAccessToken();
|
||||||
|
|
||||||
if (token) {
|
if (token) {
|
||||||
|
/// 刷新token
|
||||||
refreshToken();
|
refreshToken();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -21,6 +24,7 @@ onShow(() => {
|
|||||||
onHide(() => {
|
onHide(() => {
|
||||||
console.log("App Hide");
|
console.log("App Hide");
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import rawConfigs from '../../client-configs.json' with { type: 'json' };
|
|||||||
export const CLIENT_CONFIGS = rawConfigs;
|
export const CLIENT_CONFIGS = rawConfigs;
|
||||||
|
|
||||||
// 获取当前用户端配置
|
// 获取当前用户端配置
|
||||||
export const getCurrentConfig = () => CLIENT_CONFIGS.duohua;
|
export const getCurrentConfig = () => CLIENT_CONFIGS.zhinian;
|
||||||
export const clientId = getCurrentConfig().clientId;
|
export const clientId = getCurrentConfig().clientId;
|
||||||
export const appId = getCurrentConfig().appId;
|
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
|
朵花:wx23f86d809ae80259
|
||||||
*/
|
*/
|
||||||
"mp-weixin": {
|
"mp-weixin": {
|
||||||
"appid": "wx23f86d809ae80259",
|
"appid": "wx5e79df5996572539",
|
||||||
"setting": {
|
"setting": {
|
||||||
"urlCheck": false,
|
"urlCheck": false,
|
||||||
"minified": true
|
"minified": true
|
||||||
|
|||||||
@@ -1,10 +1,25 @@
|
|||||||
import request from "../base/request";
|
import request from "../base/request";
|
||||||
import { isProd } from "@/constant/base";
|
import { isZhiNian } from "@/constant/base";
|
||||||
import { useAppStore } from "@/store";
|
import { useAppStore } from "@/store";
|
||||||
|
import { devUrl, proUrl, wssDevUrl } from "../base/baseUrl";
|
||||||
|
|
||||||
|
/// 版本号, 每次发版本前增加
|
||||||
|
const versionValue = "1.0.3";
|
||||||
|
|
||||||
// 获取服务地址
|
// 获取服务地址
|
||||||
const getEvnUrl = async (args) => {
|
const getEvnUrl = async () => {
|
||||||
const res = await request.post("https://biz.nianxx.cn/hotelBiz/mainScene/getServiceUrl", args)
|
/// 智念客户端不需要获取环境地址
|
||||||
|
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) {
|
if (res && res.code == 0 && res.data) {
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
appStore.setServerConfig(res.data);
|
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 { defineStore } from "pinia";
|
||||||
|
import { devUrl, wssDevUrl } from "../../request/base/baseUrl";
|
||||||
|
|
||||||
export const useAppStore = defineStore("app", {
|
export const useAppStore = defineStore("app", {
|
||||||
state() {
|
state() {
|
||||||
@@ -6,10 +7,10 @@ export const useAppStore = defineStore("app", {
|
|||||||
title: "",
|
title: "",
|
||||||
sceneId: "", // 分身场景id
|
sceneId: "", // 分身场景id
|
||||||
previewImageData: [], // 预览图片数据
|
previewImageData: [], // 预览图片数据
|
||||||
serverConfig: {
|
serverConfig: { // 服务器配置
|
||||||
baseUrl: "https://onefeel.brother7.cn/ingress", // 服务器基础地址
|
baseUrl: devUrl, // 服务器基础地址
|
||||||
wssUrl: "wss://onefeel.brother7.cn/ingress/agent/ws/chat", // 服务器ws地址
|
wssUrl: wssDevUrl, // 服务器ws地址
|
||||||
}, // 服务器配置
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
getters: {},
|
getters: {},
|
||||||
|
|||||||
Reference in New Issue
Block a user