Browse Source

商城迁移代码,平台参数页面修改,拼接请求

chenguo 3 days ago
parent
commit
039159c52c
3 changed files with 33 additions and 29 deletions
  1. 7 0
      src/permission.js
  2. 8 29
      src/utils/request.js
  3. 18 0
      src/views/system/config/config.vue

+ 7 - 0
src/permission.js

@@ -10,6 +10,13 @@ NProgress.configure({ showSpinner: false })
 const whiteList = ['/login', '/auth-redirect', '/bind', '/register']
 
 router.beforeEach((to, from, next) => {
+
+  if(to.path.includes('/hisStore')){
+    sessionStorage.setItem('hisStore',"1");
+  }else{
+    sessionStorage.setItem('hisStore',"0");
+  }
+
   NProgress.start()
   if (getToken()) {
     to.meta.title && store.dispatch('settings/setTitle', to.meta.title)

+ 8 - 29
src/utils/request.js

@@ -12,35 +12,14 @@ const service = axios.create({
   // 超时
   timeout: 1200000
 })
-
-// 存储当前激活的组件状态键
-let activeStateKey = null;
-
-// 重置指定页面的状态
-export function resetEndpoint() {
-  setActive(null);
-}
-// 设置当前激活状态键
-export function setActive(stateKey) {
-  activeStateKey = stateKey;
-}
-
-
 // request拦截器
 service.interceptors.request.use(config => {
-
-  // 使用当前激活的组件状态来决定是否添加前缀
-  let useNewEndpoint = false
-  let routePrefix = ''
-  let canReg = false
-  if (activeStateKey) {
-    const state = JSON.parse(sessionStorage.getItem(activeStateKey));
-    useNewEndpoint = state.isUsingNewEndpoint;
-    routePrefix = state.prefix;
-    canReg= state.regexGate.split(',').any(reg => config.url.includes(reg));
-  }
-  if (useNewEndpoint && canReg) {
-    config.url = routePrefix + config.url;
+  //判断APP商城请求
+  if(sessionStorage.getItem('hisStore') === '1'
+    && (config.url.includes('store') || config.url.includes('order'))
+    && (config.url.indexOf('/system/dict/data/type') === -1)
+  ){
+    config.url = '/store' + config.url;
   }
 
   //判断watch请求
@@ -80,8 +59,8 @@ service.interceptors.request.use(config => {
   }
   return config
 }, error => {
-    console.log(error)
-    Promise.reject(error)
+  console.log(error)
+  Promise.reject(error)
 })
 
 // 响应拦截器

+ 18 - 0
src/views/system/config/config.vue

@@ -541,6 +541,24 @@
           <el-form-item v-if="form23.type=='wx'" label="微信商户V3密钥" prop="wxMchKey">
             <el-input  v-model="form23.wxApiV3Key" label="请输入商户V3密钥"></el-input>
           </el-form-item>
+          <el-form-item v-if="form23.type=='wx'" label="keyPath" prop="wxMchKey">
+            <el-input  v-model="form23.keyPath" label="请输入商户V3密钥"></el-input>
+          </el-form-item>
+          <el-form-item v-if="form23.type=='wx'" label="privateKeyPath" prop="wxMchKey">
+            <el-input  v-model="form23.privateKeyPath" label="请输入商户V3密钥"></el-input>
+          </el-form-item>
+          <el-form-item v-if="form23.type=='wx'" label="privateCertPath" prop="wxMchKey">
+            <el-input  v-model="form23.privateCertPath" label="请输入商户V3密钥"></el-input>
+          </el-form-item>
+          <el-form-item v-if="form23.type=='wx'" label="notifyUrlScrm" prop="wxMchKey">
+            <el-input  v-model="form23.notifyUrlScrm" label="请输入商户V3密钥"></el-input>
+          </el-form-item>
+          <el-form-item v-if="form23.type=='wx'" label="publicKeyId" prop="wxMchKey">
+            <el-input  v-model="form23.publicKeyId" label="请输入商户V3密钥"></el-input>
+          </el-form-item>
+          <el-form-item v-if="form23.type=='wx'" label="publicKeyPath" prop="wxMchKey">
+            <el-input  v-model="form23.publicKeyPath" label="请输入商户V3密钥"></el-input>
+          </el-form-item>
 
 
           <el-form-item  v-if="form23.type=='hf'" label="汇付产品号" prop="hfProductId">