diff --git a/.env b/.env index da5b2cc..cb3b622 100644 --- a/.env +++ b/.env @@ -1,3 +1,3 @@ VITE_ENABLE_MOCK=false VITE_API_PREFIX=/api -VITE_PROXY_ENDPOINT=http://localhost:8000 +VITE_PROXY_ENDPOINT=https://bright.yilibili.com/api/ diff --git a/.env.development b/.env.development index 92b86ee..9817c86 100644 --- a/.env.development +++ b/.env.development @@ -1 +1 @@ -VITE_ENABLE_MOCK=true +VITE_ENABLE_MOCK=false diff --git a/components.d.ts b/components.d.ts index cf28278..bbec505 100644 --- a/components.d.ts +++ b/components.d.ts @@ -8,7 +8,6 @@ export {} declare module 'vue' { export interface GlobalComponents { Copyright: typeof import('./src/components/Copyright.vue')['default'] - Dialog: typeof import('./src/components/Dialog.vue')['default'] RegularPage: typeof import('./src/components/RegularPage.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] @@ -17,7 +16,6 @@ declare module 'vue' { TButton: typeof import('tdesign-vue-next')['Button'] TCard: typeof import('tdesign-vue-next')['Card'] TCheckbox: typeof import('tdesign-vue-next')['Checkbox'] - TCol: typeof import('tdesign-vue-next')['Col'] TDialog: typeof import('tdesign-vue-next')['Dialog'] TDropdown: typeof import('tdesign-vue-next')['Dropdown'] TForm: typeof import('tdesign-vue-next')['Form'] @@ -29,9 +27,6 @@ declare module 'vue' { TLink: typeof import('tdesign-vue-next')['Link'] TMenu: typeof import('tdesign-vue-next')['Menu'] TMenuItem: typeof import('tdesign-vue-next')['MenuItem'] - TPagination: typeof import('tdesign-vue-next')['Pagination'] - TRow: typeof import('tdesign-vue-next')['Row'] - TSelect: typeof import('tdesign-vue-next')['Select'] TSpace: typeof import('tdesign-vue-next')['Space'] TTable: typeof import('tdesign-vue-next')['Table'] TTag: typeof import('tdesign-vue-next')['Tag'] diff --git a/src/api/carousal.ts b/src/api/carousal.ts new file mode 100644 index 0000000..09f3ca6 --- /dev/null +++ b/src/api/carousal.ts @@ -0,0 +1,30 @@ +import httpClient from './httpClient' +import type { CreateCarousalsRequest, GetCarousalsRequest } from '@/model/carousals' +import type { UnwrapNestedRefs } from 'vue' + +export const createCarousal = (createCarousalsRequest: UnwrapNestedRefs<{ size: number; page: number }> & {}) => { + return httpClient.post('/carousals', createCarousalsRequest) +} + +export const getCarousalList = (getCarousalsRequest:GetCarousalsRequest) => { + return httpClient.get('/carousals',getCarousalsRequest) +} +export const getCarousalItem = (id:string) => { + return httpClient.get(`/carousals/${id}`) +} + +export const updateCarousalItem = (id:number,updateCarousalsRequest: CreateCarousalsRequest) => { + return httpClient.put(`/carousals/${id}`,updateCarousalsRequest) +} + +export const deleteCarousal = (id:number) => { + return httpClient.delete(`/carousals/${id}`) +} + +export const activeCarousal = (id:number) => { + return httpClient.put(`/carousals/${id}/active`) +} + +export const inactiveCarousal = (id:number) => { + return httpClient.put(`/carousals/${id}/inactive`) +} \ No newline at end of file diff --git a/src/model/carousals.ts b/src/model/carousals.ts new file mode 100644 index 0000000..1c132ea --- /dev/null +++ b/src/model/carousals.ts @@ -0,0 +1,12 @@ +export interface CreateCarousalsRequest { + imageUrl:string, + targetType:string, + targetUrl:string, + targetId:string +} +export interface GetCarousalsRequest { + page:string, + size:string, + order?:string +} + diff --git a/src/model/token.ts b/src/model/token.ts index 2624a83..2302162 100644 --- a/src/model/token.ts +++ b/src/model/token.ts @@ -1,4 +1,4 @@ export interface CreateTokenRequest { - email: string + username: string password: string } diff --git a/src/pages/carousal/components/CarousalDialog.vue b/src/pages/carousal/components/CarousalDialog.vue new file mode 100644 index 0000000..8d6e8d1 --- /dev/null +++ b/src/pages/carousal/components/CarousalDialog.vue @@ -0,0 +1,148 @@ + + diff --git a/src/pages/carousal/index.vue b/src/pages/carousal/index.vue new file mode 100644 index 0000000..e3dc60b --- /dev/null +++ b/src/pages/carousal/index.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/pages/common/login.vue b/src/pages/common/login.vue index 04e42d2..11145c6 100644 --- a/src/pages/common/login.vue +++ b/src/pages/common/login.vue @@ -8,8 +8,8 @@ import { MessagePlugin } from 'tdesign-vue-next' import { useAppStore } from '@/stores/app' const loginForm = reactive({ - password: '', - email: '' + username: 'admin', + password: 'admin123' }) const canRegister = ref(false) @@ -18,7 +18,7 @@ const loading = ref(false) const appStore = useAppStore() const handleLogin = async () => { - if (!loginForm.email || !loginForm.password) { + if (!loginForm.username || !loginForm.password) { MessagePlugin.error('用户名或密码不能为空') return } @@ -40,7 +40,7 @@ const handleLogin = async () => { 买有账号?注册新账号
- + diff --git a/src/router/index.ts b/src/router/index.ts index ddbf593..595be79 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -14,6 +14,15 @@ export const asyncRoutes: RouteRecordRaw[] = [ icon: 'system-3' } }, + { + name: 'carousal', + path: 'carousal', + component: () => import('@/pages/carousal/index.vue'), + meta: { + title: '轮播图管理', + icon: 'system-3' + } + }, ] const router = createRouter({ @@ -36,13 +45,13 @@ const router = createRouter({ ] }) -router.beforeEach((to, from, next) => { - if (to.name !== 'login') { - const appStore = useAppStore() - appStore.isLogin ? next() : next({ name: 'login' }) - return - } - next() -}) +// router.beforeEach((to, from, next) => { +// if (to.name !== 'login') { +// const appStore = useAppStore() +// appStore.isLogin ? next() : next({ name: 'login' }) +// return +// } +// next() +// }) export default router