环境修改和主页图片加入

This commit is contained in:
XinWei 2024-08-22 11:54:42 +08:00
parent d498a2062a
commit e8dd6758a3
5 changed files with 326 additions and 322 deletions

View File

@ -24,7 +24,7 @@ VITE_DROP_CONSOLE=false
VITE_SOURCEMAP=false VITE_SOURCEMAP=false
# 打包路径 # 打包路径
VITE_BASE_PATH=/ VITE_BASE_PATH=/admin
# 商城H5会员端域名 # 商城H5会员端域名
VITE_MALL_H5_DOMAIN='http://localhost:3000' VITE_MALL_H5_DOMAIN='http://localhost:3000'

View File

@ -4,12 +4,12 @@ NODE_ENV=production
VITE_DEV=false VITE_DEV=false
# 请求路径 # 请求路径
VITE_BASE_URL='http://localhost:48080' VITE_BASE_URL='https://mt.ptzykjgs.com'
# 文件上传类型server - 后端上传, client - 前端直连上传仅支持S3服务 # 文件上传类型server - 后端上传, client - 前端直连上传仅支持S3服务
VITE_UPLOAD_TYPE=server VITE_UPLOAD_TYPE=server
# 上传路径 # 上传路径
VITE_UPLOAD_URL='http://localhost:48080/admin-api/infra/file/upload' VITE_UPLOAD_URL='https://mt.ptzykjgs.com/admin-api/infra/file/upload'
# 接口地址 # 接口地址
VITE_API_URL=/admin-api VITE_API_URL=/admin-api
@ -24,10 +24,13 @@ VITE_DROP_CONSOLE=true
VITE_SOURCEMAP=false VITE_SOURCEMAP=false
# 打包路径 # 打包路径
VITE_BASE_PATH=/ VITE_BASE_PATH=/admin
# 输出路径 # 输出路径
VITE_OUT_DIR=dist-prod VITE_OUT_DIR=dist-prod
# 商城H5会员端域名 # 商城H5会员端域名
VITE_MALL_H5_DOMAIN='http://mall.yudao.iocoder.cn' VITE_MALL_H5_DOMAIN='http://mall.yudao.iocoder.cn'
# 验证码的开关
VITE_APP_CAPTCHA_ENABLE=false

View File

@ -72,7 +72,7 @@ export const socialAuthRedirect = (type: number, redirectUri: string) => {
} }
// 获取验证图片以及 token // 获取验证图片以及 token
export const getCode = (data) => { export const getCode = (data) => {
return request.postOriginal({ url: 'system/captcha/get', data }) // return request.postOriginal({ url: 'system/captcha/get', data })
} }
// 滑动或者点选验证 // 滑动或者点选验证

View File

