Merge branch 'minJeecg' into 'master'
Min jeecg See merge request cxcxt/jeecguniapp!12
This commit is contained in:
commit
1ac32902f9
@ -106,6 +106,7 @@
|
|||||||
// 只有在页面中才默认返回,弹层中不返回
|
// 只有在页面中才默认返回,弹层中不返回
|
||||||
if (props.type === 'page') {
|
if (props.type === 'page') {
|
||||||
const pages = getCurrentPages()
|
const pages = getCurrentPages()
|
||||||
|
console.log(router)
|
||||||
if (props.backRouteName || props.backRoutePath) {
|
if (props.backRouteName || props.backRoutePath) {
|
||||||
const prevPage = pages[pages.length - 2]
|
const prevPage = pages[pages.length - 2]
|
||||||
if (prevPage) {
|
if (prevPage) {
|
||||||
|
@ -105,9 +105,9 @@
|
|||||||
let pw = Base64.encode(encodeURIComponent(password.value))
|
let pw = Base64.encode(encodeURIComponent(password.value))
|
||||||
loading.value = true
|
loading.value = true
|
||||||
/*生产环境 begin */
|
/*生产环境 begin */
|
||||||
loginApi({ username: un, password: pw })
|
// loginApi({ username: un, password: pw })
|
||||||
/*开发环境 begin */
|
/*开发环境 begin */
|
||||||
// loginApi({ username: userName.value, password: password.value, captcha: 'app' })
|
loginApi({ username: userName.value, password: password.value, captcha: 'app' })
|
||||||
.then((res : any) => {
|
.then((res : any) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
const { result } = res
|
const { result } = res
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<view class="dot"></view>
|
<view class="dot"></view>
|
||||||
<wd-text text="文件预览"></wd-text>
|
<wd-text text="文件预览"></wd-text>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="isH5">
|
<view v-if="ifH5">
|
||||||
<!-- 在线预览 by 闵 -->
|
<!-- 在线预览 by 闵 -->
|
||||||
<wd-text color="#1890ff" :lines='1' style="font-size: 40rpx;padding-left: 25rpx;padding-top: 25rpx;"
|
<wd-text color="#1890ff" :lines='1' style="font-size: 40rpx;padding-left: 25rpx;padding-top: 25rpx;"
|
||||||
decoration="underline"
|
decoration="underline"
|
||||||
@ -35,9 +35,17 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { isH5 } from '@/utils/platform'
|
import {
|
||||||
|
ref
|
||||||
|
} from 'vue'
|
||||||
|
import {
|
||||||
|
onLoad
|
||||||
|
} from '@dcloudio/uni-app';
|
||||||
const detail = ref({})
|
const detail = ref({})
|
||||||
const detailArr = ref([])
|
const detailArr = ref([])
|
||||||
|
const ifBackAll = ref(false); //判断是否直接返回最上级
|
||||||
|
//判断是否h5 by 闵
|
||||||
|
var ifH5 = false;
|
||||||
const onlinePreview = (url) => { //在线预览文件 by 闵
|
const onlinePreview = (url) => { //在线预览文件 by 闵
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: url
|
url: url
|
||||||
@ -50,13 +58,31 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
|
console.log(2222)
|
||||||
detail.value = options.data
|
detail.value = options.data
|
||||||
detailArr.value = options.data.split(",");
|
detailArr.value = options.data.split(",");
|
||||||
|
//#ifdef H5 || MP-WEIXIN
|
||||||
|
ifH5 = true;
|
||||||
|
//#endif
|
||||||
//判断是否只有一个文件
|
//判断是否只有一个文件
|
||||||
if (detailArr.value && detailArr.value.length == 1) {
|
if (detailArr.value && detailArr.value.length == 1) {
|
||||||
|
|
||||||
let url = '/pages/onlinePreview/onlinePreview';
|
let url = '/pages/onlinePreview/onlinePreview';
|
||||||
if (isH5) url = '/pages/onlinePreview/onlinePreviewH5'
|
if (ifH5) url = '/pages/onlinePreview/onlinePreviewH5'
|
||||||
onlinePreview(url + `?data=${JSON.stringify(options.data)}`);
|
uni.navigateTo({ //跳转成功赋予状态
|
||||||
|
url: url + `?data=${JSON.stringify(options.data)}`,
|
||||||
|
success: () => ifBackAll.value = true //只有一个文件,且加载了
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
onShow (()=>{
|
||||||
|
//页面卸载,如果是从
|
||||||
|
console.log(ifBackAll.value)
|
||||||
|
if(ifBackAll.value){
|
||||||
|
//直接返回上一级
|
||||||
|
uni.navigateBack({
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
@clickItem="onClickItem" styleType="button" activeColor="#0055ff"></uni-segmented-control>
|
@clickItem="onClickItem" styleType="button" activeColor="#0055ff"></uni-segmented-control>
|
||||||
</view>
|
</view>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<view v-show="current === 0">
|
<view v-if="current === 0">
|
||||||
<view style="padding: 0 10px">
|
<view style="padding: 0 10px">
|
||||||
<view class="progress-bartime">
|
<view class="progress-bartime">
|
||||||
<!-- 动态设置宽度和颜色 -->
|
<!-- 动态设置宽度和颜色 -->
|
||||||
@ -35,7 +35,7 @@
|
|||||||
<yy-data></yy-data>
|
<yy-data></yy-data>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
<view v-show="current === 1">
|
<view v-if="current === 1">
|
||||||
<scroll-view scroll-y :style="{ height: scrollViewHeight + 'px' }">
|
<scroll-view scroll-y :style="{ height: scrollViewHeight + 'px' }">
|
||||||
<sssjForm></sssjForm>
|
<sssjForm></sssjForm>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
@ -98,6 +98,11 @@
|
|||||||
window.removeEventListener('resize', calculateScrollViewHeight);
|
window.removeEventListener('resize', calculateScrollViewHeight);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onHide(()=>{ //切换首页后,将生产切换为日本数据以清楚定时 by闵
|
||||||
|
console.log(555555)
|
||||||
|
current.value = 0;
|
||||||
|
})
|
||||||
|
|
||||||
const calculateScrollViewHeight = () => {
|
const calculateScrollViewHeight = () => {
|
||||||
// 获取屏幕的总高度
|
// 获取屏幕的总高度
|
||||||
const screenHeight = uni.getSystemInfoSync().windowHeight;
|
const screenHeight = uni.getSystemInfoSync().windowHeight;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
</cxc-szcx-stationJl-select>
|
</cxc-szcx-stationJl-select>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<button size="mini" @click="getData">连接WebSocket</button>
|
<!-- <button size="mini" @click="getData">连接WebSocket</button> -->
|
||||||
|
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<view v-for="(item, index) in jlData" :key="index" class="card">
|
<view v-for="(item, index) in jlData" :key="index" class="card">
|
||||||
@ -114,18 +114,7 @@
|
|||||||
});
|
});
|
||||||
uni.onSocketMessage(function(res) {
|
uni.onSocketMessage(function(res) {
|
||||||
console.log('收到服务器内容:' + res.data);
|
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关闭了会执行】
|
// 这里仅是事件监听【如果socket关闭了会执行】
|
||||||
uni.onSocketClose(function(res) {
|
uni.onSocketClose(function(res) {
|
||||||
@ -141,15 +130,22 @@
|
|||||||
console.log(2, e, data.value);
|
console.log(2, e, data.value);
|
||||||
stationID.value = e
|
stationID.value = e
|
||||||
stationName.value = data.value.title
|
stationName.value = data.value.title
|
||||||
|
getScData(); //获取生产数据
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const getScData= ()=>{
|
||||||
uni.request({
|
uni.request({
|
||||||
url: jlByzc.value + '?zhanc=' + stationID.value + '&jldLx=0',
|
url: jlByzc.value + '?zhanc=' + stationID.value + '&jldLx=0',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
|
console.log(res)
|
||||||
jlData.value = JSON.parse(res.data.result).JlData;
|
jlData.value = JSON.parse(res.data.result).JlData;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const websock = ref(null);
|
const websock = ref(null);
|
||||||
const timer2 = ref(null);
|
const timer2 = ref(null);
|
||||||
// 封装心跳函数
|
// 封装心跳函数
|
||||||
@ -157,7 +153,10 @@
|
|||||||
timer2.value = setInterval(() => {
|
timer2.value = setInterval(() => {
|
||||||
if (websock.value && websock.value.readyState === 1) {
|
if (websock.value && websock.value.readyState === 1) {
|
||||||
// 如果连接正常,发送心跳消息
|
// 如果连接正常,发送心跳消息
|
||||||
connectSocketInit()
|
// connectSocketInit()
|
||||||
|
}
|
||||||
|
if(stationID.value){
|
||||||
|
getScData();
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
};
|
};
|
||||||
@ -176,9 +175,13 @@
|
|||||||
|
|
||||||
websocketheart()
|
websocketheart()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
onUnmounted(()=>{ //页面销毁删除定时
|
||||||
|
// 销毁定时器
|
||||||
|
console.log(22222)
|
||||||
|
clearInterval(timer2.value);
|
||||||
|
})
|
||||||
|
|
||||||
// 数字格式化
|
// 数字格式化
|
||||||
const formatNumber = (num) => {
|
const formatNumber = (num) => {
|
||||||
let temp = 0;
|
let temp = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user