From a5f40b4c2590a3d61592f1918d689d4932545248 Mon Sep 17 00:00:00 2001 From: liukangdong <898885815@qq.com> Date: 星期三, 22 一月 2025 15:06:38 +0800 Subject: [PATCH] ll --- h5/pages.json | 7 h5/pages/polling/detail.vue | 6 h5/utils/config.js | 4 h5/pages/workOrder/wait.vue | 431 +++++++++++++++++++++++++++++++++++++++++++ h5/pages/index.vue | 45 +++ h5/pages/login.vue | 70 +++++-- h5/pages/polling/task.vue | 4 h5/api/yw.js | 7 h5/static/home/ic_daiban@2x.png | 0 h5/api/staff.js | 7 h5/static/home/ic_pandian@2x.png | 0 h5/pages/inventory/index.vue | 1 h5/static/side/xiaoxi_ic_tongzhi@2x.png | 0 13 files changed, 549 insertions(+), 33 deletions(-) diff --git a/h5/api/staff.js b/h5/api/staff.js index 491ab58..9552ed6 100644 --- a/h5/api/staff.js +++ b/h5/api/staff.js @@ -45,3 +45,10 @@ }) } +export const myNoticesH5 = (data) => { + return http({ + url: 'visitsAdmin/cloudService/business/ywWorkDesk/myNoticesH5', + method: 'post', + data + }) +} diff --git a/h5/api/yw.js b/h5/api/yw.js index 5fb57ba..837f486 100644 --- a/h5/api/yw.js +++ b/h5/api/yw.js @@ -141,6 +141,13 @@ data }) } +// 寰俊鎵竴鎵� +export const getRecordByUserPoint = (data) => { + return http({ + url: 'visitsAdmin/cloudService/business/ywPatrolTaskRecord/getRecordByUserPoint', + data + }) +} export const getFindByCode = (code) => { return http({ url: 'visitsAdmin/cloudService/business/ywDevice/findByCode?deviceCode=' + code, diff --git a/h5/pages.json b/h5/pages.json index 0e89470..908bd3a 100644 --- a/h5/pages.json +++ b/h5/pages.json @@ -111,6 +111,13 @@ { "navigationBarTitleText" : "闂涓婃姤" } + }, + { + "path" : "pages/workOrder/wait", + "style" : + { + "navigationBarTitleText" : "浠诲姟涓績" + } } ], "globalStyle": { diff --git a/h5/pages/index.vue b/h5/pages/index.vue index 81b4ef6..f64142b 100644 --- a/h5/pages/index.vue +++ b/h5/pages/index.vue @@ -17,7 +17,8 @@ <view class="list"> <view v-for="item in list2" class="item" @click="itemClick(item)"> <image :src="item.img"></image> - <view class="name">{{item.name}}</view> + <view class="name">{{item.name}}</view> + <view v-if="item.name == '寰呭姙涓績' && taskNum" class="superscript">{{taskNum}}</view> </view> </view> <view class="loginout" @click="loginOut">閫�鍑虹櫥闄�</view> @@ -26,7 +27,8 @@ <script> import { - logoutPost + logoutPost, + myNoticesH5 } from '@/api' export default { data() { @@ -49,6 +51,12 @@ url: '/pages/operation/device', img: require('@/static/home/ic_fangkebaobe@2x.png'), auth: 'weixin:menu:visitcar' + }, + { + name: '搴撳瓨鐩樼偣', + url: '/pages/inventory/index', + img: require('@/static/home/ic_pandian@2x.png'), + auth: 'weixin:menu:visitcar' }, ], list2: [{ @@ -62,12 +70,21 @@ url: '/pages/operation/record', img: require('@/static/home/ic_wodehuiyi@2x.png'), auth: 'weixin:menu:visitcar' + }, + { + name: '寰呭姙涓績', + url: '/pages/workOrder/wait', + img: require('@/static/home/ic_daiban@2x.png'), + auth: 'weixin:menu:visitcar' }, - ] + ], + taskNum: 0 } }, - onLoad() { - + onShow() { + myNoticesH5({ page: 1, capacity: 1,model: {status: 0}}).then(res => { + this.taskNum = res.data.total + }) }, methods: { itemClick(item) { @@ -132,8 +149,8 @@ display: flex; flex-direction: column; align-items: center; - width: 25%; - + width: 25%; + position: relative; image { width: 88rpx; height: 88rpx; @@ -143,6 +160,20 @@ .name { font-size: 26rpx; } + .superscript{ + height: 40rpx; + width: 40rpx; + position: absolute; + top: -16rpx; + right: 24rpx; + background-color: red; + color: #fff; + font-size: 24rpx; + display: flex; + align-items: center; + justify-content: center; + border-radius: 50%; + } } } diff --git a/h5/pages/inventory/index.vue b/h5/pages/inventory/index.vue index 140a4e9..9181d91 100644 --- a/h5/pages/inventory/index.vue +++ b/h5/pages/inventory/index.vue @@ -88,7 +88,6 @@ } } }) - }, handleQuery() { this.list = [] diff --git a/h5/pages/login.vue b/h5/pages/login.vue index b742a89..840eba8 100644 --- a/h5/pages/login.vue +++ b/h5/pages/login.vue @@ -29,7 +29,9 @@ loginPost, getUserInfo, sendSMsPost, - ywWxAuthorize + ywWxAuthorize, + + getRecordByUserPoint } from '@/api' import { mapState, @@ -45,11 +47,19 @@ code: '' }, downTime: 0, - code: '111' - // code: '' + code: '' } }, - + onLoad(option) { + console.log('onLoad'); + // https://zhcg.fnwtzx.com/#/pages/login?type=0&ywid=ywid + if (option.ywid || option.ywid == 0) { + uni.setStorageSync('ywinfo', { + type: option.type, + ywid: option.ywid + }) + } + }, onShow() { // return var that = this @@ -66,19 +76,31 @@ ywWxAuthorize({ code: code || this.code }).then(res => { - if (res.code === 200) { + if (res.code === 200) { console.log('res', res); that.$store.commit('setOpenId', res.data.openid) - if (res.data.token && res.data.token != '') { + if (res.data.token && res.data.token != '') { that.$store.commit('setToken', res.data.token) getUserInfo().then(ress => { that.$store.commit('setUserInfo', ress.data) }) - setTimeout(() => { - uni.redirectTo({ - url: "/pages/index" + const ywinfo = uni.getStorageSync('ywinfo') || {} + if (ywinfo.ywid && (ywinfo.type || ywinfo.type == 0)) { + getRecordByUserPoint({pointCode: ywinfo.ywid}).then(res => { + if(res.data && res.data.id){ + uni.setStorageSync('ywinfo', {}) + uni.redirectTo({ + url: "/pages/polling/point?id=" + res.data.id + }) + } }) - }, 300) + } else { + setTimeout(() => { + uni.redirectTo({ + url: "/pages/index" + }) + }, 300) + } } } }) @@ -92,12 +114,6 @@ } }, - // onBackPress(options) { - // uni.redirectTo({ - // url: '/pages/login/login' - // }) - // return true - // }, methods: { ...mapMutations(["setToken", "setUserInfo"]), onLogin() { @@ -122,10 +138,24 @@ this.setToken(res.data) this.showToast('鐧诲綍鎴愬姛') getUserInfo().then(ress => { - this.setUserInfo(ress.data) - uni.redirectTo({ - url: "/pages/index" - }) + this.setUserInfo(ress.data) + const ywinfo = uni.getStorageSync('ywinfo') || {} + if (ywinfo.ywid && (ywinfo.type || ywinfo.type == 0)) { + getRecordByUserPoint({pointCode: ywinfo.ywid}).then(res => { + getRecordByUserPoint({pointCode: ywinfo.ywid}).then(res => { + if(res.data && res.data.id){ + uni.setStorageSync('ywinfo', {}) + uni.redirectTo({ + url: "/pages/polling/point?id=" + res.data.id + }) + } + }) + }) + } else { + uni.redirectTo({ + url: "/pages/index" + }) + } }) } }) diff --git a/h5/pages/polling/detail.vue b/h5/pages/polling/detail.vue index 2218e35..2f2620a 100644 --- a/h5/pages/polling/detail.vue +++ b/h5/pages/polling/detail.vue @@ -129,10 +129,12 @@ }, (decodeText, decodeResult) => { if (decodeText) { //杩欓噷decodeText灏辨槸閫氳繃鎵弿浜岀淮鐮佸緱鍒扮殑鍐呭 - this.stopScan(); //鍏抽棴鎵爜鍔熻兘 + this.stopScan(); //鍏抽棴鎵爜鍔熻兘 + const index = decodeText.indexOf('ywid') + let pointCode = decodeText.slice(index + 5) getPointRecordByCode({ taskId: this.id, - pointCode: decodeText + pointCode }).then(ress => { if (ress.data) { uni.navigateTo({ diff --git a/h5/pages/polling/task.vue b/h5/pages/polling/task.vue index 0e72898..e76a9cc 100644 --- a/h5/pages/polling/task.vue +++ b/h5/pages/polling/task.vue @@ -117,10 +117,12 @@ }, (decodeText, decodeResult) => { if (decodeText) { //杩欓噷decodeText灏辨槸閫氳繃鎵弿浜岀淮鐮佸緱鍒扮殑鍐呭 + const index = decodeText.indexOf('ywid') + let pointCode = decodeText.slice(index + 5) this.stopScan(); //鍏抽棴鎵爜鍔熻兘 getPointRecordByCode({ taskId: item.id, - pointCode: decodeText + pointCode }).then(ress=> { if(ress.data){ uni.navigateTo({ diff --git a/h5/pages/workOrder/wait.vue b/h5/pages/workOrder/wait.vue new file mode 100644 index 0000000..7ccd30a --- /dev/null +++ b/h5/pages/workOrder/wait.vue @@ -0,0 +1,431 @@ +<template> + <view class="main_app"> + <view class="tabs"> + <view class="tab" :class="{active: queryStatus == 0}" @click="tabsClick(0)"> + <text>寰呭姙</text> + <text class="border"></text> + </view> + <view class="tab" :class="{active: queryStatus == 1}" @click="tabsClick(1)"> + <text>宸插姙</text> + <text class="border"></text> + </view> + </view> + <scroll-view scroll-y="true" class="scroll_Y" @scrolltolower="scrolltolower"> + <view class="list"> + <view class="item" @click="itemClick(item)" v-for="item in list"> + <view class="img"> + <image v-if="item.type == 0 && item.status == 0" src="@/static/side/ic_pandian@2x.png"></image> + <image v-if="item.type == 1 && item.status == 0" src="@/static/side/xunjianed.png"></image> + <image v-if="item.type == 2 && item.status == 0" src="@/static/side/workordered.png"></image> + <image v-if="item.type == 0 && item.status == 1" src="@/static/side/ic_pandian_grey@2x.png"></image> + <image v-if="item.type == 1 && item.status == 1" src="@/static/side/xunjian.png"></image> + <image v-if="item.type == 2 && item.status == 1" src="@/static/side/workorder.png"></image> + </view> + <view class="content"> + <view class="title" v-if="item.obj"> + <view>{{item.obj.key1}}</view> + <view v-if="item.status == 0 && item.type == 2" class="status">寰呭鐞�</view> + <view v-if="item.status == 0 && item.param3 == 0 && (item.type == 0 || item.type == 1)" class="status">鏈紑濮� + </view> + <view v-if="item.status == 0 && item.param3 == 1 && (item.type == 0 || item.type == 1)" + class="status green">杩涜涓�</view> + <view v-if="item.status == 1 && item.type == 2" class="status gray">宸插鐞�</view> + <view v-if="item.status == 1 && (item.type == 0 || item.type == 1)" class="status gray">宸插畬鎴�</view> + </view> + <template v-if="item.obj && item.type == 1"> + <view class="text">浠诲姟鏃ユ湡锛歿{item.obj.key2}}</view> + <view class="text">鎵ц鏃堕棿锛歿{item.obj.key3}}</view> + <view class="text"> + <view class="">宸℃璐熻矗浜猴細{{item.obj.key4}}</view> + <view class="btn" @click.stop="openSc(item)"> + <image src="@/static/side/ic_saoma@2x.png" mode=""></image> + <view v-if="item.status == 0" class="">鎵爜宸℃</view> + </view> + </view> + </template> + <template v-if="item.obj && item.type == 0"> + <view class="content"> + <view class="text">鐩樼偣鏃ユ湡锛歿{item.obj.key2}}</view> + <view class="text">鐩樼偣浠撳簱锛歿{item.obj.key3}}</view> + <view class="text"> + <view class="">鐩樼偣鍛橈細{{item.obj.key4}}</view> + <view v-if="item.status == 0 && item.param3 == 0" class="btn" @click.stop="startHandle(item)">寮�濮嬬洏鐐� + </view> + <view v-if="item.status == 0 && item.param3 == 1" class="btn" @click.stop="startHandle(item)">缁х画鐩樼偣 + </view> + </view> + </view> + </template> + <template v-if="item.obj && item.type == 2"> + <view class="content"> + <view class="text">涓婃姤鏃堕棿锛歿{item.obj.key2}}</view> + <view class="text">浣嶇疆绫诲瀷锛歿{item.obj.key3}}</view> + <view class="text">宸ュ崟鍒嗙被锛歿{item.obj.key4}}</view> + </view> + </template> + + </view> + + + </view> + </view> + <view class="empty" v-if="list.length == 0"> + <image src="@/static/empty.png" mode=""></image> + <view class="">鏆傛棤鏁版嵁</view> + </view> + </scroll-view> + <!-- --> + <view class="reader-box" @click="stopScan" v-if="isScaning"> + <view class="reader" id="reader"></view> + </view> + </view> +</template> + +<script> + import { + myNoticesH5, + ywStocktakingBegin, + getPointRecordByCode + } from '@/api' + import { + Html5Qrcode + } from 'html5-qrcode'; + export default { + data() { + return { + list: [], + total: 0, + page: 1, + queryStatus: 0, + + html5Qrcode: null, + isScaning: false, + }; + }, + onShow() { + this.page = 1 + this.list = [] + this.getList() + }, + methods: { + tabsClick(val) { + this.list = [] + this.page = 1 + this.queryStatus = val + this.getList() + }, + itemClick(item) { + if (item.objType == 0) { + return + uni.navigateTo({ + url: `/pages/inventory/detail?id=${item.objId}` + }) + } else if (item.objType == 1) { + // return + uni.navigateTo({ + url: `/pages/polling/detail?id=${item.objId}` + }) + } else { + uni.navigateTo({ + url: `/pages/workOrder/detail?id=${item.objId}` + }) + } + }, + startHandle(item) { + if (item.param3 == 0) { + uni.showModal({ + content: '鐩樼偣鏈熼棿涓嶅彲杩涜鍑哄叆搴撴搷浣�', + success: (res) => { + if (res.confirm) { + ywStocktakingBegin(item.objId).then(() => { + uni.navigateTo({ + url: '/pages/inventory/detail?id=' + item.objId + }) + }) + + } + } + }) + }else{ + uni.navigateTo({ + url: '/pages/inventory/detail?id=' + item.objId + }) + } + }, + getList() { + const { + page, + total, + list, + queryStatus + } = this + myNoticesH5({ + page, + capacity: 20, + model: { + status: queryStatus + } + }).then(res => { + this.list = [...this.list, ...res.data.records] + this.list.forEach(item => { + item.obj = JSON.parse(item.param2) + }) + console.log(this.list); + this.total = res.data.total + }) + }, + scrolltolower() { + const { + total, + list + } = this + if (list.length < total) { + this.page = this.page + 1 + this.getList() + } else { + this.showToast('鏆傛棤鏇村鏁版嵁') + } + }, + openSc(item) { + 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(); //鍏抽棴鎵爜鍔熻兘 + const index = decodeText.indexOf('ywid') + let pointCode = decodeText.slice(index + 5) + getPointRecordByCode({ + taskId: item.objId, + pointCode + }).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(); + } + }, + } + } +</script> + +<style lang="scss"> + page { + background-color: #f7f7f7; + + .main_app { + padding: 0; + height: 100vh; + overflow: hidden; + } + + .tabs { + display: flex; + width: 750rpx; + margin: 12rpx 0rpx 0; + border-bottom: 1rpx solid #E5E5E5; + background-color: #fff; + + .tab { + font-size: 30rpx; + color: #666666; + flex: 1; + display: flex; + flex-direction: column; + align-items: center; + justify-content: flex-end; + height: 88rpx; + + .name { + display: flex; + align-items: center; + } + + .icon { + width: 28rpx; + height: 28rpx; + margin-right: 10rpx; + } + + .border { + width: 54rpx; + height: 6rpx; + background-color: #fff; + border-radius: 3rpx; + margin-top: 24rpx; + } + } + + .active { + font-weight: 600; + font-size: 32rpx; + color: #222222; + + .border { + background-color: $primaryColor; + } + + } + + } + + .scroll_Y { + height: calc(100vh - 120rpx); + + .empty { + padding-top: 260rpx; + + image { + width: 360rpx; + height: 360rpx; + margin-bottom: 10rpx; + } + + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + color: #999999; + } + } + + .list { + // padding-top: 20rpx; + + .item { + width: 100%; + background: #FFFFFF; + border-radius: 8rpx; + display: flex; + padding: 30rpx 24rpx; + border-bottom: 1rpx solid #e5e5e5; + + .img { + position: relative; + margin-right: 20rpx; + flex-shrink: 0; + position: relative; + + image { + width: 72rpx; + height: 72rpx; + } + + .dian { + position: absolute; + background-color: red; + width: 18rpx; + height: 18rpx; + border-radius: 50%; + top: -8rpx; + right: -8rpx; + } + } + + .content { + flex: 1; + + .title { + font-weight: 500; + font-size: 32rpx; + color: #222222; + margin-bottom: 6rpx; + display: flex; + align-items: center; + justify-content: space-between; + + .status { + color: $primaryColor; + font-weight: 400; + font-size: 28rpx; + } + + .green { + color: #0ADE79; + } + + .gray { + color: #999999; + } + } + + .text { + font-size: 26rpx; + color: #666666; + height: 60rpx; + display: flex; + align-items: center; + justify-content: space-between; + + .btn { + background-color: $primaryColor; + padding: 0 24rpx; + height: 60rpx; + border-radius: 30rpx; + display: flex; + align-items: center; + color: #fff; + + image { + width: 28rpx; + height: 28rpx; + margin-right: 6rpx; + } + } + } + + .time { + font-size: 26rpx; + color: #999999; + } + } + } + } + } + + .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/static/home/ic_daiban@2x.png b/h5/static/home/ic_daiban@2x.png new file mode 100644 index 0000000..22d7e91 --- /dev/null +++ b/h5/static/home/ic_daiban@2x.png Binary files differ diff --git a/h5/static/home/ic_pandian@2x.png b/h5/static/home/ic_pandian@2x.png new file mode 100644 index 0000000..bdf227f --- /dev/null +++ b/h5/static/home/ic_pandian@2x.png Binary files differ diff --git a/h5/static/side/xiaoxi_ic_tongzhi@2x.png b/h5/static/side/xiaoxi_ic_tongzhi@2x.png new file mode 100644 index 0000000..b262ca0 --- /dev/null +++ b/h5/static/side/xiaoxi_ic_tongzhi@2x.png Binary files differ 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