@ -5,7 +5,7 @@ import remainingRouter from './modules/remaining'
// 创建路由实例 // 创建路由实例
const router = createRouter({ const router = createRouter({
history: createWebHistory(), // createWebHashHistory URL带#createWebHistory URL不带# history: createWebHistory("/admin"), // createWebHashHistory URL带#createWebHistory URL不带#
strict: true, strict: true,
routes: remainingRouter as RouteRecordRaw[], routes: remainingRouter as RouteRecordRaw[],
scrollBehavior: () => ({ left: 0, top: 0 }) scrollBehavior: () => ({ left: 0, top: 0 })

View File

@ -22,32 +22,17 @@
<div class="h-70px flex items-center justify-end lt-sm:mt-10px"> <div class="h-70px flex items-center justify-end lt-sm:mt-10px">
<div class="px-8px text-right"> <div class="px-8px text-right">
<div class="mb-16px text-14px text-gray-400">{{ t('workplace.project') }}</div> <div class="mb-16px text-14px text-gray-400">{{ t('workplace.project') }}</div>
<CountTo <CountTo class="text-20px" :start-val="0" :end-val="totalSate.project" :duration="2600" />
class="text-20px"
:start-val="0"
:end-val="totalSate.project"
:duration="2600"
/>
</div> </div>
<el-divider direction="vertical" /> <el-divider direction="vertical" />
<div class="px-8px text-right"> <div class="px-8px text-right">
<div class="mb-16px text-14px text-gray-400">{{ t('workplace.toDo') }}</div> <div class="mb-16px text-14px text-gray-400">{{ t('workplace.toDo') }}</div>
<CountTo <CountTo class="text-20px" :start-val="0" :end-val="totalSate.todo" :duration="2600" />
class="text-20px"
:start-val="0"
:end-val="totalSate.todo"
:duration="2600"
/>
</div> </div>
<el-divider direction="vertical" border-style="dashed" /> <el-divider direction="vertical" border-style="dashed" />
<div class="px-8px text-right"> <div class="px-8px text-right">
<div class="mb-16px text-14px text-gray-400">{{ t('workplace.access') }}</div> <div class="mb-16px text-14px text-gray-400">{{ t('workplace.access') }}</div>
<CountTo <CountTo class="text-20px" :start-val="0" :end-val="totalSate.access" :duration="2600" />
class="text-20px"
:start-val="0"
:end-val="totalSate.access"
:duration="2600"
/>
</div> </div>
</div> </div>
</el-col> </el-col>
@ -55,9 +40,20 @@
</el-skeleton> </el-skeleton>
</el-card> </el-card>
</div> </div>
<div class="flex flex-wrap gap-4" style="margin: 20px 0;"> <div class="flex flex-wrap gap-4" style="margin: 10px 0;">
<el-card style="width: 420px;text-align: center;cursor: pointer;" shadow="hover" @click="goToXXLJob">任务调度中心</el-card> <el-card style="width: 420px;text-align: center;cursor: pointer;" shadow="hover" @click="goToXXLJob">任务调度中心</el-card>
</div> </div>
<!-- 新增的静态图片部分 -->
<div>
<el-card style="width: 100%; text-align: center;" shadow="never">
<div style="overflow: hidden; height: calc(100% - 2px);">
<el-image :src="luduViewImage" fit="contain" style="width: 100%; transform: translateY(-2px);" />
</div>
</el-card>
</div>
<!-- <el-row class="mt-8px" :gutter="8" justify="space-between"> <!-- <el-row class="mt-8px" :gutter="8" justify="space-between">
<el-col :xl="16" :lg="16" :md="24" :sm="24" :xs="24" class="mb-8px"> <el-col :xl="16" :lg="16" :md="24" :sm="24" :xs="24" class="mb-8px">
<el-card shadow="never"> <el-card shadow="never">
@ -74,323 +70,328 @@
</el-link> </el-link>
</div> </div>
</template> </template>
<el-skeleton :loading="loading" animated> <el-skeleton :loading="loading" animated>
<el-row> <el-row>
<el-col <el-col v-for="(item, index) in projects" :key="`card-${index}`" :xl="8" :lg="8" :md="8" :sm="24" :xs="24">
v-for="(item, index) in projects" <el-card shadow="hover" class="mr-5px mt-5px">
:key="`card-${index}`" <div class="flex items-center">
:xl="8" <Icon :icon="item.icon" :size="25" class="mr-8px" />
:lg="8" <span class="text-16px">{{ item.name }}</span>
:md="8" </div>
:sm="24" <div class="mt-12px text-9px text-gray-400">{{ t(item.message) }}</div>
:xs="24" <div class="mt-12px flex justify-between text-12px text-gray-400">
> <span>{{ item.personal }}</span>
<el-card shadow="hover" class="mr-5px mt-5px"> <span>{{ formatTime(item.time, 'yyyy-MM-dd') }}</span>
<div class="flex items-center"> </div>
<Icon :icon="item.icon" :size="25" class="mr-8px" />
<span class="text-16px">{{ item.name }}</span>
</div>
<div class="mt-12px text-9px 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-card shadow="never" class="mt-8px">
<el-skeleton :loading="loading" animated>
<el-row :gutter="20" justify="space-between">
<el-col :xl="10" :lg="10" :md="24" :sm="24" :xs="24">
<el-card shadow="hover" class="mb-8px">
<el-skeleton :loading="loading" animated>
<Echart :options="pieOptionsData" :height="280" />
</el-skeleton>
</el-card>
</el-col>
<el-col :xl="14" :lg="14" :md="24" :sm="24" :xs="24">
<el-card shadow="hover" class="mb-8px">
<el-skeleton :loading="loading" animated>
<Echart :options="barOptionsData" :height="280" />
</el-skeleton>
</el-card>
</el-col>
</el-row>
</el-skeleton>
</el-card> </el-card>
</el-col> </el-col>
<el-col :xl="8" :lg="8" :md="24" :sm="24" :xs="24" class="mb-8px"> </el-row>
<el-card shadow="never"> </el-skeleton>
<template #header> </el-card>
<el-card shadow="never" class="mt-8px">
<el-skeleton :loading="loading" animated>
<el-row :gutter="20" justify="space-between">
<el-col :xl="10" :lg="10" :md="24" :sm="24" :xs="24">
<el-card shadow="hover" class="mb-8px">
<el-skeleton :loading="loading" animated>
<Echart :options="pieOptionsData" :height="280" />
</el-skeleton>
</el-card>
</el-col>
<el-col :xl="14" :lg="14" :md="24" :sm="24" :xs="24">
<el-card shadow="hover" class="mb-8px">
<el-skeleton :loading="loading" animated>
<Echart :options="barOptionsData" :height="280" />
</el-skeleton>
</el-card>
</el-col>
</el-row>
</el-skeleton>
</el-card>
</el-col>
<el-col :xl="8" :lg="8" :md="24" :sm="24" :xs="24" class="mb-8px">
<el-card shadow="never">
<template #header>
<div class="h-3 flex justify-between"> <div class="h-3 flex justify-between">
<span>{{ t('workplace.shortcutOperation') }}</span> <span>{{ t('workplace.shortcutOperation') }}</span>
</div> </div>
</template> </template>
<el-skeleton :loading="loading" animated> <el-skeleton :loading="loading" animated>
<el-row> <el-row>
<el-col v-for="item in shortcut" :key="`team-${item.name}`" :span="8" class="mb-8px"> <el-col v-for="item in shortcut" :key="`team-${item.name}`" :span="8" class="mb-8px">
<div class="flex items-center"> <div class="flex items-center">
<Icon :icon="item.icon" class="mr-8px" /> <Icon :icon="item.icon" class="mr-8px" />
<el-link type="default" :underline="false" @click="setWatermark(item.name)"> <el-link type="default" :underline="false" @click="setWatermark(item.name)">
{{ item.name }} {{ item.name }}
</el-link> </el-link>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
</el-skeleton> </el-skeleton>
</el-card> </el-card>
<el-card shadow="never" class="mt-8px"> <el-card shadow="never" class="mt-8px">
<template #header> <template #header>
<div class="h-3 flex justify-between"> <div class="h-3 flex justify-between">
<span>{{ t('workplace.notice') }}</span> <span>{{ t('workplace.notice') }}</span>
<el-link type="primary" :underline="false">{{ t('action.more') }}</el-link> <el-link type="primary" :underline="false">{{ t('action.more') }}</el-link>
</div> </div>
</template> </template>
<el-skeleton :loading="loading" animated> <el-skeleton :loading="loading" animated>
<div v-for="(item, index) in notice" :key="`dynamics-${index}`"> <div v-for="(item, index) in notice" :key="`dynamics-${index}`">
<div class="flex items-center"> <div class="flex items-center">
<el-avatar :src="avatar" :size="35" class="mr-16px"> <el-avatar :src="avatar" :size="35" class="mr-16px">
<img src="@/assets/imgs/avatar.gif" alt="" /> <img src="@/assets/imgs/avatar.gif" alt="" />
</el-avatar> </el-avatar>
<div> <div>
<div class="text-14px"> <div class="text-14px">
<Highlight :keys="item.keys.map((v) => t(v))"> <Highlight :keys="item.keys.map((v) => t(v))">
{{ item.type }} : {{ item.title }} {{ item.type }} : {{ item.title }}
</Highlight> </Highlight>
</div> </div>
<div class="mt-16px text-12px text-gray-400"> <div class="mt-16px text-12px text-gray-400">
{{ formatTime(item.date, 'yyyy-MM-dd') }} {{ formatTime(item.date, 'yyyy-MM-dd') }}
</div>
</div>
</div> </div>
<el-divider />
</div> </div>
</el-skeleton> </div>
</el-card> <el-divider />
</el-col> </div>
</el-row> --> </el-skeleton>
</el-card>
</el-col>
</el-row> -->
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { set } from 'lodash-es' import { set } from 'lodash-es'
import { EChartsOption } from 'echarts' import { EChartsOption } from 'echarts'
import { formatTime } from '@/utils' import { formatTime } from '@/utils'
import luduView from '@/assets/imgs/ludu_view.png'
import { useUserStore } from '@/store/modules/user'
import { useWatermark } from '@/hooks/web/useWatermark'
import type { WorkplaceTotal, Project, Notice, Shortcut } from './types'
import { pieOptions, barOptions } from './echarts-data'
import { useUserStore } from '@/store/modules/user' defineOptions({ name: 'Home' })
import { useWatermark } from '@/hooks/web/useWatermark'
import type { WorkplaceTotal, Project, Notice, Shortcut } from './types'
import { pieOptions, barOptions } from './echarts-data'
defineOptions({ name: 'Home' }) const luduViewImage = ref(luduView);
const { t } = useI18n()
const { t } = useI18n() const userStore = useUserStore()
const userStore = useUserStore() const { setWatermark } = useWatermark()
const { setWatermark } = useWatermark() const loading = ref(true)
const loading = ref(true) const avatar = userStore.getUser.avatar
const avatar = userStore.getUser.avatar const username = userStore.getUser.nickname
const username = userStore.getUser.nickname const pieOptionsData = reactive<EChartsOption>(pieOptions) as EChartsOption
const pieOptionsData = reactive<EChartsOption>(pieOptions) as EChartsOption //
// let totalSate = reactive<WorkplaceTotal>({
let totalSate = reactive<WorkplaceTotal>({ project: 0,
project: 0, access: 0,
access: 0, todo: 0
todo: 0
})
const getCount = async () => {
const data = {
project: 40,
access: 2340,
todo: 10
}
totalSate = Object.assign(totalSate, data)
}
//
let projects = reactive<Project[]>([])
const getProject = async () => {
const data = [
{
name: 'ruoyi-vue-pro',
icon: 'akar-icons:github-fill',
message: 'https://github.com/YunaiV/ruoyi-vue-pro',
personal: 'Spring Boot 单体架构',
time: new Date()
},
{
name: 'yudao-ui-admin-vue3',
icon: 'logos:vue',
message: 'https://github.com/yudaocode/yudao-ui-admin-vue3',
personal: 'Vue3 + element-plus',
time: new Date()
},
{
name: 'yudao-ui-admin-vben',
icon: 'logos:vue',
message: 'https://github.com/yudaocode/yudao-ui-admin-vben',
personal: 'Vue3 + vben(antd)',
time: new Date()
},
{
name: 'yudao-cloud',
icon: 'akar-icons:github',
message: 'https://github.com/YunaiV/yudao-cloud',
personal: 'Spring Cloud 微服务架构',
time: new Date()
},
{
name: 'yudao-ui-mall-uniapp',
icon: 'logos:vue',
message: 'https://github.com/yudaocode/yudao-ui-admin-uniapp',
personal: 'Vue3 + uniapp',
time: new Date()
},
{
name: 'yudao-ui-admin-vue2',
icon: 'logos:vue',
message: 'https://github.com/yudaocode/yudao-ui-admin-vue2',
personal: 'Vue2 + element-ui',
time: new Date()
}
]
projects = Object.assign(projects, data)
}
//
let notice = reactive<Notice[]>([])
const getNotice = async () => {
const data = [
{
title: '系统支持 JDK 8/17/21Vue 2/3',
type: '通知',
keys: ['通知', '8', '17', '21', '2', '3'],
date: new Date()
},
{
title: '后端提供 Spring Boot 2.7/3.2 + Cloud 双架构',
type: '公告',
keys: ['公告', 'Boot', 'Cloud'],
date: new Date()
},
{
title: '全部开源,个人与企业可 100% 直接使用,无需授权',
type: '通知',
keys: ['通知', '无需授权'],
date: new Date()
},
{
title: '国内使用最广泛的快速开发平台,超 300+ 人贡献',
type: '公告',
keys: ['公告', '最广泛'],
date: new Date()
}
]
notice = Object.assign(notice, data)
}
//
let shortcut = reactive<Shortcut[]>([])
const getShortcut = async () => {
const data = [
{
name: 'Github',
icon: 'akar-icons:github-fill',
url: 'github.io'
},
{
name: 'Vue',
icon: 'logos:vue',
url: 'vuejs.org'
},
{
name: 'Vite',
icon: 'vscode-icons:file-type-vite',
url: 'https://vitejs.dev/'
},
{
name: 'Angular',
icon: 'logos:angular-icon',
url: 'github.io'
},
{
name: 'React',
icon: 'logos:react',
url: 'github.io'
},
{
name: 'Webpack',
icon: 'logos:webpack',
url: 'github.io'
}
]
shortcut = Object.assign(shortcut, data)
}
//
const getUserAccessSource = async () => {
const data = [
{ value: 335, name: 'analysis.directAccess' },
{ value: 310, name: 'analysis.mailMarketing' },
{ value: 234, name: 'analysis.allianceAdvertising' },
{ value: 135, name: 'analysis.videoAdvertising' },
{ value: 1548, name: 'analysis.searchEngines' }
]
set(
pieOptionsData,
'legend.data',
data.map((v) => t(v.name))
)
pieOptionsData!.series![0].data = data.map((v) => {
return {
name: t(v.name),
value: v.value
}
}) })
}
const barOptionsData = reactive<EChartsOption>(barOptions) as EChartsOption
// const getCount = async () => {
const getWeeklyUserActivity = async () => { const data = {
const data = [ project: 40,
{ value: 13253, name: 'analysis.monday' }, access: 2340,
{ value: 34235, name: 'analysis.tuesday' }, todo: 10
{ value: 26321, name: 'analysis.wednesday' },
{ value: 12340, name: 'analysis.thursday' },
{ value: 24643, name: 'analysis.friday' },
{ value: 1322, name: 'analysis.saturday' },
{ value: 1324, name: 'analysis.sunday' }
]
set(
barOptionsData,
'xAxis.data',
data.map((v) => t(v.name))
)
set(barOptionsData, 'series', [
{
name: t('analysis.activeQuantity'),
data: data.map((v) => v.value),
type: 'bar'
} }
]) totalSate = Object.assign(totalSate, data)
} }
const getAllApi = async () => { //
await Promise.all([ let projects = reactive<Project[]>([])
getCount(), const getProject = async () => {
getProject(), const data = [
getNotice(), {
getShortcut(), name: 'ruoyi-vue-pro',
getUserAccessSource(), icon: 'akar-icons:github-fill',
getWeeklyUserActivity() message: 'https://github.com/YunaiV/ruoyi-vue-pro',
]) personal: 'Spring Boot 单体架构',
loading.value = false time: new Date()
} },
{
name: 'yudao-ui-admin-vue3',
icon: 'logos:vue',
message: 'https://github.com/yudaocode/yudao-ui-admin-vue3',
personal: 'Vue3 + element-plus',
time: new Date()
},
{
name: 'yudao-ui-admin-vben',
icon: 'logos:vue',
message: 'https://github.com/yudaocode/yudao-ui-admin-vben',
personal: 'Vue3 + vben(antd)',
time: new Date()
},
{
name: 'yudao-cloud',
icon: 'akar-icons:github',
message: 'https://github.com/YunaiV/yudao-cloud',
personal: 'Spring Cloud 微服务架构',
time: new Date()
},
{
name: 'yudao-ui-mall-uniapp',
icon: 'logos:vue',
message: 'https://github.com/yudaocode/yudao-ui-admin-uniapp',
personal: 'Vue3 + uniapp',
time: new Date()
},
{
name: 'yudao-ui-admin-vue2',
icon: 'logos:vue',
message: 'https://github.com/yudaocode/yudao-ui-admin-vue2',
personal: 'Vue2 + element-ui',
time: new Date()
}
]
projects = Object.assign(projects, data)
}
const goToXXLJob = async () => { //
window.open('http://127.0.0.1:9090/xxl-job-admin/'); let notice = reactive<Notice[]>([])
} const getNotice = async () => {
getAllApi() const data = [
{
title: '系统支持 JDK 8/17/21Vue 2/3',
type: '通知',
keys: ['通知', '8', '17', '21', '2', '3'],
date: new Date()
},
{
title: '后端提供 Spring Boot 2.7/3.2 + Cloud 双架构',
type: '公告',
keys: ['公告', 'Boot', 'Cloud'],
date: new Date()
},
{
title: '全部开源,个人与企业可 100% 直接使用,无需授权',
type: '通知',
keys: ['通知', '无需授权'],
date: new Date()
},
{
title: '国内使用最广泛的快速开发平台,超 300+ 人贡献',
type: '公告',
keys: ['公告', '最广泛'],
date: new Date()
}
]
notice = Object.assign(notice, data)
}
//
let shortcut = reactive<Shortcut[]>([])
const getShortcut = async () => {
const data = [
{
name: 'Github',
icon: 'akar-icons:github-fill',
url: 'github.io'
},
{
name: 'Vue',
icon: 'logos:vue',
url: 'vuejs.org'
},
{
name: 'Vite',
icon: 'vscode-icons:file-type-vite',
url: 'https://vitejs.dev/'
},
{
name: 'Angular',
icon: 'logos:angular-icon',
url: 'github.io'
},
{
name: 'React',
icon: 'logos:react',
url: 'github.io'
},
{
name: 'Webpack',
icon: 'logos:webpack',
url: 'github.io'
}
]
shortcut = Object.assign(shortcut, data)
}
//
const getUserAccessSource = async () => {
const data = [
{ value: 335, name: 'analysis.directAccess' },
{ value: 310, name: 'analysis.mailMarketing' },
{ value: 234, name: 'analysis.allianceAdvertising' },
{ value: 135, name: 'analysis.videoAdvertising' },
{ value: 1548, name: 'analysis.searchEngines' }
]
set(
pieOptionsData,
'legend.data',
data.map((v) => t(v.name))
)
pieOptionsData!.series![0].data = data.map((v) => {
return {
name: t(v.name),
value: v.value
}
})
}
const barOptionsData = reactive<EChartsOption>(barOptions) as EChartsOption
//
const getWeeklyUserActivity = async () => {
const data = [
{ value: 13253, name: 'analysis.monday' },
{ value: 34235, name: 'analysis.tuesday' },
{ value: 26321, name: 'analysis.wednesday' },
{ value: 12340, name: 'analysis.thursday' },
{ value: 24643, name: 'analysis.friday' },
{ value: 1322, name: 'analysis.saturday' },
{ value: 1324, name: 'analysis.sunday' }
]
set(
barOptionsData,
'xAxis.data',
data.map((v) => t(v.name))
)
set(barOptionsData, 'series', [
{
name: t('analysis.activeQuantity'),
data: data.map((v) => v.value),
type: 'bar'
}
])
}
const getAllApi = async () => {
await Promise.all([
getCount(),
getProject(),
getNotice(),
getShortcut(),
getUserAccessSource(),
getWeeklyUserActivity()
])
loading.value = false
}
const goToXXLJob = async () => {
window.open('https://mt.ptzykjgs.com/xxl-job-admin/');
}
getAllApi()
</script> </script>
<style scoped>
.image-container {
width: 100%;
display: flex;
justify-content: center;
}
.el-image img {
width: 100%;
height: auto;
}
</style>