diff --git a/pages.json b/pages.json
index 16e3ae2..2e66c6a 100644
--- a/pages.json
+++ b/pages.json
@@ -1,11 +1,6 @@
{
"pages": [{
- "path": "uni_modules/yykj-tv/pages/index/index",
- "style": {
- "navigationBarTitleText": ""
- }
- },{
- "path": "uni_modules/yykj-tv/pages/home/home",
+ "path": "uni_modules/yykj-tv/pages/home/home1",
"style": {
"navigationBarTitleText": ""
}
diff --git a/uni_modules/yykj-tv/pages/home/home1.vue b/uni_modules/yykj-tv/pages/home/home1.vue
index 4ecbeb9..6ce0e4c 100644
--- a/uni_modules/yykj-tv/pages/home/home1.vue
+++ b/uni_modules/yykj-tv/pages/home/home1.vue
@@ -1,6 +1,11 @@
-
+
+ 页面加载中...
+
+ 页面加载失败
+
+
@@ -8,21 +13,67 @@
export default {
data() {
return {
- url: ''
+ url: '',
+ originalUrl: 'http://192.168.100.201',
+ loading: true,
+ loadError: false
};
},
- onLoad (options) {
- const url = 'http://192.168.100.201'
- const timestamp = new Date().getTime()
- this.url = `${url}?timestamp=${timestamp}`
- uni.onNetworkStatusChange((res) => {
- if (res.isConnected) {
- this.url = `${url}?timestamp=${timestamp}`;
- }
- })
+ onLoad(options) {
+ this.initWebView()
},
- onUnload () {
+ methods: {
+ initWebView() {
+ this.loading = true
+ this.loadError = false
+
+ const timestamp = new Date().getTime()
+ this.url = `${this.originalUrl}?timestamp=${timestamp}`
+
+ // 设置超时检测
+ setTimeout(() => {
+ if (this.loading) {
+ this.loading = false
+ this.loadError = true
+ }
+ }, 10000) // 10秒超时
+
+ uni.onNetworkStatusChange((res) => {
+ if (res.isConnected && this.loadError) {
+ this.retryLoad()
+ }
+ })
+ },
+
+ onWebViewError(e) {
+ console.error('WebView加载错误:', e)
+ this.loading = false
+ this.loadError = true
+ },
+
+ onMessage(e) {
+ // WebView内部发送的消息,可以用于确认页面加载完成
+ this.loading = false
+ this.loadError = false
+ },
+
+ retryLoad() {
+ this.initWebView()
+ }
+ },
+ onUnload() {
uni.offNetworkStatusChange()
}
}
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/unpackage/cache/wgt/__UNI__F0A98BD/app-config-service.js b/unpackage/cache/wgt/__UNI__F0A98BD/app-config-service.js
index 605611b..5c0eebd 100644
--- a/unpackage/cache/wgt/__UNI__F0A98BD/app-config-service.js
+++ b/unpackage/cache/wgt/__UNI__F0A98BD/app-config-service.js
@@ -1,8 +1,8 @@
;(function(){
let u=void 0,isReady=false,onReadyCallbacks=[],isServiceReady=false,onServiceReadyCallbacks=[];
- const __uniConfig = {"pages":[],"globalStyle":{"backgroundColor":"#F8F8F8","rpxCalcMaxDeviceWidth":1920,"rpxCalcBaseDeviceWidth":750,"navigationBar":{"backgroundColor":"#F8F8F8","titleText":"","style":"custom","type":"default","titleColor":"#000000"},"isNVue":false},"nvue":{"compiler":"uni-app","styleCompiler":"uni-app","flex-direction":"column"},"renderer":"auto","appname":"tv-pro","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":true},"compilerVersion":"3.8.12","entryPagePath":"uni_modules/yykj-tv/pages/home/home","entryPageQuery":"","realEntryPagePath":"","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000},"locales":{},"darkmode":false,"themeConfig":{}};
- const __uniRoutes = [{"path":"uni_modules/yykj-tv/pages/home/home","meta":{"isQuit":true,"isEntry":true,"navigationBar":{"titleText":"","type":"default"},"isNVue":false}}].map(uniRoute=>(uniRoute.meta.route=uniRoute.path,__uniConfig.pages.push(uniRoute.path),uniRoute.path='/'+uniRoute.path,uniRoute));
+ const __uniConfig = {"pages":[],"globalStyle":{"backgroundColor":"#F8F8F8","rpxCalcMaxDeviceWidth":1920,"rpxCalcBaseDeviceWidth":750,"navigationBar":{"backgroundColor":"#F8F8F8","titleText":"","style":"custom","type":"default","titleColor":"#000000"},"isNVue":false},"nvue":{"compiler":"uni-app","styleCompiler":"uni-app","flex-direction":"column"},"renderer":"auto","appname":"tv-pro","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":true},"compilerVersion":"3.8.12","entryPagePath":"uni_modules/yykj-tv/pages/home/home1","entryPageQuery":"","realEntryPagePath":"","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000},"locales":{},"darkmode":false,"themeConfig":{}};
+ const __uniRoutes = [{"path":"uni_modules/yykj-tv/pages/home/home1","meta":{"isQuit":true,"isEntry":true,"navigationBar":{"titleText":"","type":"default"},"isNVue":false}}].map(uniRoute=>(uniRoute.meta.route=uniRoute.path,__uniConfig.pages.push(uniRoute.path),uniRoute.path='/'+uniRoute.path,uniRoute));
__uniConfig.styles=[];//styles
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
diff --git a/unpackage/cache/wgt/__UNI__F0A98BD/app-service.js b/unpackage/cache/wgt/__UNI__F0A98BD/app-service.js
index d76217f..dcdcde1 100644
--- a/unpackage/cache/wgt/__UNI__F0A98BD/app-service.js
+++ b/unpackage/cache/wgt/__UNI__F0A98BD/app-service.js
@@ -1 +1 @@
-if("undefined"==typeof Promise||Promise.prototype.finally||(Promise.prototype.finally=function(e){const n=this.constructor;return this.then((r=>n.resolve(e()).then((()=>r))),(r=>n.resolve(e()).then((()=>{throw r}))))}),"undefined"!=typeof uni&&uni&&uni.requireGlobal){const e=uni.requireGlobal();ArrayBuffer=e.ArrayBuffer,Int8Array=e.Int8Array,Uint8Array=e.Uint8Array,Uint8ClampedArray=e.Uint8ClampedArray,Int16Array=e.Int16Array,Uint16Array=e.Uint16Array,Int32Array=e.Int32Array,Uint32Array=e.Uint32Array,Float32Array=e.Float32Array,Float64Array=e.Float64Array,BigInt64Array=e.BigInt64Array,BigUint64Array=e.BigUint64Array}uni.restoreGlobal&&uni.restoreGlobal(Vue,weex,plus,setTimeout,clearTimeout,setInterval,clearInterval),function(e){"use strict";__definePage("uni_modules/yykj-tv/pages/home/home",((e,n)=>{const r=e.__vccOpts||e;for(const[t,o]of n)r[t]=o;return r})({data:()=>({url:""}),onLoad(e){const n="http://localhost:8080",r=(new Date).getTime();this.url=`${n}?timestamp=${r}`,uni.onNetworkStatusChange((e=>{e.isConnected&&(this.url=`${n}?timestamp=${r}`)}))},onUnload(){uni.offNetworkStatusChange()}},[["render",function(n,r,t,o,a,i){return e.openBlock(),e.createElementBlock("view",null,[e.createElementVNode("web-view",{src:a.url},null,8,["src"])])}]]));const n={onLaunch:function(){plus.screen.lockOrientation("landscape-primary"),plus.navigator.setFullscreen(!0)},onHide:function(){!function(e,n,...r){uni.__log__?uni.__log__(e,n,...r):console[e].apply(console,[...r,n])}("log","at App.vue:10","App Hide")},onUnload(){plus.screen.lockOrientation("landscape-primary")}};const{app:r,Vuex:t,Pinia:o}={app:e.createVueApp(n)};uni.Vuex=t,uni.Pinia=o,r.provide("__globalStyles",__uniConfig.styles),r._component.mpType="app",r._component.render=()=>{},r.mount("#app")}(Vue);
+if("undefined"==typeof Promise||Promise.prototype.finally||(Promise.prototype.finally=function(e){const r=this.constructor;return this.then((o=>r.resolve(e()).then((()=>o))),(o=>r.resolve(e()).then((()=>{throw o}))))}),"undefined"!=typeof uni&&uni&&uni.requireGlobal){const e=uni.requireGlobal();ArrayBuffer=e.ArrayBuffer,Int8Array=e.Int8Array,Uint8Array=e.Uint8Array,Uint8ClampedArray=e.Uint8ClampedArray,Int16Array=e.Int16Array,Uint16Array=e.Uint16Array,Int32Array=e.Int32Array,Uint32Array=e.Uint32Array,Float32Array=e.Float32Array,Float64Array=e.Float64Array,BigInt64Array=e.BigInt64Array,BigUint64Array=e.BigUint64Array}uni.restoreGlobal&&uni.restoreGlobal(Vue,weex,plus,setTimeout,clearTimeout,setInterval,clearInterval),function(e){"use strict";function r(e,r,...o){uni.__log__?uni.__log__(e,r,...o):console[e].apply(console,[...o,r])}__definePage("uni_modules/yykj-tv/pages/home/home1",((e,r)=>{const o=e.__vccOpts||e;for(const[n,t]of r)o[n]=t;return o})({data:()=>({url:"",originalUrl:"http://192.168.100.201",loading:!0,loadError:!1}),onLoad(e){this.initWebView()},methods:{initWebView(){this.loading=!0,this.loadError=!1;const e=(new Date).getTime();this.url=`${this.originalUrl}?timestamp=${e}`,setTimeout((()=>{this.loading&&(this.loading=!1,this.loadError=!0)}),1e4),uni.onNetworkStatusChange((e=>{e.isConnected&&this.loadError&&this.retryLoad()}))},onWebViewError(e){r("error","at uni_modules/yykj-tv/pages/home/home1.vue:49","WebView加载错误:",e),this.loading=!1,this.loadError=!0},onMessage(e){this.loading=!1,this.loadError=!1},retryLoad(){this.initWebView()}},onUnload(){uni.offNetworkStatusChange()}},[["render",function(r,o,n,t,i,a){return e.openBlock(),e.createElementBlock("view",null,[e.createElementVNode("web-view",{src:i.url,"on:onPostMessage":o[0]||(o[0]=(...e)=>a.onMessage&&a.onMessage(...e)),onError:o[1]||(o[1]=(...e)=>a.onWebViewError&&a.onWebViewError(...e))},null,40,["src"]),i.loading?(e.openBlock(),e.createElementBlock("view",{key:0,class:"loading"},"页面加载中...")):e.createCommentVNode("",!0),i.loadError?(e.openBlock(),e.createElementBlock("view",{key:1,class:"error"},[e.createTextVNode(" 页面加载失败 "),e.createElementVNode("button",{onClick:o[2]||(o[2]=(...e)=>a.retryLoad&&a.retryLoad(...e))},"重新加载")])):e.createCommentVNode("",!0)])}]]));const o={onLaunch:function(){plus.screen.lockOrientation("landscape-primary"),plus.navigator.setFullscreen(!0)},onHide:function(){r("log","at App.vue:10","App Hide")},onUnload(){plus.screen.lockOrientation("landscape-primary")}};const{app:n,Vuex:t,Pinia:i}={app:e.createVueApp(o)};uni.Vuex=t,uni.Pinia=i,n.provide("__globalStyles",__uniConfig.styles),n._component.mpType="app",n._component.render=()=>{},n.mount("#app")}(Vue);
diff --git a/unpackage/cache/wgt/__UNI__F0A98BD/uni_modules/yykj-tv/pages/home/home.css b/unpackage/cache/wgt/__UNI__F0A98BD/uni_modules/yykj-tv/pages/home/home.css
deleted file mode 100644
index e69de29..0000000
diff --git a/unpackage/dist/build/app-plus/app-config-service.js b/unpackage/dist/build/app-plus/app-config-service.js
index 605611b..5c0eebd 100644
--- a/unpackage/dist/build/app-plus/app-config-service.js
+++ b/unpackage/dist/build/app-plus/app-config-service.js
@@ -1,8 +1,8 @@
;(function(){
let u=void 0,isReady=false,onReadyCallbacks=[],isServiceReady=false,onServiceReadyCallbacks=[];
- const __uniConfig = {"pages":[],"globalStyle":{"backgroundColor":"#F8F8F8","rpxCalcMaxDeviceWidth":1920,"rpxCalcBaseDeviceWidth":750,"navigationBar":{"backgroundColor":"#F8F8F8","titleText":"","style":"custom","type":"default","titleColor":"#000000"},"isNVue":false},"nvue":{"compiler":"uni-app","styleCompiler":"uni-app","flex-direction":"column"},"renderer":"auto","appname":"tv-pro","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":true},"compilerVersion":"3.8.12","entryPagePath":"uni_modules/yykj-tv/pages/home/home","entryPageQuery":"","realEntryPagePath":"","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000},"locales":{},"darkmode":false,"themeConfig":{}};
- const __uniRoutes = [{"path":"uni_modules/yykj-tv/pages/home/home","meta":{"isQuit":true,"isEntry":true,"navigationBar":{"titleText":"","type":"default"},"isNVue":false}}].map(uniRoute=>(uniRoute.meta.route=uniRoute.path,__uniConfig.pages.push(uniRoute.path),uniRoute.path='/'+uniRoute.path,uniRoute));
+ const __uniConfig = {"pages":[],"globalStyle":{"backgroundColor":"#F8F8F8","rpxCalcMaxDeviceWidth":1920,"rpxCalcBaseDeviceWidth":750,"navigationBar":{"backgroundColor":"#F8F8F8","titleText":"","style":"custom","type":"default","titleColor":"#000000"},"isNVue":false},"nvue":{"compiler":"uni-app","styleCompiler":"uni-app","flex-direction":"column"},"renderer":"auto","appname":"tv-pro","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":true},"compilerVersion":"3.8.12","entryPagePath":"uni_modules/yykj-tv/pages/home/home1","entryPageQuery":"","realEntryPagePath":"","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000},"locales":{},"darkmode":false,"themeConfig":{}};
+ const __uniRoutes = [{"path":"uni_modules/yykj-tv/pages/home/home1","meta":{"isQuit":true,"isEntry":true,"navigationBar":{"titleText":"","type":"default"},"isNVue":false}}].map(uniRoute=>(uniRoute.meta.route=uniRoute.path,__uniConfig.pages.push(uniRoute.path),uniRoute.path='/'+uniRoute.path,uniRoute));
__uniConfig.styles=[];//styles
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
diff --git a/unpackage/dist/build/app-plus/app-service.js b/unpackage/dist/build/app-plus/app-service.js
index d76217f..dcdcde1 100644
--- a/unpackage/dist/build/app-plus/app-service.js
+++ b/unpackage/dist/build/app-plus/app-service.js
@@ -1 +1 @@
-if("undefined"==typeof Promise||Promise.prototype.finally||(Promise.prototype.finally=function(e){const n=this.constructor;return this.then((r=>n.resolve(e()).then((()=>r))),(r=>n.resolve(e()).then((()=>{throw r}))))}),"undefined"!=typeof uni&&uni&&uni.requireGlobal){const e=uni.requireGlobal();ArrayBuffer=e.ArrayBuffer,Int8Array=e.Int8Array,Uint8Array=e.Uint8Array,Uint8ClampedArray=e.Uint8ClampedArray,Int16Array=e.Int16Array,Uint16Array=e.Uint16Array,Int32Array=e.Int32Array,Uint32Array=e.Uint32Array,Float32Array=e.Float32Array,Float64Array=e.Float64Array,BigInt64Array=e.BigInt64Array,BigUint64Array=e.BigUint64Array}uni.restoreGlobal&&uni.restoreGlobal(Vue,weex,plus,setTimeout,clearTimeout,setInterval,clearInterval),function(e){"use strict";__definePage("uni_modules/yykj-tv/pages/home/home",((e,n)=>{const r=e.__vccOpts||e;for(const[t,o]of n)r[t]=o;return r})({data:()=>({url:""}),onLoad(e){const n="http://localhost:8080",r=(new Date).getTime();this.url=`${n}?timestamp=${r}`,uni.onNetworkStatusChange((e=>{e.isConnected&&(this.url=`${n}?timestamp=${r}`)}))},onUnload(){uni.offNetworkStatusChange()}},[["render",function(n,r,t,o,a,i){return e.openBlock(),e.createElementBlock("view",null,[e.createElementVNode("web-view",{src:a.url},null,8,["src"])])}]]));const n={onLaunch:function(){plus.screen.lockOrientation("landscape-primary"),plus.navigator.setFullscreen(!0)},onHide:function(){!function(e,n,...r){uni.__log__?uni.__log__(e,n,...r):console[e].apply(console,[...r,n])}("log","at App.vue:10","App Hide")},onUnload(){plus.screen.lockOrientation("landscape-primary")}};const{app:r,Vuex:t,Pinia:o}={app:e.createVueApp(n)};uni.Vuex=t,uni.Pinia=o,r.provide("__globalStyles",__uniConfig.styles),r._component.mpType="app",r._component.render=()=>{},r.mount("#app")}(Vue);
+if("undefined"==typeof Promise||Promise.prototype.finally||(Promise.prototype.finally=function(e){const r=this.constructor;return this.then((o=>r.resolve(e()).then((()=>o))),(o=>r.resolve(e()).then((()=>{throw o}))))}),"undefined"!=typeof uni&&uni&&uni.requireGlobal){const e=uni.requireGlobal();ArrayBuffer=e.ArrayBuffer,Int8Array=e.Int8Array,Uint8Array=e.Uint8Array,Uint8ClampedArray=e.Uint8ClampedArray,Int16Array=e.Int16Array,Uint16Array=e.Uint16Array,Int32Array=e.Int32Array,Uint32Array=e.Uint32Array,Float32Array=e.Float32Array,Float64Array=e.Float64Array,BigInt64Array=e.BigInt64Array,BigUint64Array=e.BigUint64Array}uni.restoreGlobal&&uni.restoreGlobal(Vue,weex,plus,setTimeout,clearTimeout,setInterval,clearInterval),function(e){"use strict";function r(e,r,...o){uni.__log__?uni.__log__(e,r,...o):console[e].apply(console,[...o,r])}__definePage("uni_modules/yykj-tv/pages/home/home1",((e,r)=>{const o=e.__vccOpts||e;for(const[n,t]of r)o[n]=t;return o})({data:()=>({url:"",originalUrl:"http://192.168.100.201",loading:!0,loadError:!1}),onLoad(e){this.initWebView()},methods:{initWebView(){this.loading=!0,this.loadError=!1;const e=(new Date).getTime();this.url=`${this.originalUrl}?timestamp=${e}`,setTimeout((()=>{this.loading&&(this.loading=!1,this.loadError=!0)}),1e4),uni.onNetworkStatusChange((e=>{e.isConnected&&this.loadError&&this.retryLoad()}))},onWebViewError(e){r("error","at uni_modules/yykj-tv/pages/home/home1.vue:49","WebView加载错误:",e),this.loading=!1,this.loadError=!0},onMessage(e){this.loading=!1,this.loadError=!1},retryLoad(){this.initWebView()}},onUnload(){uni.offNetworkStatusChange()}},[["render",function(r,o,n,t,i,a){return e.openBlock(),e.createElementBlock("view",null,[e.createElementVNode("web-view",{src:i.url,"on:onPostMessage":o[0]||(o[0]=(...e)=>a.onMessage&&a.onMessage(...e)),onError:o[1]||(o[1]=(...e)=>a.onWebViewError&&a.onWebViewError(...e))},null,40,["src"]),i.loading?(e.openBlock(),e.createElementBlock("view",{key:0,class:"loading"},"页面加载中...")):e.createCommentVNode("",!0),i.loadError?(e.openBlock(),e.createElementBlock("view",{key:1,class:"error"},[e.createTextVNode(" 页面加载失败 "),e.createElementVNode("button",{onClick:o[2]||(o[2]=(...e)=>a.retryLoad&&a.retryLoad(...e))},"重新加载")])):e.createCommentVNode("",!0)])}]]));const o={onLaunch:function(){plus.screen.lockOrientation("landscape-primary"),plus.navigator.setFullscreen(!0)},onHide:function(){r("log","at App.vue:10","App Hide")},onUnload(){plus.screen.lockOrientation("landscape-primary")}};const{app:n,Vuex:t,Pinia:i}={app:e.createVueApp(o)};uni.Vuex=t,uni.Pinia=i,n.provide("__globalStyles",__uniConfig.styles),n._component.mpType="app",n._component.render=()=>{},n.mount("#app")}(Vue);
diff --git a/unpackage/dist/build/app-plus/uni_modules/yykj-tv/pages/home/home.css b/unpackage/dist/build/app-plus/uni_modules/yykj-tv/pages/home/home.css
deleted file mode 100644
index e69de29..0000000