From 45be153eaef9e1c1a3fe21515e9cbd785fba8e1f Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期二, 22 四月 2025 17:38:35 +0800
Subject: [PATCH] 线索任务
---
services/clue/fetchClue.js | 114 +++++++++++
pages/cluetask/home/tasks-proxy.js | 31 +++
custom-tab-bar/index.js | 12
pages/cluetask/home/options.wxss | 17 +
pages/cluetask/home/options.wxml | 22 ++
model/clue/clueTask.js | 32 +++
pages/cluetask/home/index.json | 13 +
pages/cluetask/home/index.js | 51 +++++
pages/cluetask/home/statistic-proxy.js | 20 ++
config/index.js | 23 ++
pages/selfpatrol/components/patrol-record/index.wxml | 16 -
pages/cluetask/home/options-proxy.js | 64 ++++++
custom-tab-bar/data.js | 6
pages/cluetask/home/statistic.wxml | 10 +
app.json | 7
pages/cluetask/home/statistic.wxss | 0
common/clue/dataTravelMode.js | 34 +++
pages/inspection/scene/info/device-info-items.js | 2
model/clue/clueQuestion.js | 16 +
services/baseRequset.js | 5
components/form/form-util.js | 2
common/clue/dataResponseLevel.js | 34 +++
pages/cluetask/home/tasks.wxml | 10 +
pages/cluetask/home/tasks.wxss | 0
pages/cluetask/home/index.wxss | 16 +
pages/cluetask/home/index.wxml | 15 +
26 files changed, 553 insertions(+), 19 deletions(-)
diff --git a/app.json b/app.json
index 653678c..4599fd1 100644
--- a/app.json
+++ b/app.json
@@ -36,7 +36,8 @@
"pages/inspection/scene/info/device-info/index",
"pages/inspection/scene/info/device-status/index",
"pages/simple-home/index",
- "pages/inspection/ranking/search/index"
+ "pages/inspection/ranking/search/index",
+ "pages/cluetask/home/index"
],
"tabBar": {
"custom": true,
@@ -54,6 +55,10 @@
"text": "绮剧粏鍖栫洃绠�"
},
{
+ "pagePath": "pages/cluetask/home/index",
+ "text": "搴旀�ョ嚎绱�"
+ },
+ {
"pagePath": "pages/selfpatrol/index",
"text": "搴旀�ヨ嚜宸℃煡"
},
diff --git a/common/clue/dataResponseLevel.js b/common/clue/dataResponseLevel.js
new file mode 100644
index 0000000..ad53e66
--- /dev/null
+++ b/common/clue/dataResponseLevel.js
@@ -0,0 +1,34 @@
+// 搴旀�ョ嚎绱换鍔″搷搴旂骇鍒�
+const ResponseLevels = [
+ { value: null, label: '鍏ㄩ儴' },
+ { value: 0, label: '褰撴棩' },
+ { value: 1, label: '涓夊ぉ鍐�' },
+ { value: 2, label: '涓�鍛ㄥ唴' },
+ { value: 3, label: '褰撴湀' },
+];
+
+export default {
+ ResponseLevels,
+ toLabel(value) {
+ let r = ResponseLevels.find(item => {
+ return item.value == value;
+ });
+ if (!r) r = ResponseLevels[0];
+ return r.label;
+ },
+
+ toLabel2(value) {
+ let l = this.toLabel(value);
+ if (l == ResponseLevels[0].label) {
+ l = '/';
+ }
+ return l;
+ },
+
+ toValue(label) {
+ const r = ResponseLevels.find(item => {
+ return item.label == label;
+ });
+ return r.value;
+ },
+};
diff --git a/common/clue/dataTravelMode.js b/common/clue/dataTravelMode.js
new file mode 100644
index 0000000..9a9c48e
--- /dev/null
+++ b/common/clue/dataTravelMode.js
@@ -0,0 +1,34 @@
+// 搴旀�ョ嚎绱换鍔″搷搴旂骇鍒�
+
+const TravelModes = [
+ { value: null, label: '鍏ㄩ儴' },
+ { value: 0, label: '椹捐溅' },
+ { value: 1, label: '鍏叡浜ら��' },
+ { value: 2, label: '姝ヨ' },
+];
+
+export default {
+ TravelModes,
+ toLabel(value) {
+ let r = TravelModes.find(item => {
+ return item.value == value;
+ });
+ if (!r) r = TravelModes[0];
+ return r.label;
+ },
+
+ toLabel2(value) {
+ let l = this.toLabel(value);
+ if (l == TravelModes[0].label) {
+ l = '/';
+ }
+ return l;
+ },
+
+ toValue(label) {
+ const r = TravelModes.find(item => {
+ return item.label == label;
+ });
+ return r.value;
+ },
+};
diff --git a/components/form/form-util.js b/components/form/form-util.js
index 58ec443..255166f 100644
--- a/components/form/form-util.js
+++ b/components/form/form-util.js
@@ -2,8 +2,8 @@
* 鐢熸垚涓�鏉¤〃鍗曟潯鐩�
* @param {String} _label 鏍囩鍚嶇О
* @param {String} _name 瀛楁鍚嶇О
- * @param {String} _type 杈撳叆绫诲瀷 锛坱ext: 杈撳叆妗�; switch: 鍒囨崲鎸夐挳; picker: 涓嬫媺妗嗛�夐」; cascader: 绾ц仈閫夋嫨锛�
* @param {Boolean} _required 鏄惁涓哄繀濉」
+ * @param {String} _type 杈撳叆绫诲瀷 锛坱ext: 杈撳叆妗�; switch: 鍒囨崲鎸夐挳; picker: 涓嬫媺妗嗛�夐」; cascader: 绾ц仈閫夋嫨锛�
* @param {Array} _options 褰撹緭鍏ョ被鍨嬩负picker鎴朿ascader鏃讹紝鎻愪緵鍙�夐」
* @param {Array} cascaderTitles 褰撹緭鍏ョ被鍨嬩负cascader鏃讹紝鎻愪緵姣忓眰閫夐」鐨勬爣棰�
* @param {Array} referItems 褰撹緭鍏ョ被鍨嬩负cascader鏃讹紝鎻愪緵鍏宠仈鐨勫睘鎬ame
diff --git a/config/index.js b/config/index.js
index 0d563f5..e80d281 100644
--- a/config/index.js
+++ b/config/index.js
@@ -17,7 +17,24 @@
const inspectPicUrl = `${iu}/images/`;
// const inspectPicUrl = `${inspectUrl}/images/`;
-// const mode = 'debug';
-const mode = 'prod';
+// 閬撹矾搴旀�ョ嚎绱�
+// const clueUrl = 'https://fyami.com.cn:448/';
+const clueUrl = 'http://192.168.0.110:8084/';
+const cu = 'https://fyami.com.cn:448';
+const cluePicUrl = `${cu}/images/`;
-export { basePicUrl, baseUrl, baseFileUrl, baseIconUrl, inspectUrl, inspectPicUrl, mode };
+// 杩愯妯″紡
+const mode = 'debug';
+// const mode = 'prod';
+
+export {
+ basePicUrl,
+ baseUrl,
+ baseFileUrl,
+ baseIconUrl,
+ inspectUrl,
+ inspectPicUrl,
+ clueUrl,
+ cluePicUrl,
+ mode,
+};
diff --git a/custom-tab-bar/data.js b/custom-tab-bar/data.js
index ac7639a..e7af7d4 100644
--- a/custom-tab-bar/data.js
+++ b/custom-tab-bar/data.js
@@ -12,6 +12,12 @@
level: 2,
},
{
+ icon: 'fact-check',
+ text: '搴旀�ョ嚎绱�',
+ url: 'pages/cluetask/home/index',
+ level: 1,
+ },
+ {
// icon: `${baseIconUrl}tab-slef-patrol.png`,
icon: 'root-list',
text: '搴旀�ヨ嚜宸℃煡',
diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js
index 9991a7a..a6ff3b7 100644
--- a/custom-tab-bar/index.js
+++ b/custom-tab-bar/index.js
@@ -7,10 +7,16 @@
list: TabMenu,
},
attached() {
- const menu = TabMenu.map(v => {
- v.visible = app.globalData.userInfo.usertypeid <= v.level;
- return v;
+ const menu = []
+ TabMenu.forEach(v => {
+ if (app.globalData.userInfo.usertypeid <= v.level) {
+ menu.push(v)
+ }
});
+ // TabMenu.map(v => {
+ // v.visible = app.globalData.userInfo.usertypeid <= v.level;
+ // return v;
+ // });
this.setData({ list: menu });
},
methods: {
diff --git a/model/clue/clueQuestion.js b/model/clue/clueQuestion.js
new file mode 100644
index 0000000..63b61c7
--- /dev/null
+++ b/model/clue/clueQuestion.js
@@ -0,0 +1,16 @@
+import { cluePicUrl } from '../../config/index';
+
+function getClueQuestion(data) {
+ data.cqFilePath = data.cqFilePath.split(';').map((val) => {
+ return cluePicUrl + val;
+ });
+ return data;
+}
+
+function getClueQuestionList(dataList) {
+ return dataList.map((v) => {
+ return getClueQuestion(v);
+ });
+}
+
+export { getClueQuestion, getClueQuestionList };
diff --git a/model/clue/clueTask.js b/model/clue/clueTask.js
new file mode 100644
index 0000000..85ad441
--- /dev/null
+++ b/model/clue/clueTask.js
@@ -0,0 +1,32 @@
+/**
+ * 绾跨储缁熻
+ */
+export function getClueStatistic(dataList) {
+ let total = dataList.length,
+ finished = 0,
+ unfinished = 0;
+
+ dataList.forEach(d => {
+ d.finished ? finished++ : unfinished++;
+ });
+
+ const p1 = Math.round((finished / total) * 1000) / 10;
+ const p2 = Math.round((unfinished / total) * 1000) / 10;
+ return [
+ {
+ name: '鎬昏',
+ value: total,
+ diff: '',
+ },
+ {
+ name: '宸插畬鎴�',
+ value: finished,
+ diff: total == 0 ? '0%' : `${p1}%`,
+ },
+ {
+ name: '寰呭畬鎴�',
+ value: unfinished,
+ diff: total == 0 ? '0%' : `${p2}%`,
+ },
+ ];
+}
diff --git a/pages/cluetask/home/index.js b/pages/cluetask/home/index.js
new file mode 100644
index 0000000..7af513c
--- /dev/null
+++ b/pages/cluetask/home/index.js
@@ -0,0 +1,51 @@
+import { useLoading } from '../../../behaviors/loading';
+import { useOptions } from './options-proxy.js';
+import { useStatistic } from './statistic-proxy.js';
+import { useTasks } from './tasks-proxy.js';
+
+import clueApi from '../../../services/clue/fetchClue';
+
+const app = getApp();
+
+Page({
+ behaviors: [useLoading, useOptions, useStatistic, useTasks],
+
+ data: {
+ userInfo: app.globalData.userInfo,
+ clueTaskList: [],
+ },
+
+ onLoad(options) {},
+
+ onShow() {
+ this.getTabBar().init();
+ },
+
+ onPullDownRefresh() {
+ this._startLoad();
+ },
+
+ onReachBottom() {
+ this._loadMore();
+ },
+
+ /**
+ * 鍒濆鍔犺浇
+ * 褰撴墍鏈夌瓫閫夋潯浠堕兘鑾峰彇鍒板垵濮嬪�煎悗锛屾墽琛屼竴娆″垵濮嬪寲鍔犺浇
+ * 鍖呮嫭鍖哄煙銆佹椂闂翠袱涓�夐」锛屽叏閮ㄨ幏鍙栧垵濮嬪�煎悗锛屾墽琛屽姞杞�
+ * @see options-proxy.js
+ */
+ optionsCount: 0,
+ init() {
+ this.optionsCount++;
+ if (this.optionsCount == 2) this._startLoad();
+ },
+
+ _fetchData(page) {
+ return clueApi.fetchClueTask({}).then(res => {
+ this.setData({ clueTaskList: res.data });
+ this.calClueCount();
+ this.formatClueTask();
+ });
+ },
+});
diff --git a/pages/cluetask/home/index.json b/pages/cluetask/home/index.json
new file mode 100644
index 0000000..56d9781
--- /dev/null
+++ b/pages/cluetask/home/index.json
@@ -0,0 +1,13 @@
+{
+ "navigationBarTitleText": "搴旀�ョ嚎绱�",
+ "onReachBottomDistance": 10,
+ "backgroundTextStyle": "light",
+ "enablePullDownRefresh": true,
+ "navigationBarTextStyle": "white",
+ "navigationBarBackgroundColor": "#389AFF",
+ "usingComponents": {
+ "location-picker": "/components/picker/location-picker/index",
+ "t-time-picker": "/components/time-picker/index",
+ "stat-card": "/components/stat-card/index"
+ }
+}
\ No newline at end of file
diff --git a/pages/cluetask/home/index.wxml b/pages/cluetask/home/index.wxml
new file mode 100644
index 0000000..f0f3aaa
--- /dev/null
+++ b/pages/cluetask/home/index.wxml
@@ -0,0 +1,15 @@
+<import src="/pages/common/template/template-loading.wxml" />
+
+<view class="page">
+ <template is="pulldown-loading" wx:if="{{pageLoading}}" />
+ <view class="page-header">
+
+ </view>
+ <view class="page-container">
+ <include src="./options.wxml" />
+ <include src="./statistic.wxml" />
+ <include src="./tasks.wxml" />
+ <t-toast id="t-toast" />
+ </view>
+ <view class="page-footer"></view>
+</view>
\ No newline at end of file
diff --git a/pages/cluetask/home/index.wxss b/pages/cluetask/home/index.wxss
new file mode 100644
index 0000000..0636f89
--- /dev/null
+++ b/pages/cluetask/home/index.wxss
@@ -0,0 +1,16 @@
+@import './options.wxss';
+@import './statistic.wxss';
+@import './tasks.wxss';
+
+page {
+ --header-bottom-padding: 600rpx;
+}
+
+.page .page-header {
+ background: linear-gradient(var(--td-primary-color-7), var(--td-bg-color));
+ padding-bottom: var(--header-bottom-padding);
+}
+
+.page .page-container {
+ margin-top: calc(0rpx - var(--header-bottom-padding));
+}
\ No newline at end of file
diff --git a/pages/cluetask/home/options-proxy.js b/pages/cluetask/home/options-proxy.js
new file mode 100644
index 0000000..a9d6890
--- /dev/null
+++ b/pages/cluetask/home/options-proxy.js
@@ -0,0 +1,64 @@
+import dayjs from 'dayjs';
+
+/**
+ * 绛涢�夋潯浠剁浉鍏充俊鎭幏鍙栭�昏緫
+ * 鍖呮嫭鏃堕棿銆佽鏀垮尯鍒�
+ */
+export const useOptions = Behavior({
+ data: {
+ time:'',
+ },
+ methods: {
+ setLocation(e) {
+ const {
+ provinceText: provinceName,
+ cityText: cityName,
+ districtText: districtName,
+ townText: townName,
+ provinceValue: provinceCode,
+ cityValue: cityCode,
+ districtValue: districtCode,
+ townValue: townCode,
+ locationValue,
+ } = e.detail;
+ this.setData({
+ provinceName,
+ cityName,
+ districtName,
+ townName,
+ provinceCode,
+ cityCode,
+ districtCode,
+ townCode,
+ locationValue,
+ });
+ },
+ initLocation(e) {
+ this.setLocation(e);
+ this.init();
+ },
+ // 琛屾斂鍖哄垝鍒囨崲鏃讹紝鑾峰彇鏂扮殑绾夸笂鐩戠淇℃伅浠ュ強绾夸笅宸℃煡鐩戠淇℃伅
+ onLocationChange(e) {
+ this.setLocation(e);
+ this.fetchSupervision();
+ this.fetchInspection();
+ },
+
+ // 鏃堕棿鏇存敼
+ setTimeValue(e) {
+ const { timeValue } = e.detail;
+ const p = dayjs(timeValue).format('YYYY-MM-DD HH:mm:ss');
+ this.setData({
+ time: p,
+ });
+ },
+ initTime(e) {
+ this.setTimeValue(e);
+ this.init();
+ },
+ onTimePickerConfirm(e) {
+ this.setTimeValue(e);
+ this._startLoad();
+ },
+ },
+});
diff --git a/pages/cluetask/home/options.wxml b/pages/cluetask/home/options.wxml
new file mode 100644
index 0000000..a5555e0
--- /dev/null
+++ b/pages/cluetask/home/options.wxml
@@ -0,0 +1,22 @@
+<view class="home-supervision-title">
+ <!-- <view> -->
+ <!-- <text>绾夸笂鐩戠</text> -->
+ <!-- <text class="home-supervision-title__note">鏈湀鏈�鏂�</text> -->
+ <!-- </view> -->
+ <!-- <view style="display: flex;align-items: center;"> -->
+ <t-time-picker
+ color="var(--td-font-white-1)"
+ picker-class="picker-location"
+ bind:timeInitValue="initTime"
+ bind:timePickerChange="onTimePickerConfirm"
+ >
+ </t-time-picker>
+ <location-picker
+ color="var(--td-font-white-1)"
+ style-mode="picker"
+ picker-class="picker-location"
+ bind:onChange="onLocationChange"
+ bind:locationInitValue="initLocation"
+ ></location-picker>
+ <!-- </view> -->
+</view>
diff --git a/pages/cluetask/home/options.wxss b/pages/cluetask/home/options.wxss
new file mode 100644
index 0000000..cb858c2
--- /dev/null
+++ b/pages/cluetask/home/options.wxss
@@ -0,0 +1,17 @@
+.home-supervision-title {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ font-size: var(--td-font-size-m);
+ margin-bottom: var(--td-spacer);
+ font-weight: 550;
+ color: var(--td-text-color-anti);
+}
+
+.picker-location {
+ color: var(--td-font-white-1) !important;
+ justify-content: flex-end !important;
+ width: initial !important;
+ max-width: 50vw;
+ /* background-color: lawngreen; */
+}
\ No newline at end of file
diff --git a/pages/cluetask/home/statistic-proxy.js b/pages/cluetask/home/statistic-proxy.js
new file mode 100644
index 0000000..189bdb3
--- /dev/null
+++ b/pages/cluetask/home/statistic-proxy.js
@@ -0,0 +1,20 @@
+import { getClueStatistic } from '../../../model/clue/clueTask';
+
+/**
+ * 绾跨储浠诲姟缁熻鐩稿叧淇℃伅鑾峰彇閫昏緫
+ */
+export const useStatistic = Behavior({
+ data: {
+ clueCountRes: [],
+ },
+ methods: {
+ /**
+ * 璁$畻绾跨储宸℃煡瀹屾垚鎯呭喌
+ */
+ calClueCount() {
+ this.setData({
+ clueCountRes: getClueStatistic(this.data.clueTaskList),
+ });
+ },
+ },
+});
diff --git a/pages/cluetask/home/statistic.wxml b/pages/cluetask/home/statistic.wxml
new file mode 100644
index 0000000..653dd41
--- /dev/null
+++ b/pages/cluetask/home/statistic.wxml
@@ -0,0 +1,10 @@
+<view>
+
+</view>
+<stat-card
+ title="搴旀�ュ贰鏌�"
+ subTitle=""
+ stats="{{clueCountRes}}"
+ loading="{{pageLoading}}"
+ bind:cardClick="navToEnterprise"
+></stat-card>
\ No newline at end of file
diff --git a/pages/cluetask/home/statistic.wxss b/pages/cluetask/home/statistic.wxss
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/pages/cluetask/home/statistic.wxss
diff --git a/pages/cluetask/home/tasks-proxy.js b/pages/cluetask/home/tasks-proxy.js
new file mode 100644
index 0000000..cefb31b
--- /dev/null
+++ b/pages/cluetask/home/tasks-proxy.js
@@ -0,0 +1,31 @@
+import dayjs from 'dayjs';
+import dataResponseLevel from '../../../common/clue/dataResponseLevel';
+import dataTravelMode from '../../../common/clue/dataTravelMode';
+
+/**
+ * 绾跨储浠诲姟鍒楄〃灞曠ず鐩稿叧閫昏緫
+ */
+export const useTasks = Behavior({
+ data: {},
+ methods: {
+ /**
+ * 鏍煎紡鍖�
+ */
+ formatClueTask() {
+ const { clueTaskList } = this.data;
+ clueTaskList.forEach(t => {
+ t._taskTime = dayjs(t.taskTime).format('YYYY-MM-DD')
+ let note = '';
+ note += t.provinceName ? t.provinceName : '';
+ note += t.provinceName == t.cityName ? '' : t.cityName ? `/${t.cityName}` : '';
+ note += t.districtName ? `/${t.districtName}` : '';
+ note += t.townName ? `/${t.townName}` : '';
+ t._location = note;
+ t._resLevelTxt = dataResponseLevel.toLabel2(t.responseLevel);
+ t._travelModeTxt = dataTravelMode.toLabel2(t.travelMode);
+ t._hasUavTxt = t.hasUav ? '鏈�' : '鏃�';
+ });
+ this.setData({ clueTaskList });
+ },
+ },
+});
diff --git a/pages/cluetask/home/tasks.wxml b/pages/cluetask/home/tasks.wxml
new file mode 100644
index 0000000..3b89fab
--- /dev/null
+++ b/pages/cluetask/home/tasks.wxml
@@ -0,0 +1,10 @@
+<view>
+ <view wx:for="{{clueTaskList}}" wx:key="index" wx:for-index="index">
+ <t-cell title="浠诲姟鏃堕棿" note="{{item._taskTime}}" />
+ <t-cell title="浠诲姟浣嶇疆" note="{{item._location}}"/>
+ <t-cell title="鍝嶅簲鏃堕棿" note="{{item._resLevelTxt}}"/>
+ <t-cell title="鍑鸿鏂瑰紡" note="{{item._travelModeTxt}}"/>
+ <t-cell title="鏃犱汉鏈�" note="{{item._hasUavTxt}}"/>
+
+ </view>
+</view>
diff --git a/pages/cluetask/home/tasks.wxss b/pages/cluetask/home/tasks.wxss
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/pages/cluetask/home/tasks.wxss
diff --git a/pages/inspection/scene/info/device-info-items.js b/pages/inspection/scene/info/device-info-items.js
index 6867536..542057f 100644
--- a/pages/inspection/scene/info/device-info-items.js
+++ b/pages/inspection/scene/info/device-info-items.js
@@ -159,7 +159,7 @@
hideInputItem('鏇存柊鏃堕棿', 'dlUpdateTime'),
hideInputItem('璁惧浣嶇疆', 'dlLocation', true),
hideInputItem('缁忓害', 'dlLongitude'),
- hideInputItem('缁村害', 'dlLatitude', true),
+ hideInputItem('绾害', 'dlLatitude', true),
baseInputItem('鏄惁瑙勮寖', 'dlStandard', true, 'switch'),
baseInputItem('涓嶈鑼冨師鍥�', 'dlUnStandardReason'),
diff --git a/pages/selfpatrol/components/patrol-record/index.wxml b/pages/selfpatrol/components/patrol-record/index.wxml
index 31f5d8c..5cc815c 100644
--- a/pages/selfpatrol/components/patrol-record/index.wxml
+++ b/pages/selfpatrol/components/patrol-record/index.wxml
@@ -1,26 +1,22 @@
-<view
- class="patrol-record-wrap {{item.ledgerFinished ? 'patrol-finished' : 'patrol-unfinished'}}"
->
+<view class="patrol-record-wrap {{item.ledgerFinished ? 'patrol-finished' : 'patrol-unfinished'}}">
<view class="patrol-record-text-wrap">
<view> {{indexText}} </view>
- <view style="display: flex;flex-direction: column;justify-content: space-between;">
+ <view style="display: flex; flex-direction: column; justify-content: space-between">
<view class="patrol-record-text">{{item.ledgerName}}</view>
- <view class="patrol-record-tag"
- >{{item.updateDate ? item.updateDate : '鏈彁浜�'}}</view
- >
+ <view class="patrol-record-tag">{{item.updateDate ? item.updateDate : '鏈彁浜�'}}</view>
</view>
</view>
<view class="patrol-record-img-wrap">
<t-image
wx:if="{{item.path1 == null}}"
t-class="t-class-image"
- src="{{null}}"
- mode="aspectFill"
+ src="{{'/res/nodata.png'}}"
+ mode="aspectFit"
width="80rpx"
height="80rpx"
shape="round"
>
- <text slot="error">鏈彁浜�</text>
+ <text slot="error">鏈彁浜�</text>
</t-image>
<block wx:else>
<t-image
diff --git a/services/baseRequset.js b/services/baseRequset.js
index faaf70a..2c2d2b2 100644
--- a/services/baseRequset.js
+++ b/services/baseRequset.js
@@ -68,3 +68,8 @@
fun['method'] = 'PUT';
return request(fun, hostUrl);
}
+
+export function _delete(fun, hostUrl) {
+ fun['method'] = 'DELETE';
+ return request(fun, hostUrl);
+}
diff --git a/services/clue/fetchClue.js b/services/clue/fetchClue.js
new file mode 100644
index 0000000..4a50ed4
--- /dev/null
+++ b/services/clue/fetchClue.js
@@ -0,0 +1,114 @@
+/**
+ * 閬撹矾搴旀�ョ嚎绱㈠贰鏌ョ浉鍏虫暟鎹帴鍙�
+ */
+import Multipart from '../../utils/Multipart.min';
+import { get, post, _delete } from '../baseRequset';
+import { clueUrl, cluePicUrl } from '../../config/index';
+import { getClueQuestionList } from '../../model/clue/clueQuestion';
+
+export default {
+ /******************************************************************************* */
+ /**
+ * 鏌ヨ绾跨储浠诲姟
+ * @param {*} clueTask
+ * @returns
+ */
+ fetchClueTask(clueTask) {
+ return post(
+ {
+ url: `clue/task/fetch`,
+ data: clueTask,
+ },
+ clueUrl,
+ ).then(res => {
+ return res.data;
+ });
+ },
+
+ /******************************************************************************* */
+ /**
+ * 鑾峰彇绾跨储缁撹
+ * @param {string} clueId 绾跨储id
+ */
+ getConclusion(clueId) {
+ return get({
+ url: `clue/conclusion/fetch`,
+ params: {
+ clueId: clueId,
+ },
+ 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 {string} clueId 绾跨储id
+ */
+ getQuestion(clueId) {
+ return get({
+ url: `clue/question/fetch`,
+ params: {
+ clueId: clueId,
+ },
+ clueUrl,
+ }).then(res => {
+ return getClueQuestionList(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,
+ };
+ });
+
+ return new Multipart({
+ fields,
+ images,
+ })
+ .submit(clueUrl + `/clue/question/upload`)
+ .then(res => {
+ return res.data;
+ });
+ },
+
+ deleteQuestion(questionId) {
+ return _delete({
+ url: `clue/question`,
+ params: {
+ questionId: questionId,
+ },
+ clueUrl,
+ }).then(res => res.data);
+ },
+};
--
Gitblit v1.9.3