diff --git a/.env.development b/.env.development index 7bebb92..e6af565 100644 --- a/.env.development +++ b/.env.development @@ -4,5 +4,5 @@ NODE_ENV='development' VITE_APP_TITLE = '管理系统' -VITE_APP_PORT = 3000 +VITE_APP_PORT = 4396 VITE_APP_BASE_API = '/dev-api' diff --git a/src/App.vue b/src/App.vue index cb237d2..c24529d 100644 --- a/src/App.vue +++ b/src/App.vue @@ -10,3 +10,8 @@ export default { } + diff --git a/src/api/system/client.ts b/src/api/system/client.ts new file mode 100644 index 0000000..1b34f8e --- /dev/null +++ b/src/api/system/client.ts @@ -0,0 +1,47 @@ +import request from '@/utils/request' + +export function list(queryParams:object) { + return request({ + url: '/youlai-admin/api/v1/oauth-clients', + method: 'get', + params: queryParams + }) +} + +export function detail(id:number) { + return request({ + url: '/youlai-admin/api/v1/oauth-clients/' + id, + method: 'get' + }) +} + +export function add(data:object) { + return request({ + url: '/youlai-admin/api/v1/oauth-clients', + method: 'post', + data: data + }) +} + +export function update(id:number, data:object) { + return request({ + url: '/youlai-admin/api/v1/oauth-clients/' + id, + method: 'put', + data: data + }) +} + +export function del(ids:string) { + return request({ + url: '/youlai-admin/api/v1/oauth-clients/'+ids, + method: 'delete' + }) +} + +export function patch(id:number, data:object) { + return request({ + url: '/youlai-admin/api/v1/oauth-clients/' + id, + method: 'patch', + data: data + }) +} diff --git a/src/components/Pagination/index.vue b/src/components/Pagination/index.vue new file mode 100644 index 0000000..a535c79 --- /dev/null +++ b/src/components/Pagination/index.vue @@ -0,0 +1,107 @@ + + + + + diff --git a/src/main.ts b/src/main.ts index 232ae7c..ee89eeb 100644 --- a/src/main.ts +++ b/src/main.ts @@ -6,25 +6,29 @@ import '@/styles/index.scss' import ElementPlus from 'element-plus' import 'element-plus/theme-chalk/index.css' +import locale from 'element-plus/lib/locale/lang/zh-cn' import 'virtual:svg-icons-register'; // @see https://blog.csdn.net/qq_37213281/article/details/121422027 import * as ElIconModules from '@element-plus/icons' - import '@/permission' +// 全局组件 +import Pagination from '@/components/Pagination/index.vue' + + const app=createApp(App) // 统一注册el-icon图标 -for(let iconName in ElIconModules){ - // @ts-ignore - app.component(iconName,ElIconModules[iconName] ) +for(let iconName in ElIconModules ){ + app.component(iconName,(ElIconModules as any)[iconName] ) } app + .component('Pagination',Pagination) .use(router) .use(store,key) - .use(ElementPlus) + .use(ElementPlus,{locale}) .mount('#app') \ No newline at end of file diff --git a/src/router/index.ts b/src/router/index.ts index a6dc6e1..bd38c10 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,5 +1,5 @@ import {createRouter, createWebHashHistory, RouteRecordRaw} from 'vue-router' -import Layout from '@/layout/index.vue' +export const Layout = () => import( '@/layout/index.vue') // 参数说明: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts index 29dfe38..e2cf3fd 100644 --- a/src/store/modules/permission.ts +++ b/src/store/modules/permission.ts @@ -5,7 +5,7 @@ import {constantRoutes} from '@/router' import {getRouteList} from "@/api/system/menu"; const modules = import.meta.glob("../../views/**/**.vue"); -import Layout from '@/layout/index.vue' +export const Layout = () => import( '@/layout/index.vue') const hasPermission = (roles: string[], route: RouteRecordRaw) => { // 超级管理员放行 diff --git a/src/utils/scroll-to.ts b/src/utils/scroll-to.ts new file mode 100644 index 0000000..9c24d8d --- /dev/null +++ b/src/utils/scroll-to.ts @@ -0,0 +1,61 @@ +const easeInOutQuad = (t: number, b: number, c: number, d: number) => { + t /= d / 2 + if (t < 1) { + return c / 2 * t * t + b + } + t-- + return -c / 2 * (t * (t - 2) - 1) + b +} + + +// requestAnimationFrame for Smart Animating http://goo.gl/sx5sts +const requestAnimFrame = (function () { + return window.requestAnimationFrame || (window as any).webkitRequestAnimationFrame || (window as any).mozRequestAnimationFrame || function (callback) { + window.setTimeout(callback, 1000 / 60) + } +})() + +/** + * Because it's so fucking difficult to detect the scrolling element, just move them all + * @param {number} amount + */ +const move = (amount: number) => { + document.documentElement.scrollTop = amount; + (document.body.parentNode as HTMLElement).scrollTop = amount + document.body.scrollTop = amount +} + +const position = () => { + return document.documentElement.scrollTop || (document.body.parentNode as HTMLElement).scrollTop || document.body.scrollTop +} + +/** + * @param {number} to + * @param {number} duration + * @param {Function} callback + */ +export const scrollTo = (to: number, duration: number, callback?: Function) => { + const start = position() + const change = to - start + const increment = 20 + let currentTime = 0 + duration = (typeof (duration) === 'undefined') ? 500 : duration + const animateScroll = function () { + // increment the time + currentTime += increment + // find the value with the quadratic in-out easing function + const val = easeInOutQuad(currentTime, start, change, duration) + // move the document.body + move(val) + // do the animation unless its over + if (currentTime < duration) { + requestAnimFrame(animateScroll) + } else { + if (callback && typeof (callback) === 'function') { + // the animation is done so lets callback + callback() + } + } + } + animateScroll() +} diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 0f8ed5f..969ec4e 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -52,8 +52,8 @@ style="width: 65%" @keyup.enter.native="handleLogin" /> -
- +
+
@@ -105,7 +105,7 @@ export default { }, created() { // 生成验证码 - this.getCaptcha() + this.handleCaptchaGenerate() }, watch: { $route: { @@ -135,7 +135,7 @@ export default { this.loading = false }).catch(() => { this.loading = false - this.getCaptcha() + this.handleCaptchaGenerate() }) } else { console.log('error submit!!') @@ -144,7 +144,7 @@ export default { }) }, // 获取验证码 - getCaptcha(){ + handleCaptchaGenerate(){ getCaptcha().then(response => { const {img, uuid} = response.data this.base64Captcha = "data:image/gif;base64," + img @@ -263,7 +263,7 @@ $light_gray:#eee; cursor: pointer; user-select: none; } - .validate-code { + .captcha { position: absolute; right: 0; top: 0; diff --git a/src/views/system/client/index.vue b/src/views/system/client/index.vue new file mode 100644 index 0000000..fc61aaa --- /dev/null +++ b/src/views/system/client/index.vue @@ -0,0 +1,164 @@ + + +