修改页面

This commit is contained in:
浅念
2025-07-14 17:59:02 +08:00
parent 812e3c4b0c
commit 22ae0e86c8
18 changed files with 543 additions and 531 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
<!doctype html>
<html>
<head>
<title>Vite + Vue3 + TS</title>
<title>系统管理</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<link rel="shortcut icon" type="image/x-icon" href="src/assets/img/favicon.ico" />
+11 -1
View File
@@ -15,7 +15,16 @@
const userStore = useUserStore()
const { language } = storeToRefs(userStore)
function setCompanyFromUrl() {
const userStore = useUserStore()
const params = new URLSearchParams(window.location.search)
const companyid = params.get('corp_id')
const companyabbr = params.get('corp_abbr')
if (companyid) {
userStore.setCompany(companyid, companyabbr || '')
// 你也可以加 localStorage/sessionStorage 备份
}
}
const locales = {
zh: zh,
en: en
@@ -23,6 +32,7 @@
onBeforeMount(() => {
setThemeTransitionClass(true)
setCompanyFromUrl()
useUserStore().restoreTokenTimer()
})
-3
View File
@@ -11,15 +11,12 @@ export const menuService = {
async getMenuList(delay = 300): Promise<MenuResponse> {
try {
const userStore = useUserStore()
// 验证用户登录状态
if (!userStore.isLogin) {
throw new Error('用户未登录')
}
// 模拟接口返回的菜单数据
const menuData = userStore.info.menu
// 验证菜单数据
if (!menuData || !Array.isArray(menuData) || menuData.length === 0) {
ElMessage.error('暂无系统菜单权限')
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

@@ -100,7 +100,7 @@
</el-dropdown>
</div>
<!-- 设置 -->
<div class="btn-box" @click="openSetting">
<!-- <div class="btn-box" @click="openSetting">
<el-popover :visible="showSettingGuide" placement="bottom-start" :width="190" :offset="0">
<template #reference>
<div class="btn setting-btn">
@@ -116,7 +116,7 @@
</p>
</template>
</el-popover>
</div>
</div> -->
<!-- 切换主题 -->
<div class="btn-box" @click="themeAnimation">
<div class="btn theme-btn">
@@ -145,8 +145,14 @@
<div class="user-head">
<img class="cover" src="@imgs/user/avatar.webp" style="float: left" />
<div class="user-wrap">
<span class="name">{{ userInfo.userName }}</span>
<span class="email">art.design@gmail.com</span>
<span class="name">{{ userInfo.user.id }}</span>
<span class="roles">
<template v-for="(role, idx) in userInfo.user.roles" :key="role">
<span>{{ role }}</span><span v-if="idx < userInfo.user.roles.length - 1">, </span>
</template>
</span>
<span class="phone">{{ userInfo.user.phone }}</span>
<span class="email">{{ userInfo.user.email }}</span>
</div>
</div>
<ul class="user-menu">
@@ -1,17 +1,16 @@
<template>
<div class="login-left-view">
<div class="logo">
<!-- <div class="logo">
<ArtLogo class="icon" />
<!-- <h1 class="title">{{ AppConfig.systemInfo.name }}</h1> -->
<h1 class="title">新友合系统管理平台</h1>
<h1 class="title">{{ AppConfig.systemInfo.name }}</h1>
</div>
<img class="left-bg" src="@imgs/login/lf_bg.png" />
<img class="left-img" src="@imgs/login/lf_icon2.webp" />
<img class="left-img" src="@imgs/login/lf_icon2.webp" /> -->
<div class="text-wrap">
<!-- <div class="text-wrap"> -->
<!-- <h1> {{ $t('login.leftView.title') }} </h1> -->
<!-- <p> {{ $t('login.leftView.subTitle') }} </p> -->
</div>
<!-- </div> -->
</div>
</template>
@@ -27,7 +26,7 @@
height: 100%;
padding: 20px;
overflow: hidden;
background: #f3f4fb;
// background: #f3f4fb;
background-size: cover;
.logo {
+1 -1
View File
@@ -9,7 +9,7 @@ import { configImages } from './assets/images'
const appConfig: SystemConfig = {
// 系统信息
systemInfo: {
name: 'XYH系统管理' // 系统名称
name: '总台系统服务' // 系统名称
},
// Element Plus 主题
elementPlusTheme: {
+2 -1
View File
@@ -133,7 +133,8 @@
"placeholder": [
"Please enter your account",
"Please enter your password",
"Please slide to verify"
"Please slide to verify",
"Please select a company"
],
"sliderText": "Please slide to verify",
"sliderSuccessText": "Verification successful",
+1 -1
View File
@@ -130,7 +130,7 @@
"admin": "管理员",
"user": "普通用户"
},
"placeholder": ["请输入账号", "请输入密码", "请拖动滑块完成验证"],
"placeholder": ["请输入账号", "请输入密码", "请拖动滑块完成验证","请选择公司"],
"sliderText": "按住滑块拖动",
"sliderSuccessText": "验证成功",
"rememberPwd": "记住密码",
+4 -1
View File
@@ -99,7 +99,10 @@ async function handleLoginStatus(
): Promise<boolean> {
if (!userStore.isLogin && to.path !== RoutesAlias.Login && !to.meta.noLogin) {
userStore.logOut()
next(RoutesAlias.Login)
next({
path: RoutesAlias.Login,
query: to.query // 保留原始参数
})
return false
}
return true
+7 -1
View File
@@ -87,7 +87,7 @@ export const useUserStore = defineStore(
function scheduleTokenRefresh(expiresIn: number) {
if (refreshTimeout) clearTimeout(refreshTimeout)
// 提前1分钟刷新
const refreshTime = (expiresIn - 60) * 1000
const refreshTime = (expiresIn - 100) * 1000
if (refreshTime > 0) {
refreshTimeout = setTimeout(refreshTokenAction, refreshTime)
}
@@ -103,6 +103,12 @@ export const useUserStore = defineStore(
}
const logOut = () => {
// 清空所有本地缓存
localStorage.clear();
sessionStorage.clear();
companyabbr.value = ''
companyid.value = ''
info.value = {}
isLogin.value = false
isLock.value = false
+1 -1
View File
@@ -87,7 +87,7 @@ axiosInstance.interceptors.response.use(
logOut()
throw new HttpError(msg || $t('httpMsg.unauthorized'), ApiStatus.unauthorized)
default:
throw new HttpError(msg || $t('httpMsg.requestFailed'), code)
return Promise.reject(handleError(error))
}
// return Promise.reject(handleError(error))
}
+7 -3
View File
@@ -1,6 +1,8 @@
@use '@styles/variables.scss' as *;
.login {
background: url('@imgs/login/bgx.png');
background-size: 100% 100%;
box-sizing: border-box;
display: flex;
width: 100%;
@@ -66,9 +68,11 @@
.form {
box-sizing: border-box;
height: 100%;
padding: 40px 0;
// height: 100%;
widows: 100%;
padding: 40px 30px;
background: white;
border-radius: 18px;
.title {
margin-left: -2px;
@@ -103,7 +107,7 @@
.drag-verify {
position: relative;
padding-bottom: 20px;
// padding-bottom: 20px;
margin-top: 25px;
.drag-verify-content {
+104 -137
View File
@@ -27,24 +27,6 @@
</ElDropdownMenu>
</template>
</ElDropdown>
<ElDropdown @command="changeCompany" popper-class="langDropDownStyle">
<div class="btn language-btn">
<i class="iconfont-sys icon-language">&#xe8af;</i>公司
</div>
<template #dropdown>
<ElDropdownMenu>
<div v-for="cany in companyList" :key="cany.id" class="lang-btn-item">
<ElDropdownItem
:command="cany.id"
:class="{ 'is-selected': companyid === cany.value }"
>
<span class="menu-txt">{{ cany.name }}</span>
<i v-if="companyid === cany.id" class="iconfont-sys icon-check">&#xe621;</i>
</ElDropdownItem>
</div>
</ElDropdownMenu>
</template>
</ElDropdown>
</div>
<div class="header">
<ArtLogo class="icon" />
@@ -58,9 +40,6 @@
<span :class="{active: activeLoginType === 'qrcode'}" @click="activeLoginType = 'qrcode'">飞书登录</span>
</div>
<div v-if="activeLoginType === 'password'">
<!-- 原有账号密码登录表单内容 -->
<!-- <h3 class="title">{{ $t('login.title') }}</h3> -->
<!-- <p class="sub-title">{{ $t('login.subTitle') }}</p> -->
<ElForm
ref="formRef"
:model="formData"
@@ -68,22 +47,10 @@
@keyup.enter="handleSubmit"
style="margin-top: 25px"
>
<!-- <ElFormItem prop="account">
<ElSelect v-model="formData.account" @change="setupAccount" class="account-select">
<ElOption
v-for="account in accounts"
:key="account.key"
:label="account.label"
:value="account.key"
>
<span>{{ account.label }}</span>
</ElOption>
</ElSelect>
</ElFormItem> -->
<ElFormItem prop="username">
<ElFormItem prop="username" label="账号" >
<ElInput :placeholder="$t('login.placeholder[0]')" v-model.trim="formData.username" />
</ElFormItem>
<ElFormItem prop="password">
<ElFormItem prop="password" label="密码">
<ElInput
:placeholder="$t('login.placeholder[1]')"
v-model.trim="formData.password"
@@ -93,12 +60,24 @@
show-password
/>
</ElFormItem>
<ElFormItem prop="company" label="公司">
<ElSelect v-model="formData.company" class="account-select" @change="changeCompany">
<ElOption
v-for="account in companyList"
:key="account.id"
:label="account.name"
:value="account.id"
>
<span>{{ account.name }}</span>
</ElOption>
</ElSelect>
</ElFormItem>
<div class="drag-verify">
<div class="drag-verify-content" :class="{ error: !isPassing && isClickPass }">
<ArtDragVerify
ref="dragVerify"
v-model:value="isPassing"
:width="width < 500 ? 328 : 438"
:width="width < 500 ? 260: 380"
:text="$t('login.sliderText')"
textColor="var(--art-gray-800)"
:successText="$t('login.sliderSuccessText')"
@@ -111,14 +90,13 @@
$t('login.placeholder[2]')
}}</p>
</div>
<div class="forget-password">
<ElCheckbox v-model="formData.rememberPassword">{{
$t('login.rememberPwd')
}}</ElCheckbox>
<!-- <RouterLink :to="RoutesAlias.ForgetPassword">{{ $t('login.forgetPwd') }}</RouterLink> -->
<div class="login-bottom-row">
<p>
{{ $t('login.noAccount') }}
<RouterLink :to="RoutesAlias.Register" style="color:#5D87FF;">{{ $t('login.register') }}</RouterLink>
</p>
<ElCheckbox v-model="formData.rememberPassword">{{ $t('login.rememberPwd') }}</ElCheckbox>
</div>
<div style="margin-top: 30px">
<ElButton
class="login-btn"
@@ -130,36 +108,31 @@
{{ $t('login.btnText') }}
</ElButton>
</div>
<div class="footer">
<p>
{{ $t('login.noAccount') }}
<RouterLink :to="RoutesAlias.Register">{{ $t('login.register') }}</RouterLink>
</p>
</div>
</ElForm>
</div>
<div v-else>
<div class="qrcode-login" v-if="!iscompany">请先选择公司</div>
<div v-else>
<div class="qrcode-login" v-if="isInFeishu" >
<img class="left-bg" src="@imgs/login/feishu.png" />
<ElButton
class="login-btn"
type="primary"
@click="feishuSubmit"
v-ripple
<ElForm
:model="formData"
style="margin-top: 25px"
>
{{ $t('login.btnText') }}
</ElButton>
</div>
<div class="qrcode-login" v-else>
<ElFormItem prop="company" label="公司">
<ElSelect v-model="formData.company" class="account-select" @change="changeCompany">
<ElOption
v-for="account in companyList"
:key="account.id"
:label="account.name"
:value="account.id"
>
<span>{{ account.name }}</span>
</ElOption>
</ElSelect>
</ElFormItem>
</ElForm>
<div class="qrcode-login" v-if="!isInFeishu">
<div id="login_container"></div>
<p class="qrcode-tip">请使用飞书App扫码登录</p>
</div>
</div>
</div>
</div>
</div>
</div>
@@ -178,6 +151,7 @@
import { useI18n } from 'vue-i18n'
import { HttpError } from '@/utils/http/error'
import { onMounted, ref, watch, nextTick } from 'vue'
import { useRoute } from 'vue-router'
defineOptions({ name: 'Login' })
@@ -185,40 +159,6 @@
import { useSettingStore } from '@/store/modules/setting'
import type { FormInstance, FormRules } from 'element-plus'
type AccountKey = 'super' | 'admin' | 'user'
export interface Account {
key: AccountKey
label: string
userName: string
password: string
roles: string[]
}
const accounts = computed<Account[]>(() => [
{
key: 'super',
label: t('login.roles.super'),
userName: 'Super',
password: '123456',
roles: ['R_SUPER']
},
{
key: 'admin',
label: t('login.roles.admin'),
userName: 'Admin',
password: '123456',
roles: ['R_ADMIN']
},
{
key: 'user',
label: t('login.roles.user'),
userName: 'User',
password: '123456',
roles: ['R_USER']
}
])
const settingStore = useSettingStore()
const { isDark, systemThemeType } = storeToRefs(settingStore)
@@ -234,10 +174,15 @@
const systemName = AppConfig.systemInfo.name
const formRef = ref<FormInstance>()
const companyid = ref('')
companyid.value = useUserStore().companyid
const iscompany = ref(false)
const { companyabbr } = useUserStore()
//获取公司 getCompanyList
const companyList = ref<any>()
const feishuresponse=ref()
const formData = reactive({
account: '',
company: Number(useUserStore().companyid),
username: '',
password: '',
rememberPassword: true
@@ -245,15 +190,57 @@
const rules = computed<FormRules>(() => ({
username: [{ required: true, message: t('login.placeholder[0]'), trigger: 'blur' }],
password: [{ required: true, message: t('login.placeholder[1]'), trigger: 'blur' }]
password: [{ required: true, message: t('login.placeholder[1]'), trigger: 'blur' }],
company: [{ required: true, message: t('login.placeholder[3]'), trigger: 'blur' }]
}))
const loading = ref(false)
const { width } = useWindowSize()
const getcompanyList = async () => {
try {
// 这里调用获取品牌列表的接口
const response = await UserService.getCompanyList()
companyList.value = response || []
} catch (error) { }
}
// 切换语言
const { locale } = useI18n()
const changeLanguage = (lang: LanguageEnum) => {
if (locale.value === lang) return
locale.value = lang
userStore.setLanguage(lang)
}
const getfeishuAppList = async () => {
try {
// 这里调用获取品牌列表的接口
feishuresponse.value = await UserService.getfeishuAppList({ corp_id: companyid.value })
if(activeLoginType.value=='qrcode'){
feishulogin()
}
console.log(feishuresponse)
} catch (error) { }
}
//切换公司
const changeCompany = (company: any) => {
// if (companyid.value === company) return
const companyt = companyList.value.find((c: any) => c.id === company)
companyid.value = company
iscompany.value = company
userStore.setCompany(company,companyt?.abbr)
getfeishuAppList()
}
if(companyabbr!=''){
iscompany.value = true
getfeishuAppList()
}
const feishulogin = async () => {
userStore.setLoginType('feishu')
if (isInFeishu) {
feishuSubmit()
// 飞书特定的逻辑
} else {
// 普通浏览器的逻辑
@@ -392,46 +379,19 @@
})
}, 150)
}
const route = useRoute()
onMounted(() => {
getcompanyList()
// 自动读取 query 参数并存入 userStore
const companyid = Array.isArray(route.query.corp_id) ? route.query.corp_id[0] : route.query.corp_id
const companyabbr = Array.isArray(route.query.corp_abbr) ? route.query.corp_abbr[0] : route.query.corp_abbr
if (companyid) {
userStore.setCompany(companyid as string, (companyabbr as string) || '')
formData.company = Number(companyid)
}
})
// 切换语言
const { locale } = useI18n()
const changeLanguage = (lang: LanguageEnum) => {
if (locale.value === lang) return
locale.value = lang
userStore.setLanguage(lang)
}
//获取公司 getCompanyList
const companyList = ref<any>()
const getcompanyList = async () => {
try {
// 这里调用获取品牌列表的接口
const response = await UserService.getCompanyList()
companyList.value = response || []
} catch (error) { }
}
//切换公司
const changeCompany = (company: any) => {
if (companyid.value === company) return
const companyt = companyList.value.find((c: any) => c.id === company)
companyid.value = company
iscompany.value = company
userStore.setCompany(company,companyt?.abbr)
getfeishuAppList()
}
const getfeishuAppList = async () => {
try {
// 这里调用获取品牌列表的接口
feishuresponse.value = await UserService.getfeishuAppList({ corp_id: companyid.value })
if(activeLoginType.value=='qrcode'){
feishulogin()
}
console.log(feishuresponse)
} catch (error) { }
}
// 切换主题
import { useTheme } from '@/composables/useTheme'
@@ -468,4 +428,11 @@
color: #888;
}
}
.login-bottom-row {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 14px;
// margin-top: 16px;
}
</style>
+7 -4
View File
@@ -1,8 +1,11 @@
<template>
<div class="console">
<CardList></CardList>
<div>
功能开发中...
</div>
<!-- <CardList></CardList> -->
<el-row :gutter="20">
<!-- <el-row :gutter="20">
<el-col :sm="24" :md="12" :lg="10">
<ActiveUser />
</el-col>
@@ -21,9 +24,9 @@
<el-col :sm="24" :md="12" :lg="6">
<TodoList />
</el-col>
</el-row>
</el-row> -->
<AboutProject />
<!-- <AboutProject /> -->
</div>
</template>
+6 -1
View File
@@ -1,5 +1,7 @@
<template>
<div class="page-content">
<div v-if="!isMobile">
<ElRow>
<!-- <ElCol :xs="24" :sm="12" :lg="6">
<ElInput placeholder="工单编号"></ElInput>
@@ -160,7 +162,10 @@
<ElDialog v-model="videoDialogVisible" width="60%" top="10vh" :show-close="true" append-to-body>
<video v-if="currentVideoUrl" :src="currentVideoUrl" controls autoplay style="width:100%;max-height:70vh;display:block;"></video>
</ElDialog>
</div>
<div v-else class="mobile-hide-tip">
<p>该页面暂不支持移动端访问</p>
</div>
</div>
</template>
+5 -1
View File
@@ -1,5 +1,6 @@
<template>
<div class="page-content">
<div v-if="!isMobile">
<ElRow>
<!-- <ElCol :xs="24" :sm="12" :lg="6">
<ElInput placeholder="工单编号"></ElInput>
@@ -160,7 +161,10 @@
<ElDialog v-model="videoDialogVisible" width="60%" top="10vh" :show-close="true" append-to-body>
<video v-if="currentVideoUrl" :src="currentVideoUrl" controls autoplay style="width:100%;max-height:70vh;display:block;"></video>
</ElDialog>
</div>
<div v-else class="mobile-hide-tip">
<p>该页面暂不支持移动端访问</p>
</div>
</div>
</template>
+7
View File
@@ -1,5 +1,6 @@
<template>
<div class="page-content">
<div v-if="!isMobile">
<ElRow>
<!-- <ElCol :xs="24" :sm="12" :lg="6">
<ElInput placeholder="名称"></ElInput>
@@ -61,6 +62,10 @@
</template>
</ElDialog>
</div>
<div v-else class="mobile-hide-tip">
<p>该页面暂不支持移动端访问</p>
</div>
</div>
</template>
<script setup lang="ts">
@@ -73,6 +78,8 @@
const dialogVisible = ref(false)
const typeList = ref<any[]>([])
const formRef = ref<FormInstance>()
const { width } = useWindowSize()
const isMobile = computed(() => width.value < 500)
const rules = reactive<FormRules>({
name: [
{ required: true, message: '请输入分类名称', trigger: 'blur' }