From 160272de5778bddbd8386f647258c95ecf9e02a5 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Tue, 19 Dec 2023 11:39:07 +0800
Subject: [PATCH] 水印处理
---
src/page/index/index.vue | 265 ++++++++++++++++++++++++++++-------------------------
1 files changed, 140 insertions(+), 125 deletions(-)
diff --git a/src/page/index/index.vue b/src/page/index/index.vue
index 7e1ad9e..8c48b34 100644
--- a/src/page/index/index.vue
+++ b/src/page/index/index.vue
@@ -1,143 +1,158 @@
<template>
- <div class="avue-contail" :class="{'avue--collapse':isCollapse}">
- <div class="avue-header">
- <!-- 顶部导航栏 -->
- <top ref="top"/>
- </div>
- <div class="avue-layout">
- <div class="avue-left">
- <!-- 左侧导航栏 -->
- <sidebar/>
- </div>
- <div class="avue-main">
- <!-- 顶部标签卡 -->
- <tags/>
- <transition name="fade-scale">
- <search class="avue-view" v-show="isSearch"></search>
- </transition>
- <!-- 主体视图层 -->
- <div style="height:100%;overflow-y:auto;overflow-x:hidden;" id="avue-view" v-show="!isSearch">
- <keep-alive>
- <router-view class="avue-view" v-if="$route.meta.keepAlive"/>
- </keep-alive>
- <router-view class="avue-view" v-if="!$route.meta.keepAlive"/>
+ <div class="avue-contail" :class="{ 'avue--collapse': isCollapse }">
+ <div class="avue-header">
+ <!-- 顶部导航栏 -->
+ <top ref="top" />
</div>
- </div>
+ <div class="avue-layout">
+ <div class="avue-left">
+ <!-- 左侧导航栏 -->
+ <sidebar />
+ </div>
+ <div class="avue-main">
+ <!-- 顶部标签卡 -->
+ <tags />
+ <transition name="fade-scale">
+ <search class="avue-view" v-show="isSearch"></search>
+ </transition>
+ <!-- 主体视图层 -->
+ <div style="height:100%;overflow-y:auto;overflow-x:hidden;" id="avue-view" v-show="!isSearch">
+ <keep-alive>
+ <router-view class="avue-view" v-if="$route.meta.keepAlive" />
+ </keep-alive>
+ <router-view class="avue-view" v-if="!$route.meta.keepAlive" />
+ </div>
+ </div>
+ </div>
+ <div class="avue-shade" @click="showCollapse"></div>
</div>
- <div class="avue-shade" @click="showCollapse"></div>
- </div>
</template>
<script>
- import {mapGetters} from "vuex";
- import tags from "./tags";
- import search from "./search";
- import top from "./top/";
- import sidebar from "./sidebar/";
- import admin from "@/util/admin";
- import {validatenull} from "@/util/validate";
- import {calcDate} from "@/util/date.js";
- import {getStore} from "@/util/store.js";
+import Watermark from "@/warterMarkVUE"
+import { mapGetters } from "vuex"
+import tags from "./tags"
+import search from "./search"
+import top from "./top/"
+import sidebar from "./sidebar/"
+import admin from "@/util/admin"
+import { validatenull } from "@/util/validate"
+import { calcDate } from "@/util/date.js"
+import { getStore } from "@/util/store.js"
- export default {
+export default {
components: {
- top,
- tags,
- search,
- sidebar
+ top,
+ tags,
+ search,
+ sidebar
},
name: "index",
- provide() {
- return {
- index: this
- };
+ provide () {
+ return {
+ index: this
+ }
},
- data() {
- return {
- //搜索控制
- isSearch: false,
- //刷新token锁
- refreshLock: false,
- //刷新token的时间
- refreshTime: ""
- };
+ data () {
+ return {
+ //搜索控制
+ isSearch: false,
+ //刷新token锁
+ refreshLock: false,
+ //刷新token的时间
+ refreshTime: "",
+ globalUserInfo: getStore({ name: "userInfo" }),
+ }
},
- created() {
- //实时检测刷新token
- this.refreshToken();
+ created () {
+ Watermark.set("饶城格格通" + ' ' + this.globalUserInfo.user_name + ' ' + this.getTime())
+
+ //实时检测刷新token
+ this.refreshToken()
},
- mounted() {
- this.init();
+ mounted () {
+ this.init()
},
computed: mapGetters(["isMenu", "isLock", "isCollapse", "website", "menu"]),
props: [],
- methods: {
- showCollapse() {
- this.$store.commit("SET_COLLAPSE");
- },
- // 初始化
- init() {
- this.$store.commit("SET_SCREEN", admin.getScreen());
- window.onresize = () => {
- setTimeout(() => {
- this.$store.commit("SET_SCREEN", admin.getScreen());
- }, 0);
- };
- this.$store.dispatch("FlowRoutes").then(() => {
- });
- },
- //打开菜单
- openMenu(item = {}) {
- this.$store.dispatch("GetMenu", item.id).then(data => {
- if (data.length !== 0) {
- this.$router.$avueRouter.formatRoutes(data, true);
- }
- //当点击顶部菜单后默认打开第一个菜单
- /*if (!this.validatenull(item)) {
- let itemActive = {},
- childItemActive = 0;
- if (item.path) {
- itemActive = item;
- } else {
- if (this.menu[childItemActive].length === 0) {
- itemActive = this.menu[childItemActive];
- } else {
- itemActive = this.menu[childItemActive].children[childItemActive];
- }
- }
- this.$store.commit('SET_MENU_ID', item);
- this.$router.push({
- path: this.$router.$avueRouter.getPath({
- name: (itemActive.label || itemActive.name),
- src: itemActive.path
- }, itemActive.meta)
- });
- }*/
- });
- },
- // 定时检测token
- refreshToken() {
- this.refreshTime = setInterval(() => {
- const token = getStore({
- name: "token",
- debug: true
- }) || {};
- const date = calcDate(token.datetime, new Date().getTime());
- if (validatenull(date)) return;
- if (date.seconds >= this.website.tokenTime && !this.refreshLock) {
- this.refreshLock = true;
- this.$store
- .dispatch("refreshToken")
- .then(() => {
- this.refreshLock = false;
- })
- .catch(() => {
- this.refreshLock = false;
- });
- }
- }, 10000);
- }
+ methods: {
+ getTime () {
+ var date = new Date()
+ var Y = date.getFullYear() + '-'
+ var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
+ var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' '
+ var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'
+ var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':'
+ var s = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds())
+ return Y + M + D + h + m + s
+ },
+ showCollapse () {
+ this.$store.commit("SET_COLLAPSE")
+ },
+ // 初始化
+ init () {
+ this.$store.commit("SET_SCREEN", admin.getScreen())
+ window.onresize = () => {
+ setTimeout(() => {
+ this.$store.commit("SET_SCREEN", admin.getScreen())
+ }, 0)
+ }
+ this.$store.dispatch("FlowRoutes").then(() => {
+ })
+ },
+ //打开菜单
+ openMenu (item = {}) {
+ this.$store.dispatch("GetMenu", item.id).then(data => {
+ if (data.length !== 0) {
+ this.$router.$avueRouter.formatRoutes(data, true)
+ }
+ //当点击顶部菜单后默认打开第一个菜单
+ /*if (!this.validatenull(item)) {
+ let itemActive = {},
+ childItemActive = 0;
+ if (item.path) {
+ itemActive = item;
+ } else {
+ if (this.menu[childItemActive].length === 0) {
+ itemActive = this.menu[childItemActive];
+ } else {
+ itemActive = this.menu[childItemActive].children[childItemActive];
+ }
+ }
+ this.$store.commit('SET_MENU_ID', item);
+ this.$router.push({
+ path: this.$router.$avueRouter.getPath({
+ name: (itemActive.label || itemActive.name),
+ src: itemActive.path
+ }, itemActive.meta)
+ });
+ }*/
+
+ })
+ },
+ // 定时检测token
+ refreshToken () {
+ this.refreshTime = setInterval(() => {
+ const token = getStore({
+ name: "token",
+ debug: true
+ }) || {}
+ const date = calcDate(token.datetime, new Date().getTime())
+ if (validatenull(date)) return
+ if (date.seconds >= this.website.tokenTime && !this.refreshLock) {
+ this.refreshLock = true
+ this.$store
+ .dispatch("refreshToken")
+ .then(() => {
+ this.refreshLock = false
+ })
+ .catch(() => {
+ this.refreshLock = false
+ })
+ }
+ }, 10000)
+ }
}
- };
-</script>
+}
+</script>
\ No newline at end of file
--
Gitblit v1.9.3