feat: 环境地址配置
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script setup>
|
||||
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
|
||||
import { getEvnUrl } from "@/request/api/config";
|
||||
import { getEvnUrl } from "@/request/base/config";
|
||||
import { refreshToken } from "@/hooks/useGoLogin";
|
||||
import { getAccessToken } from "@/constant/token";
|
||||
|
||||
|
||||
13
src/request/api/GetServiceUrlApi.js
Normal file
13
src/request/api/GetServiceUrlApi.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import request from "../base/request";
|
||||
import { proUrl } from "../base/baseUrl";
|
||||
import { useAppStore } from "@/store";
|
||||
|
||||
export const getServiceUrl = async (versionValue) => {
|
||||
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,15 +1,18 @@
|
||||
import request from "../base/request";
|
||||
import { isZhiNian } from "@/constant/base";
|
||||
import { useAppStore } from "@/store";
|
||||
import { devUrl, proUrl, wssDevUrl } from "../base/baseUrl";
|
||||
import { devUrl, wssDevUrl } from "./baseUrl";
|
||||
import { getServiceUrl } from "../api/GetServiceUrlApi";
|
||||
|
||||
/// 版本号, 每次发版本前增加
|
||||
const versionValue = "1.0.4";
|
||||
|
||||
/// 是否是测试版本, 测试版本为true, 发布版本为false
|
||||
const developVersion = false;
|
||||
|
||||
// 获取服务地址
|
||||
const getEvnUrl = async () => {
|
||||
/// 智念客户端不需要获取环境地址
|
||||
if (isZhiNian) {
|
||||
if (isZhiNian || developVersion) {
|
||||
const appStore = useAppStore();
|
||||
appStore.setServerConfig({
|
||||
baseUrl: devUrl, // 服务器基础地址
|
||||
@@ -18,12 +21,8 @@ const getEvnUrl = async () => {
|
||||
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);
|
||||
}
|
||||
/// 正式环境获取服务地址
|
||||
await getServiceUrl(versionValue);
|
||||
};
|
||||
|
||||
export { getEvnUrl };
|
||||
@@ -1,4 +1,3 @@
|
||||
import { goLogin } from "../../hooks/useGoLogin";
|
||||
import { getCurrentConfig } from "@/constant/base";
|
||||
import { useAppStore } from "@/store";
|
||||
import { NOTICE_EVENT_LOGOUT } from "@/constant/constant";
|
||||
|
||||
Reference in New Issue
Block a user