瀏覽代碼

feat: improve kaifain dashboard in-app experience

Acathur 5 年之前
父節點
當前提交
d8d90e7b35

+ 4 - 0
kaifain_v2/components/ApiDoc.vue

@@ -154,6 +154,10 @@ export default Vue.extend({
     }
   }
 
+  pre {
+    max-height: 240px;
+  }
+
   h2 {
     font-size: 1.25rem;
     font-weight: 500;

+ 29 - 3
kaifain_v2/components/PanelApiCell.vue

@@ -4,15 +4,27 @@
       .figure
         img.icon(:src="data.images")
       .info
-        a.title(:href="`/s/${data.hash_id}`" target="_blank") {{data.title}}
+        a.title(
+          :href="`/s/${data.hash_id}?from=brd`"
+          target="_blank"
+          @click="goSolutionPage($event, data)"
+          ) {{data.title}}
         .metas
           span 总次数 {{data.quota.toLocaleString()}}
           span 剩余次数 {{Math.max(data.quota - data.usage, 0).toLocaleString()}}
         .actions
           //- router-link.button.is-small(:to="`/dashboard/stats?api_id=${data.api_id}`") 统计
           router-link.button.is-small(:to="`/dashboard/inspector?api_id=${data.api_id}`") 调试
-          a.button.is-small(:href="`/s/${data.hash_id}?from=brd#apidoc`" target="_blank") 文档
-          a.button.is-small(:href="`/s/${data.hash_id}?from=brd`" target="_blank") 加购
+          a.button.is-small(
+            :href="`/s/${data.hash_id}?from=brd#apidoc`"
+            target="_blank"
+            @click="goSolutionPage($event, data)"
+            ) 文档
+          a.button.is-small(
+            :href="`/s/${data.hash_id}?from=brd`"
+            target="_blank"
+            @click="goSolutionPage($event, data)"
+            ) 加购
           router-link.button.is-small.is-link.is-light(
             v-if="data.title === '短信'"
             :to="`/dashboard/sms/templates`"
@@ -35,6 +47,8 @@
 
 <script lang="ts">
 import Vue from 'vue'
+import bridge from '../utils/bridge'
+import { KAIFAIN_MOB_SITE } from '../constant'
 
 export default Vue.extend({
   name: 'PanelApiCell',
@@ -49,6 +63,18 @@ export default Vue.extend({
       type: Boolean,
       default: false
     }
+  },
+
+  methods: {
+    goSolutionPage(e: Event, data) {
+      if (process.client && bridge.isInApp) {
+        e.preventDefault()
+        e.stopPropagation()
+
+        bridge.load(`${KAIFAIN_MOB_SITE}/s/${data.hash_id}?from=brd`)
+        return
+      }
+    }
   }
 })
 </script>

+ 9 - 3
kaifain_v2/components/ParamsTable.vue

@@ -14,7 +14,7 @@
           .sub-symbol(v-if="item.depth > 0")
             span └
             span.dash(v-for="idx in item.depth - 1") ─
-          span {{item.name}}
+          span.key {{item.name}}
         td(v-if="showType")
           code(v-if="item.type") {{item.type}}
           code(v-if="item.items && item.items.type !== 'object'") <{{item.items.type}}>
@@ -73,7 +73,8 @@ export default Vue.extend({
 .api-params-table {
   min-width: 100%;
   border: 1px solid #eaeaea;
-  border-collapse: 0;
+  border-collapse: collapse;
+  border-spacing: 0;
 
   th,
   td {
@@ -86,8 +87,13 @@ export default Vue.extend({
     font-weight: 500;
   }
 
+  td {
+    word-break: break-word;
+  }
+
   th,
-  code {
+  code,
+  .key {
     white-space: nowrap;
   }
 

+ 1 - 0
kaifain_v2/constant.ts

@@ -1,5 +1,6 @@
 export const MAIN_HOST = 'proginn.com'
 export const MAIN_ENDPOINT = process.env.NODE_ENV === 'development' ? 'https://web.test.proginn.com' : 'https://proginn.com'
+export const KAIFAIN_MOB_SITE = process.env.NODE_ENV === 'development' ? 'https://kaifain-m.test.proginn.com' : 'https://kaifain.m.proginn.com'
 export const KAIFAIN_API_CAT_ID = process.env.NODE_ENV === 'development' ? '71f9355f0130' : 'e66fca1ea675'
 export const BINSTD_PID = process.env.NODE_ENV === 'development' ? '667006' : '492803'
 export const enum DASHBOARD_SCENE_CODE {

+ 4 - 0
kaifain_v2/pages/dashboard/layout.vue

@@ -30,6 +30,7 @@
                     icon="progico-home"
                     tag="router-link"
                     to="/dashboard"
+                    :replace="isInApp"
                     :active="curRoutePath === '/'"
                     @click.native="onMenuClick"
                     )
@@ -39,6 +40,7 @@
                     icon="progico-api"
                     tag="router-link"
                     to="/dashboard/apis"
+                    :replace="isInApp"
                     :active="curRoutePath === '/apis'"
                     @click.native="onMenuClick"
                     )
@@ -48,6 +50,7 @@
                     icon="progico-stats"
                     tag="router-link"
                     to="/dashboard/stats"
+                    :replace="isInApp"
                     :active="curRoutePath === '/stats'"
                     @click.native="onMenuClick"
                     )
@@ -57,6 +60,7 @@
                     icon="progico-debug"
                     tag="router-link"
                     to="/dashboard/inspector"
+                    :replace="isInApp"
                     :active="curRoutePath === '/inspector'"
                     @click.native="onMenuClick"
                     )

+ 1 - 1
kaifain_v2/utils/bridge.ts

@@ -1,5 +1,5 @@
 import { ProginnBridge } from 'proginn-lib'
 
-const bridge = process.client ? new ProginnBridge() : {}
+const bridge = process.client ? new ProginnBridge() : {} as any
 
 export default bridge