Skip to content

Commit a6f9bb5

Browse files
committed
update api
1 parent 86aa5a4 commit a6f9bb5

File tree

2 files changed

+61
-4
lines changed

2 files changed

+61
-4
lines changed

src/App.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import Dialog from "./components/Dialog.vue"
66
import { useApi } from "./composables/useApi"
77
88
const isOpen = ref(true)
9-
const { getSpiritList } = useApi()
9+
const { getSpirit } = useApi()
1010
1111
onMounted(async () => {
12-
const list = await getSpiritList()
12+
const data = await getSpirit({ hash: "79bdd5fd" })
1313
14-
console.log(list)
14+
console.log(data)
1515
})
1616
</script>
1717

@@ -25,6 +25,9 @@ onMounted(async () => {
2525
<style scoped lang="postcss">
2626
#app-main {
2727
@apply w-[500px] h-[600px]
28-
border border-slate-500;
28+
border border-slate-500
29+
bg-slate-50 dark:bg-slate-800
30+
text-slate-700 dark:text-slate-100
31+
transition-all duration-200 ease-in-out;
2932
}
3033
</style>

src/composables/useApi.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const headers = {
2121
// "user-agent":
2222
// "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36 Edg/115.0.1901.188",
2323
}
24+
const staticURL = "https://res.17roco.qq.com/res/combat/icons/"
2425
const rocoApi = axios.create({
2526
baseURL,
2627
headers,
@@ -34,7 +35,20 @@ interface SpiritListParma {
3435
page: number
3536
}
3637

38+
interface ItemListParma {
39+
search: string
40+
id: string
41+
page: number
42+
}
43+
3744
export const useApi = () => {
45+
// Angel Feature Map
46+
async function getFeatures() {
47+
const response = await rocoApi.get("/feature/")
48+
return response.data
49+
}
50+
51+
// Angel List
3852
async function getSpiritList(
3953
params: SpiritListParma = {
4054
search: "",
@@ -46,7 +60,47 @@ export const useApi = () => {
4660
const response = await rocoApi.post("/spiritList/", params)
4761
return response.data.data
4862
}
63+
64+
// Angel Detail
65+
async function getSpirit(params: { hash: string }) {
66+
const response = await rocoApi.post("/detail/angel/", params)
67+
return response.data.data
68+
}
69+
70+
// Item List
71+
async function getItemList(
72+
params: ItemListParma = {
73+
search: "",
74+
id: "",
75+
page: 1,
76+
}
77+
) {
78+
const response = await rocoApi.post("/Itemlist/", params)
79+
return response.data.data
80+
}
81+
82+
// Angel Skill List
83+
async function getSkillList(
84+
params: SpiritListParma = {
85+
search: "",
86+
id: "",
87+
feature: "",
88+
page: 1,
89+
}
90+
) {
91+
const response = await rocoApi.post("/Skilllist/", params)
92+
return response.data.data
93+
}
94+
4995
return {
96+
getFeatures,
5097
getSpiritList,
98+
getSpirit,
99+
getItemList,
100+
getSkillList,
101+
baseURL,
102+
headers,
103+
timeout,
104+
staticURL,
51105
}
52106
}

0 commit comments

Comments
 (0)