From 06d06df88b85c2c7f8c66a653109df5691b64b2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=B2=E4=B9=88=E4=BA=86?= Date: Tue, 4 Apr 2023 09:14:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=97=E5=85=B8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/api/dictionary.js | 12 ++++++++++++ common/api/project.js | 3 +++ common/js/request.js | 4 ++-- pages/index/index.vue | 17 ++++++++++++++++- 4 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 common/api/dictionary.js diff --git a/common/api/dictionary.js b/common/api/dictionary.js new file mode 100644 index 0000000..9eeaf0a --- /dev/null +++ b/common/api/dictionary.js @@ -0,0 +1,12 @@ +import request from '../js/request'; +import config from '../js/config'; + +export function queryDictData(dictType) { + return request({ + url: '/dict/queryDictData', + method: 'post', + data: { + dictType, + }, + }); +} diff --git a/common/api/project.js b/common/api/project.js index 0fc93d8..71a52fa 100644 --- a/common/api/project.js +++ b/common/api/project.js @@ -18,5 +18,8 @@ export function getProjectList (params) { url: '/project/queryProject', method: 'post', data: params, + header: { + 'Content-Type': 'application/json', + }, }) } diff --git a/common/js/request.js b/common/js/request.js index 3f0b9c4..95143c4 100644 --- a/common/js/request.js +++ b/common/js/request.js @@ -25,8 +25,8 @@ export default (options = {}) => { ...options.data, }, header: { - 'Content-Type': 'application/json;charset=UTF-8', - // "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", + // 'Content-Type': 'application/json;charset=UTF-8', + "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", Authorization: '12', ...options.header, }, diff --git a/pages/index/index.vue b/pages/index/index.vue index 5665e85..f234e86 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -28,6 +28,7 @@ import ZhuanZhi from "./comp/indexZhuanZhi.vue"; import YouKe from "./comp/indexYouKe.vue"; import list from '../../common/js/list' import { getProjectList } from '../../common/api/project' +import { queryDictData } from '../../common/api/dictionary' export default { mixins: [list], components: { @@ -177,6 +178,7 @@ export default { console.log(this.store); } this.getProjectList() + this.queryDictData() }, getProjectList() { getProjectList({ @@ -194,7 +196,20 @@ export default { } })] }) - } + }, + queryDictData() { + queryDictData('projectType').then(res => { + this.projectType = [{ + text: '全部类型', + value: '' + }, ...res.data.map(item => { + return { + text: item.anotherName, + value: item.id + } + })] + }) + }, }, onLoad(options) { this.init()