|
|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<van-row class="container">
|
|
|
- <van-col style="background-color: #b0b2b2" span="6">
|
|
|
+ <van-col style="background-color: #dbdcdc" span="6">
|
|
|
<van-row justify="center" :gutter="[0, 23]" style="margin-top: 23px">
|
|
|
<h3 style="text-align: center; margin-bottom: 20px; color: #3498db;">用户信息</h3>
|
|
|
<van-col span="24"><span>用户ID:</span> {{ userInfo.userId }}</van-col>
|
|
|
@@ -37,7 +37,7 @@
|
|
|
>
|
|
|
<div class="col index">{{ index + 1 }}</div>
|
|
|
<div class="col time">{{ item.operationTime }}</div>
|
|
|
- <div class="col operator">{{ item.operator }}</div>
|
|
|
+ <div class="col operator">{{ item.operatorName }}</div>
|
|
|
<div class="col content">{{ item.deliveryNo }}</div>
|
|
|
</div>
|
|
|
</van-list>
|
|
|
@@ -75,13 +75,17 @@
|
|
|
placeholder="设置密码"
|
|
|
/>
|
|
|
</van-cell-group>
|
|
|
+
|
|
|
+ <van-notice-bar color="#1989fa" background="#ecf9ff" style="font-size: 16px; padding-left: 10px" left-icon="info-o">
|
|
|
+ {{ versionName }}
|
|
|
+ </van-notice-bar>
|
|
|
</van-dialog>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
import { onMounted, onUnmounted, ref } from 'vue'
|
|
|
import { closeListener, openListener, scanInit } from '@/utils/keydownListener'
|
|
|
-import { scanSuccess, scanError, scanRepeat, saveMacAddress, readMacAddress, pageDelivery, addDelivery } from '@/utils/android'
|
|
|
+import { getVersionName, saveUserId, getUserId, scanSuccess, scanError, scanRepeat, saveMacAddress, readMacAddress, pageDelivery, addDelivery } from '@/utils/android'
|
|
|
import { showNotify } from 'vant'
|
|
|
import { getUserIdByCert, getUserNameById } from '@/api/login/index.ts'
|
|
|
import { receive } from '@/api/scan/index.ts'
|
|
|
@@ -107,21 +111,22 @@ const finished = ref(false)
|
|
|
onUnmounted(() => {
|
|
|
closeListener()
|
|
|
})
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
mac.value = readMacAddress()
|
|
|
+ const userId = getUserId()
|
|
|
+ if (userId) {
|
|
|
+ _handlerScan(userId)
|
|
|
+ }
|
|
|
if (mac.value) {
|
|
|
_openScan()
|
|
|
} else {
|
|
|
setting.value.show = true
|
|
|
}
|
|
|
-
|
|
|
// ip
|
|
|
fetchIP()
|
|
|
})
|
|
|
|
|
|
-const themeVars = {
|
|
|
- rateIconFullColor: '20px',
|
|
|
-};
|
|
|
|
|
|
const _openScan = () => {
|
|
|
openListener()
|
|
|
@@ -143,67 +148,71 @@ const _handlerScan = (code) => {
|
|
|
userInfo.value.userId = res.data
|
|
|
getUserNameById(res.data).then(res => {
|
|
|
if (res && res.data) {
|
|
|
+ saveUserId(userInfo.value.userId)
|
|
|
userInfo.value.name = res.data
|
|
|
- showNotify({ type: 'success', className: "custom-notify", message: '登录成功!' });
|
|
|
+ showNotify({ type: 'success', style: 'font-size: 30px !important;height:50px', message: '登录成功!' });
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
|
- showNotify({ type: 'danger', message: '登录失败!' });
|
|
|
+ showNotify({ type: 'danger', style: 'font-size: 30px !important;height:50px', message: '登录失败!' });
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
|
// 校验是否已登录
|
|
|
if (!userInfo.value.userId) {
|
|
|
scanError()
|
|
|
- showNotify({ type: 'danger', message: '请先登录!' });
|
|
|
+ showNotify({ type: 'danger', style: 'font-size: 30px !important;height:50px', message: '请先登录!' });
|
|
|
return
|
|
|
}
|
|
|
// 校验是否为空
|
|
|
if (!code) {
|
|
|
scanError()
|
|
|
- showNotify({ type: 'danger', message: '请先扫描快递单号!' });
|
|
|
+ showNotify({ type: 'danger', style: 'font-size: 30px !important;height:50px', message: '请先扫描快递单号!' });
|
|
|
return
|
|
|
}
|
|
|
// 校验是否已扫描
|
|
|
if (list.value.some(item => item.code === code)) {
|
|
|
scanRepeat()
|
|
|
message.value = '该快递单已扫描!'
|
|
|
- showNotify({ type: 'danger', message: '该快递单已扫描!' });
|
|
|
+ showNotify({ type: 'danger', style: 'font-size: 30px !important;height:50px', message: '该快递单已扫描!' });
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// 校验是否已存在
|
|
|
const currentTime = formatDateTime(new Date())
|
|
|
|
|
|
- const result = addDelivery(mac.value, code, userInfo.value.userId)
|
|
|
+ const result = addDelivery(mac.value, code, userInfo.value.userId, userInfo.value.name)
|
|
|
if (result === -1) {
|
|
|
scanRepeat()
|
|
|
message.value = '该快递单已扫描!'
|
|
|
- showNotify({ type: 'danger', message: '该快递单已扫描!' });
|
|
|
+ showNotify({ type: 'danger', style: 'font-size: 30px !important;height:50px', message: '该快递单已扫描!' });
|
|
|
return
|
|
|
}
|
|
|
if (result === -2) {
|
|
|
scanError()
|
|
|
- showNotify({ type: 'danger', message: '插入失败,请联系开发人员!' });
|
|
|
+ showNotify({ type: 'danger', style: 'font-size: 30px !important;height:50px', message: '插入失败,请联系开发人员!' });
|
|
|
return
|
|
|
}
|
|
|
message.value = ''
|
|
|
- const dto = { deliveryNo: code, machine: mac.value, operator: userInfo.value.userId, operationTime: currentTime }
|
|
|
+ const dto = { deliveryNo: code, machine: mac.value, operator: userInfo.value.userId, operationTime: currentTime, operatorName: userInfo.value.name }
|
|
|
receive(dto).then(res => {
|
|
|
console.log(res)
|
|
|
scanSuccess()
|
|
|
- showNotify({ type: 'success', message: '扫描成功!' });
|
|
|
+ list.value.unshift(dto)
|
|
|
+ showNotify({ type: 'success', style: 'font-size: 30px !important;height:50px', message: '扫描成功!' });
|
|
|
}).catch(err => {
|
|
|
console.log(err)
|
|
|
scanError()
|
|
|
- showNotify({ type: 'danger', message: `扫描失败!${err.message}` });
|
|
|
+ showNotify({ type: 'danger', style: 'font-size: 30px !important;height:50px', message: `扫描失败!${err.message}` });
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+const versionName = ref('')
|
|
|
const _openSetting = () => {
|
|
|
closeListener()
|
|
|
setting.value.show = true
|
|
|
+ versionName.value = "版本号:" + getVersionName()
|
|
|
}
|
|
|
|
|
|
// 校验mac地址是否已配置
|
|
|
@@ -222,18 +231,18 @@ const _closeSetting = () => {
|
|
|
|
|
|
const _saveMac = () => {
|
|
|
if(!isValidMacAddress(setting.value.mac)) {
|
|
|
- showNotify({ type: 'danger', message: '请输入正确的MAC地址!' });
|
|
|
+ showNotify({ type: 'danger', style: 'font-size: 30px !important;height:50px', message: '请输入正确的MAC地址!' });
|
|
|
return
|
|
|
}
|
|
|
if (!isValidPassword(setting.value.password)) {
|
|
|
- showNotify({ type: 'danger', message: '请输入正确的密码!' });
|
|
|
+ showNotify({ type: 'danger', style: 'font-size: 30px !important;height:50px', message: '请输入正确的密码!' });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(!saveMacAddress(setting.value.mac)) {
|
|
|
+ showNotify({ type: 'danger', style: 'font-size: 30px !important;height:50px', message: 'MAC保存失败!' });
|
|
|
return
|
|
|
}
|
|
|
- // if(!saveMacAddress(setting.value.mac)) {
|
|
|
- // showNotify({ type: 'danger', message: 'MAC保存失败!' });
|
|
|
- // return
|
|
|
- // }
|
|
|
- showNotify({ type: 'success', message: 'MAC保存成功!' });
|
|
|
+ showNotify({ type: 'success', style: 'font-size: 30px !important;height:50px', message: 'MAC保存成功!' });
|
|
|
mac.value = setting.value.mac
|
|
|
}
|
|
|
|
|
|
@@ -285,6 +294,7 @@ const onLoad = () => {
|
|
|
padding: 0
|
|
|
box-sizing: border-box
|
|
|
|
|
|
+
|
|
|
body
|
|
|
font-family: "PingFang SC", "Microsoft YaHei", sans-serif
|
|
|
background: #f5f7fa
|