diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..11aff36 --- /dev/null +++ b/.env.development @@ -0,0 +1,4 @@ +VITE_ENABLE_MOCK=false +VITE_API_PREFIX=/api +VITE_PROXY_ENDPOINT=https://bright.yilibili.com/api + diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..92b86ee --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +VITE_ENABLE_MOCK=true diff --git a/pet-manual/components/CardList.vue b/pet-manual/components/CardList.vue new file mode 100644 index 0000000..bc7973a --- /dev/null +++ b/pet-manual/components/CardList.vue @@ -0,0 +1,36 @@ + + + + + diff --git a/pet-manual/index.vue b/pet-manual/index.vue new file mode 100644 index 0000000..21de306 --- /dev/null +++ b/pet-manual/index.vue @@ -0,0 +1,232 @@ + + + + + diff --git a/src/api/carousal.ts b/src/api/carousal.ts new file mode 100644 index 0000000..b633db3 --- /dev/null +++ b/src/api/carousal.ts @@ -0,0 +1,9 @@ +import httpClient from '@/api/httpClient' + +function getCarousalList() { + return httpClient.get('/carousals/active-list') +} + +export default { + getCarousalList, +} diff --git a/src/api/httpClient.ts b/src/api/httpClient.ts index 3ca27d4..e3bb33b 100644 --- a/src/api/httpClient.ts +++ b/src/api/httpClient.ts @@ -3,7 +3,7 @@ import { createUniAppAxiosAdapter } from '@uni-helper/axios-adapter' import axios from 'axios' const instance = axios.create({ - baseURL: import.meta.env.VITE_API_URL, + baseURL: import.meta.env.VITE_PROXY_ENDPOINT, adapter: createUniAppAxiosAdapter(), }) diff --git a/src/api/request.ts b/src/api/request.ts new file mode 100644 index 0000000..971f474 --- /dev/null +++ b/src/api/request.ts @@ -0,0 +1,26 @@ +export function get(url: string, params: string | AnyObject | ArrayBuffer = {}) { + return _request('GET', url, params) +} +export function post(url: string, data: string | AnyObject | ArrayBuffer) { + return _request('POST', url, data) +} + +function _request( + method: 'OPTIONS' | 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'TRACE' | 'CONNECT', + url: string, + data: string | AnyObject | ArrayBuffer = {}, +) { + return new Promise((resolve, reject) => { + uni.request({ + method, + url, + data, + success: (result) => { + resolve(result.data as T) + }, + fail: (result) => { + reject('服务器无法触达') + }, + }) + }) +} diff --git a/src/api/token.ts b/src/api/token.ts index f97508a..9df6222 100644 --- a/src/api/token.ts +++ b/src/api/token.ts @@ -1,6 +1,5 @@ -import type { CreateTokenRequest } from '@/model/token' import httpClient from './httpClient' -export function createToken(createTokenRequest: CreateTokenRequest) { - return httpClient.post<{ token: string }>('/tokens', createTokenRequest) +export function createToken(code: string) { + return httpClient.post<{ token: string }>(`/we-chat/tokens/${code}`) } diff --git a/src/auto-imports.d.ts b/src/auto-imports.d.ts index 7bbfa57..c5ecd8d 100644 --- a/src/auto-imports.d.ts +++ b/src/auto-imports.d.ts @@ -35,7 +35,6 @@ declare global { const extendRef: typeof import('@vueuse/core')['extendRef'] const getCurrentInstance: typeof import('vue')['getCurrentInstance'] const getCurrentScope: typeof import('vue')['getCurrentScope'] - const getSafeHeight: typeof import('./utils/index')['getSafeHeight'] const h: typeof import('vue')['h'] const ignorableWatch: typeof import('@vueuse/core')['ignorableWatch'] const inject: typeof import('vue')['inject'] @@ -353,7 +352,6 @@ declare module 'vue' { readonly extendRef: UnwrapRef readonly getCurrentInstance: UnwrapRef readonly getCurrentScope: UnwrapRef - readonly getSafeHeight: UnwrapRef readonly h: UnwrapRef readonly ignorableWatch: UnwrapRef readonly inject: UnwrapRef @@ -613,6 +611,7 @@ declare module 'vue' { readonly useWindowFocus: UnwrapRef readonly useWindowScroll: UnwrapRef readonly useWindowSize: UnwrapRef + readonly utils: UnwrapRef readonly watch: UnwrapRef readonly watchArray: UnwrapRef readonly watchAtMost: UnwrapRef diff --git a/src/model/carousals.ts b/src/model/carousals.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/pages.json b/src/pages.json index d401867..6af144d 100644 --- a/src/pages.json +++ b/src/pages.json @@ -1,46 +1,45 @@ { - "easycom": { - "autoscan": true, - "custom": { - "^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue" - } - }, - "pages": [ - { - "path": "pages/feed-plan/index", - "type": "page" - }, - { - "path": "pages/home/index", - "type": "page" - }, - { - "path": "pages/me/index", - "type": "page" - }, - { - "path": "pages/pet-manual/index", - "type": "page" - }, - { - "path": "pages/setting/index", - "type": "page" - }, - { - "path": "pages/userInfo/index", - "type": "page" - } - ], - "globalStyle": { - "backgroundColor": "@bgColor", - "backgroundColorBottom": "@bgColorBottom", - "backgroundColorTop": "@bgColorTop", - "backgroundTextStyle": "@bgTxtStyle", - "navigationBarBackgroundColor": "#000000", - "navigationBarTextStyle": "@navTxtStyle", - "navigationBarTitleText": "Vitesse-Uni", - "navigationStyle": "custom" - }, - "__esModule": true, - "subPackages": [] -} \ No newline at end of file + "easycom": { + "autoscan": true, + "custom": { + "^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue" + } + }, + "pages": [ + { + "path": "pages/feed-plan/index", + "type": "page" + }, + { + "path": "pages/home/index", + "type": "page" + }, + { + "path": "pages/me/index", + "type": "page" + }, + { + "path": "pages/setting/index", + "type": "page" + }, + { + "path": "pages/userInfo/index", + "type": "page" + }, + { + "path": "pages/pet-manual/components/CardList", + "type": "page" + } + ], + "globalStyle": { + "backgroundColor": "@bgColor", + "backgroundColorBottom": "@bgColorBottom", + "backgroundColorTop": "@bgColorTop", + "backgroundTextStyle": "@bgTxtStyle", + "navigationBarBackgroundColor": "#000000", + "navigationBarTextStyle": "@navTxtStyle", + "navigationBarTitleText": "Vitesse-Uni", + "navigationStyle": "custom" + }, + "subPackages": [] +} diff --git a/src/pages/home/index.vue b/src/pages/home/index.vue index cd7f1c2..bb868a9 100644 --- a/src/pages/home/index.vue +++ b/src/pages/home/index.vue @@ -18,38 +18,47 @@ const videoSrc = ref( >