diff --git a/code/link56/link56-frontend-new/public/no-avatar.png b/code/link56/link56-frontend-new/public/no-avatar.png new file mode 100644 index 00000000..e16488e4 Binary files /dev/null and b/code/link56/link56-frontend-new/public/no-avatar.png differ diff --git a/code/link56/link56-frontend-new/src/App.vue b/code/link56/link56-frontend-new/src/App.vue index ed4f2926..eed7c89b 100644 --- a/code/link56/link56-frontend-new/src/App.vue +++ b/code/link56/link56-frontend-new/src/App.vue @@ -11,9 +11,9 @@ onMounted(() => { }) function handleInitData() { - getAreaListApi().then((res) => { - commonOptions.areaOptions.splice(0, commonOptions.areaOptions.length, ...res.data || []) - }) + // getAreaListApi().then((res) => { + // commonOptions.areaOptions.splice(0, commonOptions.areaOptions.length, ...res.data || []) + // }) getPropertyListApi().then((res) => { commonOptions.propertyOptions.splice(0, commonOptions.propertyOptions.length, ...res.data || []) diff --git a/code/link56/link56-frontend-new/src/components/SafeImage.vue b/code/link56/link56-frontend-new/src/components/SafeImage.vue new file mode 100644 index 00000000..e69de29b diff --git a/code/link56/link56-frontend-new/src/layout/components/header.vue b/code/link56/link56-frontend-new/src/layout/components/header.vue index f1e90658..c61710b1 100644 --- a/code/link56/link56-frontend-new/src/layout/components/header.vue +++ b/code/link56/link56-frontend-new/src/layout/components/header.vue @@ -1,15 +1,10 @@ @@ -43,22 +44,24 @@ function navigateTo(path: string) { - + - + - + - 远通G3 + {{ userStore.userInfo.name }} 个人中心 - 退出登录 + + 退出登录 + diff --git a/code/link56/link56-frontend-new/src/layout/index.vue b/code/link56/link56-frontend-new/src/layout/index.vue index 8078fc4b..d96ff54f 100644 --- a/code/link56/link56-frontend-new/src/layout/index.vue +++ b/code/link56/link56-frontend-new/src/layout/index.vue @@ -1,5 +1,6 @@ diff --git a/code/link56/link56-frontend-new/src/request/api/auth.ts b/code/link56/link56-frontend-new/src/request/api/auth.ts new file mode 100644 index 00000000..5cc421f6 --- /dev/null +++ b/code/link56/link56-frontend-new/src/request/api/auth.ts @@ -0,0 +1,12 @@ +import type { forgetApiParams, loginApiParams, loginApiResult, registerApiParams } from '@/types/auth' +import { httpPostJson } from '../utils' + +export function loginApi(params: loginApiParams) { + return httpPostJson(`/auth/login`, params) +} +export function registerApi(params: registerApiParams) { + return httpPostJson(`/auth/register`, params) +} +export function forgetApi(params: forgetApiParams) { + return httpPostJson(`/auth/forget`, params) +} diff --git a/code/link56/link56-frontend-new/src/request/index.ts b/code/link56/link56-frontend-new/src/request/index.ts index e42ff155..cb355226 100644 --- a/code/link56/link56-frontend-new/src/request/index.ts +++ b/code/link56/link56-frontend-new/src/request/index.ts @@ -1,6 +1,6 @@ import type { AxiosError, AxiosInstance, AxiosResponse, InternalAxiosRequestConfig } from 'axios' import axios from 'axios' -import { useRouter } from 'vue-router' +import { router } from '@/router/index' import { useUserStore } from '@/store/user' function buildBaseUrl() { @@ -42,7 +42,7 @@ const NoFreePaths = [ // 请求拦截器 axiosInstance.interceptors.request.use( (config: InternalAxiosRequestConfig) => { - const router = useRouter() + // const router = useRouter() const userStore = useUserStore() const path = config.url || '' @@ -62,7 +62,7 @@ axiosInstance.interceptors.request.use( return config }, (error: AxiosError) => { - console.log("===ReqError==="); + console.log('===ReqError===') return Promise.reject(error) }, ) @@ -80,18 +80,29 @@ axiosInstance.interceptors.response.use( } const resData = response.data as ResponseData - response.data.data = parseJsonOrReturnString(response.data.data) - if (resData.code === 200) { - return Promise.resolve(response.data) + if (resData.code === 401) { + router.push('/auth/login') + return Promise.reject(response.data) + } + else if (resData.code === 404) { + router.push('/error/404') + return Promise.reject(response.data) } else { - return Promise.reject(resData) + resData.isSuccess = resData.code === 200 + return Promise.resolve(response.data) } }, (error: AxiosError) => { - console.log("===ResError==="); - + if (error.status === 500) { + router.push('/error/500') + } + + if (error.status === 404) { + router.push('/error/404') + } + return Promise.reject(error) }, ) diff --git a/code/link56/link56-frontend-new/src/router/index.ts b/code/link56/link56-frontend-new/src/router/index.ts index 706202a1..4ad57b13 100644 --- a/code/link56/link56-frontend-new/src/router/index.ts +++ b/code/link56/link56-frontend-new/src/router/index.ts @@ -45,6 +45,8 @@ const router = createRouter({ scrollBehavior: () => ({ left: 0, top: 0 }), }) +export { router } + export function setupRouter(app: App) { app.use(router) } diff --git a/code/link56/link56-frontend-new/src/store/user.ts b/code/link56/link56-frontend-new/src/store/user.ts index 615bcbf3..1f231f13 100644 --- a/code/link56/link56-frontend-new/src/store/user.ts +++ b/code/link56/link56-frontend-new/src/store/user.ts @@ -2,7 +2,7 @@ import { defineStore } from 'pinia' import { computed, ref } from 'vue' interface IUserInfo { - id: number + id: string account?: string email?: string name?: string @@ -14,7 +14,7 @@ export const useUserStore = defineStore( 'user', () => { const userInfo = ref({ - id: 0, + id: '', }) const setUserInfo = (val: IUserInfo) => { @@ -29,7 +29,7 @@ export const useUserStore = defineStore( return !!( ( userInfo.value.token - && userInfo.value.id !== 0 + && userInfo.value.id && userInfo.value.account ) ) diff --git a/code/link56/link56-frontend-new/src/types/auth/index.ts b/code/link56/link56-frontend-new/src/types/auth/index.ts new file mode 100644 index 00000000..de721f70 --- /dev/null +++ b/code/link56/link56-frontend-new/src/types/auth/index.ts @@ -0,0 +1,24 @@ +export interface loginApiParams { + loginCredential: string + password: string +} + +export interface loginApiResult { + id: string + account: string + name: string + email: string + token: string + avatar: string +} + +export interface registerApiParams { + account: string + name: string + email: string + password: string +} + +export interface forgetApiParams { + forgetCredential: string +} diff --git a/code/link56/link56-frontend-new/src/types/auto-import.d.ts b/code/link56/link56-frontend-new/src/types/auto-import.d.ts index df229b08..2b5cf2d1 100644 --- a/code/link56/link56-frontend-new/src/types/auto-import.d.ts +++ b/code/link56/link56-frontend-new/src/types/auto-import.d.ts @@ -19,5 +19,6 @@ declare module 'vue' { QueryCompany: typeof import('./../components/QueryCompany.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] + SafeImage: typeof import('./../components/SafeImage.vue')['default'] } } diff --git a/code/link56/link56-frontend-new/src/types/global.d.ts b/code/link56/link56-frontend-new/src/types/global.d.ts index e5b15a79..10fae533 100644 --- a/code/link56/link56-frontend-new/src/types/global.d.ts +++ b/code/link56/link56-frontend-new/src/types/global.d.ts @@ -2,6 +2,7 @@ export {} declare global { interface ResponseData { + isSuccess: boolean code: number message: string data: T diff --git a/code/link56/link56-frontend-new/src/views/auth/forget.vue b/code/link56/link56-frontend-new/src/views/auth/forget.vue index 49c1916b..244be07c 100644 --- a/code/link56/link56-frontend-new/src/views/auth/forget.vue +++ b/code/link56/link56-frontend-new/src/views/auth/forget.vue @@ -9,6 +9,34 @@ function navigateTo(path: string) { router.push(path) } +const carouselList = [ + { + title: '值得信赖', + company: '恒星科技有限公司', + content: '我们已经连续三年使用该平台,数据处理稳定高效,团队协作体验非常顺畅。', + }, + { + title: '安全 · 高效', + company: '博越信息技术', + content: '平台的权限管理做得很好,操作简单清晰,极大提升了内部管理效率。', + }, + { + title: '稳定可靠', + company: '远航供应链集团', + content: '系统运行非常稳定,几乎没有出现过宕机情况,客服响应速度也很快。', + }, + { + title: '智能化体验', + company: '蓝海数据服务中心', + content: '智能报表和自动化功能非常实用,减少了大量人工整理数据的时间。', + }, + { + title: '灵活易用', + company: '中联创投有限公司', + content: 'UI设计简洁友好,新员工上手很快,各项业务流程也能灵活配置。', + }, +] + // do not use same name with ref const form = reactive({ name: '', @@ -35,10 +63,16 @@ function onSubmit() { height="150px" indicator-position="none" > - - - {{ item }} - + + + + {{ item.title }} + + + {{ item.content }} + + - {{ item.company }} + @@ -99,13 +133,30 @@ function onSubmit() { .bg-content { position: absolute; left: 50%; - bottom: 12%; + bottom: 10%; transform: translateX(-50%); text-align: center; color: #fff; width: 600px; + + .carousel-item { + display: flex; + flex-direction: column; + .title { + font-size: 28px; + line-height: 28px; + margin-bottom: 16px; + } + .content { + margin-bottom: 8px; + } + .company { + font-size: 14px; + } + } } } + .form-label-flex { display: flex; justify-content: space-between; @@ -122,7 +173,7 @@ function onSubmit() { flex: 1; display: flex; flex-direction: column; - padding: 48px 56px 24px 56px; + padding: 36px; .logo { height: 70px; diff --git a/code/link56/link56-frontend-new/src/views/auth/login.vue b/code/link56/link56-frontend-new/src/views/auth/login.vue index 13989355..94dd4155 100644 --- a/code/link56/link56-frontend-new/src/views/auth/login.vue +++ b/code/link56/link56-frontend-new/src/views/auth/login.vue @@ -1,35 +1,125 @@ + + + + + + {{ item.title }} + + + {{ item.content }} + + - {{ item.company }} + + + + @@ -43,29 +133,38 @@ function onSubmit() { 输入你的 邮箱/账号 和 密码 登录账户. - - + + - + + - + 密码 忘记密码? - + - - + - + + - + 登录 @@ -89,12 +188,39 @@ function onSubmit() { .auth-bg { width: 70%; height: 100%; + position: relative; img { width: 100%; height: 100%; object-fit: cover; } + + .bg-content { + position: absolute; + left: 50%; + bottom: 10%; + transform: translateX(-50%); + text-align: center; + color: #fff; + width: 600px; + + .carousel-item { + display: flex; + flex-direction: column; + .title { + font-size: 28px; + line-height: 28px; + margin-bottom: 16px; + } + .content { + margin-bottom: 8px; + } + .company { + font-size: 14px; + } + } + } } .form-label-flex { display: flex; @@ -112,7 +238,7 @@ function onSubmit() { flex: 1; display: flex; flex-direction: column; - padding: 48px 56px 24px 56px; + padding: 36px; .logo { height: 70px; diff --git a/code/link56/link56-frontend-new/src/views/auth/register.vue b/code/link56/link56-frontend-new/src/views/auth/register.vue index f0cccf39..365226bb 100644 --- a/code/link56/link56-frontend-new/src/views/auth/register.vue +++ b/code/link56/link56-frontend-new/src/views/auth/register.vue @@ -1,28 +1,128 @@ @@ -30,8 +130,25 @@ function onSubmit() { - + + + + + + {{ item.title }} + + {{ item.content }} + + - {{ item.company }} + + + + + @@ -43,25 +160,62 @@ function onSubmit() { 请填写必要的注册信息,完成账户创建。 - - + + - - + + + + + {{ sending ? `${countdown}s` : "发送验证码" }} + + + - + + - - + + + + + - + 注册 @@ -77,6 +231,21 @@ function onSubmit() { + + + + + 注册 + + + 邮箱 + + + + + 邮箱验证码 + + + 发送验证码 + + + + + 密码 + + + + + 确认密码 + + + + + 注册 + + + + + + +