Merge remote-tracking branch 'remotes/origin/master'
This commit is contained in:
commit
9bafcc9c28
@ -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) {
|
||||
|
@ -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
|
||||
|
@ -14,7 +14,7 @@
|
||||
<view class="dot"></view>
|
||||
<wd-text text="文件预览"></wd-text>
|
||||
</view>
|
||||
<view v-if="isH5">
|
||||
<view v-if="ifH5">
|
||||
<!-- 在线预览 by 闵 -->
|
||||
<wd-text color="#1890ff" :lines='1' style="font-size: 40rpx;padding-left: 25rpx;padding-top: 25rpx;"
|
||||
decoration="underline"
|
||||
@ -35,9 +35,17 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { isH5 } from '@/utils/platform'
|
||||
import {
|
||||
ref
|
||||
} from 'vue'
|
||||
import {
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app';
|
||||
const detail = ref({})
|
||||
const detailArr = ref([])
|
||||
const ifBackAll = ref(false); //判断是否直接返回最上级
|
||||
//判断是否h5 by 闵
|
||||
var ifH5 = false;
|
||||
const onlinePreview = (url) => { //在线预览文件 by 闵
|
||||
uni.navigateTo({
|
||||
url: url
|
||||
@ -50,13 +58,31 @@
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
console.log(2222)
|
||||
detail.value = options.data
|
||||
detailArr.value = options.data.split(",");
|
||||
//#ifdef H5 || MP-WEIXIN
|
||||
ifH5 = true;
|
||||
//#endif
|
||||
//判断是否只有一个文件
|
||||
if (detailArr.value && detailArr.value.length == 1) {
|
||||
|
||||
let url = '/pages/onlinePreview/onlinePreview';
|
||||
if (isH5) url = '/pages/onlinePreview/onlinePreviewH5'
|
||||
onlinePreview(url + `?data=${JSON.stringify(options.data)}`);
|
||||
if (ifH5) url = '/pages/onlinePreview/onlinePreviewH5'
|
||||
uni.navigateTo({ //跳转成功赋予状态
|
||||
url: url + `?data=${JSON.stringify(options.data)}`,
|
||||
success: () => ifBackAll.value = true //只有一个文件,且加载了
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
onShow (()=>{
|
||||
//页面卸载,如果是从
|
||||
console.log(ifBackAll.value)
|
||||
if(ifBackAll.value){
|
||||
//直接返回上一级
|
||||
uni.navigateBack({
|
||||
})
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
@ -19,7 +19,7 @@
|
||||
@clickItem="onClickItem" styleType="button" activeColor="#0055ff"></uni-segmented-control>
|
||||
</view>
|
||||
<view class="content">
|
||||
<view v-show="current === 0">
|
||||
<view v-if="current === 0">
|
||||
<view style="padding: 0 10px">
|
||||
<view class="progress-bartime">
|
||||
<!-- 动态设置宽度和颜色 -->
|
||||
@ -35,7 +35,7 @@
|
||||
<yy-data></yy-data>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view v-show="current === 1">
|
||||
<view v-if="current === 1">
|
||||
<scroll-view scroll-y :style="{ height: scrollViewHeight + 'px' }">
|
||||
<sssjForm></sssjForm>
|
||||
</scroll-view>
|
||||
@ -98,6 +98,11 @@
|
||||
window.removeEventListener('resize', calculateScrollViewHeight);
|
||||
});
|
||||
|
||||
onHide(()=>{ //切换首页后,将生产切换为日本数据以清楚定时 by闵
|
||||
console.log(555555)
|
||||
current.value = 0;
|
||||
})
|
||||
|
||||
const calculateScrollViewHeight = () => {
|
||||
// 获取屏幕的总高度
|
||||
const screenHeight = uni.getSystemInfoSync().windowHeight;
|
||||
|
@ -8,7 +8,7 @@
|
||||
</cxc-szcx-stationJl-select>
|
||||
</view>
|
||||
</view>
|
||||
<button size="mini" @click="getData">连接WebSocket</button>
|
||||
<!-- <button size="mini" @click="getData">连接WebSocket</button> -->
|
||||
|
||||
<view class="container">
|
||||
<view v-for="(item, index) in jlData" :key="index" class="card">
|
||||
@ -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);
|
||||
};
|
||||
@ -177,7 +176,11 @@
|
||||
websocketheart()
|
||||
})
|
||||
|
||||
|
||||
onUnmounted(()=>{ //页面销毁删除定时
|
||||
// 销毁定时器
|
||||
console.log(22222)
|
||||
clearInterval(timer2.value);
|
||||
})
|
||||
|
||||
// 数字格式化
|
||||
const formatNumber = (num) => {
|
||||
|
Loading…
Reference in New Issue
Block a user