Browse Source

add url

master
meixinbin 2 years ago
parent
commit
d0ba8789ea
7 changed files with 58 additions and 9 deletions
  1. +7
    -5
      package-lock.json
  2. +1
    -0
      package.json
  3. +20
    -0
      src/api/data.js
  4. +1
    -1
      src/config/index.js
  5. +14
    -3
      src/libs/axios.js
  6. +2
    -0
      src/view/index.vue
  7. +13
    -0
      src/view/overview.vue

+ 7
- 5
package-lock.json View File

@@ -2984,7 +2984,6 @@
"resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz",
"integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=",
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"hoek": "2.x.x" "hoek": "2.x.x"
} }
@@ -6630,8 +6629,7 @@
"version": "2.16.3", "version": "2.16.3",
"resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz",
"integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=",
"dev": true,
"optional": true
"dev": true
}, },
"hoopy": { "hoopy": {
"version": "0.1.4", "version": "0.1.4",
@@ -7646,6 +7644,11 @@
"integrity": "sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==", "integrity": "sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==",
"dev": true "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": { "js-message": {
"version": "1.0.7", "version": "1.0.7",
"resolved": "https://registry.npmjs.org/js-message/-/js-message-1.0.7.tgz", "resolved": "https://registry.npmjs.org/js-message/-/js-message-1.0.7.tgz",
@@ -9933,8 +9936,7 @@
"version": "2.2.2", "version": "2.2.2",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz",
"integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==",
"dev": true,
"optional": true
"dev": true
}, },
"pify": { "pify": {
"version": "2.3.0", "version": "2.3.0",


+ 1
- 0
package.json View File

@@ -26,6 +26,7 @@
"html2canvas": "^1.0.0-alpha.12", "html2canvas": "^1.0.0-alpha.12",
"iview-area": "^1.5.17", "iview-area": "^1.5.17",
"js-cookie": "^2.2.0", "js-cookie": "^2.2.0",
"js-md5": "^0.7.3",
"node-sass": "^4.9.4", "node-sass": "^4.9.4",
"pdfjs": "^2.4.1", "pdfjs": "^2.4.1",
"pdfjs-dist": "^2.2.228", "pdfjs-dist": "^2.2.228",


+ 20
- 0
src/api/data.js View File

@@ -828,3 +828,23 @@ export const listPsSimpleInfo = () => {
method: 'get' 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'
})
}

+ 1
- 1
src/config/index.js View File

@@ -31,7 +31,7 @@ export default {
* @description api请求基础路径 * @description api请求基础路径
*/ */
baseUrl: { baseUrl: {
dev: 'http://a.demo.com/',
dev: 'http://localhost:9001',
pro: 'https://oss.console.ingenuity.top' pro: 'https://oss.console.ingenuity.top'
} }
} }

+ 14
- 3
src/libs/axios.js View File

@@ -4,6 +4,8 @@ import qs from 'qs'
import 'vue2-toast/lib/toast.css' import 'vue2-toast/lib/toast.css'
import Toast from 'vue2-toast' import Toast from 'vue2-toast'
import store from '@/store' import store from '@/store'
import {guid} from "./util";
import md5 from 'js-md5';


// import { Spin } from 'iview' // import { Spin } from 'iview'
Vue.use(Toast) Vue.use(Toast)
@@ -41,10 +43,18 @@ class HttpRequest {
if (!Object.keys(this.queue).length) { if (!Object.keys(this.queue).length) {
// Spin.show() // 不建议开启,因为界面不友好 // 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' 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 config.headers['Authorization'] = 'Bearer ' + store.state.user.id_token
}
}*/
this.queue[url] = true this.queue[url] = true
return config return config
}, error => { }, error => {
@@ -53,6 +63,7 @@ class HttpRequest {
// 响应拦截 // 响应拦截
instance.interceptors.response.use(res => { instance.interceptors.response.use(res => {
this.distroy(url) this.distroy(url)
console.log(res)
if (res.status === 200 || res.data.success) { if (res.status === 200 || res.data.success) {
return Promise.resolve(res.data) return Promise.resolve(res.data)
} else { } else {
@@ -60,7 +71,7 @@ class HttpRequest {
} }
}, error => { }, error => {
this.distroy(url) this.distroy(url)
console.log(JSON.stringify(error))
console.log(error)
if (error && error.response) { if (error && error.response) {
switch (error.response.status) { switch (error.response.status) {
case 400: case 400:


+ 2
- 0
src/view/index.vue View File

@@ -9,6 +9,7 @@
</template> </template>
<script> <script>
import InsideMenu from '@/view/components/menu/InsideMenu' import InsideMenu from '@/view/components/menu/InsideMenu'
import {getChannelsRequest} from "../api/data";


export default { export default {
name: 'index', name: 'index',
@@ -30,6 +31,7 @@ export default {
}, },
}, },
mounted() { mounted() {

} }
} }
</script> </script>


+ 13
- 0
src/view/overview.vue View File

@@ -170,11 +170,24 @@
</template> </template>


<script> <script>
import {getChannelInformationsRequest, getChannelsRequest, getDetailRequest} from "../api/data";

export default { export default {
data () { data () {
return { return {


} }
},
mounted() {
getChannelsRequest({current:1,size:15}).then(res=>{
console.log(JSON.stringify(res))
getChannelInformationsRequest({channelId:res.data.records[0].id}).then(res=>{
console.log(JSON.stringify(res))
getDetailRequest('1498921672646979585').then(res=>{
console.log(JSON.stringify(res))
})
})
})
} }
} }
</script> </script>


Loading…
Cancel
Save