6868 < v-menu bottom left v-if ="isMainView ">
6969 < template #activator ="{ on } ">
7070 < v-btn icon v-on ="on ">
71- < v-avatar size ="26 "> < img :src ="env.icon " /> </ v-avatar >
71+ < v-avatar size ="26 "> < img :src ="env.icons[iconEnvThemeIdx] " /> </ v-avatar >
7272 </ v-btn >
7373 </ template >
7474 < v-list >
189189 label ="透明图标 "
190190 v-model ="box.usercfgs.isTransparentIcons "
191191 @change ="saveUserCfgs "
192- :disabled ="!isDarkMode "
193192 :hide-details ="isDarkMode "
194193 :persistent-hint ="true "
195194 hint ="明亮主题下强制使用彩色图标 "
204203 < v-switch
205204 dense
206205 class ="mt-0 "
207- hide-details
208- label ="隐藏悬浮图标 "
206+ label ="勿扰模式 "
207+ hint ="不再发出系统通知 (仍记日志) "
208+ persistent-hint
209+ v-model ="box.usercfgs.isMute "
210+ @change ="saveUserCfgs "
211+ > </ v-switch >
212+ < v-spacer > </ v-spacer >
213+ < v-btn fab small text >
214+ < v-avatar size ="32 "> < v-icon > mdi-volume-off</ v-icon > </ v-avatar >
215+ </ v-btn >
216+ </ v-list-item >
217+ < v-list-item class ="mt-4 ">
218+ < v-switch
219+ dense
220+ class ="mt-0 "
221+ label ="隐藏帮助按钮 "
222+ hint ="隐藏悬浮按钮中的帮忙 "
223+ persistent-hint
224+ v-model ="box.usercfgs.isHideHelp "
225+ @change ="saveUserCfgs "
226+ > </ v-switch >
227+ < v-spacer > </ v-spacer >
228+ < v-btn fab small text @click ="window.open(box.syscfgs.boxjs.repo) ">
229+ < v-avatar size ="32 "> < v-icon > mdi-help</ v-icon > </ v-avatar >
230+ </ v-btn >
231+ </ v-list-item >
232+ < v-list-item class ="mt-4 ">
233+ < v-switch
234+ dense
235+ class ="mt-0 "
236+ label ="隐藏悬浮按钮 "
237+ hint ="右下角悬浮按钮 "
238+ persistent-hint
209239 v-model ="box.usercfgs.isHideBoxIcon "
210240 @change ="saveUserCfgs "
211241 > </ v-switch >
220250 < v-switch
221251 dense
222252 class ="mt-0 "
223- hide-details
224253 label ="隐藏我的标题 "
254+ hint ="底栏`我的`二字 (只显示图标) "
255+ persistent-hint
225256 v-model ="box.usercfgs.isHideMyTitle "
226257 @change ="saveUserCfgs "
227258 > </ v-switch >
233264 < v-icon v-else size ="32 "> mdi-face-profile</ v-icon >
234265 </ v-btn >
235266 </ v-list-item >
236- < v-list-item class ="mt-4 ">
237- < v-switch dense class ="mt-0 " hide-details label ="勿扰模式 " v-model ="box.usercfgs.isMute " @change ="saveUserCfgs "> </ v-switch >
238- < v-spacer > </ v-spacer >
239- < v-btn fab small text >
240- < v-avatar size ="32 "> < v-icon > mdi-volume-off</ v-icon > </ v-avatar >
241- </ v-btn >
242- </ v-list-item >
243267 < v-list-item class ="mt-4 ">
244268 < v-switch
245269 dense
246270 class ="mt-0 "
247- hide-details
248- label ="隐藏帮助按钮 "
249- v-model ="box.usercfgs.isHideHelp "
271+ label ="隐藏刷新按钮 "
272+ hint ="双击悬浮按钮也可刷新页面 "
273+ persistent-hint
274+ v-model ="box.usercfgs.isHideRefresh "
250275 @change ="saveUserCfgs "
251276 > </ v-switch >
252277 < v-spacer > </ v-spacer >
253- < v-btn fab small text @click =" window.open(box.syscfgs.boxjs.repo) " >
254- < v-avatar size ="32 "> < v-icon > mdi-help </ v-icon > </ v-avatar >
278+ < v-btn fab small text >
279+ < v-avatar size ="32 "> < v-icon > mdi-refresh </ v-icon > </ v-avatar >
255280 </ v-btn >
256281 </ v-list-item >
257282 < v-list-item class ="mt-4 ">
258283 < v-switch
259284 dense
260285 class ="mt-0 "
261- hide-details
262- label ="隐藏刷新按钮 "
263- v-model ="box.usercfgs.isHideRefresh "
286+ label ="调试模式 (页面) "
287+ hint ="每次访问都获取最新的页面 "
288+ persistent-hint
289+ v-model ="box.usercfgs.isDebugWeb "
264290 @change ="saveUserCfgs "
265291 > </ v-switch >
266292 < v-spacer > </ v-spacer >
267293 < v-btn fab small text >
268- < v-avatar size ="32 "> < v-icon > mdi-refresh </ v-icon > </ v-avatar >
294+ < v-avatar size ="32 "> < v-icon > mdi-language-html5 </ v-icon > </ v-avatar >
269295 </ v-btn >
270296 </ v-list-item >
271297 <!-- <v-list-item class="mt-4">
@@ -675,7 +701,7 @@ <h2>{{curapp.name}}</h2>
675701 </ v-btn >
676702 </ v-subheader >
677703 < template v-for ="(sub, subIdx) in appSubs " :key ="sub.id ">
678- < v-list-item dense two-line @click ="">
704+ < v-list-item dense two-line @click ="reloadAppSub(sub) ">
679705 < v-list-item-avatar v-if ="sub.icon "> < v-img :src ="sub.icon " /> </ v-list-item-avatar >
680706 < v-list-item-avatar v-else color ="primary "> < v-icon dark > mdi-account</ v-icon > </ v-list-item-avatar >
681707 < v-list-item-content >
@@ -910,7 +936,7 @@ <h2>{{curbak.name}}</h2>
910936 < v-btn dark fab small color ="success " @click ="">
911937 < v-icon > mdi-export-variant</ v-icon >
912938 </ v-btn >
913- < v-btn dark v-if ="!box.usercfgs.isHideRefresh " fab small color ="orange " @click =" ">
939+ < v-btn dark v-if ="!box.usercfgs.isHideRefresh " fab small color ="orange " @dblclick =" window.location.reload() ">
914940 < v-icon > mdi-refresh</ v-icon >
915941 </ v-btn >
916942 </ v-speed-dial >
@@ -935,6 +961,7 @@ <h2>{{curbak.name}}</h2>
935961 data ( ) {
936962 return {
937963 ui : {
964+ isCors : false ,
938965 path : null ,
939966 bfpath : null ,
940967 view : null ,
@@ -966,6 +993,10 @@ <h2>{{curbak.name}}</h2>
966993 version ( ) {
967994 return this . box . syscfgs . version
968995 } ,
996+ // 判断是否需要跨域请求
997+ isCors ( ) {
998+ return this . ui . isCors
999+ } ,
9691000 // 判断当前是否`WebApp`
9701001 isWebApp ( ) {
9711002 return window . navigator . standalone
@@ -1038,6 +1069,13 @@ <h2>{{curbak.name}}</h2>
10381069 }
10391070 return 1
10401071 } ,
1072+ // 获取环境图标下标, 透明: 0, 彩色: 1 (默认)
1073+ iconEnvThemeIdx ( ) {
1074+ if ( this . isWebApp ) {
1075+ return this . isTransparentIcons ? 0 : 1
1076+ }
1077+ return this . iconThemeIdx
1078+ } ,
10411079 isSaveUserCfgs : {
10421080 set ( val ) {
10431081 this . ui . isSaveUserCfgs = val
@@ -1161,7 +1199,7 @@ <h2>{{curbak.name}}</h2>
11611199 watch : {
11621200 'ui.path' : {
11631201 handler ( newval , oldval ) {
1164- if ( ! this . isWebApp ) {
1202+ if ( ! this . isWebApp && ! this . isCors ) {
11651203 history . pushState ( { title : 'BoxJs' } , '' , newval )
11661204 }
11671205 const [ , view , subview ] = newval . split ( '/' )
@@ -1200,10 +1238,21 @@ <h2>{{curbak.name}}</h2>
12001238 }
12011239 } ,
12021240 async created ( ) {
1241+ // 如果 url 参数中指定的 baseURL, 则后续的请求都请求到指定的域
1242+ if ( window . location . search ) {
1243+ const [ , baseURL ] = / b a s e U R L = ( .* ?) ( & | $ ) / . exec ( window . location . search )
1244+ axios . defaults . baseURL = baseURL || ''
1245+ this . ui . isCors = true
1246+ }
12031247 // 根据路径跳转视图
1204- this . path = location . pathname
1248+ if ( ! this . isCors ) {
1249+ const path = location . pathname
1250+ this . path = path === '/' ? '/app' : path
1251+ } else {
1252+ this . path = '/app'
1253+ }
12051254 // 监听浏览器后退事件
1206- window . addEventListener ( 'popstate' , ( ) => ( this . path = location . pathname ) , false )
1255+ window . addEventListener ( 'popstate' , ( ) => ( this . path = path ) , false )
12071256 // 获取 BoxJs 数据, 取到数据再渲染页面
12081257 await axios . get ( '/query/boxdata' ) . then ( ( resp ) => ( this . box = resp . data ) )
12091258 // 获取全局备份
@@ -1223,6 +1272,8 @@ <h2>{{curbak.name}}</h2>
12231272 back ( ) {
12241273 if ( this . view === 'bak' && ! this . bfpath ) {
12251274 this . path = '/my'
1275+ } else if ( this . view === 'app' && ! this . bfpath ) {
1276+ this . path = '/app'
12261277 } else {
12271278 this . path = this . bfpath
12281279 }
@@ -1449,7 +1500,7 @@ <h2>{{curbak.name}}</h2>
14491500 const curSessions = [ { key, val } ]
14501501 const datas = [ ...session . datas , ...curSessions ]
14511502 axios
1452- . post ( '/api/save' , [ { key , val } ] )
1503+ . post ( '/api/save' , datas )
14531504 . then ( ( resp ) => {
14541505 delete resp . data . usercfgs
14551506 Object . assign ( this . box , resp . data )
@@ -1461,7 +1512,7 @@ <h2>{{curbak.name}}</h2>
14611512 this . ui . overlay . show = true
14621513 const datas = this . curapp . datas
14631514 const data = datas . find ( ( data ) => data . key === key )
1464- data . val = null
1515+ data . val = ''
14651516 axios
14661517 . post ( '/api/save' , datas )
14671518 . then ( ( resp ) => {
0 commit comments