diff --git a/App.vue b/App.vue
index af33f22..b7cc57b 100644
--- a/App.vue
+++ b/App.vue
@@ -16,6 +16,9 @@ import request from './utils/request'
import {
setVersion
} from './utils/version.js'
+import {
+ APP_BACK_BASE_URL
+} from './utils/appBackBase.js'
//初始化一键登录插件
const aLiSDKModule = uni.requireNativePlugin('AliCloud-NirvanaPns');
export default {
@@ -66,38 +69,13 @@ export default {
// await setVersion()
//获取访问路由
- // 发起 GET 请求
- let version = uni.getStorageSync('setVersion')
- let baseUrl
- await uni.request({
- url: 'https://api.mrrwlkj.top/api/openPuc/getSjApiUrl', // 接口地址
- method: 'GET', // 请求方法(默认 GET)
- header: {
- 'Content-Type': 'application/json', // 请求头
- 'VersionCode': version.VersionCode,
- 'DeviceBrand': version.DeviceBrand,
- 'DeviceType': version.DeviceType
- },
- success: (res) => {
-
- if (res.data.code == 200) {
- // #ifndef MP-WEIXIN
- uni.setStorageSync('baseUrl', res.data.data.url)
- // #endif
- // #ifdef MP-WEIXIN
- wx.setStorageSync('baseUrl', res.data.data.url)
- // #endif
- this.$store.commit("setLocation", true)
- }
- console.log('请求成功', res.data);
- },
- fail: (err) => {
- console.log('请求失败', err);
- },
- complete: () => {
- console.log('请求完成(无论成功失败都会执行)');
- }
- });
+ // #ifndef MP-WEIXIN
+ uni.setStorageSync('baseUrl', APP_BACK_BASE_URL)
+ // #endif
+ // #ifdef MP-WEIXIN
+ wx.setStorageSync('baseUrl', APP_BACK_BASE_URL)
+ // #endif
+ this.$store.commit("setLocation", true)
// #ifdef APP-PLUS
//禁止手机横屏
diff --git a/pages.json b/pages.json
index 785abdc..f3b2606 100644
--- a/pages.json
+++ b/pages.json
@@ -31,6 +31,20 @@
"enablePullDownRefresh": true
}
},
+ {
+ "path": "pages/home/growth-package",
+ "style": {
+ "navigationBarTitleText": "",
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "pages/home/growth-package-result",
+ "style": {
+ "navigationBarTitleText": "支付结果",
+ "navigationStyle": "custom"
+ }
+ },
{
"path": "pages/message/message",
"style": {
@@ -1069,4 +1083,4 @@
]
},
"uniIdRouter": {}
-}
\ No newline at end of file
+}
diff --git a/pages/home/growth-package-result.vue b/pages/home/growth-package-result.vue
new file mode 100644
index 0000000..8dc9008
--- /dev/null
+++ b/pages/home/growth-package-result.vue
@@ -0,0 +1,167 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ resultInfo.title }}
+ {{ resultInfo.desc }}
+ {{ isFail ? "重新支付" : "返回首页" }}
+
+
+
+
+
+
+
diff --git a/pages/home/growth-package.vue b/pages/home/growth-package.vue
new file mode 100644
index 0000000..723f526
--- /dev/null
+++ b/pages/home/growth-package.vue
@@ -0,0 +1,348 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/home/home.vue b/pages/home/home.vue
index af3614d..a0735d6 100644
--- a/pages/home/home.vue
+++ b/pages/home/home.vue
@@ -20,6 +20,10 @@
+
+
+
+
{
// 请求方法
const request = async (options, isUpdate) => {
// 合并配置
- let url = uni.getStorageSync("baseUrl");
+ let url = APP_BACK_BASE_URL;
+ uni.setStorageSync("baseUrl", APP_BACK_BASE_URL);
if (uni.getStorageSync("setVersion").VersionCode == "") {
setVersion();
}
- if (!url) {
- await new Promise((resolve, reject) => {
- uni.request({
- url: "https://api.mrrwlkj.top/api/openPuc/getSjApiUrl", // 接口地址
- method: "GET", // 请求方法(默认 GET)
- header: {
- "Content-Type": "application/json", // 请求头
- VersionCode: uni.getStorageSync("setVersion").VersionCode,
- DeviceBrand: uni.getStorageSync("setVersion").DeviceBrand,
- DeviceType: uni.getStorageSync("setVersion").DeviceType,
- },
- success: (res) => {
- if (res.data.code == 200) {
- uni.setStorageSync("baseUrl", res.data.data.url);
- url = res.data.data.url;
- resolve(url);
- }
- console.log("请求成功", res.data);
- },
- fail: (err) => {
- console.log("请求失败", err);
- },
- complete: () => {
- console.log("请求完成(无论成功失败都会执行)");
- },
- });
- });
- }
-
- if (process.env.NODE_ENV === "development") {
- baseURL = url; // 发布到生产环境时,此处代码会被摇树移除掉。
- baseURL = "http://test.mrrwlkj.top"; // 发布到生产环境时,此处代码会被摇树移除掉。
- //baseURL = 'http://dev.mrrwlkj.top'; // 发布到生产环境时,此处代码会被摇树移除掉。
- // baseURL = "https://app.mrrweb.com.cn";
- } else {
- baseURL = url; // 发布到生产环境时,此处代码会被摇树移除掉。
- baseURL = "http://test.mrrwlkj.top"; // 发布到生产环境时,此处代码会被摇树移除掉。
- //baseURL = 'http://dev.mrrwlkj.top'; // 发布到生产环境时,此处代码会被摇树移除掉。
- // baseURL = "https://app.mrrweb.com.cn";
-
+ baseURL = url;
+ if (process.env.NODE_ENV !== "development") {
console.log("生产环境");
}
@@ -150,7 +113,10 @@ const request = async (options, isUpdate) => {
options = {
...config,
...options,
- url: !isUpdate ? `${config.baseURL}${options.url}` : options.url,
+ url:
+ !isUpdate && !/^https?:\/\//i.test(options.url)
+ ? `${config.baseURL}${options.url}`
+ : options.url,
};
// 请求拦截
diff --git a/utils/version.js b/utils/version.js
index 2c6fff1..63bb7d7 100644
--- a/utils/version.js
+++ b/utils/version.js
@@ -1,4 +1,6 @@
+import { APP_BACK_BASE_URL } from './appBackBase.js'
+
let VersionCode = '';
let DeviceType = '';
let platform = '';
@@ -60,30 +62,6 @@ export function setVersion() {
}
export async function getBaseUrl() {
- let version = uni.getStorageSync('setVersion')
- await uni.request({
- url: 'https://api.mrrwlkj.top/api/openPuc/getSjApiUrl', // 接口地址
- method: 'GET', // 请求方法(默认 GET)
- header: {
- 'Content-Type': 'application/json', // 请求头
- 'VersionCode': version.VersionCode,
- 'DeviceBrand': version.DeviceBrand,
- 'DeviceType': version.DeviceType
- },
- success: (res) => {
- if (res.data.code == 200) {
- uni.setStorageSync('baseUrl', res.data.data.url)
- // store.commit('setBaseUrl', res.data.data.url)
- }
- return res.data.data.url;
- console.log('请求成功', res.data);
- },
- fail: (err) => {
- console.log('请求失败', err);
- return 'http://60.247.146.5:93';
- },
- complete: () => {
- console.log('请求完成(无论成功失败都会执行)');
- }
- });
-}
\ No newline at end of file
+ uni.setStorageSync('baseUrl', APP_BACK_BASE_URL)
+ return APP_BACK_BASE_URL
+}