Browse Source

微信回跳地址问题

shaogen1995 2 years ago
parent
commit
f059fc9ed6

+ 3 - 3
houtai/src/utils/request.js

@@ -1,8 +1,8 @@
 import axios from 'axios'
 import axios from 'axios'
+// export const baseURL = process.env.NODE_ENV === 'development' ? 'http://192.168.20.55:8037' : ''                   //线下地址
+export const baseURL = process.env.NODE_ENV === 'development' ? 'https://yifangyice.4dage.com' : '' // 线上地址
 const service = axios.create({
 const service = axios.create({
-  // baseURL: 'http://192.168.20.55:8032', // 本地调试
-  // baseURL: process.env.NODE_ENV === 'development' ? 'http://192.168.20.55:8037/api/' : '/api/',
-  baseURL: process.env.NODE_ENV === 'development' ? 'https://yifangyice.4dage.com/api/' : '/api/',
+  baseURL: baseURL + '/api/',
   timeout: 5000
   timeout: 5000
 })
 })
 // 请求拦截器
 // 请求拦截器

+ 2 - 4
houtai/src/views/tab2/add.vue

@@ -47,8 +47,8 @@
 </template>
 </template>
 
 
 <script>
 <script>
+import { baseURL } from '../../utils/request'
 import { goodsDetail, shareAudit } from '../../apis/tab2'
 import { goodsDetail, shareAudit } from '../../apis/tab2'
-import axios from '@/utils/request'
 export default {
 export default {
   name: 'tab2Add',
   name: 'tab2Add',
   components: {},
   components: {},
@@ -57,7 +57,7 @@ export default {
       info: {},
       info: {},
       imgList: [],
       imgList: [],
       // 服务器前缀地址
       // 服务器前缀地址
-      baseURL: '',
+      baseURL,
       lookPics: []
       lookPics: []
     }
     }
   },
   },
@@ -92,8 +92,6 @@ export default {
   },
   },
   // 生命周期 - 创建完成(可以访问当前this实例)
   // 生命周期 - 创建完成(可以访问当前this实例)
   async created () {
   async created () {
-    // 获取服务器前缀地址
-    this.baseURL = axios.defaults.baseURL
     let id = this.$route.query.id
     let id = this.$route.query.id
     if (id) {
     if (id) {
       id = Number(id)
       id = Number(id)

+ 2 - 4
houtai/src/views/tab2/index.vue

@@ -78,7 +78,7 @@
 </template>
 </template>
 
 
 <script>
 <script>
-import axios from '@/utils/request'
+import { baseURL } from '../../utils/request'
 import { goodsList, goodsRemove } from '@/apis/tab2'
 import { goodsList, goodsRemove } from '@/apis/tab2'
 import dayjs from 'dayjs'
 import dayjs from 'dayjs'
 import relativeTime from 'dayjs/plugin/relativeTime'
 import relativeTime from 'dayjs/plugin/relativeTime'
@@ -98,7 +98,7 @@ export default {
       },
       },
       loading: false,
       loading: false,
 
 
-      baseURL: '',
+      baseURL,
       total: 0,
       total: 0,
       status: '',
       status: '',
       formData: {
       formData: {
@@ -171,8 +171,6 @@ export default {
   },
   },
   // 生命周期 - 创建完成(可以访问当前this实例)
   // 生命周期 - 创建完成(可以访问当前this实例)
   async created () {
   async created () {
-    // 获取服务器前缀地址
-    this.baseURL = axios.defaults.baseURL
     // 判断是第一次进来还是修改或者新增或者查看后返回
     // 判断是第一次进来还是修改或者新增或者查看后返回
     // 拿到路由跳转传过来的数据
     // 拿到路由跳转传过来的数据
     const k = this.$route.query.k
     const k = this.$route.query.k

+ 3 - 3
yfyc/src/utils/request.js

@@ -2,11 +2,11 @@ import axios from 'axios'
 import {
 import {
   Toast
   Toast
 } from "vant";
 } from "vant";
-// export const baseURL = process.env.NODE_ENV === 'development' ? 'http://192.168.20.55:8037/api/' : '/api/'                   //线下地址
-export const baseURL = process.env.NODE_ENV === 'development' ? 'https://yifangyice.4dage.com/api/' : 'https://yifangyice.4dage.com'             //线上地址
+// export const baseURL = process.env.NODE_ENV === 'development' ? 'http://192.168.20.55:8037' : ''                   //线下地址
+export const baseURL = process.env.NODE_ENV === 'development' ? 'https://yifangyice.4dage.com' : ''             //线上地址
 let axajInd = 0
 let axajInd = 0
 const service = axios.create({
 const service = axios.create({
-  baseURL: baseURL,
+  baseURL: baseURL+'/api/',
   timeout: 50000
   timeout: 50000
 })
 })
 // 请求拦截器
 // 请求拦截器

+ 2 - 1
yfyc/src/views/Interact/index.vue

@@ -166,7 +166,8 @@ export default {
           "YFYC_userInfo",
           "YFYC_userInfo",
           JSON.stringify({ ...res.data.wxUser, time: Date.now() })
           JSON.stringify({ ...res.data.wxUser, time: Date.now() })
         );
         );
-        this.$router.push("/layout/interact/issue");
+        window.location.href = '/web/index.html#/layout/interact/issue'
+        // this.$router.push("/layout/interact/issue");
       }
       }
       // else {
       // else {
       //   Toast.fail("登录失败,请联系管理人员");
       //   Toast.fail("登录失败,请联系管理人员");