whycq
2024-07-23 8c3f98d5240355920cfcbbe6dc96f2c079764dfc
Merge branch 'phpsMonitor' of http://47.97.1.152:5880/r/private into phpsMonitor
2个文件已修改
1个文件已添加
77 ■■■■■ 已修改文件
Monitor-APP/pages.json 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Monitor-APP/pages/home/home.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Monitor-APP/pages/webSocket.vue 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Monitor-APP/pages.json
@@ -55,10 +55,19 @@
                    "titleNView": false
                }
            }
        },
        {
            "path" : "pages/webSocket",
            "style" :
            {
                "navigationBarTitleText": "webSocket",
                "enablePullDownRefresh": false
            }
        }
    ],
    ],
    "globalStyle": {
        "navigationBarTextStyle": "black",
        "navigationBarTitleText": "uni-app",
Monitor-APP/pages/home/home.vue
@@ -233,12 +233,12 @@
                                        <swiper-item class="swiper-item" v-for="(item,i) in swiperList" :key="i">
                                            <view style="width: 30%;">{{i+1}} / {{swiperList.length}}</view>
                                            <!-- <view style="width: 30%;">料号: {{item.matnr}}</view> -->
                                            <view style="width: 40%;">名称: {{item.maknx}}</view>
                                            <view style="width: 30%;">订单: {{item.orderNo}}</view>
                                            <view style="width: 40%;">料号: {{item.matnr}}</view>
                                            <view style="width: 30%;">备注: {{item.orderNo}}</view>
                                            
                                            
                                            <view style="width: 30%;">出库: {{item.count}} / 总数: {{item.total}}</view>
                                            <view style="width: 40%;">规格: {{item.specs}}</view>
                                            <view style="width: 40%;">名称: {{item.maknx}}</view>
                                            <view style="width: 30%;">批号: {{item.batch}}</view>
                                            
                                            
Monitor-APP/pages/webSocket.vue
New file
@@ -0,0 +1,58 @@
<template>
    <view>
    </view>
</template>
<script>
    export default {
        data() {
            return {
                ws: null,
            }
        },
        onShow() {
            this.init()
        },
        methods: {
            init() {
                this.ws = new WebSocket("ws://127.0.0.1:9090/pswcs/console/websocket")
                this.ws.onopen = this.webSocketOnOpen
                this.ws.onerror = this.webSocketOnError
                this.ws.onmessage = this.webSocketOnMessage
                this.ws.onclose = this.webSocketClose
                // console.log(this.ws)
            },
            webSocketOnOpen(e) {
                console.log("open");
                this.sendWs(JSON.stringify({
                    url: 'getTvConfig',
                    data: '1'
                }))
            },
            webSocketOnError(e) {
                console.log(e);
            },
            webSocketOnMessage(e) {
                const result = JSON.parse(e.data);
                if (result.url == "getTvConfig") {
                    console.log(result.result)
                }
            },
            webSocketClose(e) {
                console.log("close");
            },
            sendWs(message) {
                if (this.ws.readyState == WebSocket.OPEN) {
                    this.ws.send(message)
                }
            }
        }
    }
</script>
<style>
</style>