Browse Source

fix:
- http去掉无用代码,更改为简洁赋值
- 企业承诺搜索传递用户id

梦辉 5 tháng trước cách đây
mục cha
commit
3a62c028d4
2 tập tin đã thay đổi với 14 bổ sung65 xóa
  1. 13 64
      src/common/js/baseUrl.js
  2. 1 1
      src/subPages/pages/commitment/home/index.vue

+ 13 - 64
src/common/js/baseUrl.js

@@ -1,71 +1,20 @@
 let httpApi = ""; // 基础服务
 let doorplateImgUrl='';//  门牌二维码图片地址
 //根据运行时版本设置请求url
-function setFetchUrlByEnv(env) {
-//  httpApi = "http://192.168.31.51:9080"; //公司测试
-  httpApi = "https://fhszmp.fh.gov.cn:9080"; //线上测试
-//  httpApi = "https://fhszmp.fh.gov.cn:8080"; //线上正式
-  doorplateImgUrl='https://fhszmp.fh.gov.cn:8090/digital-doorplateAddrUrl'
-
-//  console.log("当前运行", env);
-//  if (env === "development") {
-////        httpApi = "http://192.168.31.51:9080";
-//    httpApi = "http://122.247.77.37:9080";
-//    doorplateImgUrl='https://fhszmp.fh.gov.cn:8090/digital-doorplateAddrUrl'
-//  } else {
-//    httpApi = "https://zlszmp.fh.gov.cn:8088/digital-doorplate";
-//    doorplateImgUrl='https://zlszmp.fh.gov.cn:8088/digital-doorplateAddrUrl'
-//  }
-//  switch (env) {
-//    case "develop":
-//      httpApi = "http://172.18.50.88:8070/digital-doorplate";
-//      doorplateImgUrl='https://fhszmp.fh.gov.cn:8090/digital-doorplateAddrUrl'
-//      // 微信小程序开发环境在真机上连接外网体验版地址
-//      // #ifdef MP-WEIXIN
-//      if (__wxConfig && __wxConfig.platform !== "devtools") {
-//        httpApi = "http://60.191.98.34:8072/digital-doorplate";
-//      }
-//      // #endif
-//      break;
-//    case "trial":
-//      // 体验版
-//      // #ifdef MP-WEIXIN
-//      // httpApi = "http://60.191.98.34:8072/digital-doorplate"; // 基础服务
-//      httpApi = "https://zlszmp.fh.gov.cn:8088/digital-doorplate"; // 基础服务
-//      // #endif
-//      // #ifdef MP-ALIPAY
-//      httpApi = "https://zlszmp.fh.gov.cn:8088/digital-doorplate"; // 基础服务
-//      // #endif
-//      doorplateImgUrl='https://fhszmp.fh.gov.cn:8090/digital-doorplateAddrUrl'
-//      break;
-//    case "release":
-//      // 正式
-//      httpApi = "'https://fhszmp.fh.gov.cn:8090/digital-doorplate"; // 基础服务
-//      doorplateImgUrl='https://fhszmp.fh.gov.cn:8090/digital-doorplateAddrUrl'
-//      break;
-//    default:
-//      // httpApi = "http://172.18.50.92:8888/digital-doorplate";
-//      if (env === "development") {
-////        发版的时候恢复过来
-////         httpApi = window.location.origin + "/digital-doorplate"; //"http://172.18.50.92:8888/digital-doorplate";
-////         doorplateImgUrl='https://zlszmp.fh.gov.cn:8088/digital-doorplateAddrUrl'
-//
-////        httpApi = "http://192.168.31.51:9080";
-//        httpApi = "http://122.247.77.37:9080";
-//        doorplateImgUrl='https://fhszmp.fh.gov.cn:8090/digital-doorplateAddrUrl'
-//      } else {
-//        httpApi = "https://zlszmp.fh.gov.cn:8088/digital-doorplate";
-//        doorplateImgUrl='https://zlszmp.fh.gov.cn:8088/digital-doorplateAddrUrl'
-//      }
-//      break;
-//  }
+function setFetchUrlByEnv() {
+  // 获取当前页面的 URL
+  const currentUrl = window.location.href;
+  console.log("currentUrl", currentUrl);
+  if (currentUrl.includes('debug=true')) {
+    httpApi = 'https://fhszmp.fh.gov.cn:9080';
+    uni.getEnvVersion = ()=> 'development'
+  } else {
+    httpApi = 'https://fhszmp.fh.gov.cn:8080';
+    uni.getEnvVersion = () => 'production'
+  }
+  doorplateImgUrl='https://zlszmp.fh.gov.cn:8088/digital-doorplateAddrUrl'
 }
 
-uni.getEnvVersion = () => {
-  return process.env.NODE_ENV === "production" ? "production" : "development";
-};
-const envVersion = uni.getEnvVersion();
-
-setFetchUrlByEnv(envVersion);
+setFetchUrlByEnv();
 
 export { httpApi, doorplateImgUrl};

+ 1 - 1
src/subPages/pages/commitment/home/index.vue

@@ -36,7 +36,7 @@ export default {
       try {
         const res = await searchCommitment({
           searchCriteria: this.searchValue,
-          createUser: 2,
+          createUser: uni.getStorageSync("userInfo").id || '',
           type
         })
         if(type === 0) {