添加不同环境的url
This commit is contained in:
@@ -6,10 +6,10 @@ try {
|
|||||||
|
|
||||||
switch (envVersion) {
|
switch (envVersion) {
|
||||||
case "develop": // 开发版
|
case "develop": // 开发版
|
||||||
BASE_URL = "https://api.shelingxingqiu.com/api/shoot";
|
BASE_URL = "https://apitest.shelingxingqiu.com/api/shoot";
|
||||||
break;
|
break;
|
||||||
case "trial": // 体验版
|
case "trial": // 体验版
|
||||||
BASE_URL = "https://api.shelingxingqiu.com/api/shoot";
|
BASE_URL = "https://apitest.shelingxingqiu.com/api/shoot";
|
||||||
break;
|
break;
|
||||||
case "release": // 正式版
|
case "release": // 正式版
|
||||||
BASE_URL = "https://api.shelingxingqiu.com/api/shoot";
|
BASE_URL = "https://api.shelingxingqiu.com/api/shoot";
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const props = defineProps({
|
|||||||
default: () => {},
|
default: () => {},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const nextLvlPoints = ref("");
|
const nextLvlPoints = ref(0);
|
||||||
const containerWidth = computed(() =>
|
const containerWidth = computed(() =>
|
||||||
props.showRank ? "72%" : "calc(100% - 15px)"
|
props.showRank ? "72%" : "calc(100% - 15px)"
|
||||||
);
|
);
|
||||||
@@ -52,6 +52,7 @@ watch(
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
immediate: true,
|
immediate: true,
|
||||||
|
deep: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ const defaultUser = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getLvlName = (score, rankList = []) => {
|
const getLvlName = (score, rankList = []) => {
|
||||||
|
if (!rankList) return;
|
||||||
let lvlName = "";
|
let lvlName = "";
|
||||||
rankList.some((r, index) => {
|
rankList.some((r, index) => {
|
||||||
lvlName = rankList[index].name;
|
lvlName = rankList[index].name;
|
||||||
@@ -24,6 +25,7 @@ const getLvlName = (score, rankList = []) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getLvlImage = (rankLvl, rankList = []) => {
|
const getLvlImage = (rankLvl, rankList = []) => {
|
||||||
|
if (!rankList) return;
|
||||||
let lvlImage = "";
|
let lvlImage = "";
|
||||||
rankList.some((r, index) => {
|
rankList.some((r, index) => {
|
||||||
if (r.rank_id === rankLvl) {
|
if (r.rank_id === rankLvl) {
|
||||||
|
|||||||
@@ -7,7 +7,29 @@ let reconnectTimer = null;
|
|||||||
* 建立 WebSocket 连接
|
* 建立 WebSocket 连接
|
||||||
*/
|
*/
|
||||||
function createWebSocket(token, onMessage) {
|
function createWebSocket(token, onMessage) {
|
||||||
const url = `wss://api.shelingxingqiu.com/socket?authorization=${token}`;
|
let url = "wss://api.shelingxingqiu.com/socket";
|
||||||
|
try {
|
||||||
|
const accountInfo = uni.getAccountInfoSync();
|
||||||
|
const envVersion = accountInfo.miniProgram.envVersion;
|
||||||
|
|
||||||
|
switch (envVersion) {
|
||||||
|
case "develop": // 开发版
|
||||||
|
url = "wss://apitest.shelingxingqiu.com/socket";
|
||||||
|
break;
|
||||||
|
case "trial": // 体验版
|
||||||
|
url = "wss://apitest.shelingxingqiu.com/socket";
|
||||||
|
break;
|
||||||
|
case "release": // 正式版
|
||||||
|
url = "wss://api.shelingxingqiu.com/socket";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// 保持默认值
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error("获取环境信息失败,使用默认正式环境", e);
|
||||||
|
}
|
||||||
|
url += `?authorization=${token}`;
|
||||||
socket = uni.connectSocket({
|
socket = uni.connectSocket({
|
||||||
url,
|
url,
|
||||||
success: () => {
|
success: () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user