From b767cea8ee6bf2e782c7727ad9ccfd1d69b4f8cb Mon Sep 17 00:00:00 2001 From: qx <1084500556@qq.com> Date: 星期二, 08 七月 2025 13:55:58 +0800 Subject: [PATCH] qx --- src/main.js | 127 ++++++++++++++++-------------------------- 1 files changed, 48 insertions(+), 79 deletions(-) diff --git a/src/main.js b/src/main.js index 0ac844c..9ebec6f 100644 --- a/src/main.js +++ b/src/main.js @@ -1,40 +1,21 @@ +// src/main.js import Vue from "vue"; - import Cookies from "js-cookie"; import "babel-polyfill"; import Element from "element-ui"; import "./assets/styles/element-variables.scss"; - -import "@/assets/styles/index.scss"; // global css -import "@/assets/styles/ruoyi.scss"; // ruoyi css +import "@/assets/styles/index.scss"; +import "@/assets/styles/ruoyi.scss"; import App from "./App"; import store from "./store"; import router from "./router"; -import directive from "./directive"; // directive -import plugins from "./plugins"; // plugins +import directive from "./directive"; +import plugins from "./plugins"; import { download } from "@/utils/request"; import Print from "vue-print-nb"; - -// import Updater from "./utils/AutoUpdate.js"; - -//鍓嶇閲嶆柊閮ㄧ讲閫氱煡鐢ㄦ埛鍒锋柊缃戦〉 -// const AutoUpdate = new Updater() -// AutoUpdate.on('update',()=>{ -// setTimeout(async()=>{ -// const result = confirm('褰撳墠鐗堟湰宸叉洿鏂帮紝璇风偣鍑荤‘瀹氬埛鏂伴〉闈綋楠�'); -// if(result){ -// location.reload(); -// } -// },500) -// }) - - import JsonExcel from "vue-json-excel"; - -Vue.component("downloadExcel", JsonExcel); - -import "./assets/icons"; // icon -import "./permission"; // permission control +import "./assets/icons"; +import "./permission"; import { getDicts } from "@/api/system/dict/data"; import { getConfigKey } from "@/api/system/config"; import { @@ -45,38 +26,26 @@ selectDictLabels, handleTree, } from "@/utils/ruoyi"; -// 鍒嗛〉缁勪欢 import Pagination from "@/components/Pagination"; -// 鍒嗛〉缁勪欢 - -// import { monitorZoom } from "@/utils/devicePixelRatio.js"; -// const m = monitorZoom(); -// if (window.screen.width * window.devicePixelRatio >= 3840) { -// document.body.style.zoom = 100 / (Number(m) / 2); // 灞忓箷涓� 4k 鏃� -// } else { -// document.body.style.zoom = 100 / Number(m); -// } - -// 鑷畾涔夎〃鏍煎伐鍏风粍浠� -import RightToolbar from "@/components/RightToolbar"; -// 瀵屾枃鏈粍浠� import Editor from "@/components/Editor"; -// 鏂囦欢涓婁紶缁勪欢 import FileUpload from "@/components/FileUpload"; -// 鍥剧墖涓婁紶缁勪欢 import ImageUpload from "@/components/ImageUpload"; -// 鍥剧墖棰勮缁勪欢 import ImagePreview from "@/components/ImagePreview"; -// 瀛楀吀鏍囩缁勪欢 import DictTag from "@/components/DictTag"; -// 澶撮儴鏍囩缁勪欢 import VueMeta from "vue-meta"; -// 瀛楀吀鏁版嵁缁勪欢 import DictData from "@/components/DictData"; - import * as echarts from "echarts"; +import VueBarcode from "vue-barcode"; -// 鍏ㄥ眬鏂规硶鎸傝浇 +Vue.component("downloadExcel", JsonExcel); +Vue.component("barcode", VueBarcode); +Vue.component("DictTag", DictTag); +Vue.component("Pagination", Pagination); +Vue.component("Editor", Editor); +Vue.component("FileUpload", FileUpload); +Vue.component("ImageUpload", ImageUpload); +Vue.component("ImagePreview", ImagePreview); + Vue.prototype.getDicts = getDicts; Vue.prototype.getConfigKey = getConfigKey; Vue.prototype.parseTime = parseTime; @@ -87,42 +56,42 @@ Vue.prototype.download = download; Vue.prototype.handleTree = handleTree; Vue.prototype.$echarts = echarts; -import VueBarcode from "vue-barcode"; -Vue.component("barcode", VueBarcode); -// 鍏ㄥ眬缁勪欢鎸傝浇 -Vue.component("DictTag", DictTag); -Vue.component("Pagination", Pagination); -Vue.component("RightToolbar", RightToolbar); -Vue.component("Editor", Editor); -Vue.component("FileUpload", FileUpload); -Vue.component("ImageUpload", ImageUpload); -Vue.component("ImagePreview", ImagePreview); +// 淇濈暀 $showNotification锛屾敮鎸佹墜鍔ㄨЕ鍙戦�氱煡 +Vue.prototype.$showNotification = function (type, title, message, onClick) { + console.log('瑙﹀彂閫氱煡:', { type, title, message }, new Date().toLocaleString()); + Vue.prototype.$notify({ + title, + message, + type, + duration: 5000, + position: 'top-right', + offset: 50, + onClick, + customClass: 'global-notification', + appendTo: document.body + }); +}; + +// 鐩戝惉璺敱鍙樺寲 +router.afterEach(() => { + console.log('璺敱鍒囨崲瀹屾垚锛屽綋鍓嶈矾寰�:', router.currentRoute.path); +}); + +const app = new Vue({ + el: "#app", + router, + store, + render: (h) => h(App) +}); Vue.use(directive); Vue.use(plugins); Vue.use(VueMeta); Vue.use(Print); +Vue.use(Element, { + size: Cookies.get("size") || "medium", +}); DictData.install(); -/** - * If you don't want to use mock-server - * you want to use MockJs for mock api - * you can execute: mockXHR() - * - * Currently MockJs will be used in the production environment, - * please remove it before going online! ! ! - */ - -Vue.use(Element, { - size: Cookies.get("size") || "medium", // set element-ui default size -}); - -Vue.config.productionTip = false; - -new Vue({ - el: "#app", - router, - store, - render: (h) => h(App), -}); +Vue.config.productionTip = false; \ No newline at end of file -- Gitblit v1.8.0