From f4c8d54b4313132863df8fb9f2c5087ea6ba44a6 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期四, 26 六月 2025 09:15:06 +0800
Subject: [PATCH] 1
---
项目代码/LGPDA/pages/index/index.vue | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 104 insertions(+), 5 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/LGPDA/pages/index/index.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/LGPDA/pages/index/index.vue"
index 60ad1e5..b4803ac 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/LGPDA/pages/index/index.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/LGPDA/pages/index/index.vue"
@@ -1,7 +1,17 @@
<template>
- <!-- <u-card :title="title" > -->
+ <!-- <u-card :title="浣犲ソ"> -->
+
<view class="" slot="body">
<!-- <view v-for="(item,index) in tree" :key="item.id"> -->
+ <template>
+ <view style="display: flex;height:50px;">
+ <button
+ :style="{borderRadius: '50%',width: '35px',height: '35px',margin: '5px',backgroundColor: online ? 'green' : 'red'}"></button>
+ <div style="margin:10px;">{{online?'鍦ㄧ嚎':'绂荤嚎'}}</div>
+ <u-switch v-model="value" @change="asyncChange" style="margin-left: 180px;margin-top: 10px;"></u-switch>
+ <text style="margin-left: 10px;margin-top: 15px;">{{ value ? '鑷姩妯″紡' : '鎵嬪姩妯″紡' }}</text>
+ </view>
+ </template>
<u-grid :col="3">
<u-grid-item @tap="clickCoupon(item.url)" v-for="(item) in tree" :key="item.id">
<u-icon name="coupon" :size="50"></u-icon>
@@ -25,7 +35,10 @@
// title: '鎿嶄綔鍔熻兘'
datas: [],
tree: [],
- version: ""
+ version: "",
+ online: false,
+ value: false,
+ isChanging: false
}
},
onShow() {
@@ -43,8 +56,22 @@
},
onLoad() {
this.getCurrentTree();
+ this.Socketonline();
+ this.GetAutoStatus();
+ },
+ beforeDestroy() {
+ if (this.intervalId) {
+ clearInterval(this.intervalId);
+ }
},
mounted() {
+ this.Socketonline();
+ this.GetAutoStatus();
+ setInterval(() => {
+ this.Socketonline();
+ this.GetAutoStatus();
+ }, 5000);
+
var print = uni.getStorageSync('printFloor');
if (print) {
config.printFloor = print;;
@@ -55,11 +82,59 @@
config.outboundFloor = outbound;
}
},
+
methods: {
+ asyncChange(e) {
+ if (this.isChanging) return;
+ this.isChanging = true;
+
+
+ // 鍏堟樉绀簂oading鐘舵��
+ this.$refs.uToast.show({
+ title: '姝e湪鍒囨崲妯″紡...',
+ type: 'loading',
+ duration: 1000
+ });
+
+ // var param = {
+ // MainData: {
+ // "auto": e ? 'true' : 'false' // 鐩存帴浣跨敤浼犲叆鐨別鍊�
+ // },
+ // }
+ // console.log(param);
+ this.$u.post('/api/PDA/AutoStatus?auto='+( e ? 'true' : 'false'), {}).then(result => {
+ console.log(result);
+ if (result) {
+ this.value = e; // 鍙湁鍦ㄨ姹傛垚鍔熷悗鎵嶆洿鏂板疄闄呭��
+ this.switchValue = e; // 鍚屾switch鐨勭姸鎬�
+ this.$refs.uToast.show({
+ title: '妯″紡鍒囨崲鎴愬姛',
+ type: 'success',
+ duration: 1000
+ });
+ } else {
+ this.switchValue = !e; // 璇锋眰澶辫触鍒欐仮澶峴witch鐘舵��
+ this.$refs.uToast.show({
+ title: '妯″紡鍒囨崲澶辫触',
+ type: 'error',
+ duration: 1000
+ });
+ }
+ }).catch(error => {
+ this.switchValue = !e; // 璇锋眰澶辫触鍒欐仮澶峴witch鐘舵��
+ this.$refs.uToast.show({
+ title: '璇锋眰鍑洪敊',
+ type: 'error',
+ duration: 1000
+ });
+ }).finally(() => {
+ this.isChanging = false;
+ });
+ },
AndroidCheckUpdate: function() {
var _this = this;
uni.request({
- url: 'http://10.1.211.101:9004/api/PDA/GetPDAVersion?version=' + this.version,
+ url: 'http://192.168.30.250:5000/api/PDA/GetPDAVersion?version=' + this.version,
method: 'GET',
data: {},
success: res => {
@@ -72,7 +147,7 @@
icon: "none"
});
var dtask = plus.downloader.createDownload(
- "http://10.1.211.101:9004/api/PDA/DownLoadApp", {},
+ "http://192.168.30.250:5000/api/PDA/DownLoadApp", {},
function(d, status) {
// 涓嬭浇瀹屾垚
if (status == 200) {
@@ -102,10 +177,34 @@
});
},
getCurrentTree() {
- this.$u.post('/api/Sys_Menu/getTreeMenu', {}).then(result => {
+ this.$u.post('/api/Menu/getTreeMenu', {}).then(result => {
this.tree = result;
})
},
+ GetAutoStatus() {
+ this.$u.post('/api/PDA/GetAutoStatus', {}).then(result => {
+ if (result == false) {
+ this.value = false;
+ } else {
+ this.value = true;
+ }
+ }).catch(error => {
+ this.value = false;
+ });
+ },
+ Socketonline() {
+ this.$u.post('/api/PDA/Socketonline', {}).then(result => {
+ if (result.data != null && result.data == false) {
+ console.log(result);
+ this.online = false;
+ } else {
+ this.online = true;
+ }
+ // = result;
+ }).catch(error => {
+ this.online = false;
+ });
+ },
getTree(id, data, isRootId) {
this.datas.forEach((x) => {
if (x.pid == id) {
--
Gitblit v1.9.3