new feature: 支持自定义起始页面

This commit is contained in:
Searchstars
2025-03-23 10:35:13 +08:00
parent 2fb5d9aacd
commit 8d113584af
9 changed files with 100 additions and 68 deletions
+1 -1
View File
@@ -7,7 +7,7 @@
},
"license": "GPL-3.0-only",
"scripts": {
"start": "aiot server --watch --open-nuttx --enable-protobuf true",
"start": "aiot server --watch --open-nuttx",
"build": "aiot build --enable-jsc --enable-protobuf",
"release": "aiot release --enable-jsc --enable-protobuf --enable-image-png8",
"watch": "aiot watch --open-nuttx",
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

+12 -12
View File
@@ -4,10 +4,9 @@
<div class="vid">
<div class="loadedbox" @click="OpenVideo(video.bvid)" if="{{loadComp}}">
<div style="{{vidinfo_style}}" class="vidinfo">
<div class="vidpicture" style="{{vidpicture_style}}">
<online-image width="{{vidpicture_style['max-width']}}" height="{{vidpicture_style['max-height']}}"
lock-size="true" border-radius="30px" object-fit="cover" loading-anim="true"
src="{{video.pic}}@{{onlineimg_width}}w_{{onlineimg_height}}h"></online-image>
<div class="vidpicture">
<image class="vidpicture_img" style="width: {{vidpicture_style.width}} height: {{vidpicture_style.height}}"
src="{{video.pic}}@{{onlineimg_width}}w_{{onlineimg_height}}h"></image>
</div>
<text class="vidtitle" if="{{!useColumnTitle}}">{{ video.title }}</text>
</div>
@@ -34,10 +33,8 @@ export default {
data: {
useColumnTitle: false,
vidpicture_style: {
"min-width": "160px",
"min-height": "100px",
"max-width": "160px",
"max-height": "100px"
width: "160px",
height: "100px"
},
onlineimg_width: "160",
onlineimg_height: "100",
@@ -56,10 +53,8 @@ export default {
},
// 在线图片展示大小(UI层)
SetOnlineImageSize(width, height) {
this.vidpicture_style["min-width"] = width + "px"
this.vidpicture_style["max-width"] = width + "px"
this.vidpicture_style["min-height"] = height + "px"
this.vidpicture_style["max-height"] = height + "px"
this.vidpicture_style["width"] = width + "px"
this.vidpicture_style["height"] = height + "px"
},
// 在线图片加载大小(组件层)
// 使用比展示大小更小的加载大小可以节省设备RAM、降低渲染压力、节省流量等
@@ -142,6 +137,11 @@ export default {
align-items: center;
}
.vidpicture_img {
border-radius: 30px;
object-fit: scale-down;
}
.vidtitle {
padding-left: 20px;
width: 145px;
+1
View File
@@ -114,6 +114,7 @@
"videoPushRelevance": "Video Recommendation Relevance",
"videoPushCount": "Number of Recommended Videos on Homepage",
"enableFullAnimation": "Enable Full Animation",
"startupPage": "Startup Page",
"clearTemp": "Clear Cache",
"logOut": "Log Out",
"donation": "Donate",
+1
View File
@@ -116,6 +116,7 @@
"videoPushRelevance": "视频推荐相关性",
"videoPushCount": "首页视频推荐数",
"enableFullAnimation": "启用完整动画",
"startupPage": "起始页面",
"clearTemp": "清除缓存",
"logOut": "退出登录",
"donation": "捐赠",
+20 -3
View File
@@ -20,9 +20,26 @@ export default {
},
async PreLogin() {
await global.biliclient.login(false, null)
router.replace({
uri: "pages/app/features/main"
})
switch (global.settings.SETTINGS.startupPage) {
case "主页":
router.replace({
uri: "pages/app/features/main"
})
break;
case "私信":
router.replace({
uri: "pages/app/features/mypage"
})
router.push({
uri: "pages/message/dmlist"
})
break;
case "菜单":
router.replace({
uri: "pages/app/arealist"
})
break;
}
},
ReLogin(){
global.biliclient.logOut()
+63 -52
View File
@@ -5,21 +5,26 @@
<scroll class="scroll {{scrclass}}" scroll-y="true" bounces="true">
<switch-bar title="settings.title"></switch-bar>
<img src="/common/settings_version.png" @click="GoAbout"></img>
<div class="setbase" onclick="ClickCountSet(countset_name[0])">
<div class="setbase" onclick="ClickCountSet('fresh_type')">
<image class="seticon" src="/common/settings_freshtype.png"></image>
<text class="setext_small">{{ $t("settings.videoPushRelevance") }}</text>
<text class="countset_num">{{ fresh_type }}</text>
</div>
<div class="setbase" onclick="ClickCountSet(countset_name[1])">
<div class="setbase" onclick="ClickCountSet('home_vid_count')">
<image class="seticon" src="/common/settings_homevidcount.png"></image>
<text class="setext_small">{{ $t("settings.videoPushCount") }}</text>
<text class="countset_num">{{ home_vid_count }}</text>
</div>
<div class="setbase" onclick="SwitchSet(switchset_name[0])">
<div class="setbase" onclick="SwitchSet('enable_full_anim')">
<image class="seticon" src="/common/settings_enablefullanim.png"></image>
<text class="setext_small">{{ $t("settings.enableFullAnimation") }}</text>
<text class="countset_num">{{ enableFullAnimation ? "开" : "关" }}</text>
</div>
<div class="setbase" onclick="ItemsChangeSet('startup_page')">
<image class="seticon" src="/common/settings_startuppage.png"></image>
<text class="setext_small">{{ $t("settings.startupPage") }}</text>
<text class="countset_num">{{ startupPage }}</text>
</div>
<div class="setbase" @click="ClearTmp()">
<image class="seticon" src="/common/settings_removetmp.png"></image>
<text class="setext_small">{{ $t("settings.clearTemp") }}</text>
@@ -59,8 +64,7 @@ export default {
fresh_type: 3,
home_vid_count: 10,
enableFullAnimation: false,
switchset_name: ["enable_full_anim"],
countset_name: ["fresh_type", "home_vid_count"],
startupPage: "主页",
countset: {
fresh_type_max: 3,
fresh_type_min: 1,
@@ -90,56 +94,62 @@ export default {
})
},
SwitchSet(name) {
switch (name) {
case "enable_full_anim":
if (this.enableFullAnimation) {
this.enableFullAnimation = false
global.settings.saveSettings({
enableFullAnimation: this.enableFullAnimation
})
} else {
this.enableFullAnimation = true
global.settings.saveSettings({
enableFullAnimation: this.enableFullAnimation
})
prompt.showToast({
message: "开启此选项会导致首页等页面在低性能设备上严重卡顿,因此建议保持关闭!",
duration: 6000
})
}
this.UpdateNumView()
if (name === "enable_full_anim") {
this.enableFullAnimation = !this.enableFullAnimation;
global.settings.saveSettings({ enableFullAnimation: this.enableFullAnimation });
if (this.enableFullAnimation) {
prompt.showToast({
message: "开启此选项会导致首页等页面在低性能设备上严重卡顿,因此建议保持关闭!",
duration: 6000
});
}
this.UpdateNumView();
}
},
ClickCountSet(name) {
switch (name) {
case "fresh_type":
var new_fresh_type = null
if (this.fresh_type < this.countset.fresh_type_max) {
new_fresh_type = this.fresh_type + 1
} else {
new_fresh_type = this.countset.fresh_type_min
}
global.settings.saveSettings({
fresh_type: new_fresh_type
})
setTimeout(() => {
this.UpdateNumView()
}, 100)
break
case "home_vid_count":
var new_home_vid_count = null
if (this.home_vid_count < this.countset.home_vid_count_max) {
new_home_vid_count = this.home_vid_count + 1
} else {
new_home_vid_count = this.countset.home_vid_count_min
}
global.settings.saveSettings({
home_vid_count: new_home_vid_count
})
setTimeout(() => {
this.UpdateNumView()
}, 100)
break
const mapping = {
"fresh_type": {
current: this.fresh_type,
max: this.countset.fresh_type_max,
min: this.countset.fresh_type_min,
key: "fresh_type"
},
"home_vid_count": {
current: this.home_vid_count,
max: this.countset.home_vid_count_max,
min: this.countset.home_vid_count_min,
key: "home_vid_count"
}
};
if (mapping[name]) {
const { current, max, min, key } = mapping[name];
const newValue = current < max ? current + 1 : min;
global.settings.saveSettings({ [key]: newValue });
// 延时更新视图
setTimeout(() => {
this.UpdateNumView();
}, 100);
}
},
ItemsChangeSet(name) {
if (name === "startup_page") {
const pages = ["主页", "私信", "菜单"];
// 新建变量 startupPage 用于存储当前启动页状态,若未初始化则默认取 "主页"
if (!this.startupPage) {
this.startupPage = pages[0];
} else {
// 获取当前 startupPage 在 pages 数组中的索引,然后切换到下一个项(循环)
let index = pages.indexOf(this.startupPage);
index = (index + 1) % pages.length;
this.startupPage = pages[index];
}
global.settings.saveSettings({
startupPage: this.startupPage
});
this.UpdateNumView();
}
},
logout() {
@@ -153,6 +163,7 @@ export default {
this.fresh_type = global.settings.SETTINGS.fresh_type
this.home_vid_count = global.settings.SETTINGS.home_vid_count
this.enableFullAnimation = global.settings.SETTINGS.enableFullAnimation
this.startupPage = global.settings.SETTINGS.startupPage
},
onInit() {
this.UpdateNumView()
+2
View File
@@ -6,6 +6,7 @@ interface SettingsInterface {
// 专栏articleshow的每页dom节点裁切数量(单页最大dom数)
article_split_dom_count: number;
enableFullAnimation: boolean;
startupPage: string;
// 下面的设置项将不在设置页面中展示
agreedAllAgreements: boolean;
@@ -20,6 +21,7 @@ export let SETTINGS: SettingsInterface = {
home_vid_count: 10,
article_split_dom_count: 9999,
enableFullAnimation: false,
startupPage: "主页",
agreedAllAgreements: false, // 是否已同意所有协议(用户协议 隐私协议 etc.)
enableUserTracker: true,