Forráskód Böngészése

后台接口调整

mxs 10 hónapja
szülő
commit
f3068a405a

+ 1 - 1
backend/types.go

@@ -23,7 +23,7 @@ type (
 		ModifyUser         string `json:"modifyuser"`
 		Href               string `json:"href"`
 		Code               string `json:"code"`
-		ListBodyCss        string `json:"listBodyCss"`
+		ListBodyCss        string `json:"listBodyCss"` //用于判断是否翻页成功
 		ListItemCss        string `json:"listItemCss"`
 		ListLinkCss        string `json:"listLinkCss"`
 		ListPubtimeCss     string `json:"listPublishTimeCss"`

+ 3 - 3
backend/vm/single.go

@@ -22,7 +22,6 @@ func NewVM(attachesDir string, dnf be.EventNotifyFace) *VM {
 // RunSpider
 func (vm *VM) RunSpider(url string, maxPages int, listDealy int64, contentDelay int64, headless bool, showImage bool, proxyServe string, exit chan bool, cssMark map[string]interface{}) {
 	sc, err := be.NewSpiderConfig(cssMark)
-	qu.Debug("sc---", *sc)
 	if err != nil {
 		qu.Debug("标注信息传输失败!")
 		vm.dnf.Dispatch("debug_event", "标注信息传输失败!")
@@ -54,7 +53,7 @@ func (vm *VM) RunSpider(url string, maxPages int, listDealy int64, contentDelay
 	if runJs == "" {
 		runJs = renderJavascriptCoder(loadListItemsJS, sc)
 	}
-	//qu.Debug("execute list jscode", runJs)
+	qu.Debug("execute list jscode", runJs)
 	err = chromedp.Run(ctx, chromedp.Tasks{
 		chromedp.Evaluate(runJs, &listResult),
 	})
@@ -73,12 +72,13 @@ func (vm *VM) RunSpider(url string, maxPages int, listDealy int64, contentDelay
 	}
 	currentResult := list.New()
 	be.DataResults[sc.Code] = currentResult
-	//qu.Debug("execute content js", runJs)
+	qu.Debug("execute content js", runJs)
 	for _, v := range listResult {
 		select {
 		case <-exit:
 			return
 		default:
+			qu.Debug(v.No, v.ListTitle, v.Href)
 			vm.dnf.Dispatch("debug_event", fmt.Sprintf("4. %d- 待 下载详情页 %s ", v.No, v.ListTitle))
 			var result string = ""
 			err = chromedp.Run(ctx, chromedp.Tasks{

+ 22 - 1
backend/webservice/webservice.go

@@ -88,7 +88,28 @@ func (ws *WebService) SaveSpiderConfig(w http.ResponseWriter, r *http.Request) {
 		http.Error(w, err.Error(), http.StatusBadRequest)
 		return
 	}
-
+	switch req.Key {
+	case "listItemCss":
+		currentTabSpiderConfig.ListItemCss = req.Css
+	case "listLinkCss":
+		currentTabSpiderConfig.ListLinkCss = req.Css
+	case "listPublishTimeCss":
+		currentTabSpiderConfig.ListPubtimeCss = req.Css
+	case "listNextPageCss":
+		currentTabSpiderConfig.ListNextPageCss = req.Css
+	case "listBodyCss":
+		currentTabSpiderConfig.ListBodyCss = req.Css
+	case "titleCss":
+		currentTabSpiderConfig.TitleCss = req.Css
+	case "publishUnitCss":
+		currentTabSpiderConfig.PublishUnitCss = req.Css
+	case "publishTimeCss":
+		currentTabSpiderConfig.PublishTimeCss = req.Css
+	case "contentCss":
+		currentTabSpiderConfig.ContentCss = req.Css
+	case "attachCss":
+		currentTabSpiderConfig.AttachCss = req.Css
+	}
 	qu.Debug("CSS", req.Key, req.Css, req.Url)
 	fmt.Fprint(w, "{'code':200}")
 	//TODO 通知开发工具端,CSS选择器有变动

+ 4 - 4
frontend/src/components/spider/EditSpider.vue

@@ -131,7 +131,7 @@
                     <el-row>
                         <el-col :span="24">
                             <el-form-item label="详情页附件">
-                                <el-input v-model="formData.attachCss" @input="onCssFormChange" placeholder="span"></el-input>
+                                <el-input v-model="formData.attachCss" @input="onCssFormChange" placeholder="span" :style="{ background: cssInputBg.attachCss.color }"></el-input>
                                 <div class="form-item-sub-line">{{ fastKeyDownMap.attachCss }}</div>
                             </el-form-item>
                         </el-col>
@@ -148,7 +148,7 @@
                     </span>
                 </template>
                 <el-divider>手写列表页提取JS代码 <el-button type="primary"
-                        @click='editorHandle.ImportListCode'>导入样例</el-button></el-divider>
+                        @click='editorHandle.ImportListCode'>导入模板</el-button></el-divider>
                 <el-row>
                     <el-input v-model="formData.listJs" class="codeEditor" :rows="6" type="textarea"
                         placeholder="Please input" />
@@ -164,7 +164,7 @@
                     </span>
                 </template>
                 <el-divider>手写列表页翻页JS代码 <el-button type="primary"
-                        @click='editorHandle.ImportListTrunPageCode'>导入样例</el-button></el-divider>
+                        @click='editorHandle.ImportListTrunPageCode'>导入模板</el-button></el-divider>
                 <el-row>
                     <el-input v-model="formData.listTurnPageJs" class="codeEditor" :rows="6" type="textarea"
                         placeholder="Please input" />
@@ -181,7 +181,7 @@
                     </span>
                 </template>
                 <el-divider>手写附件下载/上传JS代码 <el-button type="primary"
-                        @click='editorHandle.ImportContentCode'>导入样例</el-button></el-divider>
+                        @click='editorHandle.ImportContentCode'>导入模板</el-button></el-divider>
                 <el-row><el-input v-model="formData.contentJs" class="codeEditor" :rows="6" type="textarea"
                         placeholder="Please input" />
                 </el-row>

+ 2 - 2
frontend/src/data/filters.js

@@ -25,10 +25,10 @@ export const spiderStateOptions = [
     label: '已上线',
     value: 11,
   },
-  {
+  /*{
     label: '无法标注',
     value: 12,
-  },
+  },*/
 ]
 
 // codeList审核列表爬虫状态备选项

+ 1 - 2
frontend/src/views/CodeList.vue

@@ -381,7 +381,7 @@ const userClaimCodes = async () => {
     }
 }
 const clickClaimCodes = () => {
-    ElMessageBox.confirm('确定认领爬虫?', '提示',
+    ElMessageBox.confirm('确定认领爬虫?', '提示',
         {
             customClass: 'j-confirm-message-box',
             type: 'warning',
@@ -708,7 +708,6 @@ const tableActionDisabled = {
     }
 }
 
-
 const onEditFormChange = (info) => {
     const mark = getMarkWithEditDialogInfo(info)
     ServerActionCurrentOpenTab(mark)