File tree Expand file tree Collapse file tree 6 files changed +44
-10
lines changed Expand file tree Collapse file tree 6 files changed +44
-10
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ 商用代码公司自用产品无需授权
3+ 若作为代码出售的产品(任何涉及代码交付第三方作为后续开发)必须保留此脚本
4+ 或标注原作者信息
5+ 否则将依法维权
6+ */
7+
8+ var child_process = require ( "child_process" ) ;
9+
10+ var url = "https://www.gin-vue-admin.com" ,
11+ cmd = '' ;
12+ console . log ( process . platform )
13+ switch ( process . platform ) {
14+ case 'win32' :
15+ cmd = 'start' ;
16+ child_process . exec ( cmd + ' ' + url ) ;
17+ break ;
18+
19+ case 'darwin' :
20+ cmd = 'open' ;
21+ child_process . exec ( cmd + ' ' + url ) ;
22+ break ;
23+ }
Original file line number Diff line number Diff line change 33 "version" : " 0.1.0" ,
44 "private" : true ,
55 "scripts" : {
6- "serve" : " vue-cli-service serve" ,
6+ "serve" : " node openDocument.js && vue-cli-service serve" ,
77 "build" : " vue-cli-service build" ,
88 "lint" : " vue-cli-service lint"
99 },
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ auth(Vue)
5454import uploader from 'vue-simple-uploader'
5555Vue . use ( uploader )
5656
57- new Vue ( {
57+ export default new Vue ( {
5858 render : h => h ( App ) ,
5959 router,
6060 store
Original file line number Diff line number Diff line change 11import axios from 'axios' ; // 引入axios
2- import { Message , Loading } from 'element-ui' ;
2+ import { Message } from 'element-ui' ;
33import { store } from '@/store/index'
4+ import context from '@/main.js'
45const service = axios . create ( {
56 baseURL : process . env . VUE_APP_BASE_API ,
67 timeout : 99999
78} )
89let acitveAxios = 0
9- let loadingInstance
1010let timer
1111const showLoading = ( ) => {
1212 acitveAxios ++
@@ -15,7 +15,7 @@ const showLoading = () => {
1515 }
1616 timer = setTimeout ( ( ) => {
1717 if ( acitveAxios > 0 ) {
18- loadingInstance = Loading . service ( { fullscreen : true } )
18+ context . $bus . emit ( "showLoading" )
1919 }
2020 } , 400 ) ;
2121}
@@ -24,13 +24,12 @@ const closeLoading = () => {
2424 acitveAxios --
2525 if ( acitveAxios <= 0 ) {
2626 clearTimeout ( timer )
27- loadingInstance && loadingInstance . close ( )
27+ context . $bus . emit ( "closeLoading" )
2828 }
2929 }
3030 //http request 拦截器
3131service . interceptors . request . use (
3232 config => {
33- console . log ( config )
3433 if ( ! config . donNotShowLoading ) {
3534 showLoading ( )
3635 }
Original file line number Diff line number Diff line change 5858 </transition >
5959 <transition mode =" out-in" name =" el-fade-in-linear" >
6060 <keep-alive >
61- <router-view class =" admin-box" v-if =" $route.meta.keepAlive" ></router-view >
61+ <router-view v-loading = " loadingFlag " element-loading-text = " 正在加载中 " class =" admin-box" v-if =" $route.meta.keepAlive" ></router-view >
6262 </keep-alive >
6363 </transition >
6464 <transition mode =" out-in" name =" el-fade-in-linear" >
65- <router-view class =" admin-box" v-if =" !$route.meta.keepAlive" ></router-view >
65+ <router-view v-loading = " loadingFlag " element-loading-text = " 正在加载中 " class =" admin-box" v-if =" !$route.meta.keepAlive" ></router-view >
6666 </transition >
6767 <BottomInfo />
6868 </el-main >
@@ -106,6 +106,7 @@ export default {
106106 isMobile: false ,
107107 isShadowBg: false ,
108108 showPassword: false ,
109+ loadingFlag: false ,
109110 pwdModify: {},
110111 rules: {
111112 password: [
@@ -209,6 +210,12 @@ export default {
209210 }
210211 this .$bus .emit (' collapse' , this .isCollapse )
211212 this .$bus .emit (' mobile' , this .isMobile )
213+ this .$bus .on (" showLoading" ,()=> {
214+ this .loadingFlag = true
215+ })
216+ this .$bus .on (" closeLoading" ,()=> {
217+ this .loadingFlag = false
218+ })
212219 window .onresize = () => {
213220 return (() => {
214221 let screenWidth = document .body .clientWidth
Original file line number Diff line number Diff line change @@ -138,6 +138,7 @@ export default {
138138 name: " State" ,
139139 data () {
140140 return {
141+ timer: null ,
141142 state: {},
142143 colors: [
143144 { color: " #5cb87a" , percentage: 20 },
@@ -148,10 +149,14 @@ export default {
148149 },
149150 created () {
150151 this .reload ();
151- setInterval (() => {
152+ this . timer = setInterval (() => {
152153 this .reload ();
153154 }, 1000 * 10 );
154155 },
156+ beforeDestroy (){
157+ clearInterval (this .timer )
158+ this .timer = null
159+ },
155160 methods: {
156161 async reload () {
157162 const { data } = await getSystemState ();
You can’t perform that action at this time.
0 commit comments