Selaa lähdekoodia

Merge branch 'master' of http://face3d.4dage.com:7005/shaogen1995/YFYC-H5

任一存 2 vuotta sitten
vanhempi
commit
8bf7a182bb

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

@@ -1,8 +1,8 @@
 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({
-  // 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
 })
 // 请求拦截器

+ 12 - 5
houtai/src/views/tab2/add.vue

@@ -33,6 +33,10 @@
           </div>
         </div>
       </div>
+      <div class="row">
+        <div class="ll">状态:</div>
+        <div class="rr">{{ statusObj[info.status] }}</div>
+      </div>
     </div>
     <!-- 底部按钮 -->
     <div class="con_btn">
@@ -47,8 +51,8 @@
 </template>
 
 <script>
+import { baseURL } from '../../utils/request'
 import { goodsDetail, shareAudit } from '../../apis/tab2'
-import axios from '@/utils/request'
 export default {
   name: 'tab2Add',
   components: {},
@@ -57,8 +61,13 @@ export default {
       info: {},
       imgList: [],
       // 服务器前缀地址
-      baseURL: '',
-      lookPics: []
+      baseURL,
+      lookPics: [],
+      statusObj: {
+        0: '待审核',
+        1: '通过',
+        2: '不通过'
+      }
     }
   },
   // 监听属性 类似于data概念
@@ -92,8 +101,6 @@ export default {
   },
   // 生命周期 - 创建完成(可以访问当前this实例)
   async created () {
-    // 获取服务器前缀地址
-    this.baseURL = axios.defaults.baseURL
     let id = this.$route.query.id
     if (id) {
       id = Number(id)

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

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

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

@@ -2,12 +2,12 @@ import axios from 'axios'
 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' ? 'http://192.168.20.55:8037' : ''                   //线下地址
+export const baseURL = process.env.NODE_ENV === 'development' ? 'https://yifangyice.4dage.com' : ''             //线上地址
 let axajInd = 0
 const service = axios.create({
-  baseURL: baseURL,
-  timeout: 5000
+  baseURL: baseURL+'/api/',
+  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) {

+ 38 - 30
yfyc/src/views/Layout/index.vue

@@ -1,12 +1,22 @@
 <template>
-  <div class='Layout'>
-
+  <div class="Layout">
     <!-- 底部固定栏 -->
     <div class="bottom">
-      <div class="row" @click="$router.push(item.path).catch(() => { })" v-for="item in data" :key="item.id">
-        <img :src="require(`@/assets/img/layout/inco${item.id}${item.id === $route.meta.myInd ? 'Ac' : ''}.png`)" alt="">
+      <div
+        class="row"
+        @click="toUrl(item.path)"
+        v-for="item in data"
+        :key="item.id"
+      >
+        <img
+          :src="
+            require(`@/assets/img/layout/inco${item.id}${
+              item.id === $route.meta.myInd ? 'Ac' : ''
+            }.png`)
+          "
+          alt=""
+        />
         <p>{{ item.name }}</p>
-        
       </div>
     </div>
 
@@ -15,38 +25,37 @@
 </template>
 
 <script>
-
 export default {
   components: {},
   data() {
     return {
       data: [
-        { id: 1, path: '/layout/list', name: '建筑可阅读' },
-        { id: 2, path: '/layout/serve', name: '建筑可游玩' },
-        { id: 3, path: '/layout/interact', name: '建筑可对话' },
-        { id: 4, path: '/layout/my', name: '我的' },
-      ]
+        { id: 1, path: "/layout/list", name: "建筑可阅读" },
+        { id: 2, path: "/layout/serve", name: "建筑可游玩" },
+        { id: 3, path: "/layout/interact", name: "建筑可对话" },
+        { id: 4, path: "/layout/my", name: "我的" },
+      ],
     };
   },
   computed: {},
   watch: {},
   methods: {
-
-  },
-  created() {
-
+    toUrl(url) {
+      const href = window.location.href
+      if(href.includes('?code'))  window.location.href = `/web/index.html#${url}`;
+      else this.$router.push(url)
+    },
   },
-  mounted() {
-
-  },
-  beforeCreate() { }, //生命周期 - 创建之前
-  beforeMount() { }, //生命周期 - 挂载之前
-  beforeUpdate() { }, //生命周期 - 更新之前
-  updated() { }, //生命周期 - 更新之后
-  beforeDestroy() { }, //生命周期 - 销毁之前
-  destroyed() { }, //生命周期 - 销毁完成
-  activated() { }, //如果页面有keep-alive缓存功能,这个函数会触发
-}
+  created() {},
+  mounted() {},
+  beforeCreate() {}, //生命周期 - 创建之前
+  beforeMount() {}, //生命周期 - 挂载之前
+  beforeUpdate() {}, //生命周期 - 更新之前
+  updated() {}, //生命周期 - 更新之后
+  beforeDestroy() {}, //生命周期 - 销毁之前
+  destroyed() {}, //生命周期 - 销毁完成
+  activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
+};
 </script>
 <style lang='less' scoped>
 .Layout {
@@ -65,18 +74,17 @@ export default {
     background-color: #fff;
     display: flex;
     align-items: center;
-    .row{
+    .row {
       width: 25%;
       text-align: center;
-      &>img{
+      & > img {
         width: 30px;
       }
-      &>p{
+      & > p {
         margin-top: 5px;
         font-size: 12px;
       }
     }
-
   }
 }
 </style>