From d0ba8789eaef724a01859e4f549153299c0198ea Mon Sep 17 00:00:00 2001 From: meixinbin Date: Sat, 12 Mar 2022 18:26:38 +0800 Subject: [PATCH] add url --- package-lock.json | 12 +++++++----- package.json | 1 + src/api/data.js | 20 ++++++++++++++++++++ src/config/index.js | 2 +- src/libs/axios.js | 17 ++++++++++++++--- src/view/index.vue | 2 ++ src/view/overview.vue | 13 +++++++++++++ 7 files changed, 58 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0c50295..397ee0c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2984,7 +2984,6 @@ "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", "dev": true, - "optional": true, "requires": { "hoek": "2.x.x" } @@ -6630,8 +6629,7 @@ "version": "2.16.3", "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", - "dev": true, - "optional": true + "dev": true }, "hoopy": { "version": "0.1.4", @@ -7646,6 +7644,11 @@ "integrity": "sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==", "dev": true }, + "js-md5": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/js-md5/-/js-md5-0.7.3.tgz", + "integrity": "sha512-ZC41vPSTLKGwIRjqDh8DfXoCrdQIyBgspJVPXHBGu4nZlAEvG3nf+jO9avM9RmLiGakg7vz974ms99nEV0tmTQ==" + }, "js-message": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/js-message/-/js-message-1.0.7.tgz", @@ -9933,8 +9936,7 @@ "version": "2.2.2", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", - "dev": true, - "optional": true + "dev": true }, "pify": { "version": "2.3.0", diff --git a/package.json b/package.json index fc5441d..cad59a9 100755 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "html2canvas": "^1.0.0-alpha.12", "iview-area": "^1.5.17", "js-cookie": "^2.2.0", + "js-md5": "^0.7.3", "node-sass": "^4.9.4", "pdfjs": "^2.4.1", "pdfjs-dist": "^2.2.228", diff --git a/src/api/data.js b/src/api/data.js index 806210a..b6835f9 100755 --- a/src/api/data.js +++ b/src/api/data.js @@ -828,3 +828,23 @@ export const listPsSimpleInfo = () => { method: 'get' }) } +export const getChannelsRequest = (p) => { + return axios.request({ + url: 'api/cms/open/api/infor/channels', + method: 'get', + params:p + }) +} +export const getChannelInformationsRequest = (p) => { + return axios.request({ + url: 'api/cms/open/api/infor/informations', + method: 'get', + params:p + }) +} +export const getDetailRequest = (id) => { + return axios.request({ + url: 'api/cms/open/api/infor/'+id, + method: 'get' + }) +} diff --git a/src/config/index.js b/src/config/index.js index ff1d45f..8bd4b53 100755 --- a/src/config/index.js +++ b/src/config/index.js @@ -31,7 +31,7 @@ export default { * @description api请求基础路径 */ baseUrl: { - dev: 'http://a.demo.com/', + dev: 'http://localhost:9001', pro: 'https://oss.console.ingenuity.top' } } diff --git a/src/libs/axios.js b/src/libs/axios.js index e682491..133c242 100755 --- a/src/libs/axios.js +++ b/src/libs/axios.js @@ -4,6 +4,8 @@ import qs from 'qs' import 'vue2-toast/lib/toast.css' import Toast from 'vue2-toast' import store from '@/store' +import {guid} from "./util"; +import md5 from 'js-md5'; // import { Spin } from 'iview' Vue.use(Toast) @@ -41,10 +43,18 @@ class HttpRequest { if (!Object.keys(this.queue).length) { // Spin.show() // 不建议开启,因为界面不友好 } + let accesstoken = 'aaaa09f1bc6305d06a7307c698ca2403' + let timestamp = new Date().getTime() + let nonce = guid() + let secret = 'a7d1c64a82e5105e7a9e6713478a2a66' + config.headers['x-dj-accesstoken'] = accesstoken + config.headers['x-dj-timestamp'] = timestamp + config.headers['x-dj-nonce'] = nonce + config.headers['x-dj-signature'] = md5(accesstoken+secret+timestamp+nonce) config.headers['X-Requested-With'] = 'XMLHttpRequest' - if (store.state.user.id_token) { + /*if (store.state.user.id_token) { config.headers['Authorization'] = 'Bearer ' + store.state.user.id_token - } + }*/ this.queue[url] = true return config }, error => { @@ -53,6 +63,7 @@ class HttpRequest { // 响应拦截 instance.interceptors.response.use(res => { this.distroy(url) + console.log(res) if (res.status === 200 || res.data.success) { return Promise.resolve(res.data) } else { @@ -60,7 +71,7 @@ class HttpRequest { } }, error => { this.distroy(url) - console.log(JSON.stringify(error)) + console.log(error) if (error && error.response) { switch (error.response.status) { case 400: diff --git a/src/view/index.vue b/src/view/index.vue index ef03163..433101f 100755 --- a/src/view/index.vue +++ b/src/view/index.vue @@ -9,6 +9,7 @@ diff --git a/src/view/overview.vue b/src/view/overview.vue index 954f738..db2c6da 100755 --- a/src/view/overview.vue +++ b/src/view/overview.vue @@ -170,11 +170,24 @@