select some api
This commit is contained in:
53
pages/index/index.vue
Normal file
53
pages/index/index.vue
Normal file
@@ -0,0 +1,53 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
notice:null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async request(gest, path) {
|
||||
let text
|
||||
if (gest == "get") {
|
||||
text = await fetch(`http://124.93.196.45:10091/Neusoft/community${path}`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization":(await this.request("post","/api/login")).token
|
||||
},
|
||||
})
|
||||
}
|
||||
else if (gest=="post"){
|
||||
text = await fetch(`http://124.93.196.45:10091/Neusoft/community${path}`,{
|
||||
method:"POST",
|
||||
headers:{
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
"password": "0CYdq6Hn",
|
||||
"username": "6dOMIgIU",
|
||||
})
|
||||
})
|
||||
}
|
||||
const data = await text.json()
|
||||
console.log(data)
|
||||
return data
|
||||
}
|
||||
},
|
||||
async mounted(){
|
||||
// await this.request("get","/api/notice/list")
|
||||
// await this.request("get","/api/cms/article/list")
|
||||
// await this.request("get","/api/visitor/list")
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user