Explorar o código

更新 项目集成入口

wzh %!s(int64=3) %!d(string=hai) anos
pai
achega
52493842f7
Modificáronse 3 ficheiros con 93 adicións e 10 borrados
  1. 1 0
      package.json
  2. 1 0
      src/styles/index.css
  3. 91 10
      src/views/toolManage/urls.vue

+ 1 - 0
package.json

@@ -12,6 +12,7 @@
     "@element-plus/icons": "^0.0.11",
     "@element-plus/icons-vue": "^2.0.6",
     "axios": "^0.21.1",
+    "copy-to-clipboard": "^3.3.1",
     "element-plus": "^1.1.0-beta.24",
     "lodash": "^4.17.21",
     "md5": "^2.3.0",

+ 1 - 0
src/styles/index.css

@@ -193,3 +193,4 @@
 }
 
 
+

+ 91 - 10
src/views/toolManage/urls.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="full-container-p24">
     <div class="df jcfe pb20">
-      <el-button type="primary" @click="modalVisable = true"
+      <el-button size="medium" type="primary" @click="modalVisable = true"
         >新增项目</el-button
       >
     </div>
@@ -12,12 +12,66 @@
         </div>
       </template>
       <div class="df">
-        <el-card v-for="item in pcData" :key="item._id">
+        <el-card
+          v-for="item in pcData"
+          :key="item._id"
+          class="mr20"
+          style="width: 300px"
+        >
           <template #header>
             <div class="card-header">
               <span>{{ item.name }}</span>
             </div>
-          </template></el-card
+          </template>
+          <div class="mb10 df jscb card-line aic" v-if="item.master_url">
+            <div class="s-title">正式版:</div>
+            <el-button
+              size="medium"
+              type="primary"
+              @click="goTo(item.master_url)"
+              >去访问</el-button
+            >
+            <el-button
+              size="medium"
+              type="primary"
+              @click="copy2(item.master_url)"
+              >复制链接</el-button
+            >
+          </div>
+          <div class="mb10 df jscb card-line aic" v-if="item.dev_url">
+            <div class="s-title">测试版:</div>
+            <el-button size="medium" type="primary" @click="goTo(item.dev_url)"
+              >去访问</el-button
+            >
+            <el-button size="medium" type="primary" @click="copy2(item.dev_url)"
+              >复制链接</el-button
+            >
+          </div>
+          <div class="mb10 df jscb card-line aic" v-if="item.api_url">
+            <div class="s-title">接口地址:</div>
+            <el-button size="medium" type="primary" @click="copy2(item.api_url)"
+              >复制链接</el-button
+            >
+          </div>
+          <div class="mb10 df jscb card-line aic" v-if="item.api_url">
+            <div class="s-title">接口文档:</div>
+            <el-button
+              size="medium"
+              type="primary"
+              @click="goTo(item.api_url + 'swagger-ui.html#/')"
+              >去访问</el-button
+            >
+            <el-button
+              size="medium"
+              type="primary"
+              @click="copy2(item.master_url)"
+              >复制链接</el-button
+            >
+          </div>
+          <div class="mb10 df jscb card-line aic" v-if="item.desc">
+            <div>备注:</div>
+            <div>{{ item.desc }}</div>
+          </div></el-card
         >
       </div>
     </el-card>
@@ -28,7 +82,7 @@
         </div>
       </template>
       <div class="df">
-        <el-card v-for="item in wxData" :key="item._id">
+        <el-card v-for="item in wxData" :key="item._id" class="mr20">
           <template #header>
             <div class="card-header">
               <span>{{ item.name }}</span>
@@ -101,9 +155,9 @@
             style="width: 100px"
           ></el-image>
           <el-button
-            v-else
-            size="small"
+            size="medium"
             type="primary"
+            v-else
             @click="upload('master_url')"
             >上传</el-button
           >
@@ -120,9 +174,9 @@
             style="width: 100px"
           ></el-image>
           <el-button
-            v-else
-            size="small"
+            size="medium"
             type="primary"
+            v-else
             @click="upload('dev_url')"
             >上传</el-button
           >
@@ -143,8 +197,16 @@
         </el-form-item>
         <el-form-item>
           <div class="df jcfe">
-            <el-button @click="resetForm(ruleFormRef)">重置</el-button>
-            <el-button type="primary" @click="submitForm(ruleFormRef)"
+            <el-button
+              size="medium"
+              type="primary"
+              @click="resetForm(ruleFormRef)"
+              >重置</el-button
+            >
+            <el-button
+              size="medium"
+              type="primary"
+              @click="submitForm(ruleFormRef)"
               >创建项目</el-button
             >
           </div>
@@ -161,6 +223,8 @@ import _ from "lodash";
 import { ElMessage, ElMessageBox } from "element-plus";
 import store from "../../store";
 import { chooseFile } from "../../utils/chooseFile";
+import copy from "copy-to-clipboard";
+
 const db = tcb.database();
 const p = db.collection("huihenduo_projects");
 const __ = db.command;
@@ -170,6 +234,7 @@ async function init() {
   pcData.value = [];
   wxData.value = [];
   let { data } = await p.get();
+  console.log(data);
   if (data.length) {
     for (let i of data) {
       if (i.type == 1) {
@@ -242,6 +307,13 @@ async function upload(type) {
   ruleForm.value[type] = download_url;
 }
 
+function goTo(url) {}
+
+function copy2(url) {
+  console.log(url);
+  copy(url);
+}
+
 onMounted(() => {
   init();
 });
@@ -255,4 +327,13 @@ onMounted(() => {
 .el-form-item {
   align-items: center;
 }
+
+.card-line:first-child {
+  width: 100px;
+}
+
+.s-title {
+  flex: 0 0 auto;
+  width: 70px;
+}
 </style>