From f5cc74977256a60587d4598ff85811314c77796e Mon Sep 17 00:00:00 2001
From: toesbieya <1647775459@qq.com>
Date: Tue, 30 Jun 2020 12:08:23 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=94=B9=E5=8A=A8=EF=BC=8C?=
=?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E4=B8=80=E4=BA=9B=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../static/img/fileType/{xlsx.png => xls.png} | Bin
vue/public/static/live2d/waifu-tips.js | 227 --------------
vue/public/static/live2d/waifu-tips.json | 72 -----
vue/public/static/live2d/waifu.css | 6 -
.../ContextMenu/ContextMenuItem.vue | 2 +-
vue/src/components/ContextMenu/index.vue | 27 +-
.../components/DialogForm/DialogFormItem.vue | 4 +-
vue/src/components/DialogForm/index.vue | 4 +-
vue/src/components/Guide/index.js | 4 +-
vue/src/components/Guide/main.vue | 64 ++--
vue/src/components/LinerProgress/style.scss | 2 +
vue/src/components/PuzzleVerify/index.js | 2 +
vue/src/components/PuzzleVerify/style.scss | 2 +
vue/src/components/SearchForm/index.vue | 23 +-
vue/src/components/SignautreBoard/index.js | 2 +
vue/src/components/Skeleton/PageSkeleton.vue | 2 +
vue/src/components/UploadFile/index.vue | 46 ++-
vue/src/components/UploadFile/style.scss | 2 +
vue/src/layout/components/Header.vue | 2 +
vue/src/layout/components/Main.vue | 2 +
.../Navbar/components/Breadcrumb.vue | 8 +-
vue/src/layout/components/Navbar/index.vue | 3 +-
vue/src/layout/components/Navbar/style.scss | 2 +
vue/src/layout/components/Sidebar/index.vue | 6 +
vue/src/layout/components/Sidebar/style.scss | 2 +
vue/src/layout/components/TagsView/index.vue | 5 +
vue/src/layout/components/TagsView/style.scss | 2 +
vue/src/mixins/guide/base.js | 22 +-
vue/src/mixins/guide/data/index.js | 31 --
vue/src/mixins/guide/data/navbar.js | 15 -
vue/src/mixins/guide/index.js | 2 +-
vue/src/plugin/live2d/index.js | 291 ++++++++++++++++++
vue/src/router/constant/index.js | 4 +-
vue/src/router/index.js | 15 +-
vue/src/router/util.js | 3 +-
vue/src/store/modules/iframe.js | 4 +-
vue/src/store/modules/tagsView.js | 6 +-
vue/src/utils/browser.js | 36 +++
vue/src/utils/excel/xlsx.js | 2 +-
vue/src/utils/index.js | 2 +-
vue/src/utils/math.js | 2 +-
vue/src/views/app/login/style.scss | 2 +
.../example/components/skeletonExample.vue | 2 +
vue/src/views/example/cool/l2d.vue | 81 +----
.../components/ImageCompressTest.vue | 11 +-
vue/src/views/stock/current/DetailDialog.vue | 2 +
.../system/role/components/RoleResource.vue | 2 +
vue/src/views/system/supplier/EditDialog.vue | 3 +-
vue/src/views/system/supplier/index.vue | 3 +-
.../views/userCenter/components/Avatar.vue | 4 +-
vue/vue.config.js | 4 +-
51 files changed, 524 insertions(+), 548 deletions(-)
rename vue/public/static/img/fileType/{xlsx.png => xls.png} (100%)
delete mode 100644 vue/public/static/live2d/waifu-tips.js
delete mode 100644 vue/src/mixins/guide/data/index.js
create mode 100644 vue/src/plugin/live2d/index.js
diff --git a/vue/public/static/img/fileType/xlsx.png b/vue/public/static/img/fileType/xls.png
similarity index 100%
rename from vue/public/static/img/fileType/xlsx.png
rename to vue/public/static/img/fileType/xls.png
diff --git a/vue/public/static/live2d/waifu-tips.js b/vue/public/static/live2d/waifu-tips.js
deleted file mode 100644
index eadf4e8..0000000
--- a/vue/public/static/live2d/waifu-tips.js
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Live2D Widget
- * https://github.com/stevenjoezhang/live2d-widget
- */
-
-function initWidget(waifuPath = "/waifu-tips.json", apiPath = "") {
- sessionStorage.removeItem("waifu-text")
- document.body.insertAdjacentHTML("beforeend",
- `
`)
- setTimeout(() => {
- document.getElementById("waifu").style.bottom = 0
- }, 0)
-
- function registerEventListener() {
- document.querySelector("#waifu-tool .el-icon-s-promotion").addEventListener("click", () => {
- if (window.Asteroids) {
- if (!window.ASTEROIDSPLAYERS) window.ASTEROIDSPLAYERS = []
- window.ASTEROIDSPLAYERS.push(new Asteroids())
- }
- else {
- var script = document.createElement("script")
- script.src = "https://cdn.jsdelivr.net/gh/GalaxyMimi/CDN/asteroids.js"
- document.head.appendChild(script)
- }
- })
- document.querySelector("#waifu-tool .el-icon-refresh").addEventListener("click", loadOtherModel)
- document.querySelector("#waifu-tool .el-icon-s-operation").addEventListener("click", loadRandModel)
- document.querySelector("#waifu-tool .el-icon-camera").addEventListener("click", () => {
- showMessage("照好了嘛,是不是很可爱呢?", 6000, 9)
- Live2D.captureName = "photo.png"
- Live2D.captureFrame = true
- })
- document.querySelector("#waifu-tool .el-icon-switch-button").addEventListener("click", exit)
- var devtools = () => ({})
- console.log("%c", devtools)
- devtools.toString = () => {
- showMessage("哈哈,你打开了控制台,是想要看看我的小秘密吗?", 6000, 9)
- }
- window.addEventListener("visibilitychange", () => {
- if (!document.hidden) showMessage("哇,你终于回来了~", 6000, 9)
- })
- }
-
- registerEventListener()
-
- function welcomeMessage() {
- let text
- if (location.pathname === "/") { // 如果是主页
- let now = new Date().getHours()
- if (now > 5 && now <= 7) text = "早上好!一日之计在于晨,美好的一天就要开始了。"
- else if (now > 7 && now <= 11) text = "上午好!工作顺利嘛,不要久坐,多起来走动走动哦!"
- else if (now > 11 && now <= 13) text = "中午了,工作了一个上午,现在是午餐时间!"
- else if (now > 13 && now <= 17) text = "午后很容易犯困呢,今天的运动目标完成了吗?"
- else if (now > 17 && now <= 19) text = "傍晚了!窗外夕阳的景色很美丽呢,最美不过夕阳红~"
- else if (now > 19 && now <= 21) text = "晚上好,今天过得怎么样?"
- else if (now > 21 && now <= 23) text = ["已经这么晚了呀,早点休息吧,晚安~", "深夜时要爱护眼睛呀!"]
- else text = "你是夜猫子呀?这么晚还不睡觉,明天起的来嘛?"
- }
- else if (document.referrer !== "") {
- let referrer = new URL(document.referrer),
- domain = referrer.hostname.split(".")[1]
- if (location.hostname === referrer.hostname) text = `欢迎阅读「${document.title.split(" - ")[0]}」`
- else if (domain === "baidu") text = `Hello!来自 百度搜索 的朋友
你是搜索 ${referrer.search.split("&wd=")[1].split("&")[0]} 找到的我吗?`
- else if (domain === "so") text = `Hello!来自 360搜索 的朋友
你是搜索 ${referrer.search.split("&q=")[1].split("&")[0]} 找到的我吗?`
- else if (domain === "google") text = `Hello!来自 谷歌搜索 的朋友
欢迎阅读「${document.title.split(" - ")[0]}」`
- else text = `Hello!来自 ${referrer.hostname} 的朋友`
- }
- else {
- text = `欢迎阅读「${document.title.split(" - ")[0]}」`
- }
- showMessage(text, 7000, 8)
- }
-
- welcomeMessage()
-
- // 检测用户活动状态,并在空闲时显示消息
- var userAction = false,
- userActionTimer = null,
- messageTimer = null,
- messageArray = ["好久不见,日子过得好快呢……", "大坏蛋!你都多久没理人家了呀,嘤嘤嘤~", "嗨~快来逗我玩吧!", "拿小拳拳锤你胸口!", "记得把小家加入 Adblock 白名单哦!"]
- window.addEventListener("mousemove", () => userAction = true)
- window.addEventListener("keydown", () => userAction = true)
- setInterval(() => {
- if (userAction) {
- userAction = false
- clearInterval(userActionTimer)
- userActionTimer = null
- }
- else if (!userActionTimer) {
- userActionTimer = setInterval(() => {
- showMessage(messageArray[Math.floor(Math.random() * messageArray.length)], 6000, 9)
- }, 20000)
- }
- }, 1000)
-
- function initModel() {
- let modelId = localStorage.getItem("modelId"),
- modelTexturesId = localStorage.getItem("modelTexturesId")
- if (modelId == null) {
- // 首次访问加载 指定模型 的 指定材质
- modelId = 1 // 模型 ID
- modelTexturesId = 53 // 材质 ID
- }
- loadModel(modelId, modelTexturesId)
- fetch(waifuPath)
- .then(response => response.json())
- .then(result => {
- result.mouseover.forEach(tips => {
- window.addEventListener("mouseover", event => {
- if (!event.target.matches(tips.selector)) return
- var text = Array.isArray(tips.text) ? tips.text[Math.floor(Math.random() * tips.text.length)] : tips.text
- text = text.replace("{text}", event.target.innerText)
- showMessage(text, 4000, 8)
- })
- })
- result.click.forEach(tips => {
- window.addEventListener("click", event => {
- if (!event.target.matches(tips.selector)) return
- var text = Array.isArray(tips.text) ? tips.text[Math.floor(Math.random() * tips.text.length)] : tips.text
- text = text.replace("{text}", event.target.innerText)
- showMessage(text, 4000, 8)
- })
- })
- result.seasons.forEach(tips => {
- var now = new Date(),
- after = tips.date.split("-")[0],
- before = tips.date.split("-")[1] || after
- if ((after.split("/")[0] <= now.getMonth() + 1 && now.getMonth() + 1 <= before.split("/")[0]) && (after.split("/")[1] <= now.getDate() && now.getDate() <= before.split("/")[1])) {
- var text = Array.isArray(tips.text) ? tips.text[Math.floor(Math.random() * tips.text.length)] : tips.text
- text = text.replace("{year}", now.getFullYear())
- //showMessage(text, 7000, true);
- messageArray.push(text)
- }
- })
- })
- }
-
- initModel()
-
- function loadModel(modelId, modelTexturesId) {
- localStorage.setItem("modelId", modelId)
- if (modelTexturesId === undefined) modelTexturesId = 0
- localStorage.setItem("modelTexturesId", modelTexturesId)
- loadlive2d("live2d", `${apiPath}/get/?id=${modelId}-${modelTexturesId}`, console.log(`Live2D 模型 ${modelId}-${modelTexturesId} 加载完成`))
- }
-
- //调用一言api
- function showHitokoto() {
- // 增加 hitokoto.cn 的 API
- fetch("https://v1.hitokoto.cn")
- .then(response => response.json())
- .then(result => {
- var text = `这句一言来自 「${result.from}」,是 ${result.creator} 在 hitokoto.cn 投稿的。`
- showMessage(result.hitokoto, 6000, 9)
- setTimeout(() => {
- showMessage(text, 4000, 9)
- }, 6000)
- })
- }
-
- //显示信息
- function showMessage(text, timeout, priority) {
- if (!text) return
- if (!sessionStorage.getItem("waifu-text") || sessionStorage.getItem("waifu-text") <= priority) {
- if (messageTimer) {
- clearTimeout(messageTimer)
- messageTimer = null
- }
- if (Array.isArray(text)) text = text[Math.floor(Math.random() * text.length)]
- sessionStorage.setItem("waifu-text", priority)
- var tips = document.getElementById("waifu-tips")
- if (!tips) return
- tips.innerHTML = text
- tips.classList.add("waifu-tips-active")
- messageTimer = setTimeout(() => {
- sessionStorage.removeItem("waifu-text")
- tips.classList.remove("waifu-tips-active")
- }, timeout)
- }
- }
-
- //换装
- function loadRandModel() {
- let modelId = localStorage.getItem("modelId"),
- modelTexturesId = localStorage.getItem("modelTexturesId")
- // 可选 "rand"(随机), "switch"(顺序)
- fetch(`${apiPath}/rand_textures/?id=${modelId}-${modelTexturesId}`)
- .then(response => response.json())
- .then(result => {
- if (result.textures.id == 1 && (modelTexturesId == 1 || modelTexturesId == 0)) showMessage("我还没有其他衣服呢!", 4000, 10)
- else showMessage("我的新衣服好看嘛?", 4000, 10)
- loadModel(modelId, result.textures.id)
- })
- }
-
- //切换其他模型
- function loadOtherModel() {
- var modelId = localStorage.getItem("modelId")
- fetch(`${apiPath}/switch/?id=${modelId}`)
- .then(response => response.json())
- .then(result => {
- loadModel(result.model.id)
- showMessage(result.model.message, 4000, 10)
- })
- }
-
- //退出
- function exit() {
- showMessage("愿你有一天能与重要的人重逢。", 2000, 11)
- const dom = document.getElementById("waifu")
- dom.style.bottom = "-500px"
- setTimeout(() => {
- // dom.style.display = "none"
- dom.remove()
- }, 3000)
- }
-}
diff --git a/vue/public/static/live2d/waifu-tips.json b/vue/public/static/live2d/waifu-tips.json
index df94cc1..2558fea 100644
--- a/vue/public/static/live2d/waifu-tips.json
+++ b/vue/public/static/live2d/waifu-tips.json
@@ -60,28 +60,6 @@
"我们,还能再见面吗……",
"哼,你会后悔的!"
]
- },
- {
- "selector": ".menu-item-search",
- "text": [
- "找不到想看的内容?搜索看看吧!",
- "在找什么东西呢,需要帮忙吗?"
- ]
- },
- {
- "selector": "#qrcode",
- "text": [
- "手机扫一下就能继续看,很方便呢~",
- "扫一扫,打开新世界的大门!"
- ]
- },
- {
- "selector": ".back-to-top",
- "text": [
- "点它就可以回到顶部啦!",
- "又回到最初的起点~",
- "要回到开始的地方么?"
- ]
}
],
"click": [
@@ -98,55 +76,5 @@
"别摸我,有什么好摸的!"
]
}
- ],
- "seasons": [
- {
- "date": "01/01",
- "text": "元旦了呢,新的一年又开始了,今年是{year}年~"
- },
- {
- "date": "02/14",
- "text": "又是一年情人节,{year}年找到对象了嘛~"
- },
- {
- "date": "03/08",
- "text": "今天是国际妇女节!"
- },
- {
- "date": "03/12",
- "text": "今天是植树节,要保护环境呀!"
- },
- {
- "date": "04/01",
- "text": "悄悄告诉你一个秘密~今天是愚人节,不要被骗了哦~"
- },
- {
- "date": "05/01",
- "text": "今天是五一劳动节,计划好假期去哪里了吗~"
- },
- {
- "date": "06/01",
- "text": "儿童节了呢,快活的时光总是短暂,要是永远长不大该多好啊…"
- },
- {
- "date": "09/03",
- "text": "中国人民抗日战争胜利纪念日,铭记历史、缅怀先烈、珍爱和平、开创未来。"
- },
- {
- "date": "09/10",
- "text": "教师节,在学校要给老师问声好呀~"
- },
- {
- "date": "10/01",
- "text": "国庆节到了,为祖国母亲庆生!"
- },
- {
- "date": "11/05-11/12",
- "text": "今年的双十一是和谁一起过的呢~"
- },
- {
- "date": "12/20-12/31",
- "text": "这几天是圣诞节,主人肯定又去剁手买买买了~"
- }
]
}
diff --git a/vue/public/static/live2d/waifu.css b/vue/public/static/live2d/waifu.css
index 9d8d186..2ddeb63 100644
--- a/vue/public/static/live2d/waifu.css
+++ b/vue/public/static/live2d/waifu.css
@@ -12,12 +12,6 @@
transform: translateY(0);
}
-@media (max-width: 768px) {
- #waifu {
- display: none;
- }
-}
-
#waifu-tips {
animation: shake 50s ease-in-out 5s infinite;
background-color: rgba(236, 217, 188, .5);
diff --git a/vue/src/components/ContextMenu/ContextMenuItem.vue b/vue/src/components/ContextMenu/ContextMenuItem.vue
index dedbc1b..7268f73 100644
--- a/vue/src/components/ContextMenu/ContextMenuItem.vue
+++ b/vue/src/components/ContextMenu/ContextMenuItem.vue
@@ -5,7 +5,7 @@
functional: true,
render(h, context) {
- return h('li', context.data, context.children)
+ return
}
}
diff --git a/vue/src/components/ContextMenu/index.vue b/vue/src/components/ContextMenu/index.vue
index 9578a2b..0fdd99d 100644
--- a/vue/src/components/ContextMenu/index.vue
+++ b/vue/src/components/ContextMenu/index.vue
@@ -9,16 +9,9 @@
name: "ContextMenu",
props: {
- value: {
- type: Boolean,
- default: false
- },
- left: {
- type: Number
- },
- top: {
- type: Number
- }
+ value: Boolean,
+ left: Number,
+ top: Number
},
data() {
@@ -31,7 +24,7 @@
watch: {
value(v) {
document.body[v ? 'addEventListener' : 'removeEventListener']('click', this.closeContextMenu)
- if (v) this.$nextTick(() => this.autoAdapt())
+ if (v) this.$nextTick(this.autoAdapt)
},
left(v) {
if (!v) return
@@ -56,24 +49,22 @@
if (this.$el.offsetHeight > document.body.clientHeight - v && v > this.$el.offsetHeight) {
this.realTop = v - this.$el.offsetHeight + 'px'
}
- else {
- this.realTop = v + 'px'
- }
+ else this.realTop = v + 'px'
},
autoAdaptLeft(v) {
if (!this.value) return
if (this.$el.offsetWidth > document.body.clientWidth - v) {
this.realLeft = v - this.$el.offsetWidth + 'px'
}
- else {
- this.realLeft = v + 'px'
- }
+ else this.realLeft = v + 'px'
}
}
}