Selaa lähdekoodia

后台接口调整

mxs 10 kuukautta sitten
vanhempi
commit
4b41d44813

+ 5 - 1
backend/webservice/webservice.go

@@ -138,7 +138,11 @@ func (ws *WebService) LoadSpiderConfig(w http.ResponseWriter, r *http.Request) {
 	}
 }
 
-func SetCurrentTabCssMark(sc *be.SpiderConfig) {
+func SetCurrentTabCssMark(cssMark map[string]interface{}) {
+	sc, err := be.NewSpiderConfig(cssMark)
+	if err != nil {
+		qu.Debug("标注信息传输失败!")
+	}
 	currentTabSpiderConfig = sc
 	qu.Debug("当前编辑爬虫链接:", currentTabSpiderConfig)
 }

+ 1 - 5
bind4spider.go

@@ -83,11 +83,7 @@ func (a *App) ViewResultItemAll(code string) be.ResultItems {
 
 // ServerActionCurrentOpenTab 记录当前编辑code的cssmark,高亮回显使用
 func (a *App) ServerActionCurrentOpenTab(cssMark map[string]interface{}) {
-	sc, err := be.NewSpiderConfig(cssMark)
-	if err != nil {
-		qu.Debug("标注信息传输失败!")
-	}
-	bew.SetCurrentTabCssMark(sc)
+	bew.SetCurrentTabCssMark(cssMark)
 }
 
 // ExportEpubFile epub导出

+ 6 - 2
frontend/src/components/spider/RunSpider.vue

@@ -343,7 +343,7 @@ defineExpose({
     setPageData,
 })
 </script>
-<style scoped>
+<style lang="scss" scoped>
 .dialog-content {
     max-height: 60vh;
     overflow-y: scroll;
@@ -354,4 +354,8 @@ defineExpose({
 .edit-tag {
     margin-bottom: 4px;
 }
-</style>
+#debugEventContian {
+  font-size: 16px;
+  color: #000;
+}
+</style>

+ 50 - 28
frontend/src/components/spider/ViewArticle.vue

@@ -1,41 +1,63 @@
 <!-- 文章查看 -->
 <template>
-    <el-dialog width="80%" title="文章查看" v-model="dialogVisible">
-        <el-row>
-            <el-col :span="24">
-                <h3>{{ formData.title }}</h3>
-            </el-col>
-        </el-row>
-        <el-row>
-            <el-col :span="24">
-                <el-space>
-                    <el-tag type="primary">{{ formData.publishTime }} </el-tag>
-                    <el-tag type="success">{{ formData.publishUnit }} </el-tag>
-                </el-space>
-            </el-col>
-        </el-row>
-        <el-row>
-            <el-col :span=24>
-                <el-scrollbar ref="scrollbarRef" height="400px">
-                    <div v-html="formData.content"></div>
-                </el-scrollbar>
-            </el-col>
-        </el-row>
-    </el-dialog>
+  <el-dialog width="85%" title="文章查看" v-model="dialogVisible">
+    <el-row>
+      <el-col :span="24">
+        <h3>{{ formData.title }}</h3>
+      </el-col>
+    </el-row>
+    <el-row>
+      <el-col :span="24">
+        <el-space>
+          <el-tag type="primary">{{ formData.publishTime }} </el-tag>
+          <el-tag type="success">{{ formData.publishUnit }} </el-tag>
+        </el-space>
+      </el-col>
+    </el-row>
+    <div v-if="formData.attachLinks&&formData.attachLinks.length > 0">
+      <el-divider>附件</el-divider>
+      <el-row v-for="(item, name, index) in formData.attachLinks" :key="index">
+        <el-descriptions :title="item.title" direction="vertical" :column="5" border>
+          <el-descriptions-item label="下载">下载</el-descriptions-item>
+          <el-descriptions-item label="文件名">{{ item.fileName }}</el-descriptions-item>
+          <el-descriptions-item label="类型">{{ item.fileType }}</el-descriptions-item>
+          <el-descriptions-item label="大小">{{ item.fileSize }}</el-descriptions-item>
+          <el-descriptions-item label="路径">{{ item.filePath }}</el-descriptions-item>
+        </el-descriptions>
+      </el-row>
+    </div>
+    <el-row>
+      <el-divider>正文</el-divider>
+      <el-col :span=24>
+        <el-scrollbar ref="scrollbarRef" height="300px">
+          <div v-html="formData.content"></div>
+        </el-scrollbar>
+      </el-col>
+    </el-row>
+  </el-dialog>
 </template>
 <script setup>
 import { ref, defineExpose } from 'vue';
 const dialogVisible = ref(false)
+const scrollbarRef = ref(null)
 
-const scrollTop=()=>{
-    scrollbarRef.wrap.scrollTop = 0
+const scrollTop = () => {
+  //scrollbarRef.wrap.scrollTop = 0
 }
 //
 const formData = ref({})
 //这里是重点
 defineExpose({
-    formData,
-    dialogVisible,
-    scrollTop
+  formData,
+  dialogVisible,
+  scrollTop
 })
-</script>
+</script>
+<style lang="scss" scoped>
+::v-deep {
+  .el-descriptions__cell {
+    white-space: pre-wrap;
+    word-break: break-word;
+  }
+}
+</style>