Compare commits
4 Commits
fix-109
...
71a1083887
| Author | SHA1 | Date | |
|---|---|---|---|
| 71a1083887 | |||
| 972c777177 | |||
|
|
ae2fb40d72 | ||
| 27b2052cec |
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"appid": "wx23f86d809ae80259",
|
||||
"appid": "wx5e79df5996572539",
|
||||
"compileType": "miniprogram",
|
||||
"libVersion": "3.8.10",
|
||||
"packOptions": {
|
||||
|
||||
@@ -200,6 +200,7 @@ function main() {
|
||||
console.log("\n🎉 所有文件更新完成!");
|
||||
console.log(`💡 已切换到 ${CLIENT_CONFIGS[clientName].name} 客户端配置`);
|
||||
console.log("💡 提示: 请检查文件内容确认更新正确");
|
||||
console.log("\n💡 版本升级: 请到request/api/config.js文件中更新versionValue版本号\n");
|
||||
} else {
|
||||
console.log("\n❌ 部分文件更新失败,请检查错误信息");
|
||||
process.exit(1);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -102,6 +102,9 @@ const handleLogout = () => {
|
||||
uni.clearStorageSync();
|
||||
emits("close");
|
||||
uni.$emit(NOTICE_EVENT_LOGOUT);
|
||||
uni.showToast({
|
||||
title: "退出登录成功",
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -258,9 +258,6 @@ const addNoticeListener = () => {
|
||||
|
||||
uni.$on(NOTICE_EVENT_LOGOUT, () => {
|
||||
resetConfig();
|
||||
uni.showToast({
|
||||
title: "退出登录成功",
|
||||
});
|
||||
});
|
||||
|
||||
uni.$on(SCROLL_TO_BOTTOM, () => {
|
||||
|
||||
@@ -28,9 +28,10 @@
|
||||
<!-- 按钮区域 -->
|
||||
<view class="login-btn-area">
|
||||
<!-- 同意隐私协议并获取手机号按钮 -->
|
||||
|
||||
<button class="login-btn" type="primary" :open-type="needWxLogin ? 'getPhoneNumber' : ''"
|
||||
@getphonenumber="getPhoneNumber" @click="handleAgreeAndGetPhone">
|
||||
<button v-if="needWxLogin" class="login-btn" type="primary" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
|
||||
手机号快捷登录
|
||||
</button>
|
||||
<button v-else class="login-btn" type="primary" @click="handleAgreeAndGetPhone">
|
||||
手机号快捷登录
|
||||
</button>
|
||||
</view>
|
||||
@@ -76,19 +77,29 @@ const handleAgreeAndGetPhone = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
refreshToken(true).then(() => goBack());
|
||||
refreshToken(true).then(() => loginSuccess());
|
||||
};
|
||||
|
||||
/// 获取授权后绑定手机号登录
|
||||
const getPhoneNumber = (e) => {
|
||||
onLogin(e)
|
||||
.then(() => {
|
||||
if (!isAgree.value) {
|
||||
uni.showToast({
|
||||
title: "请先同意服务协议和隐私协议",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
onLogin(e).then(() => loginSuccess())
|
||||
.catch(() => { });
|
||||
};
|
||||
|
||||
/// 登录成功返回上一页
|
||||
const loginSuccess = () => {
|
||||
uni.showToast({
|
||||
title: "登录成功",
|
||||
icon: "success",
|
||||
});
|
||||
goBack();
|
||||
})
|
||||
.catch(() => { });
|
||||
};
|
||||
|
||||
// 处理同意协议点击事件
|
||||
@@ -111,7 +122,6 @@ const getServiceAgreementData = async () => {
|
||||
const { data } = await getServiceAgreement();
|
||||
serviceAgreement.value = data;
|
||||
};
|
||||
|
||||
getServiceAgreementData();
|
||||
|
||||
// 获取隐私协议数据
|
||||
@@ -119,15 +129,15 @@ const getPrivacyAgreementData = async () => {
|
||||
const { data } = await getPrivacyAgreement();
|
||||
privacyAgreement.value = data;
|
||||
};
|
||||
|
||||
getPrivacyAgreementData();
|
||||
|
||||
// 页面显示时刷新token
|
||||
onShow(async () => {
|
||||
const res = await refreshToken();
|
||||
|
||||
needWxLogin.value = res;
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -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