panhui преди 5 години
родител
ревизия
1e762a1f9d
променени са 3 файла, в които са добавени 32 реда и са изтрити 3 реда
  1. 2 2
      src/main/h5/src/plugins/http.js
  2. 16 0
      src/main/h5/src/router/index.js
  3. 14 1
      src/main/h5/src/views/expert/expertDetail.vue

+ 2 - 2
src/main/h5/src/plugins/http.js

@@ -4,8 +4,8 @@ import qs from "qs";
 let baseUrl = "http://localhost:8080";
 switch (process.env.NODE_ENV) {
   case "development":
-    // baseUrl = "http://wlj.izouma.com";
-    baseUrl = 'http://localhost:8080';
+    baseUrl = "http://wlj.izouma.com";
+    // baseUrl = 'http://localhost:8080';
     break;
   case "test":
     baseUrl = "http://localhost:8080";

+ 16 - 0
src/main/h5/src/router/index.js

@@ -73,6 +73,22 @@ const router = new VueRouter({
   mode: 'history',
   base: process.env.BASE_URL,
   routes,
+  scrollBehavior(to, from, savedPosition) {
+    console.log(savedPosition)
+    if (savedPosition) {
+      return new Promise((resolve) => {
+        setTimeout(() => {
+          resolve(savedPosition)
+        }, 200)
+      })
+    } else if (to.hash) {
+      return {
+        selector: to.hash,
+      }
+    } else {
+      return { x: 0, y: 0 }
+    }
+  },
 })
 
 router.beforeEach((to, from, next) => {

+ 14 - 1
src/main/h5/src/views/expert/expertDetail.vue

@@ -44,7 +44,7 @@
 
     <div class="submitInfo" v-else>
       <div class="score-card">
-        <div class="score">总评分 {{ rateInfo.score }}</div>
+        <div class="score">总评分 {{ score }}</div>
 
         <div class="score-ratelist">
           <div
@@ -111,6 +111,19 @@ export default {
       rateListInfo: {}
     };
   },
+  computed: {
+    score() {
+      let list = [...this.categories];
+      return list.reduce((total, current) => {
+        return (
+          total +
+          current.children.reduce((tChild, cChild) => {
+            return tChild + (this.rateListInfo[cChild.value] || 0);
+          }, 0)
+        );
+      }, 0);
+    }
+  },
   mounted() {
     this.getInfo(this.$route.query.id);
   },