diff --git a/base/ctx/log_handler.go b/base/ctx/log_handler.go index f1e3309e..24ff6bcc 100644 --- a/base/ctx/log_handler.go +++ b/base/ctx/log_handler.go @@ -75,10 +75,8 @@ func getErrMsg(rc *ReqCtx, err interface{}) string { switch t := err.(type) { case *biz.BizError: errMsg = fmt.Sprintf("\n<-e errCode: %d, errMsg: %s", t.Code(), t.Error()) - break case error: errMsg = fmt.Sprintf("\n<-e errMsg: %s\n%s", t.Error(), string(debug.Stack())) - break case string: errMsg = fmt.Sprintf("\n<-e errMsg: %s\n%s", t, string(debug.Stack())) } diff --git a/mayfly_go_web/src/views/home/api.ts b/mayfly_go_web/src/views/home/api.ts new file mode 100644 index 00000000..91436e9b --- /dev/null +++ b/mayfly_go_web/src/views/home/api.ts @@ -0,0 +1,6 @@ +import Api from '@/common/Api'; + +export const indexApi = { + getIndexCount: Api.create("/common/index/count", 'get'), +} + diff --git a/mayfly_go_web/src/views/home/index.vue b/mayfly_go_web/src/views/home/index.vue index e11caeb0..7fa06f0a 100644 --- a/mayfly_go_web/src/views/home/index.vue +++ b/mayfly_go_web/src/views/home/index.vue @@ -8,25 +8,24 @@
{{ `${currentTime}, ${getUserInfos.username}` }}
-
- +
{{ v.title }}
-
-
{{ v.tip }}
-
+
+
- + @@ -99,6 +98,7 @@ import { useStore } from '@/store/index.ts'; import * as echarts from 'echarts'; import { CountUp } from 'countup.js'; import { formatAxis } from '@/common/utils/formatTime.ts'; +import { indexApi } from './api'; import { topCardItemList, environmentList, activitiesList } from './mock.ts'; export default { name: 'Home', @@ -129,21 +129,23 @@ export default { ], }, }); + // 当前时间提示语 const currentTime = computed(() => { return formatAxis(new Date()); }); + // 初始化数字滚动 - const initNumCountUp = () => { + const initNumCountUp = async () => { + const res: any = await indexApi.getIndexCount.request() nextTick(() => { - new CountUp('titleNum1', Math.random() * 10000).start(); - new CountUp('titleNum2', Math.random() * 10000).start(); - new CountUp('titleNum3', Math.random() * 10000).start(); - new CountUp('tipNum1', Math.random() * 1000).start(); - new CountUp('tipNum2', Math.random() * 1000).start(); - new CountUp('tipNum3', Math.random() * 1000).start(); + new CountUp('projectNum', res.projectNum).start(); + new CountUp('machineNum', res.machineNum).start(); + new CountUp('dbNum', res.dbNum).start(); + new CountUp('redisNum', res.redisNum).start(); }); }; + // 实验室使用情况 const initHomeLaboratory = () => { const myChart = echarts.init(proxy.$refs.homeLaboratoryRef); @@ -245,8 +247,8 @@ export default { // 页面加载时 onMounted(() => { initNumCountUp(); - initHomeLaboratory(); - initHomeOvertime(); + // initHomeLaboratory(); + // initHomeOvertime(); }); // 获取用户信息 vuex diff --git a/mayfly_go_web/src/views/home/mock.ts b/mayfly_go_web/src/views/home/mock.ts index 7eb34ed1..d8c45f71 100644 --- a/mayfly_go_web/src/views/home/mock.ts +++ b/mayfly_go_web/src/views/home/mock.ts @@ -1,80 +1,93 @@ // 最顶部 card export const topCardItemList = [ - { - title: '今日访问人数', - titleNum: '123', - tip: '在场人数', - tipNum: '911', - color: '#F95959', - iconColor: '#F86C6B', - icon: 'iconfont icon-jinridaiban', - }, - { - title: '实验室总数', - titleNum: '123', - tip: '使用中', - tipNum: '611', - color: '#8595F4', - iconColor: '#92A1F4', - icon: 'iconfont icon-AIshiyanshi', - }, - { - title: '申请人数(月)', - titleNum: '123', - tip: '通过人数', - tipNum: '911', - color: '#FEBB50', - iconColor: '#FDC566', - icon: 'iconfont icon-shenqingkaiban', - }, + { + title: '项目数', + id: 'projectNum', + num: '123', + tip: '通过人数', + tipNum: '911', + color: '#FEBB50', + iconColor: '#FDC566', + icon: 'el-icon-histogram', + }, + { + title: 'Linux机器数', + id: 'machineNum', + num: '123', + tip: '在场人数', + tipNum: '911', + color: '#F95959', + iconColor: '#F86C6B', + icon: 'iconfont icon-jinridaiban', + }, + { + title: '数据库总数', + id: "dbNum", + num: '123', + tip: '使用中', + tipNum: '611', + color: '#8595F4', + iconColor: '#92A1F4', + icon: 'iconfont icon-AIshiyanshi', + }, + { + title: 'redis总数', + id: 'redisNum', + num: '123', + tip: '通过人数', + tipNum: '911', + color: '#1abc9c', + iconColor: '#FDC566', + icon: 'iconfont icon-shenqingkaiban', + }, ]; // 环境监测 export const environmentList = [ - { - icon: 'iconfont icon-yangan', - label: '烟感', - value: '2.1%OBS/M', - iconColor: '#F72B3F', - }, - { - icon: 'iconfont icon-wendu', - label: '温度', - value: '30℃', - iconColor: '#91BFF8', - }, - { - icon: 'iconfont icon-shidu', - label: '湿度', - value: '57%RH', - iconColor: '#88D565', - }, - { - icon: 'iconfont icon-zaosheng', - label: '噪声', - value: '57DB', - iconColor: '#FBD4A0', - }, + { + icon: 'iconfont icon-yangan', + label: '烟感', + value: '2.1%OBS/M', + iconColor: '#F72B3F', + }, + { + icon: 'iconfont icon-wendu', + label: '温度', + value: '30℃', + iconColor: '#91BFF8', + }, + { + icon: 'iconfont icon-shidu', + label: '湿度', + value: '57%RH', + iconColor: '#88D565', + }, + { + icon: 'iconfont icon-zaosheng', + label: '噪声', + value: '57DB', + iconColor: '#FBD4A0', + }, ]; // 动态信息 export const activitiesList = [ - { - time1: '今天', - time2: '12:20:30', - title: '更名', - label: '正式更名为 vue-next-admin', - }, - { - time1: '02-17', - time2: '12:20:30', - title: '页面', - label: '完成对首页的开发', - }, - { - time1: '02-14', - time2: '12:20:30', - title: '页面', - label: '新增个人中心', - }, + { + time1: '今天', + time2: '12:20:30', + title: '更名', + label: '正式更名为 vue-next-admin', + }, + { + time1: '02-17', + time2: '12:20:30', + title: '页面', + label: '完成对首页的开发', + }, + { + time1: '02-14', + time2: '12:20:30', + title: '页面', + label: '新增个人中心', + }, ]; diff --git a/mayfly_go_web/src/views/layout/navBars/breadcrumb/userNews.vue b/mayfly_go_web/src/views/layout/navBars/breadcrumb/userNews.vue index 78797878..d7f1bcf1 100644 --- a/mayfly_go_web/src/views/layout/navBars/breadcrumb/userNews.vue +++ b/mayfly_go_web/src/views/layout/navBars/breadcrumb/userNews.vue @@ -16,7 +16,7 @@ -
前往通知中心
+
前往通知中心
@@ -27,15 +27,10 @@ export default { setup() { const state = reactive({ newsList: [ - { - label: '关于版本发布的通知', - value: 'vue-next-admin,基于 vue3 + CompositionAPI + typescript + vite + element plus,正式发布时间:2021年02月28日!', - time: '2020-12-08', - }, { label: '关于学习交流的通知', - value: 'QQ群号码 665452019,欢迎小伙伴入群学习交流探讨!', - time: '2020-12-08', + value: 'QQ群号码 119699946', + time: '2021-09-08', }, ], }); @@ -44,12 +39,12 @@ export default { state.newsList = []; }; // 前往通知中心点击 - const onGoToGiteeClick = () => { - window.open('https://gitee.com/lyt-top/vue-next-admin'); + const toMsgCenter = () => { + // window.open('https://gitee.com/lyt-top/vue-next-admin'); }; return { onAllReadClick, - onGoToGiteeClick, + toMsgCenter, ...toRefs(state), }; }, diff --git a/mayfly_go_web/src/views/login/component/Account.vue b/mayfly_go_web/src/views/login/component/Account.vue index cb7db49e..9a37a8f2 100644 --- a/mayfly_go_web/src/views/login/component/Account.vue +++ b/mayfly_go_web/src/views/login/component/Account.vue @@ -127,14 +127,17 @@ export default defineComponent({ getCaptcha(); return; } - // 用户信息模拟数据 + // 用户信息 const userInfos = { username: state.loginForm.username, + // 头像 photo: letterAvatar(state.loginForm.username), time: new Date().getTime(), // // 菜单资源code数组 // menus: loginRes.menus, permissions: loginRes.permissions, + lastLoginTime: loginRes.lastLoginTime, + lastLoginIp: loginRes.lastLoginIp, }; // 存储用户信息到浏览器缓存 diff --git a/mayfly_go_web/src/views/personal/api.ts b/mayfly_go_web/src/views/personal/api.ts new file mode 100644 index 00000000..ef594c39 --- /dev/null +++ b/mayfly_go_web/src/views/personal/api.ts @@ -0,0 +1,8 @@ +import Api from '@/common/Api'; + +export const personApi = { + accountInfo: Api.create("/sys/accounts/self", 'get'), + updateAccount: Api.create("/sys/accounts/self", 'put'), + getMsgs: Api.create("/sys/accounts/msgs", 'get'), +} + diff --git a/mayfly_go_web/src/views/personal/index.vue b/mayfly_go_web/src/views/personal/index.vue index 5f36a6f7..8071dddb 100644 --- a/mayfly_go_web/src/views/personal/index.vue +++ b/mayfly_go_web/src/views/personal/index.vue @@ -6,41 +6,36 @@
- +
{{ currentTime }},admin,生活变的再糟糕,也不妨碍我变得更好! + >{{ currentTime }},{{ getUserInfos.username }},生活变的再糟糕,也不妨碍我变得更好! -
昵称:
-
小柒
+
用户名:
+
{{ getUserInfos.username }}
-
身份:
-
超级管理
+
角色:
+
{{ roleInfo }}
-
登录IP:
-
192.168.1.1
+
上次登录IP:
+
{{ getUserInfos.lastLoginIp }}
-
登录时间:
-
2021-02-05 18:47:26
+
上次登录时间:
+
{{ $filters.dateFormat(getUserInfos.lastLoginTime) }}
@@ -59,8 +54,8 @@ @@ -68,7 +63,7 @@ - +
基本信息
- + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - 更新个人信息 + 更新个人信息 -
账号安全
+ +
@@ -186,26 +157,24 @@