Merge branch 'fanpeng' into 'master'
v1.0.2+19 See merge request StarlockTeam/wx-starlock!12
This commit is contained in:
commit
dba3a47b79
@ -6,10 +6,10 @@
|
||||
{{ timeFormat(time, 'yyyy-mm-dd h:M') }}
|
||||
</view>
|
||||
</view>
|
||||
<up-datetime-picker :filter="filter" itemHeight="60" :minDate="minDate" :title="placeholder" :show="show"
|
||||
v-model="time"
|
||||
<up-datetime-picker :filter="filter" itemHeight="60" :minDate="minDate" :show="show"
|
||||
v-model="time" :formatter="formatter" :maxDate="maxDate"
|
||||
mode="datetime" @confirm="confirm" :closeOnClickOverlay="true"
|
||||
@close="close"></up-datetime-picker>
|
||||
@close="close" @cancel="close"></up-datetime-picker>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -22,7 +22,7 @@ export default {
|
||||
title: String,
|
||||
value: Number,
|
||||
minDate: Number,
|
||||
placeholder: String,
|
||||
maxDate: Number,
|
||||
type: {
|
||||
type: String,
|
||||
default: 'datetime'
|
||||
@ -39,6 +39,24 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
timeFormat,
|
||||
formatter(type, value) {
|
||||
if (type === 'year') {
|
||||
return `${value}年`;
|
||||
}
|
||||
if (type === 'month') {
|
||||
return `${value}月`;
|
||||
}
|
||||
if (type === 'day') {
|
||||
return `${value}日`;
|
||||
}
|
||||
if (type === 'hour') {
|
||||
return `${value}时`;
|
||||
}
|
||||
if (type === 'minute') {
|
||||
return `${value}分`;
|
||||
}
|
||||
return value;
|
||||
},
|
||||
filter(mode, options) {
|
||||
if (mode === 'minute' && this.type === 'datehour') {
|
||||
return options.filter((option) => option === '00')
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
"name" : "wx-starlock",
|
||||
"appid" : "__UNI__933D519",
|
||||
"description" : "",
|
||||
"versionName" : "1.0.1",
|
||||
"versionCode" : "18",
|
||||
"versionName" : "1.0.2",
|
||||
"versionCode" : "22",
|
||||
"transformPx" : false,
|
||||
/* 小程序特有相关 */
|
||||
"mp-weixin" : {
|
||||
|
||||
@ -10,26 +10,28 @@
|
||||
:list="tabs" :autoplay="false"
|
||||
:circular="true" :current="currnetIndex" @change="changeSwiper">
|
||||
<swiper-item>
|
||||
<LockInput :value="permanentAccount" title="接收者账号" placeholder="请输入手机号或邮箱"
|
||||
<LockInput :value="permanentAccount" title="接收者" placeholder="请输入手机号或邮箱"
|
||||
@changeInput="changePermanentAccountInput"></LockInput>
|
||||
<LockInput :value="permanentName" title="钥匙名称" placeholder="请输入钥匙名称"
|
||||
<LockInput :value="permanentName" title="姓名" placeholder="请输入姓名"
|
||||
@changeInput="changePermanentNmaeInput"></LockInput>
|
||||
<view class="text">接收者可使用此小程序开关锁</view>
|
||||
<view class="button" @click="createKey('permanent')">发送钥匙</view>
|
||||
<view class="text" style="margin-top: 40rpx;">接收者可使用此小程序开关锁</view>
|
||||
<view class="text" style="margin-bottom: 50rpx;">小程序暂不支持邮箱登录,若接收者账号为邮箱可先使用星星锁APP登录,绑定手机号后可使用小程序登录</view>
|
||||
<view class="button" @click="createKey('permanent')">发送</view>
|
||||
</swiper-item>
|
||||
<swiper-item :style="{height: deviceInfo.windowHeight - 44 + 'px'}">
|
||||
<LockInput :value="temporaryAccount" title="接收者账号" placeholder="请输入手机号或邮箱"
|
||||
<LockInput :value="temporaryAccount" title="接收者" placeholder="请输入手机号或邮箱"
|
||||
@changeInput="changeTemporaryAccountInput"></LockInput>
|
||||
<LockInput :value="temporaryName" title="钥匙名称" placeholder="请输入钥匙名称"
|
||||
<LockInput :value="temporaryName" title="姓名" placeholder="请输入姓名"
|
||||
@changeInput="changeTemporaryNameInput"></LockInput>
|
||||
<view style="margin-top: 20rpx">
|
||||
<LockDatetimePicker title="生效时间" :value="temporaryValidTime" :minDate="minDate"
|
||||
placeholder="请选择失效时间" @changeTime="changeTemporaryValidTime"></LockDatetimePicker>
|
||||
@changeTime="changeTemporaryValidTime" :maxDate="maxDate"></LockDatetimePicker>
|
||||
<LockDatetimePicker title="失效时间" :value="temporaryInvalidTime" :minDate="minDate"
|
||||
placeholder="请选择失效时间" @changeTime="changeTemporaryInvalidTime"></LockDatetimePicker>
|
||||
@changeTime="changeTemporaryInvalidTime" :maxDate="maxDate"></LockDatetimePicker>
|
||||
</view>
|
||||
<view class="text">接收者在有效期内可以不限次数使用</view>
|
||||
<view class="button" @click="createKey('temporary')">发送钥匙</view>
|
||||
<view class="text" style="margin-top: 40rpx;">接收者在有效期内可以不限次数使用</view>
|
||||
<view class="text" style="margin-bottom: 50rpx;">小程序暂不支持邮箱登录,若接收者账号为邮箱可先使用星星锁APP登录,绑定手机号后可使用小程序登录</view>
|
||||
<view class="button" @click="createKey('temporary')">发送</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
@ -62,6 +64,7 @@ export default {
|
||||
temporaryValidTime: Number(new Date()),
|
||||
temporaryInvalidTime: Number(new Date()),
|
||||
minDate: Number(new Date()),
|
||||
maxDate: Number(4133951940000),
|
||||
currnetIndex: 0,
|
||||
deviceInfo: null,
|
||||
pending: false
|
||||
@ -77,7 +80,7 @@ export default {
|
||||
},
|
||||
async onLoad () {
|
||||
this.deviceInfo = await this.getDeviceInfo()
|
||||
this.temporaryInvalidTime = this.setTime()
|
||||
// this.temporaryInvalidTime = this.setTime()
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useBasicStore, ['getDeviceInfo', 'backAndToast', 'getNetworkType']),
|
||||
@ -212,8 +215,6 @@ page {
|
||||
}
|
||||
|
||||
.text {
|
||||
margin-top: 40rpx;
|
||||
margin-bottom: 50rpx;
|
||||
color: #262626;
|
||||
font-size: 26rpx;
|
||||
padding: 0 32rpx;
|
||||
|
||||
@ -10,17 +10,17 @@
|
||||
:list="tabs" :autoplay="false"
|
||||
:circular="true" :current="currnetIndex" @change="changeSwiper">
|
||||
<swiper-item>
|
||||
<LockInput :value="permanentName" title="名称" placeholder="给密码命名"
|
||||
<LockInput :value="permanentName" title="姓名" placeholder="请给密码命名"
|
||||
@changeInput="changePermanentInput"></LockInput>
|
||||
<view class="text">{{ text }}</view>
|
||||
<view class="button" @click="createPassword('permanent')">获取密码</view>
|
||||
</swiper-item>
|
||||
<swiper-item :style="{height: deviceInfo.windowHeight - 44 + 'px'}">
|
||||
<LockInput :value="temporaryName" title="名称" placeholder="给密码命名"
|
||||
<LockInput :value="temporaryName" title="姓名" placeholder="请给密码命名"
|
||||
@changeInput="changeTemporaryInput"></LockInput>
|
||||
<view style="margin-top: 20rpx">
|
||||
<LockDatetimePicker title="失效时间" :value="temporaryTime" :minDate="minDate" type="datehour"
|
||||
placeholder="请选择失效时间" @changeTime="changeTemporaryTime"></LockDatetimePicker>
|
||||
<LockDatetimePicker title="失效时间" :value="temporaryTime" :minDate="minDate" :maxDate="maxDate" type="datehour"
|
||||
@changeTime="changeTemporaryTime"></LockDatetimePicker>
|
||||
</view>
|
||||
<view class="text">{{ text }}</view>
|
||||
<view class="button" @click="createPassword('temporary')">获取密码</view>
|
||||
@ -51,10 +51,11 @@ export default {
|
||||
temporaryName: '',
|
||||
temporaryTime: Number(new Date()),
|
||||
minDate: Number(new Date()),
|
||||
maxDate: Number(4133951940000),
|
||||
currnetIndex: 0,
|
||||
deviceInfo: null,
|
||||
pending: false,
|
||||
text: '密码生成后,请在当日23:59前使用一次进行激活,否则过点后未激活则失效。密码激活后,有效期内不限次数使用。'
|
||||
text: '密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。密码激活后,有效期内不限次数使用。'
|
||||
}
|
||||
},
|
||||
components: {
|
||||
@ -68,14 +69,37 @@ export default {
|
||||
async onLoad() {
|
||||
this.deviceInfo = await this.getDeviceInfo()
|
||||
this.temporaryTime = this.setTime()
|
||||
this.minDate = Number(this.getNextFullHour())
|
||||
this.maxDate = Number(this.getFutureTimestamp())
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useBasicStore, ['getDeviceInfo', 'backAndToast', 'getNetworkType']),
|
||||
...mapActions(useLockStore, ['getPasswordList', 'updatePasswordSearch']),
|
||||
// 获取下一个整点时间
|
||||
getNextFullHour() {
|
||||
const now = new Date()
|
||||
const currentHour = now.getHours()
|
||||
now.setHours(currentHour);
|
||||
now.setMinutes(0);
|
||||
now.setSeconds(0);
|
||||
now.setMilliseconds(0);
|
||||
|
||||
return now;
|
||||
},
|
||||
getFutureTimestamp() {
|
||||
const currentDate = new Date();
|
||||
|
||||
const year = currentDate.getFullYear();
|
||||
const month = currentDate.getMonth();
|
||||
const day = currentDate.getDate();
|
||||
|
||||
const futureDate = new Date(year + 3, month, day, 23, 0, 0);
|
||||
|
||||
return futureDate.getTime();
|
||||
},
|
||||
setTime() {
|
||||
const now = new Date()
|
||||
now.setMinutes(0, 0, 0)
|
||||
now.setDate(now.getDate() + 1)
|
||||
|
||||
return now.getTime()
|
||||
},
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="item">
|
||||
<view class="item-title" style="width: 350rpx">名称</view>
|
||||
<view class="item-title" style="width: 350rpx">姓名</view>
|
||||
<view class="item-content">{{ currentKeyInfo.keyName }}</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx">
|
||||
@ -39,7 +39,7 @@
|
||||
<view class="item-title">发送时间</view>
|
||||
<view class="item-content">{{ timeFormat(currentKeyInfo.sendDate, 'yyyy-mm-dd h:M') }}</view>
|
||||
</view>
|
||||
<view class="button" @click="deleteKey">删除钥匙</view>
|
||||
<view class="button" @click="deleteKey">删除</view>
|
||||
<up-modal :show="showModal" title="是否删除授权管理员钥匙?" :showCancelButton="true" width="600rpx" @cancel="cancelModal"
|
||||
@confirm="confirmModal">
|
||||
<view class="slot-content" @click="changeRadio">
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<view class="item-content">{{ currentPasswordInfo.keyboardPwd }}</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx">
|
||||
<view class="item-title">名称</view>
|
||||
<view class="item-title">姓名</view>
|
||||
<view class="item-content">{{ currentPasswordInfo.keyboardPwdName }}</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx">
|
||||
@ -16,7 +16,7 @@
|
||||
<view class="item-content">{{ timeFormat(currentPasswordInfo.endDate, 'yyyy-mm-dd h:M') }}</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
{{ currentPasswordInfo.timeText }}
|
||||
{{ currentPasswordInfo.timeText.slice(0, -3) }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 20rpx">
|
||||
@ -27,8 +27,7 @@
|
||||
<view class="item-title">发送时间</view>
|
||||
<view class="item-content">{{ timeFormat(currentPasswordInfo.sendDate, 'yyyy-mm-dd h:M') }}</view>
|
||||
</view>
|
||||
<view class="tips">密码生成后,请在当日23:59前使用一次进行激活,否则过0点后未激活则失效。</view>
|
||||
<view class="button" @click="deletePassword">删除密码</view>
|
||||
<view class="button" @click="deletePassword">删除</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
@ -495,7 +495,7 @@ export const useBluetoothStore = defineStore('ble', {
|
||||
if(searchNumber === 0 && searchTipFlag) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '长时间未搜索到任何设备,请确认微信的附近设备权限开启后再试',
|
||||
content: '长时间未搜索到任何设备,请确认微信的附近设备权限开启后再试(鸿蒙系统在设置-隐私-定位服务中开启位置信息权限)',
|
||||
showCancel: false,
|
||||
success() {
|
||||
uni.openAppAuthorizeSetting({
|
||||
@ -756,15 +756,33 @@ export const useBluetoothStore = defineStore('ble', {
|
||||
return new Promise((resolve) => {
|
||||
uni.startBluetoothDevicesDiscovery({
|
||||
success: function () {
|
||||
timer2 = setTimeout(() => {
|
||||
uni.stopBluetoothDevicesDiscovery()
|
||||
clearInterval(timer1)
|
||||
resolve({ code: -1 })
|
||||
}, 10500)
|
||||
let searchFlag = false
|
||||
timer2 = setTimeout(async () => {
|
||||
uni.stopBluetoothDevicesDiscovery()
|
||||
clearInterval(timer1)
|
||||
if (!searchFlag) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '长时间未搜索到任何设备,请确认微信的附近设备权限开启后再试(鸿蒙系统在设置-隐私-定位服务中开启位置信息权限)',
|
||||
showCancel: false,
|
||||
success () {
|
||||
uni.openAppAuthorizeSetting({
|
||||
success (res) {
|
||||
console.log(res)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
resolve({ code: -1 })
|
||||
}, 10500)
|
||||
timer1 = setInterval(() => {
|
||||
uni.getBluetoothDevices({
|
||||
success(res) {
|
||||
const deviceList = res.devices
|
||||
if(searchFlag === false && res.devices.length > 0) {
|
||||
searchFlag = true
|
||||
}
|
||||
for(let i = 0; i < deviceList.length; i++) {
|
||||
if(deviceList[i]?.name === that.currentLockInfo.name) {
|
||||
const uuid = deviceList[i]?.advertisServiceUUIDs[0]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user