From 3282e95db0207ee133d1e98d9771dec9d83b0fc4 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 02 四月 2026 16:24:38 +0800
Subject: [PATCH] 2026.4.2 新增专题管理功能
---
services/clue/fetchClue.js | 304 ++++++++++++++++++++++++++++++++++++--------------
1 files changed, 216 insertions(+), 88 deletions(-)
diff --git a/services/clue/fetchClue.js b/services/clue/fetchClue.js
index 4a50ed4..6c6d3de 100644
--- a/services/clue/fetchClue.js
+++ b/services/clue/fetchClue.js
@@ -5,110 +5,238 @@
import { get, post, _delete } from '../baseRequset';
import { clueUrl, cluePicUrl } from '../../config/index';
import { getClueQuestionList } from '../../model/clue/clueQuestion';
+import { getClueList } from '../../model/clue/clue';
-export default {
- /******************************************************************************* */
- /**
- * 鏌ヨ绾跨储浠诲姟
- * @param {*} clueTask
- * @returns
- */
- fetchClueTask(clueTask) {
- return post(
- {
- url: `clue/task/fetch`,
- data: clueTask,
- },
- clueUrl,
- ).then(res => {
- return res.data;
- });
- },
+/******************************************************************************* */
+/**
+ * 鏌ヨ绾跨储
+ * @param {*} clue
+ * @returns
+ */
+function fetchClue(clue) {
+ return post(
+ {
+ url: `clue/search`,
+ data: clue,
+ },
+ clueUrl,
+ ).then(res => {
+ res.data.data = getClueList(res.data.data);
+ return res.data;
+ });
+}
- /******************************************************************************* */
- /**
- * 鑾峰彇绾跨储缁撹
- * @param {string} clueId 绾跨储id
- */
- getConclusion(clueId) {
- return get({
+/**
+ * 鏌ヨ绾跨储
+ * @param {*} clue
+ * @returns
+ */
+function fetchClueInternal(clue) {
+ return post(
+ {
+ url: `clue/internal/search`,
+ data: clue,
+ },
+ clueUrl,
+ ).then(res => {
+ res.data.data = getClueList(res.data.data);
+ return res.data;
+ });
+}
+/******************************************************************************* */
+/**
+ * 鏌ヨ绾跨储浠诲姟
+ * @param {*} clueTask
+ * @returns
+ */
+function fetchClueTask(clueTask) {
+ return post(
+ {
+ url: `clue/task/fetch`,
+ data: clueTask,
+ },
+ clueUrl,
+ ).then(res => {
+ return res.data;
+ });
+}
+
+/**
+ * 鏌ヨ绾跨储浠诲姟
+ * @param {object} options 鏌ヨ鏉′欢
+ * @param {Number} page 椤电爜
+ * @param {Number} per_page 鍗曢〉鏁版嵁閲�
+ * @returns
+ */
+function searchClueTask(options, page, per_page) {
+ return post(
+ {
+ url: `clue/task/search`,
+ params:{page, per_page},
+ data: options,
+ },
+ clueUrl,
+ ).then(res => {
+ return res.data;
+ });
+}
+
+/**
+ * 鏌ヨ绾跨储浠诲姟
+ * @param {object} options 鏌ヨ鏉′欢
+ * @returns
+ */
+function fetchClueTaskSummary(options) {
+ return post(
+ {
+ url: `clue/task/summary`,
+ data: options,
+ },
+ clueUrl,
+ ).then(res => {
+ return res.data;
+ });
+}
+/******************************************************************************* */
+/**
+ * 鑾峰彇绾跨储缁撹
+ * @param {string} clueId 绾跨储id
+ */
+function getConclusion(clueId, internal) {
+ return get(
+ {
url: `clue/conclusion/fetch`,
params: {
- clueId: clueId,
+ clueId,
+ internal,
},
- clueUrl,
- }).then(res => res.data);
- },
+ },
+ clueUrl,
+ ).then(res => res.data);
+}
- /**
- * 鎻愪氦绾跨储缁撹
- * @param {object} conclusion 绾跨储
- * @returns
- */
- uploadConclusion(conclusion) {
- return post(
- {
- url: `clue/conclusion/upload`,
- data: conclusion,
- },
- clueUrl,
- ).then(res => res.data);
- },
+/**
+ * 鎻愪氦绾跨储缁撹
+ * @param {object} conclusion 绾跨储
+ * @returns
+ */
+function uploadConclusion(conclusion) {
+ return post(
+ {
+ url: `clue/conclusion/upload`,
+ data: conclusion,
+ },
+ clueUrl,
+ ).then(res => res.data);
+}
- /******************************************************************************* */
- /**
- * 鑾峰彇宸叉彁浜ょ殑绾跨储闂
- * @param {string} clueId 绾跨储id
- */
- getQuestion(clueId) {
- return get({
+/******************************************************************************* */
+/**
+ * 鑾峰彇宸叉彁浜ょ殑绾跨储闂
+ * @param {string} clueId 绾跨储id
+ */
+function getQuestion(clueId, internal) {
+ return get(
+ {
url: `clue/question/fetch`,
params: {
- clueId: clueId,
+ clueId,
+ internal,
},
- clueUrl,
- }).then(res => {
- return getClueQuestionList(res.data);
+ },
+ clueUrl,
+ ).then(res => {
+ res.data.data = getClueQuestionList(res.data.data);
+ return res.data;
+ });
+}
+
+/**
+ * 涓婁紶绾跨储闂
+ * @param {object} question 闂鎻忚堪
+ * @param {*} files 闂鍥剧墖
+ * @returns
+ */
+function uploadQuestion(question, files) {
+ const fields = [
+ {
+ name: 'question',
+ value: JSON.stringify(question),
+ },
+ ];
+ const images = files.map(f => {
+ return {
+ name: 'images',
+ filePath: f,
+ };
+ });
+
+ return new Multipart({
+ fields,
+ files: images,
+ })
+ .submit(clueUrl + `/clue/question/upload`)
+ .then(res => {
+ return res.data;
});
- },
+}
- /**
- * 涓婁紶绾跨储闂
- * @param {object} question 闂鎻忚堪
- * @param {*} files 闂鍥剧墖
- * @returns
- */
- uploadQuestion(question, files) {
- const fields = [
- {
- name: 'question',
- value: JSON.stringify(question),
- },
- ];
- const images = files.map(f => {
- return {
- name: 'images',
- filePath: f,
- };
+/**
+ * 鏇存柊绾跨储闂
+ * @param {object} question 闂鎻忚堪
+ * @param {Sting} deleteImgUrl 鍒犻櫎鐨勫浘鐗囩浉瀵硅矾寰勶紝鐢�;鍒嗗壊
+ * @param {*} files 闂鍥剧墖
+ * @returns
+ */
+function updateQuestion(question, deleteImgUrl, files) {
+ const fields = [
+ {
+ name: 'question',
+ value: JSON.stringify(question),
+ },
+ {
+ name: 'deleteImg',
+ value: deleteImgUrl,
+ },
+ ];
+ const images = files.map(f => {
+ return {
+ name: 'images',
+ filePath: f,
+ };
+ });
+
+ return new Multipart({
+ fields,
+ files: images,
+ })
+ .submit(clueUrl + `/clue/question/update`)
+ .then(res => {
+ return res.data;
});
+}
- return new Multipart({
- fields,
- images,
- })
- .submit(clueUrl + `/clue/question/upload`)
- .then(res => {
- return res.data;
- });
- },
-
- deleteQuestion(questionId) {
- return _delete({
+function deleteQuestion(questionId) {
+ return _delete(
+ {
url: `clue/question`,
params: {
questionId: questionId,
},
- clueUrl,
- }).then(res => res.data);
- },
+ },
+ clueUrl,
+ ).then(res => res.data);
+}
+export {
+ fetchClue,
+ fetchClueInternal,
+ fetchClueTask,
+ searchClueTask,
+ fetchClueTaskSummary,
+ getConclusion,
+ uploadConclusion,
+ updateQuestion,
+ getQuestion,
+ uploadQuestion,
+ deleteQuestion,
};
--
Gitblit v1.9.3