'admin-21.02.26:首页数字动画滚动效果、添加全局修改网站标题等'

This commit is contained in:
lyt 2021-02-26 18:39:44 +08:00
parent 59a108e490
commit 4fe5fd943d
8 changed files with 43 additions and 11 deletions

View File

@ -6,7 +6,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta <meta
name="keywords" name="keywords"
content="vue-admin-wonderful后台管理系统一站式平台模板希望可以帮你完成快速开发。" content="vue-admin-wonderful后台管理系统一站式平台模板希望可以帮你完成快速开发。vue2、vue3、vue3.x、
CompositionAPI、typescript、element plus、element、plus、admin、wonderful、wonderful-next、快速、高效"
/> />
<meta <meta
name="description" name="description"

View File

@ -8,6 +8,7 @@
"dependencies": { "dependencies": {
"axios": "^0.21.1", "axios": "^0.21.1",
"clipboard": "^2.0.6", "clipboard": "^2.0.6",
"countup.js": "^2.0.7",
"echarts": "^5.0.2", "echarts": "^5.0.2",
"echarts-wordcloud": "^2.0.0", "echarts-wordcloud": "^2.0.0",
"element-plus": "^1.0.2-beta.32", "element-plus": "^1.0.2-beta.32",

View File

@ -5,6 +5,7 @@ import 'nprogress/nprogress.css'
import { store } from "/@/store/index.ts" import { store } from "/@/store/index.ts"
import { getSession, clearSession } from "/@/utils/storage.ts" import { getSession, clearSession } from "/@/utils/storage.ts"
import { getMenuAdmin, getMenuTest } from '/@/api/menu/index.ts' import { getMenuAdmin, getMenuTest } from '/@/api/menu/index.ts'
import themeConfig from '/@/utils/themeConfig.ts'
// 定义动态路由 // 定义动态路由
export const dynamicRoutes = [ export const dynamicRoutes = [
@ -659,7 +660,7 @@ if (store.state.themeConfig.isRequestRoutes) getBackEndControlRoutes()
// 路由加载前 // 路由加载前
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
document.title = `${to.meta.title} - vue-admin-wonderful-next` || `vue-admin-wonderful-next` document.title = `${to.meta.title} - ${themeConfig.globalTitle}` || themeConfig.globalTitle
NProgress.configure({ showSpinner: false }) NProgress.configure({ showSpinner: false })
if (to.meta.title) NProgress.start() if (to.meta.title) NProgress.start()
const token = getSession('token') const token = getSession('token')

View File

@ -43,7 +43,9 @@ export interface RootStateTypes {
animation: string, animation: string,
columnsAsideStyle: string, columnsAsideStyle: string,
layout: string, layout: string,
isRequestRoutes: boolean isRequestRoutes: boolean,
globalTitle: string,
globalViceTitle: string,
}, },
routes: Array<object>, routes: Array<object>,
keepAliveNames: Array<string>, keepAliveNames: Array<string>,

View File

@ -101,5 +101,12 @@ export default {
/* /*
------------------------------- */ ------------------------------- */
// 是否开启后端控制路由 // 是否开启后端控制路由
isRequestRoutes: false isRequestRoutes: false,
/* 全局网站标题 /
------------------------------- */
// 网站主标题(菜单导航、浏览器当前网页标题)
globalTitle: 'vue-admin-wonderful-next',
// 网站副标题(登录页顶部文字)
globalViceTitle: 'SMALL@小柒'
} }

View File

@ -18,9 +18,9 @@
<div class="home-card-item home-card-item-box" :style="{background:v.color}"> <div class="home-card-item home-card-item-box" :style="{background:v.color}">
<div class="home-card-item-flex"> <div class="home-card-item-flex">
<div class="home-card-item-title pb3">{{v.title}}</div> <div class="home-card-item-title pb3">{{v.title}}</div>
<div class="home-card-item-title-num pb6">{{v.titleNum}}</div> <div class="home-card-item-title-num pb6" :id="`titleNum${k+1}`"></div>
<div class="home-card-item-tip pb3">{{v.tip}}</div> <div class="home-card-item-tip pb3">{{v.tip}}</div>
<div class="home-card-item-tip-num">{{v.tipNum}}</div> <div class="home-card-item-tip-num" :id="`tipNum${k+1}`"></div>
</div> </div>
<i :class="v.icon" :style="{'color': v.iconColor}"></i> <i :class="v.icon" :style="{'color': v.iconColor}"></i>
</div> </div>
@ -94,8 +94,9 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { toRefs, reactive, onMounted } from "vue"; import { toRefs, reactive, onMounted, nextTick } from "vue";
import * as echarts from "echarts"; import * as echarts from "echarts";
import { CountUp } from "countup.js";
import { topCardItemList, environmentList, activitiesList } from "./mock.ts"; import { topCardItemList, environmentList, activitiesList } from "./mock.ts";
export default { export default {
name: "home", name: "home",
@ -124,6 +125,17 @@ export default {
], ],
}, },
}); });
//
const initNumCountUp = () => {
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();
});
};
// 使 // 使
const initHomeLaboratory = () => { const initHomeLaboratory = () => {
const myChart = echarts.init(document.getElementById("homeLaboratory")); const myChart = echarts.init(document.getElementById("homeLaboratory"));
@ -235,8 +247,9 @@ export default {
myChart.resize(); myChart.resize();
}); });
}; };
// //
onMounted(() => { onMounted(() => {
initNumCountUp();
initHomeLaboratory(); initHomeLaboratory();
initHomeOvertime(); initHomeOvertime();
}); });

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="layout-logo" v-if="setShowLogo" @click="onThemeConfigChange"> <div class="layout-logo" v-if="setShowLogo" @click="onThemeConfigChange">
<span>vue-admin-wonderful</span> <span>{{config.globalTitle}}</span>
</div> </div>
<div class="layout-logo-size" v-else @click="onThemeConfigChange"> <div class="layout-logo-size" v-else @click="onThemeConfigChange">
<img src="https://gitee.com/lyt-top/vue-admin-wonderful-images/raw/master/next/assets/logo-docs-mini.svg" <img src="https://gitee.com/lyt-top/vue-admin-wonderful-images/raw/master/next/assets/logo-docs-mini.svg"
@ -9,13 +9,17 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { computed, getCurrentInstance } from "vue"; import { reactive, toRefs, computed, getCurrentInstance } from "vue";
import { useStore } from "/@/store/index.ts"; import { useStore } from "/@/store/index.ts";
import config from "/@/utils/themeConfig.ts";
export default { export default {
name: "layoutLogo", name: "layoutLogo",
setup() { setup() {
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const store = useStore(); const store = useStore();
const state = reactive({
config,
});
// logo classic logo // logo classic logo
const setShowLogo = computed(() => { const setShowLogo = computed(() => {
let { isCollapse, layout } = store.state.themeConfig; let { isCollapse, layout } = store.state.themeConfig;
@ -32,6 +36,7 @@ export default {
return { return {
setShowLogo, setShowLogo,
onThemeConfigChange, onThemeConfigChange,
...toRefs(state),
}; };
}, },
}; };

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="login-container"> <div class="login-container">
<div class="login-logo"> <div class="login-logo">
<span>SMALL@小柒</span> <span>{{themeConfig.globalViceTitle}}</span>
</div> </div>
<div class="login-content" :class="{'login-content-mobile' : tabsActiveName === 'mobile'}"> <div class="login-content" :class="{'login-content-mobile' : tabsActiveName === 'mobile'}">
<div class="login-content-main"> <div class="login-content-main">
@ -34,6 +34,7 @@
<script lang="ts"> <script lang="ts">
import Account from "/@/views/login/component/account.vue"; import Account from "/@/views/login/component/account.vue";
import Mobile from "/@/views/login/component/mobile.vue"; import Mobile from "/@/views/login/component/mobile.vue";
import themeConfig from "/@/utils/themeConfig.ts";
import { toRefs, reactive } from "vue"; import { toRefs, reactive } from "vue";
export default { export default {
name: "login", name: "login",
@ -42,6 +43,7 @@ export default {
const state = reactive({ const state = reactive({
tabsActiveName: "account", tabsActiveName: "account",
isTabPaneShow: false, isTabPaneShow: false,
themeConfig,
}); });
const onTabsClick = () => { const onTabsClick = () => {
state.isTabPaneShow = !state.isTabPaneShow; state.isTabPaneShow = !state.isTabPaneShow;