diff --git a/components.d.ts b/components.d.ts index 01a36e5e..146a60a7 100644 --- a/components.d.ts +++ b/components.d.ts @@ -7,10 +7,24 @@ export {} declare module '@vue/runtime-core' { export interface GlobalComponents { + ABadge: typeof import('ant-design-vue/es')['Badge'] + AButton: typeof import('ant-design-vue/es')['Button'] ACard: typeof import('ant-design-vue/es')['Card'] + ACheckbox: typeof import('ant-design-vue/es')['Checkbox'] ACol: typeof import('ant-design-vue/es')['Col'] + ADatePicker: typeof import('ant-design-vue/es')['DatePicker'] + ADivider: typeof import('ant-design-vue/es')['Divider'] + AForm: typeof import('ant-design-vue/es')['Form'] + AFormItem: typeof import('ant-design-vue/es')['FormItem'] + AInput: typeof import('ant-design-vue/es')['Input'] + AInputNumber: typeof import('ant-design-vue/es')['InputNumber'] + AInputPassword: typeof import('ant-design-vue/es')['InputPassword'] + AModal: typeof import('ant-design-vue/es')['Modal'] ARow: typeof import('ant-design-vue/es')['Row'] + ASelect: typeof import('ant-design-vue/es')['Select'] + ASpin: typeof import('ant-design-vue/es')['Spin'] ATooltip: typeof import('ant-design-vue/es')['Tooltip'] + AUpload: typeof import('ant-design-vue/es')['Upload'] BadgeStatus: typeof import('./src/components/BadgeStatus/index.vue')['default'] CardBox: typeof import('./src/components/CardBox/index.vue')['default'] GeoComponent: typeof import('./src/components/GeoComponent/index.vue')['default'] diff --git a/package.json b/package.json index 55e0ef59..b21ab2cd 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "@vuemap/vue-amap": "^1.1.20", "ant-design-vue": "^3.2.15", "axios": "^1.2.1", + "js-cookie": "^3.0.1", "less": "^4.1.3", "less-loader": "^11.1.0", "lodash-es": "^4.17.21", diff --git a/public/images/logo.png b/public/images/logo.png new file mode 100644 index 00000000..66295185 Binary files /dev/null and b/public/images/logo.png differ diff --git a/src/api/login.js b/src/api/login.js new file mode 100644 index 00000000..edf859f8 --- /dev/null +++ b/src/api/login.js @@ -0,0 +1,15 @@ +import server from '@/utils/request' + +export const config = () => server.get(`/authorize/captcha/config`) + +export const code = () => server.get(`/authorize/captcha/image?width=130&height=30`) + +export const authLogin = (data) => server.post(`/authorize/login`, data) + +export const getInitSet = () => server.get(`/user/settings/init`) + +export const postInitSet = (data) => server.post(`/user/settings/init`, data) + +export const systemVersion = () => server.get(`/system/version`) + +export const bindInfo = () => server.get(`/application/sso/_all`) \ No newline at end of file diff --git a/src/router/menu.ts b/src/router/menu.ts index 6110e81b..8aea26a2 100644 --- a/src/router/menu.ts +++ b/src/router/menu.ts @@ -20,6 +20,10 @@ export default [ // } // start: 测试用, 可删除 + { + path: '/login', + component: () => import('@/views/user/Login/index.vue') + }, { path: '/demo', component: () => import('@/views/demo/index.vue') diff --git a/src/store/userInfo.ts b/src/store/userInfo.ts new file mode 100644 index 00000000..4cf56cc6 --- /dev/null +++ b/src/store/userInfo.ts @@ -0,0 +1,42 @@ +import { defineStore } from 'pinia'; +import { authLogin } from '@/api/login'; +import { LocalStore } from '@/utils/comm'; +import { TOKEN_KEY } from '@/utils/variable'; + +/** + * 用户信息 + * @methods setUserInfos 设置用户信息 + */ +export const useUserInfo = defineStore('userInfo', { + state: () => ({ + userInfos: { + id: '', + username: '', + isAdmin: true, + currentAuthority: [], + expires: 0, + permissions: [], + roles: [], + token: '', + user: {}, + }, + }), + actions: { + login(userInfo: any) { + const username = userInfo.userName.trim(); + const password = userInfo.password; + const verifyCode = userInfo.verifyCode; + return new Promise((resolve: any, reject: any) => { + authLogin({ username, password, verifyCode }) + .then((res: any) => { + Object.assign(this.userInfos, res.result); + LocalStore.set(TOKEN_KEY, res?.result.token); + resolve(res); + }) + .catch((error: any) => { + reject(error); + }); + }); + }, + }, +}); diff --git a/src/utils/variable.ts b/src/utils/variable.ts index 7fc92ea9..591acb68 100644 --- a/src/utils/variable.ts +++ b/src/utils/variable.ts @@ -1,3 +1,5 @@ export const BASE_API_PATH = import.meta.env.VITE_APP_BASE_API -export const TOKEN_KEY = 'X-Access-Token' \ No newline at end of file +export const TOKEN_KEY = 'X-Access-Token' + +export const Version_Code = 'version_code' \ No newline at end of file diff --git a/src/views/user/Login/index.vue b/src/views/user/Login/index.vue new file mode 100644 index 00000000..9e7f4273 --- /dev/null +++ b/src/views/user/Login/index.vue @@ -0,0 +1,479 @@ + + + + +