Skip to content

feat: 登录页 #151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# 标题
VITE_APP_TITLE=芋道管理系统
VITE_APP_TITLE=云匣

# 项目本地运行端口号
VITE_PORT=80
Expand All @@ -8,13 +8,13 @@ VITE_PORT=80
VITE_OPEN=true

# 租户开关
VITE_APP_TENANT_ENABLE=true
VITE_APP_TENANT_ENABLE=false

# 验证码的开关
VITE_APP_CAPTCHA_ENABLE=true
VITE_APP_CAPTCHA_ENABLE=false

# 文档地址的开关
VITE_APP_DOCALERT_ENABLE=true
VITE_APP_DOCALERT_ENABLE=false

# 百度统计
VITE_APP_BAIDU_CODE = a1ff8825baa73c3a78eb96aa40325abc
Expand Down
Binary file modified public/favicon.ico
Binary file not shown.
Binary file modified public/logo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/imgs/home/monkey.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/imgs/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/assets/svgs/login-box-bg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 0 additions & 23 deletions src/layout/components/Message/src/Message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,29 +57,6 @@ onMounted(() => {
<Icon :size="18" class="cursor-pointer" icon="ep:bell" @click="getList" />
</ElBadge>
</template>
<ElTabs v-model="activeName">
<ElTabPane label="我的站内信" name="notice">
<el-scrollbar class="message-list">
<template v-for="item in list" :key="item.id">
<div class="message-item">
<img alt="" class="message-icon" src="@/assets/imgs/avatar.gif" />
<div class="message-content">
<span class="message-title">
{{ item.templateNickname }}:{{ item.templateContent }}
</span>
<span class="message-date">
{{ formatDate(item.createTime) }}
</span>
</div>
</div>
</template>
</el-scrollbar>
</ElTabPane>
</ElTabs>
<!-- 更多 -->
<div style="margin-top: 10px; text-align: right">
<XButton preIcon="ep:view" title="查看全部" type="primary" @click="goMyList" />
</div>
</ElPopover>
</div>
</template>
Expand Down
16 changes: 0 additions & 16 deletions src/layout/components/ToolHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,6 @@ export default defineComponent({
) : undefined}
<div class="h-full flex items-center">
{hasTenantVisitPermission.value ? <TenantVisit /> : undefined}
{screenfull.value ? (
<Screenfull class="custom-hover" color="var(--top-header-text-color)"></Screenfull>
) : undefined}
{search.value ? <RouterSearch isModal={false} /> : undefined}
{size.value ? (
<SizeDropdown class="custom-hover" color="var(--top-header-text-color)"></SizeDropdown>
) : undefined}
{locale.value ? (
<LocaleDropdown
class="custom-hover"
color="var(--top-header-text-color)"
></LocaleDropdown>
) : undefined}
{message.value ? (
<Message class="custom-hover" color="var(--top-header-text-color)"></Message>
) : undefined}
<UserInfo></UserInfo>
</div>
</div>
Expand Down
9 changes: 0 additions & 9 deletions src/layout/components/UserInfo/src/UserInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ const toDocument = () => {
<template>
<ElDropdown class="custom-hover" :class="prefixCls" trigger="click">
<div class="flex items-center">
<ElAvatar :src="avatar" alt="" class="w-[calc(var(--logo-height)-25px)] rounded-[50%]" />
<span class="pl-[5px] text-14px text-[var(--top-header-text-color)] <lg:hidden">
{{ userName }}
</span>
Expand All @@ -68,14 +67,6 @@ const toDocument = () => {
<Icon icon="ep:tools" />
<div @click="toProfile">{{ t('common.profile') }}</div>
</ElDropdownItem>
<ElDropdownItem>
<Icon icon="ep:menu" />
<div @click="toDocument">{{ t('common.document') }}</div>
</ElDropdownItem>
<ElDropdownItem divided>
<Icon icon="ep:lock" />
<div @click="lockScreen">{{ t('lock.lockScreen') }}</div>
</ElDropdownItem>
<ElDropdownItem divided @click="loginOut">
<Icon icon="ep:switch-button" />
<div>{{ t('common.loginOut') }}</div>
Expand Down
10 changes: 5 additions & 5 deletions src/locales/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ export default {
small: '小'
},
login: {
welcome: '欢迎使用本系统',
message: '开箱即用的中后台管理系统',
welcome: '欢迎使用云匣',
message: '云端一匣,万用皆藏。',
tenantname: '租户名称',
username: '用户名',
password: '密码',
code: '验证码',
login: '登录',
login: '登 录',
relogin: '重新登录',
otherLogin: '其他登录方式',
register: '注册',
Expand Down Expand Up @@ -201,7 +201,7 @@ export default {
happyDay: '祝你开心每一天!',
toady: '今日晴',
notice: '通知公告',
project: '项目数',
project: '工具列表',
access: '项目访问',
toDo: '待办',
introduction: '一个正经的简介',
Expand Down Expand Up @@ -366,7 +366,7 @@ export default {
},
login: {
backSignIn: '返回',
signInFormTitle: '登录',
signInFormTitle: '登 录',
ssoFormTitle: '三方授权',
mobileSignInFormTitle: '手机登录',
qrSignInFormTitle: '二维码登录',
Expand Down
2 changes: 1 addition & 1 deletion src/router/modules/remaining.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
children: [
{
path: 'index',
component: () => import('@/views/Home/Index.vue'),
component: () => import('@/views/Home/Index3.vue'),
name: 'Index',
meta: {
title: t('router.home'),
Expand Down
92 changes: 92 additions & 0 deletions src/views/Home/Index3.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<template>
<el-row class="mt-8px" :gutter="8" justify="center">
<el-col
:xl="16"
:lg="20"
:md="22"
:sm="24"
:xs="24"
class="mb-8px"
style="margin: 0 auto;"
>
<el-card shadow="never">
<el-skeleton :loading="loading" animated>
<el-row :gutter="16">
<el-col
v-for="(item, index) in projects"
:key="`card-${index}`"
:xl="8"
:lg="8"
:md="12"
:sm="24"
:xs="24"
>
<el-card
shadow="hover"
class="mt-5px cursor-pointer"
style="margin-right: 5px;margin-bottom: 5px"
@click="handleProjectClick(item.message)"
>
<div class="flex items-center">
<img :src="item.img" alt="icon" class="w-25px h-25px mr-8px" />
<span class="text-16px">{{ item.name }}</span>
</div>
<div class="mt-12px text-12px text-gray-400">{{ t(item.message) }}</div>
<div class="mt-12px flex justify-between text-12px text-gray-400">
<span>{{ item.personal }}</span>
<span>{{ formatTime(item.time, 'yyyy-MM-dd') }}</span>
</div>
</el-card>
</el-col>
</el-row>
</el-skeleton>
</el-card>
</el-col>
</el-row>

</template>
<script lang="ts" setup>
import { formatTime } from '@/utils'

import { useUserStore } from '@/store/modules/user'
import type { Project } from './types'
import { useRouter } from 'vue-router'

defineOptions({ name: 'Home' })

const { t } = useI18n()
const router = useRouter()
const userStore = useUserStore()
const loading = ref(true)
const avatar = userStore.getUser.avatar
const username = userStore.getUser.nickname

// 获取项目数
let projects = reactive<Project[]>([])
const getProject = async () => {
const data = [
{
name: '花果山',
img: 'https://spc.yuqm.asia/assets/monkey.png',
message: 'spc.yuqm.asia',
personal: '猴子的乐园',
}
]
projects = Object.assign(projects, data)
}

const getAllApi = async () => {
await Promise.all([
getProject(),
])
loading.value = false
}

const handleProjectClick = (message: string) => {
window.open(`https://${message}`, '_blank')
}

getAllApi()
</script>


2 changes: 1 addition & 1 deletion src/views/Login/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,4 @@ $prefix-cls: #{$namespace}-login;
background-color: var(--login-bg-color);
}
}
</style>
</style>
112 changes: 1 addition & 111 deletions src/views/Login/components/LoginForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,6 @@
{{ t('login.remember') }}
</el-checkbox>
</el-col>
<el-col :offset="6" :span="12">
<el-link
style="float: right"
type="primary"
@click="setLoginState(LoginStateEnum.RESET_PASSWORD)"
>
{{ t('login.forgetPassword') }}
</el-link>
</el-col>
</el-row>
</el-form-item>
</el-col>
Expand All @@ -89,64 +80,6 @@
mode="pop"
@success="handleLogin"
/>
<el-col :span="24" style="padding-right: 10px; padding-left: 10px">
<el-form-item>
<el-row :gutter="5" justify="space-between" style="width: 100%">
<el-col :span="8">
<XButton
:title="t('login.btnMobile')"
class="w-[100%]"
@click="setLoginState(LoginStateEnum.MOBILE)"
/>
</el-col>
<el-col :span="8">
<XButton
:title="t('login.btnQRCode')"
class="w-[100%]"
@click="setLoginState(LoginStateEnum.QR_CODE)"
/>
</el-col>
<el-col :span="8">
<XButton
:title="t('login.btnRegister')"
class="w-[100%]"
@click="setLoginState(LoginStateEnum.REGISTER)"
/>
</el-col>
</el-row>
</el-form-item>
</el-col>
<el-divider content-position="center">{{ t('login.otherLogin') }}</el-divider>
<el-col :span="24" style="padding-right: 10px; padding-left: 10px">
<el-form-item>
<div class="w-[100%] flex justify-between">
<Icon
v-for="(item, key) in socialList"
:key="key"
:icon="item.icon"
:size="30"
class="anticon cursor-pointer"
color="#999"
@click="doSocialLogin(item.type)"
/>
</div>
</el-form-item>
</el-col>
<el-divider content-position="center">萌新必读</el-divider>
<el-col :span="24" style="padding-right: 10px; padding-left: 10px">
<el-form-item>
<div class="w-[100%] flex justify-between">
<el-link href="https://doc.iocoder.cn/" target="_blank">📚开发指南</el-link>
<el-link href="https://doc.iocoder.cn/video/" target="_blank">🔥视频教程</el-link>
<el-link href="https://www.iocoder.cn/Interview/good-collection/" target="_blank">
⚡面试手册
</el-link>
<el-link href="http://static.yudao.iocoder.cn/mp/Aix9975.jpeg" target="_blank">
🤝外包咨询
</el-link>
</div>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
Expand All @@ -165,13 +98,12 @@ import { LoginStateEnum, useFormValid, useLoginState } from './useLogin'
defineOptions({ name: 'LoginForm' })

const { t } = useI18n()
const message = useMessage()
const iconHouse = useIcon({ icon: 'ep:house' })
const iconAvatar = useIcon({ icon: 'ep:avatar' })
const iconLock = useIcon({ icon: 'ep:lock' })
const formLogin = ref()
const { validForm } = useFormValid(formLogin)
const { setLoginState, getLoginState } = useLoginState()
const { getLoginState } = useLoginState()
const { currentRoute, push } = useRouter()
const permissionStore = usePermissionStore()
const redirect = ref<string>('')
Expand Down Expand Up @@ -199,13 +131,6 @@ const loginData = reactive({
}
})

const socialList = [
{ icon: 'ant-design:wechat-filled', type: 30 },
{ icon: 'ant-design:dingtalk-circle-filled', type: 20 },
{ icon: 'ant-design:github-filled', type: 0 },
{ icon: 'ant-design:alipay-circle-filled', type: 0 }
]

// 获取验证码
const getCode = async () => {
// 情况一,未开启:则直接登录
Expand Down Expand Up @@ -288,41 +213,6 @@ const handleLogin = async (params: any) => {
}
}

// 社交登录
const doSocialLogin = async (type: number) => {
if (type === 0) {
message.error('此方式未配置')
} else {
loginLoading.value = true
if (loginData.tenantEnable === 'true') {
// 尝试先通过 tenantName 获取租户
await getTenantId()
// 如果获取不到,则需要弹出提示,进行处理
if (!authUtil.getTenantId()) {
try {
const data = await message.prompt('请输入租户名称', t('common.reminder'))
if (data?.action !== 'confirm') throw 'cancel'
const res = await LoginApi.getTenantIdByName(data.value)
authUtil.setTenantId(res)
} catch (error) {
if (error === 'cancel') return
} finally {
loginLoading.value = false
}
}
}
// 计算 redirectUri
// 注意: type、redirect 需要先 encode 一次,否则钉钉回调会丢失。
// 配合 social-login.vue#getUrlValue() 使用
const redirectUri =
location.origin +
'/social-login?' +
encodeURIComponent(`type=${type}&redirect=${redirect.value || '/'}`)

// 进行跳转
window.location.href = await LoginApi.socialAuthRedirect(type, encodeURIComponent(redirectUri))
}
}
watch(
() => currentRoute.value,
(route: RouteLocationNormalizedLoaded) => {
Expand Down
Loading