From b5c4d5b884a996002197987c07f90a6c8d7720f2 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期二, 10 十二月 2024 10:45:29 +0800
Subject: [PATCH] ll
---
h5/pages/polling/detail.vue | 189 ++++++++++++++++++++++++++++---------
h5/utils/config.js | 4
h5/pages/operation/record.vue | 2
h5/pages/operation/device.vue | 34 +++---
h5/pages/login.vue | 2
h5/pages/polling/task.vue | 33 +++++
6 files changed, 195 insertions(+), 69 deletions(-)
diff --git a/h5/pages/login.vue b/h5/pages/login.vue
index b742a89..81323ed 100644
--- a/h5/pages/login.vue
+++ b/h5/pages/login.vue
@@ -45,7 +45,7 @@
code: ''
},
downTime: 0,
- code: '111'
+ code: ''
// code: ''
}
},
diff --git a/h5/pages/operation/device.vue b/h5/pages/operation/device.vue
index b9a4c5f..9377ebb 100644
--- a/h5/pages/operation/device.vue
+++ b/h5/pages/operation/device.vue
@@ -118,19 +118,7 @@
} = this
if (!param.deviceId) return this.showToast('璇峰厛閫夋嫨瑕佺淮鎶ょ殑璁惧')
- if (param.status != 0) {
- uni.showModal({
- title: '娓╅Θ鎻愮ず',
- content: '璁惧杩愮淮缁撴灉寮傚父锛屾槸鍚﹀墠寰�鎻愪氦宸ュ崟?',
- success: function(res) {
- if (res.confirm) {
- this.handleP()
- } else if (res.cancel) {}
- }
- });
- }else{
- this.handleP()
- }
+ this.handleP()
},
handleP() {
const {
@@ -143,8 +131,24 @@
dealDate: dayjs().format('YYYY-MM-DD HH:mm:ss'),
multifileList: fileList
}).then(res => {
- this.showToast('鎻愪氦鎴愬姛')
- uni.navigateBack()
+ if (param.status != 0) {
+ uni.showModal({
+ title: '娓╅Θ鎻愮ず',
+ content: '璁惧杩愮淮缁撴灉寮傚父锛屾槸鍚﹀墠寰�鎻愪氦宸ュ崟?',
+ success: function(res) {
+ if (res.confirm) {
+ uni.redirectTo({
+ url: '/pages/workOrder/edit'
+ })
+ } else if (res.cancel) {
+ uni.navigateBack()
+ }
+ }
+ });
+ }else{
+ this.showToast('鎻愪氦鎴愬姛')
+ uni.navigateBack()
+ }
})
},
getDevice() {
diff --git a/h5/pages/operation/record.vue b/h5/pages/operation/record.vue
index 94122b2..21af5f5 100644
--- a/h5/pages/operation/record.vue
+++ b/h5/pages/operation/record.vue
@@ -71,6 +71,8 @@
this.$eventBus.$on('memberSel', (option) => {
this.$set(this.param, 'userName', option.realname)
this.$set(this.param, 'userId', option.id)
+ this.list = []
+ this.page = 1
this.getList()
})
diff --git a/h5/pages/polling/detail.vue b/h5/pages/polling/detail.vue
index 24b5721..383395d 100644
--- a/h5/pages/polling/detail.vue
+++ b/h5/pages/polling/detail.vue
@@ -1,14 +1,16 @@
<template>
<view class="main_app">
- <view v-if="info.status || info.status == 0" class="head_bg" :style="{
- background: `linear-gradient(180deg, ${statusM[info.status].color} 0%, rgba(247, 247, 247, 0) 100%)`
+ <view v-if="info.status || info.status == 0" class="head_bg" :style="{
+ background: `linear-gradient(180deg, ${statusM[info.status].color} 0%, rgba(247, 247, 247, 0) 100%)`
}"></view>
<view class="info">
<image v-if="info.status == 2" class="icon" src="@/static/side/ic_dabiaoed.png" mode=""></image>
<image v-if="info.status == 3" class="icon" src="@/static/side/ic_dabiao.png" mode=""></image>
<view class="head">
<view class="name">{{ info.title || info.planTitle }}</view>
- <view class="status" v-if="info.status || info.status == 0" :style="{color: statusM[info.status].color}">{{statusM[info.status].name}}</view>
+ <view class="status" v-if="info.status || info.status == 0" :style="{color: statusM[info.status].color}">
+ {{statusM[info.status].name}}
+ </view>
</view>
<view class="line">
<view class="la">浠诲姟鏃ユ湡锛�</view>
@@ -17,7 +19,8 @@
<view class="line">
<view class="la">鎵ц鏃堕棿锛�</view>
<view class="val" v-if="info.startDate && info.endDate">{{ info.startDate.slice(11,16) }} 鑷�
- {{ info.endDate.slice(11, 16) }}</view>
+ {{ info.endDate.slice(11, 16) }}
+ </view>
</view>
<view class="line">
<view class="la">瀹屾垚鎯呭喌锛�</view>
@@ -47,8 +50,12 @@
</view>
</view>
</view>
- <view class="footer" v-if="flag">
+ <view class="footer" @click="openSc" v-if="flag">
<view class="sub_btn">鎵爜宸℃</view>
+ </view>
+ <!-- -->
+ <view class="reader-box" @click="stopScan" v-if="isScaning">
+ <view class="reader" id="reader"></view>
</view>
</view>
</template>
@@ -56,34 +63,95 @@
<script>
import {
ywPatrolDetail,
- ywPatrolTaskRecord
- } from '@/api'
+ ywPatrolTaskRecord,
+ getPointRecordByCode
+ } from '@/api'
import dayjs from 'dayjs';
+ import {
+ Html5Qrcode
+ } from 'html5-qrcode';
export default {
data() {
return {
id: '',
info: {},
- list: [],
- flag: false,
- statusM: [
- { color: '#4593f7', name: '寰呭紑濮�' },
- { color: '#73e09a', name: '杩涜涓�' },
- { color: '#f1a93f', name: '宸茶秴鏈�' },
- { color: '#b9b9b9', name: '宸插鐞�' },
- ]
+ list: [],
+ flag: false,
+ statusM: [{
+ color: '#4593f7',
+ name: '寰呭紑濮�'
+ },
+ {
+ color: '#73e09a',
+ name: '杩涜涓�'
+ },
+ {
+ color: '#f1a93f',
+ name: '宸茶秴鏈�'
+ },
+ {
+ color: '#b9b9b9',
+ name: '宸插鐞�'
+ },
+ ],
+ html5Qrcode: null,
+ isScaning: false,
};
},
onLoad(option) {
this.id = option.id
this.getDetail()
- },
- // onShow() {
- // this.getDetail()
+ },
+ // onShow() {
+ // this.getDetail()
// },
methods: {
- itemClick(item) {
- if(!this.flag) return
+ openSc() {
+ this.isScaning = true;
+ Html5Qrcode.getCameras().then((devices) => {
+ if (devices && devices.length) {
+ this.html5Qrcode = new Html5Qrcode('reader');
+ this.html5Qrcode.start({
+ facingMode: 'environment'
+ }, {
+ focusMode: 'continuous', //璁剧疆杩炵画鑱氱劍妯″紡
+ fps: 5, //璁剧疆鎵爜璇嗗埆閫熷害
+ qrbox: 280 //璁剧疆浜岀淮鐮佹壂鎻忔澶у皬
+ },
+ (decodeText, decodeResult) => {
+ if (decodeText) { //杩欓噷decodeText灏辨槸閫氳繃鎵弿浜岀淮鐮佸緱鍒扮殑鍐呭
+ this.stopScan(); //鍏抽棴鎵爜鍔熻兘
+ getPointRecordByCode({
+ taskId: this.id,
+ pointCode: decodeText
+ }).then(ress => {
+ if (ress.data) {
+ uni.navigateTo({
+ url: '/pages/polling/point?id=' + ress.data.id
+ })
+ } else {
+ this.showToast('鏈尮閰嶅埌宸℃鐐�,璇烽噸鏂版壂鎻�')
+ }
+ })
+ }
+ },
+ (err) => {
+ // console.log(err); //閿欒淇℃伅
+ }
+ );
+ }
+ });
+ },
+
+ stopScan() {
+ console.log('鍋滄鎵爜')
+ this.isScaning = false;
+ if (this.html5Qrcode) {
+ this.html5Qrcode.stop();
+ }
+ },
+ itemClick(item) {
+ if (!this.flag) return
uni.navigateTo({
url: '/pages/polling/point?id=' + item.id
})
@@ -93,9 +161,9 @@
id
} = this
ywPatrolDetail(id).then(res => {
- this.info = res.data
- let time = new Date(res.data.startDate).getTime()
- console.log('res.data.startDate', new Date().getTime());
+ this.info = res.data
+ let time = new Date(res.data.startDate).getTime()
+ console.log('res.data.startDate', new Date().getTime());
this.flag = new Date().getTime() > time
})
ywPatrolTaskRecord({
@@ -108,22 +176,26 @@
this.list = res.data.records
})
},
- async startScan() {
- try {
- const video = document.getElementById('video');
- const stream = await navigator.mediaDevices.getUserMedia({ video: { facingMode: "environment" } });
- video.srcObject = stream;
-
- // 浣跨敤 QrScanner 瑙f瀽
- const qrScanner = new QrScanner(video, result => {
- alert(`鎵弿缁撴灉: ${result}`);
- qrScanner.stop(); // 鍋滄鎵爜
- });
- qrScanner.start();
- } catch (err) {
- console.error('鎵撳紑鎽勫儚澶村け璐�:', err);
- }
- }
+ async startScan() {
+ try {
+ const video = document.getElementById('video');
+ const stream = await navigator.mediaDevices.getUserMedia({
+ video: {
+ facingMode: "environment"
+ }
+ });
+ video.srcObject = stream;
+
+ // 浣跨敤 QrScanner 瑙f瀽
+ const qrScanner = new QrScanner(video, result => {
+ alert(`鎵弿缁撴灉: ${result}`);
+ qrScanner.stop(); // 鍋滄鎵爜
+ });
+ qrScanner.start();
+ } catch (err) {
+ console.error('鎵撳紑鎽勫儚澶村け璐�:', err);
+ }
+ }
}
}
</script>
@@ -175,9 +247,10 @@
.status {
color: $primaryColor;
- }
- .gray{
- color: gray;
+ }
+
+ .gray {
+ color: gray;
}
}
@@ -213,9 +286,11 @@
display: flex;
padding: 20rpx 30rpx 0 16rpx;
margin-bottom: 20rpx;
- .line{
- margin-bottom: 10rpx;
+
+ .line {
+ margin-bottom: 10rpx;
}
+
.icon {
width: 10rpx;
height: 148rpx;
@@ -239,9 +314,10 @@
offset-anchor: 28rpx;
color: $primaryColor;
font-weight: 400;
- }
- .gray{
- color: #999999;
+ }
+
+ .gray {
+ color: #999999;
}
}
@@ -285,4 +361,23 @@
}
}
+
+ .reader-box {
+ position: fixed;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ background-color: rgba(0, 0, 0, 0.5);
+ }
+
+ .reader {
+ width: 100%;
+ // width: 540rpx;
+ // height: 540rpx;
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ }
</style>
\ No newline at end of file
diff --git a/h5/pages/polling/task.vue b/h5/pages/polling/task.vue
index 8298402..6ba466e 100644
--- a/h5/pages/polling/task.vue
+++ b/h5/pages/polling/task.vue
@@ -55,7 +55,10 @@
</scroll-view>
<!-- -->
-
+ <!-- -->
+ <view class="reader-box" @click="stopScan" v-if="isScaning">
+ <view class="reader" id="reader"></view>
+ </view>
</view>
</template>
@@ -87,7 +90,7 @@
},
html5Qrcode: null,
isScaning: false,
- activeItem: {}
+ // activeItem: {}
};
},
onLoad() {
@@ -95,7 +98,6 @@
},
methods: {
openSc(item) {
- this.activeItem = item
this.isScaning = true;
Html5Qrcode.getCameras().then((devices) => {
if (devices && devices.length) {
@@ -115,7 +117,11 @@
pointCode: decodeText
}).then(ress=> {
if(ress.data){
-
+ uni.navigateTo({
+ url: '/pages/polling/point?id=' + ress.data.id
+ })
+ }else{
+ this.showToast('鏈尮閰嶅埌宸℃鐐�,璇烽噸鏂版壂鎻�')
}
})
}
@@ -349,4 +355,23 @@
}
}
}
+
+ .reader-box {
+ position: fixed;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ background-color: rgba(0, 0, 0, 0.5);
+ }
+
+ .reader {
+ width: 100%;
+ // width: 540rpx;
+ // height: 540rpx;
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ }
</style>
\ No newline at end of file
diff --git a/h5/utils/config.js b/h5/utils/config.js
index 49ff135..450773b 100644
--- a/h5/utils/config.js
+++ b/h5/utils/config.js
@@ -1,6 +1,6 @@
- export const baseUrl = 'gateway_interface/'
+ // export const baseUrl = 'gateway_interface/'
// export const baseUrl = 'http://192.168.0.173/gateway_interface/'
-// export const baseUrl = 'https://zhcg.fnwtzx.com/gateway_interface/'
+export const baseUrl = 'https://zhcg.fnwtzx.com/gateway_interface/'
export const uploadAvatar = `${baseUrl}visitsAdmin/cloudService/web/public/uploadFtp.do`
export const uploadUrl = `${baseUrl}visitsAdmin/cloudService/public/uploadBatch`
--
Gitblit v1.9.3