<template>
|
<view class="template-job tn-safe-area-inset-bottom">
|
|
<!-- 顶部自定义导航 -->
|
<tn-nav-bar fixed :isBack="false" :bottomShadow="false" backgroundColor="unset">
|
<text class="page-title">我的</text>
|
</tn-nav-bar>
|
|
<view class="home-top-bg"></view>
|
|
<view class="home-top-box" :style="{paddingTop:paddingTop+'px'}">
|
<view class="userinfo-box">
|
<view class="userinfo-img">
|
<image src="../../static/user.png" style="width:50px;height:50px;"></image>
|
</view>
|
<view class="userinfo-value-box">
|
<view class="user-nickname">{{ vuex_is_login ? vuex_user :'昵称' }}</view>
|
<view class="user-nickname">{{ vuex_is_login ? company :'公司' }}</view>
|
<!-- <view class="user-company">{{ vuex_is_login ? usercode :'暂未登录' }}</view> -->
|
</view>
|
</view>
|
<view style="margin:0 15px;margin-top:20px;">
|
<u-notice-bar v-if="text1.length!=0" mode="closable" direction="row" step
|
:text="text1">{{text1}}</u-notice-bar>
|
<u-cell-group>
|
<u-cell size="large" icon="level" title="当前版本" :value="appversion" isLink @click="update">
|
</u-cell>
|
<u-cell size="large" icon="setting-fill" title="切换数据源" value="输入地址" isLink
|
@click="updatedata"></u-cell>
|
<!-- <u-cell size="large" icon="bell-fill" title="测试通知" value="发送通知" isLink @click="message"></u-cell> -->
|
<u-cell size="large" icon="camera-fill" title="信息登记" value="前往录入" isLink @click="camera"></u-cell>
|
<u-cell v-show="juese=='超级管理员'" size="large" icon="../../static/my/faka.png" title="发卡管理"
|
value="进入管理" isLink @click="faka"></u-cell>
|
<u-cell size="large" icon="../../static/my/base.png" title="显示基站">
|
<u-switch slot="value" v-model="isbase" @change="changejizhan"></u-switch></u-cell>
|
<u-cell size="large" icon="../../static/my/fence.png" title="显示围栏">
|
<u-switch slot="value" v-model="isfence" @change="changeweilan"></u-switch></u-cell>
|
<u-cell size="large" icon="../../static/my/offline.png" title="离线显示">
|
<u-switch slot="value" v-model="isoffline" @change="changelixian"></u-switch></u-cell>
|
<u-cell size="large" icon="../../static/my/3wei.png" title="显示3维">
|
<u-switch slot="value" v-model="is3wei" @change="change3wei"></u-switch></u-cell>
|
<u-cell size="large" icon="../../static/my/ceju.png" title="寻物防丢">
|
<u-switch slot="value" v-model="isceju" @change="changeceju"></u-switch></u-cell>
|
</u-cell-group>
|
<image v-if="imageSrc" :src="imageSrc" mode="aspectFit"></image>
|
</view>
|
|
<u-modal buttonReverse confirmText="取一张卡" cancelText="取全部卡" :show="showfaka" @cancel="cancelfaka"
|
@confirm="confirmfaka" ref="uModal" :showCancelButton="true" :closeOnClickOverlay="true">
|
<u-icon name="close" style="position: absolute;right: 10px;top:10px" @click="closemodal"></u-icon>
|
<uni-data-select style="position: absolute; width: 85%;" placeholder="选择柜子" v-model="value"
|
:localdata="guizi" @change="change"></uni-data-select>
|
<uni-grid style="margin-top: 50px;" v-if="isguizi" :column="3" :highlight="true">
|
<view v-for="(locker,index) in lockers" :key="index">
|
<uni-grid-item v-for="(item, index) in locker" :index="index" :key="index"
|
style="height: 20px; padding:0">
|
<text :style="{'background-color': item.borderColor,'border': '1px solid #000000' }"
|
align="center" class="text" @click="check1(item)">{{item.num}}</text>
|
|
</uni-grid-item>
|
</view>
|
</uni-grid>
|
<view v-else style="background-color: #ffffff; margin-top: 30px;margin-bottom: 30px;"></view>
|
<!--<u--form style="width: 80%; position: absolute;bottom: 60px;" labelPosition="left" :model="model2"
|
:rules="rules2" ref="uForm">
|
<u-form-item required label="手机号:" prop="userInfo.phone" borderBottom ref="item1" labelWidth="60px">
|
<u--input v-model="model2.userInfo.phone" border="none" placeholder="请输入电话"></u--input>
|
</u-form-item>
|
<u-form-item required label="验证码:" prop="userInfo.yzm" borderBottom ref="item1" labelWidth="60px">
|
<u--input v-model="model2.userInfo.yzm" border="none" placeholder="请输入验证码"></u--input>
|
<u-toast ref="uToast"></u-toast>
|
<u-code :seconds="seconds" ref="uCode" @change="codeChange"></u-code>
|
<u-button slot="right" type="primary" size="small" @tap="getCode2">{{tips}}</u-button>
|
</u-form-item>
|
</u--form> -->
|
</u-modal>
|
<u-modal buttonReverse confirmText="保存" :show="showinfo" :title="titleinfo" @cancel="cancelinfo"
|
@confirm="confirminfo" ref="uModal" :showCancelButton="true">
|
<u--form labelPosition="left" :model="model1" :rules="rules" ref="uForm">
|
<u-form-item required label="人脸照片" prop="userInfo.images" borderBottom ref="item1"
|
labelWidth="100px">
|
<u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple
|
:previewFullImage="true" :maxCount="1"></u-upload>
|
</u-form-item>
|
<u-form-item required label="卡类型" prop="userInfo.type" borderBottom ref="item1" labelWidth="60px">
|
<u-radio-group v-model="radiovalue1" @change="groupChange" placement="row">
|
<u-radio :customStyle="{marginBottom: '8px',marginLeft:'18px'}"
|
v-for="(item, index) in radiolist1" :key="index" :label="item.name" :name="item.name"
|
@change="radioChange"></u-radio>
|
</u-radio-group>
|
</u-form-item>
|
<u-form-item v-if="tagshow" required label="卡号" prop="userInfo.tagId" borderBottom ref="item1">
|
<u--input v-model="model1.userInfo.tagId" border="none" placeholder="请输入卡号"></u--input>
|
</u-form-item>
|
<u-form-item required label="姓名" prop="userInfo.name" borderBottom ref="item1">
|
<u--input v-model="model1.userInfo.name" border="none" placeholder="请输入姓名"></u--input>
|
</u-form-item>
|
|
<u-form-item required label="电话" prop="userInfo.phone" borderBottom ref="item1">
|
<u--input v-model="model1.userInfo.phone" border="none" placeholder="请输入电话"></u--input>
|
</u-form-item>
|
|
<u-form-item required label="验证码" prop="userInfo.yzm" borderBottom ref="item1" labelWidth="60px">
|
<u--input v-model="model1.userInfo.yzm" border="none" placeholder="请输入验证码"></u--input>
|
<u-toast ref="uToast"></u-toast>
|
<u-code :seconds="seconds" ref="uCode" @change="codeChange"></u-code>
|
<u-button slot="right" type="primary" size="small" @tap="getCode">{{tips}}</u-button>
|
<!-- <u-button size="small" type="primary" @click="getVerificationCode">获取验证码</u-button> -->
|
</u-form-item>
|
</u--form>
|
</u-modal>
|
<tn-popup v-model="showpopup" mode="bottom" closeBtn>
|
|
|
<view style="padding: 30rpx;margin-bottom:70px;">
|
<tn-form>
|
<tn-form-item label="IP地址:" labelWidth='100rpx'>
|
<tn-input v-model="form.url" inputAlign="right" placeholder="请输入IP地址"></tn-input>
|
</tn-form-item>
|
<tn-form-item label="端口:" labelWidth='100rpx'>
|
<tn-input v-model="form.port" inputAlign="right" placeholder="请输入端口"></tn-input>
|
</tn-form-item>
|
</tn-form>
|
<button style="margin-top: 20px;" type="primary" @click="submitForm">提交</button>
|
</view>
|
</tn-popup>
|
</view>
|
|
<scroll-view scroll-y="true" class="scroll-Y">
|
<view class="scroll-box">
|
|
</view>
|
</scroll-view>
|
|
<view class="confirm-box">
|
<view class="confirm-right" @click="logout" v-if="vuex_is_login">退出登录</view>
|
<view class="confirm-right" @click="confirm" v-if="!vuex_is_login">去登录</view>
|
</view>
|
|
<u-modal :show="show" :title="title" @cancel="cancel" @confirm="confirm" ref="uModal" :showCancelButton="true"
|
:content='content'></u-modal>
|
<successCom ref="refSuccess"></successCom>
|
|
<!-- <bleCom></bleCom> -->
|
</view>
|
</template>
|
|
<script>
|
// const content = require('./content')
|
const http = uni.$u.http
|
import checkUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update';
|
var url = http.config.baseURL.split(":")[0] + ":" + http.config.baseURL.split(":")[1]
|
import successCom from '@/components/success.vue'
|
import {
|
formatDate,
|
get_time_cha_s
|
} from '@/js/tools.js'
|
import store from '@/store/index.js'
|
import bleCom from './ble.vue';
|
import linkCom from '@/components/linkBox.vue'
|
import {
|
updateBaseURL
|
} from '@/config/request.js' // 导入 updateBaseURL 函数
|
import {
|
undateFaka,
|
findFakaTag,
|
findFakagui,
|
findTbUpapp,
|
ShouDongKaiSuo,
|
findFakaji,
|
updateTagApi,
|
sms,
|
addpicqwe,
|
earlyWarning,
|
updatedatasource
|
} from '@/config/api.js';
|
import {
|
minLogin
|
} from '@/js/minLogin.js'
|
import {
|
pagesPerson
|
} from '@/js/pages/person.js'
|
export default {
|
mixins: [pagesPerson, minLogin],
|
components: {
|
bleCom,
|
successCom,
|
linkCom
|
},
|
data() {
|
return {
|
kalist: [],
|
tag: '',
|
value: 0,
|
guizi: [],
|
appversion: 'v1.1.0',
|
downloadUrl: '',
|
text1: [],
|
isguizi: false,
|
rowindex: 0,
|
checked: Boolean,
|
lockers: [
|
[{
|
num: 1,
|
borderColor: '',
|
checked: false,
|
}, {
|
num: 2,
|
checked: false,
|
borderColor: ''
|
}, {
|
num: 3,
|
checked: false,
|
borderColor: ''
|
}, {
|
num: 4,
|
checked: false,
|
borderColor: ''
|
}, {
|
num: 5,
|
checked: false,
|
borderColor: ''
|
}, {
|
num: 6,
|
checked: false,
|
borderColor: ''
|
}, {
|
num: 7,
|
checked: false,
|
borderColor: ''
|
}, {
|
num: 8,
|
checked: false,
|
borderColor: ''
|
}, {
|
num: 9,
|
checked: false,
|
borderColor: ''
|
}, {
|
num: 10,
|
checked: false,
|
borderColor: ''
|
}, {
|
num: 11,
|
checked: false,
|
borderColor: ''
|
}, {
|
num: 12,
|
checked: false,
|
borderColor: ''
|
}, {
|
num: 13,
|
checked: false,
|
borderColor: ''
|
}, {
|
num: 14,
|
borderColor: ''
|
}, {
|
num: 15,
|
borderColor: ''
|
}, {
|
num: 16,
|
borderColor: ''
|
}, {
|
num: 17,
|
borderColor: ''
|
}, {
|
num: 18,
|
borderColor: ''
|
}, {
|
num: 19,
|
borderColor: ''
|
}, {
|
num: 20,
|
borderColor: ''
|
}],
|
|
|
[{
|
num: 21,
|
borderColor: ''
|
},
|
{
|
num: 22,
|
borderColor: ''
|
}, {
|
num: 23,
|
borderColor: ''
|
}, {
|
num: 24,
|
borderColor: ''
|
}, {
|
num: 25,
|
borderColor: ''
|
}, {
|
num: 26,
|
borderColor: ''
|
}, {
|
num: 27,
|
borderColor: ''
|
}, {
|
num: 28,
|
borderColor: ''
|
}, {
|
num: 29,
|
borderColor: ''
|
}, {
|
num: 30,
|
borderColor: ''
|
}, {
|
num: 31,
|
borderColor: ''
|
}, {
|
num: 32,
|
borderColor: ''
|
}, {
|
num: 33,
|
borderColor: ''
|
}, {
|
num: 34,
|
borderColor: ''
|
}, {
|
num: 35,
|
borderColor: ''
|
}, {
|
num: 36,
|
borderColor: ''
|
}, {
|
num: 37,
|
borderColor: ''
|
}, {
|
num: 38,
|
borderColor: ''
|
}, {
|
num: 39,
|
borderColor: ''
|
}, {
|
num: 40,
|
borderColor: ''
|
}
|
],
|
|
|
[{
|
num: 41,
|
borderColor: ''
|
},
|
{
|
num: 42,
|
borderColor: ''
|
}, {
|
num: 43,
|
borderColor: ''
|
}, {
|
num: 44,
|
borderColor: ''
|
}, {
|
num: 45,
|
borderColor: ''
|
}, {
|
num: 46,
|
borderColor: ''
|
}, {
|
num: 47,
|
borderColor: ''
|
}, {
|
num: 48,
|
borderColor: ''
|
}, {
|
num: 49,
|
borderColor: ''
|
}, {
|
num: 50,
|
borderColor: ''
|
}, {
|
num: 51,
|
borderColor: ''
|
}, {
|
num: 52,
|
borderColor: ''
|
}, {
|
num: 53,
|
borderColor: ''
|
}, {
|
num: 54,
|
borderColor: ''
|
}, {
|
num: 55,
|
borderColor: ''
|
}, {
|
num: 56,
|
borderColor: ''
|
}, {
|
num: 57,
|
borderColor: ''
|
}, {
|
num: 58,
|
borderColor: ''
|
}, {
|
num: 59,
|
borderColor: ''
|
}, {
|
num: 60,
|
borderColor: ''
|
}
|
],
|
// [21, 22,23,24],
|
// // ... 其他数据
|
// [41, 42, 43,44]
|
],
|
borderColor: '',
|
showfaka: false,
|
tagshow: false,
|
radiovalue1: '随机卡',
|
radiolist1: [{
|
name: '随机卡',
|
disabled: false
|
},
|
{
|
name: '固定卡',
|
disabled: false
|
}
|
],
|
yzm: '',
|
tips: '',
|
seconds: 60,
|
jizhan: false,
|
weilan: false,
|
lixian: true,
|
model1: {
|
userInfo: {
|
images: '',
|
name: '',
|
phone: '',
|
yzm: '',
|
tagId: '',
|
},
|
},
|
model2: {
|
userInfo: {
|
images: '',
|
name: '',
|
phone: '',
|
yzm: '',
|
tagId: '',
|
},
|
},
|
rules2: {
|
'userInfo.phone': {
|
type: 'string',
|
// max: 1,
|
required: true,
|
message: '请填写手机号',
|
trigger: ['blur', 'change']
|
},
|
'userInfo.yzm': {
|
type: 'string',
|
// max: 1,
|
required: true,
|
message: '请填写验证码',
|
trigger: ['blur', 'change']
|
},
|
|
},
|
rules: {
|
'userInfo.name': {
|
type: 'string',
|
required: true,
|
message: '请填写姓名',
|
trigger: ['blur', 'change']
|
},
|
'userInfo.phone': {
|
type: 'string',
|
// max: 1,
|
required: true,
|
message: '请填写手机号',
|
trigger: ['blur', 'change']
|
},
|
'userInfo.yzm': {
|
type: 'string',
|
// max: 1,
|
required: true,
|
message: '请填写验证码',
|
trigger: ['blur', 'change']
|
},
|
'userInfo.tagId': {
|
type: 'string',
|
// max: 1,
|
required: true,
|
message: '请填写卡号',
|
trigger: ['blur', 'change']
|
},
|
'userInfo.images': {
|
type: 'string',
|
// max: 1,
|
required: true,
|
message: '请上传照片',
|
trigger: ['blur', 'change']
|
},
|
},
|
showinfo: false,
|
titleinfo: '信息登记',
|
// contentinfo: 'uView的目标是成为uni-app生态最优秀的UI框架',
|
fileList1: [],
|
imageSrc: '', // 存储图片路径
|
showpopup: false,
|
form: {
|
port: '',
|
url: '',
|
// username:'',
|
// password:'',
|
},
|
|
show: false,
|
title: '退出登录',
|
content: '确认退出当前登录?',
|
scrollHeight: 500,
|
paddingTop: 60,
|
list: [{
|
title: '当前版本',
|
route: '',
|
icon: '/static/my/test1.png',
|
value: 'v1.0.3',
|
},
|
{
|
title: '切换数据源',
|
route: 'updatedata',
|
icon: '/static/my/test2.png',
|
value: '',
|
},
|
{
|
title: '测试通知',
|
route: 'message',
|
icon: '/static/my/test2.png',
|
value: '',
|
}
|
]
|
}
|
},
|
mounted() {
|
this.lunbo()
|
if (this.vuex_is_login) {
|
findFakagui().then((res) => {
|
if (res.code == 0) {
|
this.guizi = res.data.map(item => ({
|
value: item.deviceid,
|
text: item.cabinetname
|
}));
|
}
|
})
|
}
|
setTimeout(() => {
|
this.paddingTop = this.vuex_padding_top
|
this.paddingTop += 5
|
}, 700)
|
},
|
methods: {
|
lunbo() {
|
// const params = {
|
// name: '定位app',
|
// // deviceid: this.value,
|
// }
|
if (this.vuex_is_login) {
|
findTbUpapp().then((res) => {
|
console.log(res);
|
if (res.code == 0) {
|
if (this.appversion != res.data.version) {
|
for (var i = 0; i < res.data.info.split(",").length; i++) {
|
this.text1.push(res.data.info.split(",")[i])
|
}
|
this.downloadUrl = res.data.address
|
}
|
}
|
})
|
}
|
},
|
change(e) {
|
if (this.value != 0) {
|
this.isguizi = true
|
const params = {
|
deviceid: this.value,
|
}
|
if (this.vuex_is_login) {
|
findFakaji(params).then((res) => {
|
|
if (res.data != 0) {
|
for (var j = 0; j < 3; j++) {
|
let num = 0
|
let total = 20
|
for (let i = num; i < total; i++) {
|
if (this.lockers[j][i].num === parseInt(res.data[j * 20 + i].slotnumber)) {
|
// // 设置borderColor属性
|
if (res.data[j * 20 + i].allowtakecard == 'true') {
|
this.lockers[j][i].borderColor = '#00ff00';
|
this.lockers[j][i].checked = true
|
this.kalist.push(res.data[j * 20 + i].slotnumber)
|
} else {
|
this.lockers[j][i].borderColor = '#a3a3a3';
|
this.lockers[j][i].checked = false
|
}
|
}
|
if (i == total - 1) {
|
break;
|
}
|
}
|
}
|
}
|
})
|
}
|
} else {
|
this.isguizi = false
|
this.this.kalist = []
|
}
|
},
|
update() {
|
if (this.info == undefined) {
|
this.$refs.refSuccess.showBox({
|
type: 'error',
|
txt: '未检测到新版本'
|
});
|
} else {
|
uni.showLoading({
|
title: '正在下载'
|
});
|
|
uni.downloadFile({
|
url: this.downloadUrl,
|
header: {
|
'Authorization': uni.getStorageSync('access_token')
|
},
|
success: (res) => {
|
uni.hideLoading();
|
if (res.statusCode === 200) {
|
// 下载成功,打开文件管理器让用户选择保存位置
|
uni.openDocument({
|
filePath: res.tempFilePath,
|
showMenu: true,
|
success: () => {},
|
fail: (err) => {
|
uni.showToast({
|
title: '文件打开失败',
|
icon: 'none'
|
});
|
}
|
});
|
} else {
|
console.error('下载失败', res);
|
uni.showToast({
|
title: '下载失败',
|
icon: 'none'
|
});
|
}
|
},
|
fail: (err) => {
|
uni.hideLoading();
|
console.error('下载失败', err);
|
uni.showToast({
|
title: '下载失败',
|
icon: 'none'
|
});
|
}
|
});
|
}
|
},
|
closemodal() {
|
this.showfaka = false
|
this.isguizi = false
|
this.kalist = []
|
this.value = 0
|
this.model2.userInfo.phone = ''
|
this.model2.userInfo.yzm = ''
|
},
|
check1(rowIndex) {
|
// 遍历每个子数组
|
if (this.rowindex != 0) {
|
for (let i = 0; i < this.lockers.length; i++) { //3
|
for (let j = 0; j < this.lockers[i].length; j++) { //20
|
// 找到num为21的对象
|
if (this.lockers[i][j].num === this.rowindex) {
|
// 设置borderColor属性
|
if (this.lockers[i][j].checked == true) {
|
this.lockers[i][j].borderColor = '#00ff00';
|
} else {
|
this.lockers[i][j].borderColor = '#a3a3a3';
|
}
|
//
|
// 找到后直接返回,无需继续遍历
|
break;
|
}
|
}
|
}
|
}
|
rowIndex.borderColor = 'red'
|
this.rowindex = rowIndex.num
|
this.checked = rowIndex.checked
|
const params = {
|
slotnumber: this.rowindex,
|
deviceid: this.value,
|
}
|
if (this.vuex_is_login) {
|
findFakaTag(params).then((res) => {
|
this.tag = res.data.tagid
|
})
|
}
|
},
|
faka() {
|
this.showfaka = true
|
|
},
|
cancelfaka() {
|
// if (this.model2.userInfo.phone == '' || this.model2.userInfo.yzm == '') {
|
// this.$refs.refSuccess.showBox({
|
// type: 'error',
|
// txt: '请先输入手机号和验证码'
|
// });
|
// } else if (this.model2.userInfo.yzm != this.yzm) {
|
// this.$refs.refSuccess.showBox({
|
// type: 'error',
|
// txt: '验证码有误'
|
// });
|
// } else
|
if (this.isguizi == false) {
|
this.$refs.refSuccess.showBox({
|
type: 'error',
|
txt: '请先选择柜子'
|
});
|
} else if (this.kalist.length == 0) {
|
this.$refs.refSuccess.showBox({
|
type: 'error',
|
txt: '暂无可用的卡'
|
});
|
} else {
|
var data = {
|
// const username = sessionStorage.getItem("username");
|
// doorNo:'05'
|
}
|
data.username = this.username
|
var method = 'POST'
|
var contentType = 'application/x-www-form-urlencoded'
|
uni.request({
|
// url: "http://192.168.31.101:8181/Fence/", //接口地址。
|
// url: "http://111.198.60.6:6008/Fence/", //接口地址。
|
url: url + ":8081/hxzkuwb/ShouDongQuanKaiSuo", //接口地址。
|
// url: "http://39.106.210.13:8081/hxzkuwb/ShouDongQuanKaiSuo", //接口地址。
|
data: data,
|
method: method,
|
// header: { //请求头可自定义
|
// 'x-access-token': 'eyJ0eXAiOjKV1QiLCJhbGciOiUzI1Ni9.eyJ0aW1UЗRhbXAiО¡EЗMzUzMDY5MjU3NDcsInVzZXJZCl6luS6juW_1-W9pCj9.etegDTn2NtsHF-vTnV8b0q-4AESEjBZ-n 9XTqTSXYk',
|
// 'content-type': contentType,
|
// },
|
timeout: 5000, //设置超时时间,默认5秒
|
success: (rep) => { //具体捕获请看自己接口返回的形式
|
if (rep.data > 0) {
|
|
for (var i = 0; i < this.kalist.length; i++) {
|
const params = {
|
slotnumber: this.kalist[i],
|
deviceid: this.value,
|
}
|
if (this.vuex_is_login) {
|
undateFaka(params).then((res) => {
|
if (res.data > 0) {
|
this.$refs.refSuccess.showBox({
|
type: 'success',
|
txt: "取卡成功!"
|
});
|
}
|
})
|
}
|
}
|
|
|
}
|
},
|
fail(error) {
|
// uni.hideLoading();
|
// uni.$u.toast('网络不通');
|
// reject(error)
|
},
|
complete() {
|
uni.hideLoading();
|
}
|
});
|
|
}
|
},
|
confirmfaka() {
|
// if (this.model2.userInfo.phone == '' || this.model2.userInfo.yzm == '') {
|
// this.$refs.refSuccess.showBox({
|
// type: 'error',
|
// txt: '请先输入手机号和验证码'
|
// });
|
// } else if (this.model2.userInfo.yzm != this.yzm) {
|
// this.$refs.refSuccess.showBox({
|
// type: 'error',
|
// txt: '验证码有误'
|
// });
|
// } else
|
if (this.checked == false) {
|
this.$refs.refSuccess.showBox({
|
type: 'error',
|
txt: '当前选择卡不可取'
|
});
|
} else if (this.rowindex == 0) {
|
this.$refs.refSuccess.showBox({
|
type: 'error',
|
txt: '请选择一张卡'
|
});
|
} else {
|
var data = {}
|
data.slotnumber = this.rowindex
|
data.deviceid = this.value
|
data.tagname = this.vuex_user
|
// var tag = ''
|
|
|
data.tagid = this.tag
|
var method = 'POST'
|
var contentType = 'application/x-www-form-urlencoded'
|
uni.request({
|
// url: "http://192.168.31.101:8181/Fence/", //接口地址。
|
// url: "http://111.198.60.6:6008/Fence/", //接口地址。
|
url: url + ":8081/hxzkuwb/ShouDongKaiSuo", //接口地址。
|
// url: "http://39.106.210.13:8081/hxzkuwb/ShouDongKaiSuo", //接口地址。
|
data: data,
|
method: method,
|
// header: { //请求头可自定义
|
// 'x-access-token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0aW1lU3RhbXAiOjE3MzY4NDU4ODA1NzQsInVzZXJSb2xlIjoi5pmu6YCa566h55CG5ZGYIiwidXNlcklkIjoi546L6aOeIn0.tLcyMcQEl4PpawmWIKBZ3cr7st2h_XxlclsGCuQBEzo',
|
// 'content-type': contentType,
|
// },
|
timeout: 5000, //设置超时时间,默认5秒
|
success: (rep) => { //具体捕获请看自己接口返回的形式
|
if (rep.data > 0) {
|
const params = {
|
slotnumber: this.rowindex,
|
deviceid: this.value,
|
}
|
if (this.vuex_is_login) {
|
undateFaka(params).then((res) => {
|
if (res.data > 0) {
|
this.$refs.refSuccess.showBox({
|
type: 'success',
|
txt: "取卡成功!"
|
});
|
}
|
})
|
}
|
}
|
},
|
fail(error) {},
|
complete() {
|
uni.hideLoading();
|
}
|
});
|
|
}
|
},
|
groupChange(n) {},
|
radioChange(n) {
|
if (n == "固定卡") {
|
this.tagshow = true
|
} else {
|
this.tagshow = false
|
}
|
},
|
generateRandomCode: function() {
|
var code = "";
|
var possible = "0123456789"; // 可选的字符集合
|
for (var i = 0; i < 4; i++) {
|
// 从字符集合中随机选择一个字符,并添加到验证码中
|
code += possible.charAt(Math.floor(Math.random() * possible.length));
|
}
|
return code;
|
},
|
codeChange(text) {
|
this.tips = text;
|
},
|
getCode2() {
|
if (this.model2.userInfo.phone == '') {
|
uni.$u.toast('手机号不能为空!');
|
return false;
|
}
|
if (this.$refs.uCode.canGetCode) {
|
// 模拟向后端请求验证码
|
uni.showLoading({
|
title: '正在获取验证码'
|
})
|
this.yzm = this.generateRandomCode();
|
const params = {
|
phone: this.model2.userInfo.phone,
|
randomNumber: this.yzm,
|
}
|
if (this.vuex_is_login) {
|
sms(params).then((res) => {
|
uni.hideLoading();
|
// 这里此提示会被this.start()方法中的提示覆盖
|
uni.$u.toast('验证码已发送');
|
// 通知验证码组件内部开始倒计时
|
this.$refs.uCode.start();
|
})
|
}
|
} else {
|
uni.$u.toast('倒计时结束后再发送');
|
}
|
},
|
getCode() {
|
if (this.model1.userInfo.phone == '') {
|
uni.$u.toast('手机号不能为空!');
|
return false;
|
}
|
if (this.$refs.uCode.canGetCode) {
|
// 模拟向后端请求验证码
|
|
uni.showLoading({
|
title: '正在获取验证码'
|
})
|
this.yzm = this.generateRandomCode();
|
const params = {
|
phone: this.model1.userInfo.phone,
|
randomNumber: this.yzm,
|
}
|
if (this.vuex_is_login) {
|
sms(params).then((res) => {
|
uni.hideLoading();
|
// 这里此提示会被this.start()方法中的提示覆盖
|
uni.$u.toast('验证码已发送');
|
// 通知验证码组件内部开始倒计时
|
this.$refs.uCode.start();
|
|
})
|
}
|
} else {
|
uni.$u.toast('倒计时结束后再发送');
|
}
|
},
|
end() {
|
uni.$u.toast('倒计时结束');
|
},
|
start() {
|
uni.$u.toast('倒计时开始');
|
},
|
changejizhan(e) {
|
store.commit('$tStore', {
|
name: 'isbase',
|
value: e
|
})
|
},
|
changeweilan(e) {
|
store.commit('$tStore', {
|
name: 'isfence',
|
value: e
|
})
|
},
|
changelixian(e) {
|
store.commit('$tStore', {
|
name: 'isoffline',
|
value: e
|
})
|
},
|
|
change3wei(e) {
|
store.commit('$tStore', {
|
name: 'is3wei',
|
value: e
|
})
|
},
|
changeceju(e) {
|
console.log(e);
|
// checkUpdate()
|
if (e==true) {
|
uni.reLaunch({
|
url: '/pages/index/ble'
|
});
|
}else{
|
// closeBle() { //关闭蓝牙
|
uni.closeBLEConnection({
|
deviceId: this.GET_CONNECT_DEVICEId,
|
success(res) {
|
store.commit('$tStore', {
|
name: 'GET_CONNECT_DEVICEId',
|
value: ""
|
})
|
store.commit('$tStore', {
|
name: 'GET_BLE_DATA',
|
value: '请先连接蓝牙'
|
})
|
store.commit('$tStore', {
|
name: 'isceju',
|
value: false
|
})
|
}
|
})
|
// },
|
}
|
|
},
|
|
|
|
|
cancelinfo() {
|
this.showinfo = false
|
this.fileList1 = []
|
this.model1.userInfo.phone = ''
|
this.model1.userInfo.name = ''
|
this.model1.userInfo.images = ''
|
this.model1.userInfo.tagId = ''
|
this.model1.userInfo.yzm = ''
|
},
|
confirminfo() {
|
this.$refs.uForm.validate().then(res => {
|
uni.$u.toast('校验通过')
|
const params = {
|
pdepartment: '系统默认',
|
pphone: this.model1.userInfo.phone,
|
pname: this.model1.userInfo.name,
|
baoliu38: this.model1.userInfo.images,
|
ptagid: this.model1.userInfo.tagId,
|
}
|
var method = 'POST'
|
var contentType = 'application/x-www-form-urlencoded'
|
uni.request({
|
// url: "http://192.168.31.101:8181/Fence/", //接口地址。
|
// url: "http://111.198.60.6:6008/Fence/", //接口地址。
|
url: url + ":8081/hxzkuwb/AddFacePerson", //接口地址。
|
// url: "http://192.168.31.60:8081/hxzkuwb/AddFacePerson", //接口地址。
|
// url: "http://39.106.210.13:8081/hxzkuwb/ShouDongKaiSuo", //接口地址。
|
data: params,
|
method: method,
|
// header: { //请求头可自定义
|
// 'x-access-token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0aW1lU3RhbXAiOjE3MzY4NDU4ODA1NzQsInVzZXJSb2xlIjoi5pmu6YCa566h55CG5ZGYIiwidXNlcklkIjoi546L6aOeIn0.tLcyMcQEl4PpawmWIKBZ3cr7st2h_XxlclsGCuQBEzo',
|
// 'content-type': contentType,
|
// },
|
timeout: 5000, //设置超时时间,默认5秒
|
success: (rep) => { //具体捕获请看自己接口返回的形式
|
if (rep.data > 0) {
|
this.model1.userInfo.phone = ''
|
this.model1.userInfo.name = ''
|
this.model1.userInfo.images = ''
|
this.model1.userInfo.tagId = ''
|
this.model1.userInfo.yzm = ''
|
this.fileList1 = []
|
}
|
},
|
fail(error) {},
|
complete() {
|
uni.hideLoading();
|
}
|
});
|
this.showinfo = false
|
}).catch(errors => {
|
uni.$u.toast('校验失败', errors)
|
})
|
|
},
|
// 删除图片
|
deletePic(event) {
|
this[`fileList${event.name}`].splice(event.index, 1)
|
},
|
// 新增图片
|
async afterRead(event) {
|
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
|
let lists = [].concat(event.file)
|
let fileListLen = this[`fileList${event.name}`].length
|
lists.map((item) => {
|
this[`fileList${event.name}`].push({
|
...item,
|
status: 'uploading',
|
message: '上传中'
|
})
|
})
|
for (let i = 0; i < lists.length; i++) {
|
const result = await this.uploadFilePromise(lists[i].url)
|
let item = this[`fileList${event.name}`][fileListLen]
|
this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
|
status: 'success',
|
message: '',
|
url: result
|
}))
|
fileListLen++
|
}
|
},
|
uploadFilePromise(url) {
|
var timename = this.getCurrentDateTime()
|
return new Promise((resolve, reject) => {
|
let a = uni.uploadFile({
|
// url: 'http://192.168.31.112:8081/api/wx/addpicqwe', // 仅为示例,非真实的接口地址
|
url: http.config.baseURL + '/api/wx/addpicqwe', // 仅为示例,非真实的接口地址
|
filePath: url,
|
method: "POST",
|
name: 'file',
|
formData: {
|
timename: timename,
|
},
|
success: (res) => {
|
this.model1.userInfo.images = res.data
|
setTimeout(() => {
|
resolve(url)
|
}, 1000)
|
}
|
});
|
})
|
},
|
|
submitForm() {
|
// 更新 baseURL
|
updateBaseURL("http://" + this.form.url + ':' + this.form.port); // 调用 updateBaseURL 函数
|
if (this.vuex_is_login) {
|
earlyWarning().then((res) => {
|
if (res.code == 0) {
|
this.$refs.refSuccess.showBox({
|
type: 'success',
|
txt: "切换数据源成功!"
|
});
|
this.showpopup = false
|
this.form.port = ''
|
this.form.url = ''
|
} else {
|
this.$refs.refSuccess.showBox({
|
type: 'error',
|
txt: res.data
|
});
|
this.showpopup = false
|
this.form.port = ''
|
this.form.url = ''
|
}
|
})
|
}
|
},
|
camera() {
|
this.showinfo = true
|
let _this = this
|
// uni.chooseImage({
|
// count: 1, // 选择照片的数量
|
// sourceType: ['camera'], // 来源为相机
|
// success: function (res) {
|
// console.log(res);
|
// // 返回的临时文件路径列表
|
// const tempFilePaths = res.tempFilePaths;
|
// console.log('拍摄的图片路径: ', tempFilePaths[0]);
|
// // 你可以在这里调用处理图片的函数
|
// // _this.imageSrc = tempFilePaths[0];
|
// _this.handleImage(tempFilePaths[0]);
|
// },
|
// fail: function (err) {
|
// // 处理调用摄像头失败的情况
|
// console.error('调用摄像头失败: ', err);
|
// }
|
// });
|
},
|
// handleImage(imagePath) {
|
// // 假设我们需要展示在页面上
|
// this.model1.userInfo.images = imagePath; // 将图片路径存储在组件的 data 中
|
// console.log('显示的图片路径: ', imagePath);
|
// },
|
updatedata() {
|
this.showpopup = true
|
},
|
|
message() {
|
var content = "您有一条新的消息!";
|
var options = {
|
"cover": false, // 覆盖上次
|
"when": new Date(),
|
'title': "通知消息"
|
};
|
var body = {
|
'id': 'id',
|
'key2': "key2"
|
}
|
var payload = JSON.stringify(body);
|
plus.push.createMessage(content, payload, options);
|
|
uni.getPushClientId({
|
success: (res) => {},
|
fail(err) {}
|
});
|
},
|
cancel() {
|
this.show = false;
|
},
|
confirm() {
|
store.commit('$tStore', {
|
name: 'vuex_is_login',
|
value: false
|
})
|
uni.reLaunch({
|
url: '/pages/index/login'
|
});
|
},
|
getCurrentDateTime() {
|
var now = new Date();
|
var year = now.getFullYear();
|
var month = String(now.getMonth() + 1).padStart(2, '0');
|
var day = String(now.getDate()).padStart(2, '0');
|
var hours = String(now.getHours()).padStart(2, '0');
|
var minutes = String(now.getMinutes()).padStart(2, '0');
|
var seconds = String(now.getSeconds()).padStart(2, '0');
|
|
var currentDateAndTime = year + month + day + hours + minutes + seconds;
|
return currentDateAndTime
|
},
|
logout() {
|
store.commit('$tStore', {
|
name: 'uuid',
|
value: ''
|
})
|
this.show = true;
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.biaoge {
|
border-top-color: #000000;
|
}
|
|
.u-content {
|
padding: 24rpx;
|
font-size: 32rpx;
|
color: $u-content-color;
|
line-height: 1.6;
|
}
|
|
.home-top-bg {
|
width: 100%;
|
height: 175px;
|
|
background: linear-gradient(225deg, #D1EEE8 0%, #D0EEE7 0%, #F5F5F5 100%);
|
border-radius: 0px 0px 0px 0px;
|
opacity: 1;
|
filter: blur(220px);
|
position: fixed;
|
top: 0;
|
left: 0;
|
z-index: 1;
|
}
|
|
.home-top-box {
|
width: 100%;
|
height: 302px;
|
position: fixed;
|
top: 0;
|
left: 0;
|
border-bottom-left-radius: 30px;
|
border-bottom-right-radius: 30px;
|
z-index: 1;
|
}
|
|
.scroll-Y {
|
width: 100%;
|
margin-top: 232px;
|
position: relative;
|
}
|
|
.scroll-box {
|
padding-top: 30px;
|
padding-bottom: 50px;
|
display: flex;
|
flex-wrap: wrap;
|
}
|
|
.confirm-box {
|
position: fixed;
|
width: 100%;
|
height: 65px;
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
margin-bottom: env(safe-area-inset-bottom);
|
bottom: 70px;
|
padding: 0 30px;
|
|
.confirm-left {
|
font-size: 14px;
|
color: rgba(35, 35, 35, 0.5);
|
}
|
|
.confirm-right {
|
height: 45px;
|
background: #3E989D;
|
border-radius: 32px;
|
color: #fff;
|
font-size: 15px;
|
font-weight: bold;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
width: 100%;
|
}
|
}
|
|
.userinfo-box {
|
padding: 0 15px;
|
margin-top: 20px;
|
display: flex;
|
|
.userinfo-img {
|
padding-left: 15px;
|
height: 50px;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
}
|
|
.userinfo-value-box {
|
padding-left: 20px;
|
|
.user-nickname {
|
height: 28px;
|
font-size: 15px;
|
font-weight: bold;
|
color: #000000;
|
}
|
|
.user-company {
|
height: 22px;
|
font-size: 12px;
|
color: rgba(35, 35, 35, 0.7);
|
}
|
}
|
}
|
</style>
|