Skip to content

Commit 3b731d6

Browse files
committed
更新[BoxJs TF]: 可自定页面源码地址, 修复底栏事件无效、部分情况下贡献者重复加载问题
1 parent 10c0ffc commit 3b731d6

3 files changed

Lines changed: 90 additions & 113 deletions

File tree

‎box/chavy.boxjs.html‎

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,7 @@
9090
></v-system-bar>
9191
<v-app-bar v-bind="appBarBind" v-if="!box.usercfgs.isHidedSearchBar">
9292
<!-- 搜索条 -->
93-
<v-autocomplete
94-
v-bind="ui.searchBar"
95-
:label="`BoxJs - v${version}`"
96-
@click="ui.searchDialog.show = true"
97-
hide-no-data
98-
hide-details
99-
solo
100-
>
93+
<v-autocomplete v-bind="ui.searchBar" :label="title" @click="ui.searchDialog.show = true" hide-no-data hide-details solo>
10194
<template #prepend-inner>
10295
<!-- 容器切换 Surge、QuanX、Loon -->
10396
<v-menu bottom left v-if="!isLoading && isMainView">
@@ -132,14 +125,19 @@
132125
<v-btn icon dark @click="ui.searchDialog.show = false">
133126
<v-icon>mdi-chevron-left</v-icon>
134127
</v-btn>
135-
<v-text-field v-model="ui.searchBar.input" :label="`BoxJs - v${version}`" autofocus hide-details solo></v-text-field>
128+
<v-text-field v-model="ui.searchBar.input" :label="title" autofocus hide-details solo></v-text-field>
136129
<v-btn icon @click="window.open(box.syscfgs.orz3.repo)">
137130
<v-avatar size="26"><img :src="box.syscfgs.orz3.icon" /></v-avatar>
138131
</v-btn>
139132
</v-toolbar>
140133
<v-card-text class="px-0">
141134
<v-list nav>
142-
<v-list-item v-for="(app, appIdx) in searchApps" @click="ui.searchDialog.show = false, switchAppView(app.id)" dense>
135+
<v-list-item
136+
v-for="(app, appIdx) in searchApps"
137+
:key="app.id"
138+
@click="ui.searchDialog.show = false, switchAppView(app.id)"
139+
dense
140+
>
143141
<v-list-item-avatar class="elevation-3"><img :src="app.icon" /></v-list-item-avatar>
144142
<v-list-item-content>
145143
<v-list-item-title>{{`${app.name} (${app.id})`}}</v-list-item-title>
@@ -175,6 +173,7 @@
175173
</v-list-item>
176174
<v-divider></v-divider>
177175
<v-list-item class="pt-1">
176+
<v-progress-linear :active="isLoading" height="1" absolute top indeterminate></v-progress-linear>
178177
<v-row justify="start" no-gutters>
179178
<v-col v-for="(c, cIdx) in ui.contributors" cols="2" :key="c.id">
180179
<v-tooltip bottom>
@@ -415,6 +414,19 @@
415414
<v-avatar size="32"><v-icon>mdi-language-html5</v-icon></v-avatar>
416415
</v-btn>
417416
</v-list-item>
417+
<v-list-item v-if="box.usercfgs.isDebugWeb">
418+
<v-list-item-content>
419+
<v-text-field
420+
label="调试页面地址"
421+
v-model="box.usercfgs.debugger_web"
422+
hint="设置页面源码的获取地址"
423+
placeholder="http://ip:port/boxjs.html"
424+
persistent-hint
425+
@change="saveUserCfgs"
426+
>
427+
</v-text-field>
428+
</v-list-item-content>
429+
</v-list-item>
418430
<v-list-item class="mt-4"></v-list-item>
419431
</v-list>
420432
</v-navigation-drawer>
@@ -1216,6 +1228,13 @@ <h2 :class="version === ver.version ? 'primary--text' : undefined">v{{ver.versio
12161228
version() {
12171229
return this.box.syscfgs.version
12181230
},
1231+
// 标题
1232+
title() {
1233+
const isDebugWeb = this.box.usercfgs.isDebugWeb
1234+
const debugger_web = this.box.usercfgs.debugger_web
1235+
const isDebugMode = this.box.syscfgs.isDebugMode
1236+
return `BoxJs - v${this.version}${isDebugMode ? ` - ${debugger_web}` : ''}`
1237+
},
12191238
// 判断是否有新版本
12201239
hasNewVersion() {
12211240
const curver = this.box.syscfgs.version
@@ -1615,7 +1634,7 @@ <h2 :class="version === ver.version ? 'primary--text' : undefined">v{{ver.versio
16151634
'ui.naviDrawer.show': {
16161635
handler(newval, oldval) {
16171636
// 获取贡献者列表
1618-
if (newval === true && !this.box.syscfgs.contributors) {
1637+
if (_.isEmpty(this.ui.contributors)) {
16191638
this.getContributors()
16201639
}
16211640
}
@@ -1705,16 +1724,23 @@ <h2 :class="version === ver.version ? 'primary--text' : undefined">v{{ver.versio
17051724
},
17061725
// 页面返回
17071726
back() {
1708-
history.back()
1727+
if (this.view === 'bak' && !this.bfpath) {
1728+
this.path = '/#/my'
1729+
} else if (this.view === 'app' && !this.bfpath) {
1730+
this.path = '/#/app'
1731+
} else {
1732+
history.back()
1733+
}
17091734
},
17101735
// 切换当前容器环境
17111736
switchEnv(env) {
17121737
this.env = env
17131738
},
17141739
// 切换当前视图
17151740
switchView(path) {
1741+
path = `/#/${path}`
17161742
if (this.path !== path) {
1717-
this.path = `/#/${path}`
1743+
this.path = path
17181744
} else {
17191745
const scrollY = this.ui.scrollY[this.path]
17201746
const isTopY = _.isNil(scrollY) || scrollY === 0
@@ -2081,7 +2107,6 @@ <h2 :class="version === ver.version ? 'primary--text' : undefined">v{{ver.versio
20812107
// 获取仓库贡献者
20822108
getContributors() {
20832109
const url = 'https://api.github.com/repos/chavyleung/scripts/contributors'
2084-
this.box.syscfgs.contributors = []
20852110
axios.get(url).then((resp) => {
20862111
if (!resp) return
20872112
resp.data.forEach((contributor) => {

0 commit comments

Comments
 (0)