소스 검색

正式环境下访问帮助中心,浏览器卡住bug修复。
run.sh文件,将build步骤省去

yangc 8 년 전
부모
커밋
70cfba6c38
2개의 변경된 파일23개의 추가작업 그리고 11개의 파일을 삭제
  1. 23 9
      pages/help/home.vue
  2. 0 2
      run.sh

+ 23 - 9
pages/help/home.vue

@@ -31,13 +31,25 @@
   </div>
 </template>
 <script>
-  // 升序
-  function compare (property) {
-    return function (a, b) {
-      var value1 = a[property]
-      var value2 = b[property]
-      return value1 - value2
+//   升序
+//  function compare (property) {
+//    return function (a, b) {
+//      var value1 = a[property]
+//      var value2 = b[property]
+//      return value1 - value2
+//    }
+//  }
+  function sortBy (arr, property) {
+    for (let i = 0; i < arr.length; i++) {
+      for (let j = i; j < arr.length; j++) {
+        if (arr[i][property] > arr[j][property]) {
+          let tmp = arr[i]
+          arr[i] = arr[j]
+          arr[j] = tmp
+        }
+      }
     }
+    return arr
   }
   import { left, helpHeader } from '~components/help'
   export default {
@@ -53,10 +65,12 @@
     },
     computed: {
       helpNav () {
-        let list = this.$store.state.help.snapsho.data.sort(compare('detno'))
-        if (list) {
+        let list = this.$store.state.help.snapsho.data || []
+        if (list.length > 0) {
+          list = sortBy(list, 'detno')
           for (let i = 0; i < list.length; i++) {
-            list[i].children = list[i].children.sort(compare('detno'))
+            let tem = sortBy(list[i].children, 'detno')
+            list[i].children = tem
           }
         }
         return list

+ 0 - 2
run.sh

@@ -4,9 +4,7 @@ echo "NODE_ENV: $NODE_ENV"
 echo "BASE_URL: $BASE_URL"
 
 if [ "$NODE_ENV" == 'production' ]; then
-  npm run build
   npm run start
 else
-  npm run dev-build
   npm run dev-start
 fi