提交 f69dbe5d 编写于 作者: Mr.奇淼('s avatar Mr.奇淼(

局部更新和自动打开文档

上级 21a173f7
/*
商用代码公司自用产品无需授权
若作为代码出售的产品(任何涉及代码交付第三方作为后续开发)必须保留此脚本
或标注原作者信息
否则将依法维权
*/
var child_process = require("child_process");
var url = "https://www.gin-vue-admin.com",
cmd = '';
console.log(process.platform)
switch (process.platform) {
case 'win32':
cmd = 'start';
child_process.exec(cmd + ' ' + url);
break;
case 'darwin':
cmd = 'open';
child_process.exec(cmd + ' ' + url);
break;
}
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "node openDocument.js && vue-cli-service serve",
"build": "vue-cli-service build", "build": "vue-cli-service build",
"lint": "vue-cli-service lint" "lint": "vue-cli-service lint"
}, },
......
...@@ -54,7 +54,7 @@ auth(Vue) ...@@ -54,7 +54,7 @@ auth(Vue)
import uploader from 'vue-simple-uploader' import uploader from 'vue-simple-uploader'
Vue.use(uploader) Vue.use(uploader)
new Vue({ export default new Vue({
render: h => h(App), render: h => h(App),
router, router,
store store
......
import axios from 'axios'; // 引入axios import axios from 'axios'; // 引入axios
import { Message, Loading } from 'element-ui'; import { Message } from 'element-ui';
import { store } from '@/store/index' import { store } from '@/store/index'
import context from '@/main.js'
const service = axios.create({ const service = axios.create({
baseURL: process.env.VUE_APP_BASE_API, baseURL: process.env.VUE_APP_BASE_API,
timeout: 99999 timeout: 99999
}) })
let acitveAxios = 0 let acitveAxios = 0
let loadingInstance
let timer let timer
const showLoading = () => { const showLoading = () => {
acitveAxios++ acitveAxios++
...@@ -15,7 +15,7 @@ const showLoading = () => { ...@@ -15,7 +15,7 @@ const showLoading = () => {
} }
timer = setTimeout(() => { timer = setTimeout(() => {
if (acitveAxios > 0) { if (acitveAxios > 0) {
loadingInstance = Loading.service({ fullscreen: true }) context.$bus.emit("showLoading")
} }
}, 400); }, 400);
} }
...@@ -24,13 +24,12 @@ const closeLoading = () => { ...@@ -24,13 +24,12 @@ const closeLoading = () => {
acitveAxios-- acitveAxios--
if (acitveAxios <= 0) { if (acitveAxios <= 0) {
clearTimeout(timer) clearTimeout(timer)
loadingInstance && loadingInstance.close() context.$bus.emit("closeLoading")
} }
} }
//http request 拦截器 //http request 拦截器
service.interceptors.request.use( service.interceptors.request.use(
config => { config => {
console.log(config)
if (!config.donNotShowLoading) { if (!config.donNotShowLoading) {
showLoading() showLoading()
} }
......
...@@ -58,11 +58,11 @@ ...@@ -58,11 +58,11 @@
</transition> </transition>
<transition mode="out-in" name="el-fade-in-linear"> <transition mode="out-in" name="el-fade-in-linear">
<keep-alive> <keep-alive>
<router-view class="admin-box" v-if="$route.meta.keepAlive"></router-view> <router-view v-loading="loadingFlag" element-loading-text="正在加载中" class="admin-box" v-if="$route.meta.keepAlive"></router-view>
</keep-alive> </keep-alive>
</transition> </transition>
<transition mode="out-in" name="el-fade-in-linear"> <transition mode="out-in" name="el-fade-in-linear">
<router-view class="admin-box" v-if="!$route.meta.keepAlive"></router-view> <router-view v-loading="loadingFlag" element-loading-text="正在加载中" class="admin-box" v-if="!$route.meta.keepAlive"></router-view>
</transition> </transition>
<BottomInfo /> <BottomInfo />
</el-main> </el-main>
...@@ -106,6 +106,7 @@ export default { ...@@ -106,6 +106,7 @@ export default {
isMobile: false, isMobile: false,
isShadowBg: false, isShadowBg: false,
showPassword: false, showPassword: false,
loadingFlag:false,
pwdModify: {}, pwdModify: {},
rules: { rules: {
password: [ password: [
...@@ -209,6 +210,12 @@ export default { ...@@ -209,6 +210,12 @@ export default {
} }
this.$bus.emit('collapse', this.isCollapse) this.$bus.emit('collapse', this.isCollapse)
this.$bus.emit('mobile', this.isMobile) this.$bus.emit('mobile', this.isMobile)
this.$bus.on("showLoading",()=>{
this.loadingFlag = true
})
this.$bus.on("closeLoading",()=>{
this.loadingFlag = false
})
window.onresize = () => { window.onresize = () => {
return (() => { return (() => {
let screenWidth = document.body.clientWidth let screenWidth = document.body.clientWidth
......
...@@ -138,6 +138,7 @@ export default { ...@@ -138,6 +138,7 @@ export default {
name: "State", name: "State",
data() { data() {
return { return {
timer:null,
state: {}, state: {},
colors: [ colors: [
{ color: "#5cb87a", percentage: 20 }, { color: "#5cb87a", percentage: 20 },
...@@ -148,10 +149,14 @@ export default { ...@@ -148,10 +149,14 @@ export default {
}, },
created() { created() {
this.reload(); this.reload();
setInterval(() => { this.timer = setInterval(() => {
this.reload(); this.reload();
}, 1000*10); }, 1000*10);
}, },
beforeDestroy(){
clearInterval(this.timer)
this.timer = null
},
methods: { methods: {
async reload() { async reload() {
const { data } = await getSystemState(); const { data } = await getSystemState();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册