diff --git a/README.md b/README.md index 10c9c12..69e5bd2 100644 --- a/README.md +++ b/README.md @@ -3,25 +3,16 @@ ### 1. 开发 -克隆此仓库,然后运行: +克隆此仓库,然后在`Aiot IDE`中打开它,按照IDE的提示配置环境后就可以开始开发了 -``` -npm install -npm run start -``` +对于Aiot IDE的安装,推荐参阅:[https://www.projcora.club/OpenWearWiki/vela-developer-guide.html#preparing](https://www.projcora.club/OpenWearWiki/vela-developer-guide.html#preparing) -### 2. 构建 +### 2. 模拟器运行注意事项 +模拟器和真机环境环境归根结底还是有所不同,部分功能的效果在模拟器和真机上的区别也不是可以忽略的,甚至可以直接影响到程序逻辑 -``` -npm run build -npm run release -``` +因此,我们设置了一个叫`emu_mode`的变量,当它为true时,部分检测功能(如网络类型判定)会被禁用,只有这样,应用才能正常在模拟器下运行,否则将会产生误判导致出现异常。 -### 3. 调试 - -``` -npm run watch -``` +所以,在使用模拟器开发的过程中,请到`src/app.ux`中的`script`标签下的`emu_mode`变量设置为true,***但是请千万不要忘记,打要装到真机上的rpk包时,请务必把它设置回false!*** ## 了解更多 diff --git a/dist/com.searchstars.hyperbilibili.debug.1.0.1.rpk b/dist/com.searchstars.hyperbilibili.debug.1.0.1.rpk index c7bff09..dcc86c4 100644 Binary files a/dist/com.searchstars.hyperbilibili.debug.1.0.1.rpk and b/dist/com.searchstars.hyperbilibili.debug.1.0.1.rpk differ diff --git a/src/app.ux b/src/app.ux index 39a6ccc..a275eed 100644 --- a/src/app.ux +++ b/src/app.ux @@ -2,6 +2,7 @@ import * as bilirequest_imported from './bilirequest' export default { + emu_mode: true, //发布真机版本时关闭 bilirequest: bilirequest_imported, onCreate() { console.log('app created') diff --git a/src/bilirequest.js b/src/bilirequest.js index 3e8e51d..6f211b9 100644 --- a/src/bilirequest.js +++ b/src/bilirequest.js @@ -1,7 +1,7 @@ import fetch from '@system.fetch' import file from '@system.file' import router from '@system.router' -import prompt from '@system.prompt' +import storage from '@system.storage' import { ParseSetCookie } from './tools' import { md5 } from './tinymd5' @@ -69,14 +69,31 @@ export function InitBiliWbi(wbi_img){ } export async function InitBiliBUVID3(){ - var req_homepage_ret = await SendBiliGETReturnAll("https://bilibili.com") - var headers = ParseSetCookie(req_homepage_ret.headers["Set-Cookie"]) - for (var i=0;i { + if(data != ""){ + var req_homepage_ret = await SendBiliGETReturnAll("https://bilibili.com") + var headers = ParseSetCookie(req_homepage_ret.headers["Set-Cookie"]) + for (var i=0;i { + console.log("Inited buvid3") + } + }) + } + else{ + buvid3 = data + } } - } + }) } // JumpToHomePage: bool diff --git a/src/common/icons8-error-globe-64.png b/src/common/icons8-error-globe-64.png new file mode 100644 index 0000000..b5c352b Binary files /dev/null and b/src/common/icons8-error-globe-64.png differ diff --git a/src/manifest.json b/src/manifest.json index 88c15a7..b8a9810 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -41,6 +41,9 @@ }, "pages/videodetail": { "component": "videodetail" + }, + "pages/networkerror":{ + "component": "networkerror" } } }, diff --git a/src/pages/main/main.ux b/src/pages/main/main.ux index 2a08660..5b9e7aa 100644 --- a/src/pages/main/main.ux +++ b/src/pages/main/main.ux @@ -8,6 +8,8 @@ import file from '@system.file' import router from '@system.router' import storage from '@system.storage' +import network from '@system.network' +import prompt from '@system.prompt' export default{ private: { @@ -35,22 +37,39 @@ export default{ }) }, async onReadyInit(){ - storage.get({ - key: "video_fresh_type", + network.getType({ success: (data) => { - if(data == ""){ - storage.set({ - key: "video_fresh_type", - value: "2", - success: (data) => { - console.log("Inited video_fresh_type") - this.JumpToNextPage() - } + console.log(data.type) + if(data.type === 'none' && (!this.$app.$def.emu_mode)){ + router.push({ + uri: "pages/networkerror" }) } else{ - this.JumpToNextPage() + storage.get({ + key: "video_fresh_type", + success: (data) => { + if(data == ""){ + storage.set({ + key: "video_fresh_type", + value: "2", + success: (data) => { + console.log("Inited video_fresh_type") + this.JumpToNextPage() + } + }) + } + else{ + this.JumpToNextPage() + } + } + }) } + }, + fail: (data,code) => { + prompt.showToast({ + message: "获取网络信息失败,程序异常:" + data + }) } }) }, diff --git a/src/pages/networkerror/networkerror.ux b/src/pages/networkerror/networkerror.ux new file mode 100644 index 0000000..9a62e0a --- /dev/null +++ b/src/pages/networkerror/networkerror.ux @@ -0,0 +1,46 @@ + + + + + \ No newline at end of file diff --git a/src/pages/settings/settings.ux b/src/pages/settings/settings.ux index 336af53..65602c4 100644 --- a/src/pages/settings/settings.ux +++ b/src/pages/settings/settings.ux @@ -3,7 +3,11 @@
视频推荐相关性:{{video_fresh_type}}
-
+
+ 清除storage缓存 + > +
+
退出登录 >
@@ -33,6 +37,17 @@ export default{ } }) }, + ClearStorageCache(){ + storage.set({ + key: "BUVID3", + value: "", + success: (data) => { + prompt.showToast({ + message: "清除完毕" + }) + } + }) + }, Logout(){ console.log("logout") file.delete({