star7th 4 年之前
父節點
當前提交
7a1a7ac6f6

+ 2 - 1
server/Application/Api/Controller/ImportSwaggerController.class.php

@@ -16,7 +16,8 @@ class ImportSwaggerController extends BaseController {
         unset($json);
         if ($json_array['info']) {
             $this->json_array = $json_array ;
-            $this->url_pre = $json_array['schemes'][0]."://".$json_array['host'].$json_array['basePath'] ;
+            $scheme = $json_array['schemes'][0] ? $json_array['schemes'][0] : 'http';
+            $this->url_pre = $scheme."://".$json_array['host'].$json_array['basePath'] ;
             $this->_fromSwaggerV2($json_array);
             return ;
         }

+ 1 - 1
web/index.html

@@ -16,4 +16,4 @@
       "server": window.location.protocol +'//'+ window.location.host + window.location.pathname+ '../server/index.php?s=',
       //"lang" :'en'
       "lang" :'zh-cn'
-  }</script><link href=./static/css/app.d7f2f54b5d88847b570e9398b15f18b0.css rel=stylesheet></head><body class=grey-bg><div id=app></div><div style=display:none>本网站基于开源版showdoc搭建,仅供私人使用。如需访问showdoc官网,请在搜索引擎里搜索showdoc字样或者直接访问showdoc.com.cn</div><script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script><script type=text/javascript src=./static/js/vendor.1eb6213d11eb61d1bd46.js></script><script type=text/javascript src=./static/js/app.4e82df706574be2d811b.js></script></body></html>
+  }</script><link href=./static/css/app.c4490050a5fc4066781c455caa321f9d.css rel=stylesheet></head><body class=grey-bg><div id=app></div><div style=display:none>本网站基于开源版showdoc搭建,仅供私人使用。如需访问showdoc官网,请在搜索引擎里搜索showdoc字样或者直接访问showdoc.com.cn</div><script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script><script type=text/javascript src=./static/js/vendor.1eb6213d11eb61d1bd46.js></script><script type=text/javascript src=./static/js/app.53f39f7954339fc46d22.js></script></body></html>

文件差異過大導致無法顯示
+ 0 - 0
web/static/css/app.c4490050a5fc4066781c455caa321f9d.css


文件差異過大導致無法顯示
+ 0 - 0
web/static/js/app.4e82df706574be2d811b.js


文件差異過大導致無法顯示
+ 0 - 0
web/static/js/app.53f39f7954339fc46d22.js


+ 10 - 0
web_src/src/components/item/Index.vue

@@ -451,6 +451,16 @@ export default {
     logout() {
       var that = this
       var url = DocConfig.server + '/api/user/logout'
+      // 清空所有cookies
+      var keys = document.cookie.match(/[^ =;]+(?=\=)/g)
+      if (keys) {
+        for (var i = keys.length; i--; ) {
+          document.cookie = keys[i] + '=0;expires=' + new Date(0).toUTCString()
+        }
+      }
+
+      // 清空 localStorage
+      localStorage.clear()
 
       var params = new URLSearchParams()
 

+ 1 - 0
web_src/src/components/item/show/Index.vue

@@ -123,6 +123,7 @@ export default {
   mounted() {
     this.checkDb()
     this.get_item_menu()
+    this.$store.dispatch('changeOpenCatId', 0)
   },
   beforeDestroy() {
     this.$message.closeAll()

+ 64 - 2
web_src/src/components/item/show/show_regular_item/Index.vue

@@ -27,7 +27,7 @@
             <i
               class="el-icon-full-screen"
               id="full-page"
-              v-show="showfullPageBtn"
+              v-show="showfullPageBtn && page_id"
               @click="clickFullPage"
             ></i>
             <i
@@ -46,6 +46,34 @@
                 :keyword="keyword"
               ></Editormd>
             </div>
+            <div v-if="emptyItem && lang == 'zh-cn'" class="empty-tips">
+              <div class="icon"><i class="el-icon-shopping-cart-2"></i></div>
+              <div class="text">
+                <p>
+                  当前项目是空的,你可以点击右上方的 + 以手动添加页面。
+                </p>
+
+                <div>
+                  除了手动添加外,你还可以通过以下三种方式自动化生成文档:
+                  <p class="links">
+                    <a href="https://www.showdoc.com.cn/runapi" target="_blank"
+                      >使用runapi工具自动生成(推荐)</a
+                    ><br />
+                    <a
+                      href="https://www.showdoc.com.cn/page/741656402509783"
+                      target="_blank"
+                    >
+                      使用程序注释自动生成</a
+                    ><br />
+                    <a
+                      href="https://www.showdoc.com.cn/page/102098"
+                      target="_blank"
+                      >自己写程序调用接口来生成</a
+                    >
+                  </p>
+                </div>
+              </div>
+            </div>
           </div>
         </div>
 
@@ -103,7 +131,9 @@ export default {
       fullPage: false,
       showfullPageBtn: false,
       showToc: true,
-      showComp: true
+      showComp: true,
+      emptyItem: false,
+      lang: ''
     }
   },
   components: {
@@ -231,6 +261,15 @@ export default {
   mounted() {
     this.adaptScreen()
     this.set_bg_grey()
+    this.lang = DocConfig.lang
+    if (
+      this.item_info &&
+      this.item_info.menu &&
+      this.item_info.menu.catalogs.length === 0 &&
+      this.item_info.menu.pages.length === 0
+    ) {
+      this.emptyItem = true
+    }
   }
 }
 </script>
@@ -330,4 +369,27 @@ pre ol {
   padding: 0px;
   font-size: 14px;
 }
+.empty-tips {
+  margin: 5% auto;
+  width: 400px;
+  text-align: center;
+  color: #909399;
+}
+
+.empty-tips .icon {
+  font-size: 100px;
+  margin-left: -50px;
+}
+
+.empty-tips .text {
+  text-align: left;
+}
+
+.empty-tips .links {
+  line-height: 2em;
+}
+.empty-tips .links a {
+  color: #909399;
+  text-decoration: underline;
+}
 </style>

+ 5 - 0
web_src/src/components/user/Login.vue

@@ -148,6 +148,11 @@ export default {
     this.script_cron()
     this.checkDb()
   },
+  watch: {
+    $route(to, from) {
+      this.$router.go(0)
+    }
+  },
   beforeDestroy() {}
 }
 </script>

部分文件因文件數量過多而無法顯示