41 lines
953 B
TypeScript
41 lines
953 B
TypeScript
import { request } from "@/utils/request"
|
|
|
|
export const getZhouList = () => {
|
|
return request('/api/zhou-yis?sort=index&pagination[pageSize]=64', {
|
|
method: 'GET',
|
|
})
|
|
}
|
|
|
|
export const getZhouDetail = ({
|
|
id,
|
|
name
|
|
}: {
|
|
id?: string,
|
|
name?: string
|
|
}) => {
|
|
if (id) {
|
|
return request(`/api/zhou-yis/${id}`, {
|
|
method: 'GET',
|
|
})
|
|
}
|
|
if (name) {
|
|
return request(`/api/zhou-yis?filters[name]=${name}`, {
|
|
method: 'GET',
|
|
})
|
|
}
|
|
}
|
|
|
|
export const 获取易经爻辞 = (
|
|
name: string,
|
|
动爻名称: string
|
|
) => {
|
|
return request(`/api/zhou-yis?filters[name]=${name}`, {
|
|
method: 'GET',
|
|
}).then(
|
|
res => res.data[0]
|
|
).then(res => {
|
|
let str = res.desc.split('\n\n')
|
|
let index = str.findIndex(item => item.includes(动爻名称))
|
|
return str[index] + '\n' + str[index + 1]
|
|
})
|
|
} |