shaogen1995 2 éve
szülő
commit
51df45362d

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

@@ -3,11 +3,11 @@ import {
   Toast
 } 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/' : '/api/'             //线上地址
+export const baseURL = process.env.NODE_ENV === 'development' ? 'https://yifangyice.4dage.com/api/' : 'https://yifangyice.4dage.com'             //线上地址
 let axajInd = 0
 const service = axios.create({
   baseURL: baseURL,
-  timeout: 5000
+  timeout: 50000
 })
 // 请求拦截器
 service.interceptors.request.use(function (config) {

+ 2 - 2
yfyc/src/views/Construct/components/HomeList.vue

@@ -210,7 +210,7 @@ export default {
       }
 
       .name {
-        padding: 10px 10px 5px;
+        padding: 8px 10px 3px;
         font-size: 14px;
         font-weight: 700;
       }
@@ -219,7 +219,7 @@ export default {
         padding-left: 10px;
         display: flex;
         align-items: center;
-        margin-top: 6px;
+        margin-top: 3px;
         font-size: 12px;
         & > img {
           margin-right: 3px;

+ 27 - 10
yfyc/src/views/Interact/index.vue

@@ -33,17 +33,14 @@
         v-for="item in dataShow"
         :key="item.id"
       >
-        <img
-          v-lazy="baseURL + item.thumb"
-          alt=""
-        />
+        <img v-lazy="baseURL + item.thumb" alt="" />
         <div class="name">{{ item.name }}</div>
         <div class="author">
           <div class="author_ll">
             <img :src="item.avatarUrl" alt="" />
             <p>{{ item.nickName }}</p>
           </div>
-          <div class="author_rr">{{ item.createTime.slice(0,10) }}</div>
+          <div class="author_rr">{{ item.createTime.slice(0, 10) }}</div>
         </div>
       </div>
     </div>
@@ -114,9 +111,29 @@ export default {
     },
 
     // 获取地址栏参数的方法
-    getQueryCode() {
-      return this.$route.query.code ? this.$route.query.code : "";
+    getQueryCode(name) {
+      // 未传参,返回空
+      if (!name) return null;
+      // 查询参数:先通过search取值,如果取不到就通过hash来取
+      var after = window.location.search;
+      after = after.substr(1) || window.location.hash.split("?")[1];
+      // 地址栏URL没有查询参数,返回空
+      if (!after) return null;
+      // 如果查询参数中没有"name",返回空
+      if (after.indexOf(name) === -1) return null;
+
+      var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
+      // 当地址栏参数存在中文时,需要解码,不然会乱码
+      var r = decodeURI(after).match(reg);
+      // 如果url中"name"没有值,返回空
+      if (!r) return null;
+
+      return r[2];
     },
+
+    // getQueryCode() {
+    //   return this.$route.query.code ? this.$route.query.code : "";
+    // },
     // 封装一个获取列表的方法
     async getListFu() {
       const obj = {
@@ -137,10 +154,10 @@ export default {
     // 获取话题列表
     const res1 = await getDictAPI("topic");
     this.bsData = res1.data;
-    this.bsData.unshift({id:null,name:'全部'})
+    this.bsData.unshift({ id: null, name: "全部" });
 
-    
-    let code = this.getQueryCode();
+    let code = this.getQueryCode("code");
+    console.log("-----------", code);
     if (code) {
       let res = await getCodeAPI(code);
       if (res.code === 0) {