This commit is contained in:
2023-08-29 15:11:11 +08:00
commit d65bfda4e5
109 changed files with 15486 additions and 0 deletions

175
pages/home/home.vue Normal file
View File

@@ -0,0 +1,175 @@
<template>
<view class="zd_content">
<view class="header">首页</view>
<view class="userInfo-wrap">
<view class="userInfo">
<text class="p1">{{userName}}</text>
<text class="p2">欢迎进入瑞泰马钢手持系统</text>
</view>
<view class="exit" @tap="Quit">
<view class="icon-exit"></view>
<view class="exit-text">退出</view>
</view>
</view>
<view class="zd_wrapper">
<view class="menu-wrap">
<view class="menu-item" v-for="(e, i) in menuList" :key="i" @tap="toPage1(e)">
<image class="menu-img" :src="require('../../static/image/menu/' + e.icon + '.png')" alt="">
<view class="menu-name">{{e.name}}</view>
</view>
</view>
</view>
<view v-if="show === true" class="sec_menu_wraper">
<view class="sec_menu_w">
<view class="menu-item" v-for="(e, i) in secM" :key="i" @click="toPage2(e)">
<view class="sec_menu-col_inner">
<view class="menu-name menu-name_inner">{{e.name}}</view>
</view>
</view>
</view>
<view class="cancel">
<view class="iconfont cancel_icon" @tap="show = false"></view>
</view>
</view>
</view>
</template>
<script>
import {authority} from '@/utils/getData2.js'
export default {
data() {
return {
userName: this.$store.getters.userInfo !== '' ? JSON.parse(this.$store.getters.userInfo).username : '',
menuList: [],
show: false,
secM: []
};
},
created () {
this._authority()
},
methods: {
async _authority () {
let res = await authority()
this.menuList = [...res.sonTree]
},
toPage1 (e) {
let url = e.path
uni.redirectTo({
url: url
})
// if (e.sonTree.length > 0) {
// this.show = true
// this.secM = e.sonTree
// }
},
toPage2 (e) {
let url = e.path
uni.redirectTo({
url: url
})
},
Quit () {
this.$store.dispatch('delUserInfo')
uni.redirectTo({
url: '/pages/login/login'
})
}
}
}
</script>
<style lang="stylus">
@import '../../common/style/mixin.styl';
.zd_content
padding-top 0
.header
height 86rpx
_font(36rpx,86rpx,#333,,center)
.userInfo-wrap
_fj()
_wh(100%,160rpx)
padding 0 30rpx
background-color $red
_bis('../../static/image/info_bg.png',auto,100%,right,bottom)
border-radius 12rpx
margin-bottom 20rpx
.userInfo
_fj(,flex-start,column)
.p1
_font(34rpx,1,#fff)
padding-bottom 18rpx
.p2
_font(26rpx,1,#fff)
.exit
_fj()
height 47rpx
padding 0 15rpx
border 1px solid #FF967C
border-radius 20rpx
.icon-exit
_wh(22rpx, 22rpx)
_bis('../../static/image/exit.png',22rpx)
.exit-text
_font(24rpx,47rpx,#fff,,right)
padding-left 10rpx
.menu-wrap
_fj(flex-start,flex-start,,wrap)
align-content: flex-start
.menu-item
_fj()
flex-direction column
_wh(30%, auto)
margin-bottom 40rpx
_font(26rpx, 60rpx,#e74f1a,,center)
&:nth-child(3n+2)
margin-left 5%
margin-right 5%
::v-deep .menu-img
_wh(100%, auto)
img
position relative
opacity 1
_wh(55%, auto)
margin 0 auto 0.2rpx
.menu-name
_font(28rpx, 38rpx, #444,,center)
.sec_menu_wraper
position fixed
top 0
left 0
_wh(100%, 100%)
background-color rgba(0, 0, 0, .9)
z-index 2017
flex-direction column
.sec_menu_w
_fj()
_wh(100%, calc(100% - 100rpx))
padding 0 24rpx
flex-wrap wrap
align-content center
&::after
content ''
display block
_wh(30%,0)
.sec_menu-col
background-color transparent
border none
height auto
.sec_menu-col_inner
_fj(center)
_wh(160rpx, 160rpx)
border-radius 50%
background-color $yellow
margin 0 auto
.menu-name_inner
color #fff
padding 0 20rpx
.cancel
_wh(100%, 100rpx)
padding 0 24rpx
overflow hidden
background-color rgba(255, 255, 255, .3)
box-shadow 0 1rpx 4rpx 0 rgba(160,160,160,0.9)
</style>

190
pages/login/login.vue Normal file
View File

@@ -0,0 +1,190 @@
<template>
<view class="zd_content bg">
<view class="p1">欢迎来到</view>
<view class="p2">瑞泰马钢手持系统</view>
<view class="input-box">
<input class="large-input" type="text" placeholder="请输入用户名" v-model="user">
</view>
<div class="input-box">
<input class="large-input" :password="!showPassword" placeholder="请输入密码" v-model="password">
<span class="iconfont icon_eye_close" :class="[showPassword ? 'icon_eye_active' : '']" @tap="changePassword">&#xe6a0;</span>
</div>
<view class="radio-box">
<view class="radio-wrap">
<span class="iconfont icon_unchecked" :class="{'icon_checked': saveUser}" @tap="toSaveUser">&#xe66b;</span>
<text class="radio-label">记住用户名</text>
</view>
<text class="setup-text" @tap="setup">设置</text>
<text class="setup-text" @tap="isUpdate">升级版本</text>
</view>
<button class="login-btn" :disabled="disabled" @tap="toLogin">确认登录</button>
<!-- <button class="login-btn" @tap="test">打印</button> -->
<view v-if="version !== ''" class="version-name">v{{version}}</view>
<Up-grade v-if="grade === true" @closeUpdate="closeUpdate" :androidUrl="androidUrl"></up-grade>
</view>
</template>
<script>
// import {getCLodop, getPrinterList} from "@/utils/CLodopfuncs.js"
import { RSAencrypt } from '@/utils/jsencrypt.js'
import {handLogin, pdaUpdate} from '@/utils/getData2.js'
import UpGrade from './upgrade.vue'
export default {
components: {
UpGrade
},
data() {
return {
user: this.$store.getters.loginName ? this.$store.getters.loginName : '',
password: '',
showPassword: false,
saveUser: this.$store.getters.loginName ? true : false,
disabled: false,
version: '',
versionCode: '',
grade: false,
androidUrl: ''
}
},
created () {
//#ifdef APP-PLUS
// 获取本地应用资源版本号
plus.runtime.getProperty(plus.runtime.appid, (info) => {
console.log(JSON.stringify(info));
this.version = info.version;
this.versionCode = info.versionCode ;
})
//#endif
},
methods: {
isUpdate () {
this._pdaUpdate()
},
// test() {
// let LODOP = getCLodop();
// // 更换为打印服务器ip 不需要加前缀
// LODOP.PRINT_INIT(null, "192.168.81.198");
// // 打印机序号 规则为打印服务器打印机列表倒数从0开始 -1为默认打印机
// LODOP.SET_PRINTER_INDEX(-1);
// // 设置打印纸大小
// LODOP.SET_PRINT_PAGESIZE(1, 800, 600, "");
// // 根据需求插入打印代码
// LODOP.PRINT(); // 打印
// // LODOP.PREVIEW()
// },
toSaveUser() {
this.saveUser = !this.saveUser
},
changePassword() {
this.showPassword = !this.showPassword
},
setup () {
uni.redirectTo({
url: '/pages/login/setup'
})
},
async toLogin() {
// uni.redirectTo({
// url: '/pages/home/home'
// })
this.disabled = true
if (this.user === '') {
uni.showToast({
title: '用户名不能为空',
icon: 'none'
})
this.disabled = false
return
}
if (this.password === '') {
uni.showToast({
title: '密码不能为空',
icon: 'none'
})
this.disabled = false
return
}
try {
let res = await handLogin(this.user, RSAencrypt(this.password))
if (this.saveUser) {
this.$store.dispatch('saveLoginName', this.user)
} else {
this.$store.dispatch('delLoginName', '')
}
this.$store.dispatch('saveUserInfo', JSON.stringify(res.user.user))
this.$store.dispatch('saveToken', res.token)
uni.redirectTo({
url: '/pages/home/home'
})
this.disabled = false
} catch (e) {
this.disabled = false
}
},
async _pdaUpdate () {
let res = await pdaUpdate()
if (res.versionName === this.version) {
uni.showToast({
title: '当前为最新版本',
icon: 'none'
})
} else {
this.grade = true
this.androidUrl = res.url
}
},
closeUpdate () {
this.grade = false
}
}
}
</script>
<style lang="stylus" scoped>
@import '../../common/style/mixin.styl';
.p1
_font(60rpx,75rpx,#444)
padding-top: 90rpx
.p2
_font(50rpx,1,#444)
padding: 40rpx 0 25rpx
.input-box
_fj()
margin-top 68rpx
height 75rpx
border-bottom 1rpx solid #e2e2e2
.large-input
_wh(calc(100% - 40rpx), 74rpx)
_font(32rpx,74rpx,#999)
padding-left 10rpx
.radio-box
_fj()
margin: 25rpx 0 70rpx 0
height: 34rpx
.radio-wrap
_fj(flex-start)
height: 34rpx
flex: 2
.radio-label
_font(28rpx, 28rpx,#333)
padding-left: 10rpx
.setup-text
_font(28rpx, 28rpx,$red,,right)
padding-left 25rpx
.bg
background-color: #fff;
_bis('../../static/image/login_bg.png', 100%,,bottom)
.login-btn
width 100%
border-radius 46rpx
_font(36rpx,92rpx,#fff,,center)
background-color $red
.zd_content
position: relative
height: 100%
.version-name
width 100%
position: absolute
bottom: 30rpx
_font(30rpx, 60rpx, #999,,center)
</style>

105
pages/login/setup.vue Normal file
View File

@@ -0,0 +1,105 @@
<template>
<view class="zd_container">
<nav-bar title="设置" :inner2="true" @goIn="goIn" :show1="false"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="input-wrap">
<view class="input-label">服务器地址</view>
<input type="text" class="setup-input" placeholder="请输入服务器地址" v-model="addrip">
</view>
</view>
<view class="zd_wrapper">
<view class="input-wrap">
<view class="input-label">刷新时间(s)</view>
<input type="text" class="setup-input" placeholder="请输入刷新时间" v-model="setTime">
</view>
</view>
<!-- <view class="zd_wrapper">
<view class="input-wrap">
<view class="input-label" style="margin-right: 20upx;">客户标签打印</view>
<uni-data-select v-model="index" :localdata="options" @change="selectChange"></uni-data-select>
</view>
</view> -->
</view>
<view class="submit-bar">
<button class="submit-button" @click="_submit">确认</button>
<!-- <button class="submit-button" @click="_virtualprintType">查询</button> -->
</view>
</view>
</template>
<script>
// import {virtualprintType} from '@/utils/getData2.js'
import NavBar from '@/components/NavBar.vue'
export default {
components: {
NavBar
},
data() {
return {
options: [],
index: '',
addrip: this.$store.getters.baseUrl,
setTime: this.$store.getters.setTime / 1000
};
},
created () {
// this._virtualprintType()
},
methods: {
goIn () {
uni.redirectTo({
url: '/pages/login/login'
})
},
/** 选择器 */
selectChange(e) {
this.index = e
},
/** 打印机类型下拉框查询 */
async _virtualprintType () {
let res = await virtualprintType(this.addrip)
this.options = [...res.data]
// if (this.$store.getters.setPrintName !== '') {
// this.index = this.$store.getters.setPrintName
// }
},
_submit () {
if (this.addrip === '') {
uni.showToast({
title: '服务器地址',
icon: 'none'
})
return
}
if (this.setTime === '') {
uni.showToast({
title: '请填写刷新时间',
icon: 'none'
})
return
}
// 存值
this.$store.dispatch('setConfig',{baseUrl: this.addrip, setTime: this.setTime * 1000, setPrintName: this.index})
uni.redirectTo({
url: '/pages/login/login'
})
}
}
}
</script>
<style lang="stylus">
@import '../../common/style/mixin.styl';
.input-wrap
width 100%
_fj()
.input-label
wh(200rpx, 58rpx)
_font(28rpx,58rpx,#464646)
.setup-input
_wh(calc(100% - 200rpx), 58rpx)
background #fff
_font(28rpx,58rpx,#323232)
padding 0 10rpx
</style>

229
pages/login/upgrade.vue Normal file
View File

@@ -0,0 +1,229 @@
<template>
<view class="mask flex-center">
<view class="content botton-radius">
<view class="content-top">
<text class="content-top-text">发现新版本</text>
<image class="content-top" style="top: 0;" width="100%" height="100%" src="../../static/image/bg_top.png">
</image>
</view>
<view class="content-header"></view>
<view class="content-body">
<view class="title">
<text>海亮铜箔又有新版本了升级到最新版本享受更丰富稳定快速的功能和体验</text>
</view>
<view class="footer flex-center">
<template>
<template v-if="!downloadSuccess">
<view class="progress-box flex-column" v-if="downloading">
<progress class="progress" border-radius="35" :percent="downLoadPercent" activeColor="#3DA7FF" show-info stroke-width="10" />
<view style="width:100%;font-size: 28rpx;display: flex;justify-content: space-around;">
<text>安装包下载中请稍后</text>
<text>({{downloadedSize}}/{{packageFileSize}}M)</text>
</view>
</view>
<button v-else class="content-button" style="border: none;color: #fff;" plain @click="updateApp">立即升级</button>
</template>
</template>
</view>
</view>
<image v-if="is_mandatory" class="close-img" src="../../static/image/app_update_close.png" @click.stop="closeUpdate"></image>
</view>
</view>
</template>
<script>
export default {
data () {
return {
downloadSuccess: false,
downloading: false,
downLoadPercent: 0,
downloadedSize: 0,
packageFileSize: 0,
is_mandatory: true
}
},
props: {
androidUrl: String
},
methods: {
updateApp() {
this.is_mandatory = false
this.downloading = true
this.doUpData(this.androidUrl);
},
doUpData(Url) {
const downloadTask = uni.downloadFile({
url: Url,
success: downloadResult => {
if (downloadResult.statusCode == 200) {
this.downloadSuccess = true;
plus.runtime.install(
//安装软件
downloadResult.tempFilePath,
{
force: true
},
function(res) {
plus.runtime.restart();
}
);
}
},
complete: () => {
this.downloading = false;
this.downLoadPercent = 0
this.downloadedSize = 0
this.packageFileSize = 0
}
});
// 下载进度
downloadTask.onProgressUpdate(res => {
this.downLoadPercent = res.progress;
this.downloadedSize = (res.totalBytesWritten / Math.pow(1024, 2)).toFixed(2);
this.packageFileSize = (res.totalBytesExpectedToWrite / Math.pow(1024, 2)).toFixed(2);
});
},
closeUpdate () {
this.$emit('closeUpdate')
}
}
}
</script>
<style>
page {
background: transparent;
}
.flex-center {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
justify-content: center;
align-items: center;
}
.mask {
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, .65);
}
.botton-radius {
border-bottom-left-radius: 30rpx;
border-bottom-right-radius: 30rpx;
}
.content {
position: relative;
top: 0;
width: 600rpx;
background-color: #fff;
box-sizing: border-box;
padding: 0 50rpx;
font-family: Source Han Sans CN;
}
.text {
/* #ifndef APP-NVUE */
display: block;
/* #endif */
line-height: 200px;
text-align: center;
color: #FFFFFF;
}
.content-top {
position: absolute;
top: -195rpx;
left: 0;
width: 600rpx;
height: 270rpx;
}
.content-top-text {
font-size: 45rpx;
font-weight: bold;
color: #F8F8FA;
position: absolute;
top: 120rpx;
left: 50rpx;
z-index: 1;
}
.content-header {
height: 80rpx;
}
.title {
font-size: 33rpx;
font-weight: bold;
color: #3DA7FF;
line-height: 38rpx;
color: #333;
}
.footer {
height: 150rpx;
display: flex;
align-items: center;
justify-content: space-around;
}
.box-des-scroll {
box-sizing: border-box;
padding: 0 40rpx;
height: 50rpx;
text-align: left;
}
.box-des {
font-size: 26rpx;
color: #000000;
line-height: 50rpx;
}
.progress-box {
width: 100%;
}
.progress {
width: 90%;
height: 40rpx;
border-radius: 35px;
}
.close-img {
width: 70rpx;
height: 70rpx;
z-index: 1000;
position: absolute;
bottom: -120rpx;
left: calc(50% - 70rpx / 2);
}
.content-button {
text-align: center;
flex: 1;
font-size: 30rpx;
font-weight: 400;
color: #FFFFFF;
border-radius: 40rpx;
margin: 0 18rpx;
height: 80rpx;
line-height: 80rpx;
background: linear-gradient(to right, #1785ff, #3DA7FF);
}
.flex-column {
display: flex;
flex-direction: column;
align-items: center;
}
</style>

View File

@@ -0,0 +1,124 @@
<template>
<view class="zd_container">
<nav-bar title="设备点检"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="filter_item">
<view class="filter_label">设备号</view>
<view class="filter_input_wraper">
<uni-data-select v-model="index1" :localdata="options1" @change="selectChange1"></uni-data-select>
</view>
</view>
<view class="filter_item">
<view class="filter_label_wraper">
<span class="filter_label">状态</span>
</view>
<view class="filter_input_wraper">
<uni-data-select v-model="index2" :localdata="options2" @change="selectChange2"></uni-data-select>
</view>
</view>
<view class="filter_item filter_item_1">
<view class="filter_label">备注</view>
<view class="filter_input_wraper filter_input_wraper_1">
<textarea class="filter_textarea" v-model="remark"></textarea>
</view>
</view>
</view>
</view>
<view class="submit-bar">
<button class="submit-button" :class="{'btn-disabled': !index1 || !index2}" :disabled="disabled1" @tap="toSure">确认</button>
<button class="submit-button" @tap="toCancle">取消</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {deviceInfo, deviceStatus, deviceCheckVerify} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
options1: [],
index1: '',
options2: [],
index2: '',
remark: '',
disabled1: false
};
},
created () {
this._deviceInfo()
this._deviceStatus()
},
methods: {
/** 选择器 */
selectChange1(e) {
this.index1 = e
},
selectChange2(e) {
this.index2 = e
},
/** 获取设备下拉框 */
async _deviceInfo () {
let res = await deviceInfo()
this.options1 = [...res]
},
/** 获取设备状态下拉框 */
async _deviceStatus () {
let res = await deviceStatus()
this.options2 = [...res]
},
/** 确定 */
async toSure () {
this.disabled1 = true
if (!this.index1) {
uni.showToast({
title: '设备号不能为空',
icon: 'none'
})
this.disabled1 = false
return
}
if (!this.index2) {
uni.showToast({
title: '状态不能为空',
icon: 'none'
})
this.disabled1 = false
return
}
try {
let userName = this.$store.getters.userInfo !== '' ? JSON.parse(this.$store.getters.userInfo).username : ''
let res = await deviceCheckVerify(this.index1, userName,this.remark, this.index2)
this.disabled1 = false
this.index1 = ''
this.index2 = ''
this.remark = ''
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled1 = false
}
},
toCancle () {
this.disabled1 = false
this.index1 = ''
this.index2 = ''
this.remark = false
}
}
}
</script>
<style lang="stylus" scoped>
.filter_item_1, .filter_input_wraper_1
align-items: flex-start
height 210rpx
</style>