diff --git a/src/components/PageLayout/PageLayout.vue b/src/components/PageLayout/PageLayout.vue index d11684c..c2a5947 100644 --- a/src/components/PageLayout/PageLayout.vue +++ b/src/components/PageLayout/PageLayout.vue @@ -106,6 +106,7 @@ // 只有在页面中才默认返回,弹层中不返回 if (props.type === 'page') { const pages = getCurrentPages() + console.log(router) if (props.backRouteName || props.backRoutePath) { const prevPage = pages[pages.length - 2] if (prevPage) { diff --git a/src/pages/login/login.vue b/src/pages/login/login.vue index 385a637..2e1ebfd 100644 --- a/src/pages/login/login.vue +++ b/src/pages/login/login.vue @@ -105,9 +105,9 @@ let pw = Base64.encode(encodeURIComponent(password.value)) loading.value = true /*生产环境 begin */ - loginApi({ username: un, password: pw }) + // loginApi({ username: un, password: pw }) /*开发环境 begin */ - // loginApi({ username: userName.value, password: password.value, captcha: 'app' }) + loginApi({ username: userName.value, password: password.value, captcha: 'app' }) .then((res : any) => { if (res.success) { const { result } = res diff --git a/src/pages/onlinePreview/detail.vue b/src/pages/onlinePreview/detail.vue index 4d85970..9c780cc 100644 --- a/src/pages/onlinePreview/detail.vue +++ b/src/pages/onlinePreview/detail.vue @@ -14,7 +14,7 @@ - + diff --git a/src/pages/production/index.vue b/src/pages/production/index.vue index adcac4f..75cab1e 100644 --- a/src/pages/production/index.vue +++ b/src/pages/production/index.vue @@ -19,7 +19,7 @@ @clickItem="onClickItem" styleType="button" activeColor="#0055ff"> - + @@ -35,7 +35,7 @@ - + @@ -98,6 +98,11 @@ window.removeEventListener('resize', calculateScrollViewHeight); }); + onHide(()=>{ //切换首页后,将生产切换为日本数据以清楚定时 by闵 + console.log(555555) + current.value = 0; + }) + const calculateScrollViewHeight = () => { // 获取屏幕的总高度 const screenHeight = uni.getSystemInfoSync().windowHeight; diff --git a/src/pages/production/shishishuju/trqSssj.vue b/src/pages/production/shishishuju/trqSssj.vue index 64b915d..b97dc1f 100644 --- a/src/pages/production/shishishuju/trqSssj.vue +++ b/src/pages/production/shishishuju/trqSssj.vue @@ -8,7 +8,7 @@ - + @@ -114,18 +114,7 @@ }); uni.onSocketMessage(function(res) { console.log('收到服务器内容:' + res.data); - // 语音播放 start - const innerAudioContext = uni.createInnerAudioContext(); - innerAudioContext.autoplay = true; - innerAudioContext.src = 'https://wzs1.oss-cn-beijing.aliyuncs.com/music.mp3'; - innerAudioContext.onPlay(() => { - console.log('开始播放'); - }); - innerAudioContext.onError(res => { - console.log(res.errMsg); - console.log(res.errCode); - }); - //语音播放 end + }); // 这里仅是事件监听【如果socket关闭了会执行】 uni.onSocketClose(function(res) { @@ -141,15 +130,22 @@ console.log(2, e, data.value); stationID.value = e stationName.value = data.value.title + getScData(); //获取生产数据 + + } + + const getScData= ()=>{ uni.request({ url: jlByzc.value + '?zhanc=' + stationID.value + '&jldLx=0', method: 'GET', success: (res) => { + console.log(res) jlData.value = JSON.parse(res.data.result).JlData; } }) - } + + const websock = ref(null); const timer2 = ref(null); // 封装心跳函数 @@ -157,7 +153,10 @@ timer2.value = setInterval(() => { if (websock.value && websock.value.readyState === 1) { // 如果连接正常,发送心跳消息 - connectSocketInit() + // connectSocketInit() + } + if(stationID.value){ + getScData(); } }, 1000); }; @@ -176,9 +175,13 @@ websocketheart() }) - - - + + onUnmounted(()=>{ //页面销毁删除定时 + // 销毁定时器 + console.log(22222) + clearInterval(timer2.value); + }) + // 数字格式化 const formatNumber = (num) => { let temp = 0;