Browse Source

no message

USER-20230908AJ\Administrator 11 months ago
parent
commit
cc86e93ffb
5 changed files with 21 additions and 13 deletions
  1. 2 3
      .env.dev.js
  2. 11 4
      .env.js
  3. 1 1
      .env.prod.js
  4. 2 2
      .env.trial.js
  5. 5 3
      service/ajax.js

+ 2 - 3
.env.dev.js

@@ -1,7 +1,6 @@
 const config = {
-  // baseUrl: 'whapi.test.cc',
-  baseUrl: 'http://wh-api.localhost.com',
-  webUrl: 'http://wh-api.localhost.com',
+  baseUrl: 'https://api.wealfavor.cn',
+  goUrl: 'http://127.0.0.1:8001',
   appName: '开发环境'
 }
 module.exports = config;

+ 11 - 4
.env.js

@@ -1,18 +1,25 @@
 let version = __wxConfig.envVersion;
 
+console.log('配置文件加载')
 // #ifdef MP-WEIXIN
-if (__wxConfig.envVersion === 'release') {
-
+console.log('微信小程序验证')
+console.log(__wxConfig.envVersion)
+if (version === 'develop') {
+    //开发环境
+    ENV_CONFIG = require('.env.dev.js');
+    ENV_CONFIG.isCanvas2d = false
+}else if (__wxConfig.envVersion === 'release') {
     //生产环境
     ENV_CONFIG = require('.env.prod.js');
     ENV_CONFIG.isCanvas2d = true
 }  else {
-    //开发环境
+    //体验环境
     ENV_CONFIG = require('.env.prod.js');
-    ENV_CONFIG.isCanvas2d = false
+    ENV_CONFIG.isCanvas2d = true
 }
 //#endif
 // #ifndef MP-WEIXIN
+console.log('其它环境验证')
 if (version === 'develop') {
     //开发环境
     // ENV_CONFIG = require('.env.dev.js');

+ 1 - 1
.env.prod.js

@@ -1,6 +1,6 @@
 const config = {
     baseUrl: 'https://api.wealfavor.cn',
-    webUrl: 'https://api.wealfavor.cn',
+    goUrl: 'https://api.wealfavor.cn',
     appName:'正式环境'
 }
 module.exports = config;

+ 2 - 2
.env.trial.js

@@ -1,6 +1,6 @@
 const config = {
     baseUrl: 'https://test-api.wealfavor.cn',
-    webUrl: 'https://test-api.wealfavor.cn',
-    appName:'正式环境'
+    goUrl: 'https://test-api.wealfavor.cn',
+    appName:'演示环境'
 }
 module.exports = config;

+ 5 - 3
service/ajax.js

@@ -8,12 +8,14 @@ BASE_URL = process.uniEnv.baseUrl;
 /**
  * post请求封装
  */
-export const request = (url, method, data, show = false) => {
+export const request = (url, method, data, show = false,isGo=false) => {
   let token=uni.getStorageSync('token')
   // data.token = token;
   // data.m_id = uni.getStorageSync('m_id')
-  if(url==='/api/task/add'){
-    console.log('token:'+token)
+  if(isGo){
+    BASE_URL = process.uniEnv.goUrl;
+  }else {
+    BASE_URL = process.uniEnv.baseUrl;
   }
 
   if (show) {