feat: 新增sky分支
This commit is contained in:
parent
ada5dfdff5
commit
5b66f6f9cb
@ -1,56 +1,72 @@
|
|||||||
let version = '-'
|
let version = '-'
|
||||||
let buildNumber = '-'
|
let buildNumber = '-'
|
||||||
uni.getSystemInfo({
|
uni.getSystemInfo({
|
||||||
success(res) {
|
success(res) {
|
||||||
version = res.appVersion
|
version = res.appVersion
|
||||||
buildNumber = res.appVersionCode
|
buildNumber = res.appVersionCode
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const DEV = {
|
const DEV = {
|
||||||
name: 'dev',
|
name: 'dev',
|
||||||
appName: '星星锁Lite',
|
appName: '星星锁Lite',
|
||||||
baseUrl: 'https://lock.dev.star-lock.cn/api',
|
baseUrl: 'https://lock.dev.star-lock.cn/api',
|
||||||
webviewBaseUrl: 'https://lock.dev.star-lock.cn',
|
webviewBaseUrl: 'https://lock.dev.star-lock.cn',
|
||||||
version,
|
officialEmail: '',
|
||||||
buildNumber
|
officialWebsite: '',
|
||||||
|
version,
|
||||||
|
buildNumber
|
||||||
}
|
}
|
||||||
|
|
||||||
const PRE = {
|
const PRE = {
|
||||||
name: 'pre',
|
name: 'pre',
|
||||||
appName: '星星锁Lite',
|
appName: '星星锁Lite',
|
||||||
baseUrl: 'https://lock.pre.star-lock.cn/api',
|
baseUrl: 'https://lock.pre.star-lock.cn/api',
|
||||||
webviewBaseUrl: 'https://lock.xhjcn.ltd',
|
webviewBaseUrl: 'https://lock.xhjcn.ltd',
|
||||||
version,
|
officialEmail: '',
|
||||||
buildNumber
|
officialWebsite: '',
|
||||||
|
version,
|
||||||
|
buildNumber
|
||||||
}
|
}
|
||||||
|
|
||||||
const XHJ = {
|
const XHJ = {
|
||||||
name: 'xhj',
|
name: 'xhj',
|
||||||
appName: '星星锁Lite',
|
appName: '星星锁Lite',
|
||||||
baseUrl: 'https://lock.xhjcn.ltd/api',
|
baseUrl: 'https://lock.xhjcn.ltd/api',
|
||||||
webviewBaseUrl: 'https://lock.xhjcn.ltd',
|
webviewBaseUrl: 'https://lock.xhjcn.ltd',
|
||||||
version,
|
officialEmail: '',
|
||||||
buildNumber
|
officialWebsite: '',
|
||||||
|
version,
|
||||||
|
buildNumber
|
||||||
}
|
}
|
||||||
|
|
||||||
const SKY = {
|
const SKY = {
|
||||||
name: 'sky',
|
name: 'sky',
|
||||||
appName: '锁通通',
|
appName: '锁通通',
|
||||||
baseUrl: 'https://lock.skychip.top/api',
|
baseUrl: 'https://lock.skychip.top/api',
|
||||||
webviewBaseUrl: 'https://lock.skychip.top',
|
webviewBaseUrl: 'https://lock.skychip.top',
|
||||||
version,
|
officialEmail: 'contact@skychip.top',
|
||||||
buildNumber
|
officialWebsite: 'www.skychip.top',
|
||||||
|
version,
|
||||||
|
buildNumber
|
||||||
}
|
}
|
||||||
|
|
||||||
const GE = {
|
const GE = {
|
||||||
name: 'ge',
|
name: 'ge',
|
||||||
appName: '星星锁Lite',
|
appName: '星星锁Lite',
|
||||||
baseUrl: 'http://lock.ge.star-lock.cn/api',
|
baseUrl: 'http://lock.ge.star-lock.cn/api',
|
||||||
webviewBaseUrl: 'http://lock.ge.star-lock.cn',
|
webviewBaseUrl: 'http://lock.ge.star-lock.cn',
|
||||||
version,
|
officialEmail: '',
|
||||||
buildNumber
|
officialWebsite: '',
|
||||||
|
version,
|
||||||
|
buildNumber
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更换环境的时候 切换导出就行
|
// 更换环境的时候 切换导出就行
|
||||||
export default { DEV, PRE, XHJ, SKY, GE }
|
export default {
|
||||||
|
DEV,
|
||||||
|
PRE,
|
||||||
|
XHJ,
|
||||||
|
SKY,
|
||||||
|
GE
|
||||||
|
}
|
||||||
@ -20,9 +20,7 @@
|
|||||||
"optimization" : {
|
"optimization" : {
|
||||||
"subPackages" : true
|
"subPackages" : true
|
||||||
},
|
},
|
||||||
"plugins" : {
|
"plugins" : {}
|
||||||
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"vueVersion" : "3",
|
"vueVersion" : "3",
|
||||||
"app-plus" : {
|
"app-plus" : {
|
||||||
|
|||||||
1328
pages.json
1328
pages.json
File diff suppressed because it is too large
Load Diff
@ -142,11 +142,11 @@
|
|||||||
const { code, message } = await bindLockAdmin(params)
|
const { code, message } = await bindLockAdmin(params)
|
||||||
console.log('添加锁返回', code, message)
|
console.log('添加锁返回', code, message)
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
this.updateLockSearch({
|
await this.updateLockSearch({
|
||||||
...this.lockSearch,
|
...this.lockSearch,
|
||||||
pageNo: 1
|
pageNo: 1
|
||||||
})
|
})
|
||||||
this.getLockList(this.lockSearch)
|
await this.getLockList(this.lockSearch)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
this.backAndToast('添加成功', 2)
|
this.backAndToast('添加成功', 2)
|
||||||
@ -204,7 +204,7 @@
|
|||||||
line-height: 96rpx;
|
line-height: 96rpx;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
background: #4777ee;
|
background: #4777ee;
|
||||||
border-radius: 16rpx;
|
border-radius: 16rpx;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -3,79 +3,104 @@
|
|||||||
<scroll-view
|
<scroll-view
|
||||||
v-if="deviceInfo"
|
v-if="deviceInfo"
|
||||||
scroll-y="true"
|
scroll-y="true"
|
||||||
:style="{ height: deviceInfo.windowHeight - deviceInfo.safeArea.top + 'px' }"
|
:style="{
|
||||||
|
height: deviceInfo.windowHeight - deviceInfo.safeArea.top + 'px'
|
||||||
|
}"
|
||||||
@refresherrefresh="refresher"
|
@refresherrefresh="refresher"
|
||||||
:refresher-enabled="true"
|
:refresher-enabled="true"
|
||||||
:refresher-triggered="refresherTriggered"
|
:refresher-triggered="refresherTriggered"
|
||||||
>
|
>
|
||||||
<view class="days" v-if="$bluetooth.currentLockInfo.days"
|
<view class="select-lock-row">
|
||||||
>钥匙将在{{ $bluetooth.currentLockInfo.days }}天后失效</view
|
|
||||||
>
|
|
||||||
<view class="lock-name">{{ $bluetooth.currentLockInfo.lockAlias }}</view>
|
|
||||||
<view class="top">
|
|
||||||
<image
|
<image
|
||||||
class="top-background"
|
src="https://cos-lock.skychip.top/mp/icon_add_round.png"
|
||||||
src="https://oss-lock.xhjcn.ltd/mp/background_main.jpg"
|
|
||||||
mode="aspectFill"
|
mode="aspectFill"
|
||||||
|
style="width: 48rpx; height: 48rpx"
|
||||||
|
@click="toSearchDevice"
|
||||||
></image>
|
></image>
|
||||||
<view style="width: 100%; height: 50rpx">
|
<!-- 普通 picker -->
|
||||||
<view class="power" @click="powerTip">
|
<picker :range="pickerOptions" @change="onPickerChange">
|
||||||
|
<view class="lock-name">
|
||||||
|
<text>
|
||||||
|
{{ $bluetooth.currentLockInfo.lockAlias }}
|
||||||
|
</text>
|
||||||
<image
|
<image
|
||||||
class="power-icon"
|
class="icon-down"
|
||||||
:src="$lock.getPowerIcon($bluetooth.currentLockInfo.electricQuantity)"
|
src="https://cos-lock.skychip.top/mp/icon_down.png"
|
||||||
mode="aspectFill"
|
mode="aspectFill"
|
||||||
></image>
|
|
||||||
<view class="power-text">{{ $bluetooth.currentLockInfo.electricQuantity }}%</view>
|
|
||||||
<image
|
|
||||||
class="power-tips"
|
|
||||||
src="https://cos-lock.skychip.top/mp/icon_tips.png"
|
|
||||||
mode="aspectFill"
|
|
||||||
></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="switch" @click="openDoorOperate('open')" @longpress="openDoorOperate('close')">
|
|
||||||
<SwitchLoading :size="220" ref="sLoading"></SwitchLoading>
|
|
||||||
</view>
|
|
||||||
<view class="switch-text">点击开锁,长按闭锁</view>
|
|
||||||
<view class="bottom">
|
|
||||||
<view class="bottom-side">
|
|
||||||
<image
|
|
||||||
class="bottom-icon"
|
|
||||||
src="https://cos-lock.skychip.top/mp/icon_role.png"
|
|
||||||
mode="aspectFill"
|
|
||||||
></image>
|
|
||||||
<view>{{
|
|
||||||
$lock.getRole(
|
|
||||||
$bluetooth.currentLockInfo.userType,
|
|
||||||
$bluetooth.currentLockInfo.keyRight
|
|
||||||
)
|
|
||||||
}}</view>
|
|
||||||
</view>
|
|
||||||
<view class="bottom-side">
|
|
||||||
<image
|
|
||||||
class="bottom-icon"
|
|
||||||
:src="
|
|
||||||
$bluetooth.currentLockInfo.appUnlockOnline
|
|
||||||
? 'https://cos-lock.skychip.top/mp/icon_cloud_active.png'
|
|
||||||
: 'https://cos-lock.skychip.top/mp/icon_cloud.png'
|
|
||||||
"
|
|
||||||
mode="aspectFill"
|
|
||||||
style="width: 40rpx; height: 40rpx"
|
|
||||||
></image>
|
|
||||||
<view
|
|
||||||
:style="{
|
|
||||||
color: $bluetooth.currentLockInfo.appUnlockOnline ? '#4777ee' : '#a3a3a3'
|
|
||||||
}"
|
|
||||||
>手机需联网</view
|
|
||||||
>
|
>
|
||||||
|
</image>
|
||||||
</view>
|
</view>
|
||||||
|
</picker>
|
||||||
|
|
||||||
|
<view class="power" @click="powerTip">
|
||||||
|
<image
|
||||||
|
class="power-icon"
|
||||||
|
:src="$lock.getPowerIcon($bluetooth.currentLockInfo.electricQuantity)"
|
||||||
|
mode="aspectFill"
|
||||||
|
></image>
|
||||||
|
<view class="power-text">{{ $bluetooth.currentLockInfo.electricQuantity }}%</view>
|
||||||
|
<image
|
||||||
|
class="power-tips"
|
||||||
|
src="https://cos-lock.skychip.top/mp/icon_tips.png"
|
||||||
|
mode="aspectFill"
|
||||||
|
>
|
||||||
|
</image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="open-lock-btn"
|
||||||
|
@click="openDoorOperate('open')"
|
||||||
|
@longpress="openDoorOperate('close')"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
class="open-lock-btn-image-1"
|
||||||
|
ref="sLoading"
|
||||||
|
src="https://cos-lock.skychip.top/mp/icon_main_openLockBtn_center.png"
|
||||||
|
></image>
|
||||||
|
<image
|
||||||
|
class="open-lock-btn-image-2"
|
||||||
|
:class="{ rotate: isRotating }"
|
||||||
|
src="https://cos-lock.skychip.top/mp/icon_main_openLockBtn_circle.png"
|
||||||
|
></image>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="days" v-if="$bluetooth.currentLockInfo.days"
|
||||||
|
>钥匙将在{{ $bluetooth.currentLockInfo.days }}天后失效
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="switch-text">点击开锁,长按闭锁</view>
|
||||||
|
<view class="other-text">
|
||||||
|
<view class="bottom-side">
|
||||||
|
<image
|
||||||
|
class="bottom-icon"
|
||||||
|
style="width: 32rpx; height: 32rpx"
|
||||||
|
src="https://cos-lock.skychip.top/mp/icon_role.png"
|
||||||
|
mode="aspectFill"
|
||||||
|
></image>
|
||||||
|
<view>{{
|
||||||
|
$lock.getRole($bluetooth.currentLockInfo.userType, $bluetooth.currentLockInfo.keyRight)
|
||||||
|
}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="bottom-side">
|
||||||
|
<image
|
||||||
|
class="bottom-icon"
|
||||||
|
:src="
|
||||||
|
$bluetooth.currentLockInfo.appUnlockOnline
|
||||||
|
? 'https://cos-lock.skychip.top/mp/icon_cloud_active.png'
|
||||||
|
: 'https://cos-lock.skychip.top/mp/icon_cloud.png'
|
||||||
|
"
|
||||||
|
mode="aspectFill"
|
||||||
|
style="width: 40rpx; height: 40rpx"
|
||||||
|
></image>
|
||||||
|
<view
|
||||||
|
:style="{
|
||||||
|
color: $bluetooth.currentLockInfo.appUnlockOnline ? '#4777ee' : '#a3a3a3'
|
||||||
|
}"
|
||||||
|
>手机需联网</view
|
||||||
|
>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="menu">
|
<view class="menu">
|
||||||
<view class="menu-title">
|
|
||||||
<image class="menu-image" src="https://oss-lock.xhjcn.ltd/mp/icon_menu.png"></image>
|
|
||||||
<view>功能</view>
|
|
||||||
</view>
|
|
||||||
<view class="menu-main">
|
<view class="menu-main">
|
||||||
<view
|
<view
|
||||||
v-if="
|
v-if="
|
||||||
@ -86,8 +111,8 @@
|
|||||||
@click="$basic.routeJump({ name: 'keyList' })"
|
@click="$basic.routeJump({ name: 'keyList' })"
|
||||||
>
|
>
|
||||||
<image
|
<image
|
||||||
class="menu-main-image transform-scale-90"
|
class="menu-main-image"
|
||||||
src="https://cos-lock.skychip.top/mp/icon_key.png"
|
src="https://cos-lock.skychip.top/mp/icon_main_electronicKey.png"
|
||||||
></image>
|
></image>
|
||||||
<view>电子钥匙</view>
|
<view>电子钥匙</view>
|
||||||
</view>
|
</view>
|
||||||
@ -102,8 +127,9 @@
|
|||||||
>
|
>
|
||||||
<image
|
<image
|
||||||
class="menu-main-image"
|
class="menu-main-image"
|
||||||
src="https://cos-lock.skychip.top/mp/icon_password_green.png"
|
src="https://cos-lock.skychip.top/mp/icon_main_password.png"
|
||||||
></image>
|
>
|
||||||
|
</image>
|
||||||
<view>密码</view>
|
<view>密码</view>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
@ -117,7 +143,7 @@
|
|||||||
>
|
>
|
||||||
<image
|
<image
|
||||||
class="menu-main-image transform-scale-110"
|
class="menu-main-image transform-scale-110"
|
||||||
src="https://cos-lock.skychip.top/mp/icon_card.png"
|
src="https://cos-lock.skychip.top/mp/icon_main_icCard.png"
|
||||||
></image>
|
></image>
|
||||||
<view>卡</view>
|
<view>卡</view>
|
||||||
</view>
|
</view>
|
||||||
@ -132,8 +158,9 @@
|
|||||||
>
|
>
|
||||||
<image
|
<image
|
||||||
class="menu-main-image"
|
class="menu-main-image"
|
||||||
src="https://cos-lock.skychip.top/mp/icon_fingerprint.png"
|
src="https://cos-lock.skychip.top/mp/icon_main_fingerprint.png"
|
||||||
></image>
|
>
|
||||||
|
</image>
|
||||||
<view>指纹</view>
|
<view>指纹</view>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
@ -147,7 +174,7 @@
|
|||||||
>
|
>
|
||||||
<image
|
<image
|
||||||
class="menu-main-image"
|
class="menu-main-image"
|
||||||
src="https://cos-lock.skychip.top/mp/icon_remote.png"
|
src="https://cos-lock.skychip.top/mp/icon_main_remoteControl.png"
|
||||||
></image>
|
></image>
|
||||||
<view>遥控</view>
|
<view>遥控</view>
|
||||||
</view>
|
</view>
|
||||||
@ -177,7 +204,7 @@
|
|||||||
>
|
>
|
||||||
<image
|
<image
|
||||||
class="menu-main-image"
|
class="menu-main-image"
|
||||||
src="https://cos-lock.skychip.top/mp/icon_palm_vein.png"
|
src="https://cos-lock.skychip.top/mp/icon_palm.png"
|
||||||
></image>
|
></image>
|
||||||
<view>掌静脉</view>
|
<view>掌静脉</view>
|
||||||
</view>
|
</view>
|
||||||
@ -188,7 +215,7 @@
|
|||||||
>
|
>
|
||||||
<image
|
<image
|
||||||
class="menu-main-image transform-scale-140"
|
class="menu-main-image transform-scale-140"
|
||||||
src="https://oss-lock.xhjcn.ltd/mp/icon_control.png"
|
src="https://oss-lock.xhjcn.ltd/mp/icon_catEyes.png"
|
||||||
></image>
|
></image>
|
||||||
<view>监控</view>
|
<view>监控</view>
|
||||||
</view>
|
</view>
|
||||||
@ -202,7 +229,7 @@
|
|||||||
>
|
>
|
||||||
<image
|
<image
|
||||||
class="menu-main-image transform-scale-140"
|
class="menu-main-image transform-scale-140"
|
||||||
src="https://cos-lock.skychip.top/mp/icon_admin_black.png"
|
src="https://cos-lock.skychip.top/mp/icon_main_authorizedAdmin.png"
|
||||||
></image>
|
></image>
|
||||||
<view>授权管理员</view>
|
<view>授权管理员</view>
|
||||||
</view>
|
</view>
|
||||||
@ -213,7 +240,7 @@
|
|||||||
>
|
>
|
||||||
<image
|
<image
|
||||||
class="menu-main-image"
|
class="menu-main-image"
|
||||||
src="https://cos-lock.skychip.top/mp/icon_record.png"
|
src="https://cos-lock.skychip.top/mp/icon_main_operatingRecord.png"
|
||||||
></image>
|
></image>
|
||||||
<view>操作记录</view>
|
<view>操作记录</view>
|
||||||
</view>
|
</view>
|
||||||
@ -224,57 +251,31 @@
|
|||||||
>
|
>
|
||||||
<image
|
<image
|
||||||
class="menu-main-image"
|
class="menu-main-image"
|
||||||
src="https://cos-lock.skychip.top/mp/icon_record.png"
|
src="https://cos-lock.skychip.top/mp/icon_main_operatingRecord.png"
|
||||||
></image>
|
></image>
|
||||||
<view>门锁记录</view>
|
<view>门锁记录</view>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view class="menu-main-view" @click="$basic.routeJump({ name: 'setting' })">
|
||||||
v-if="
|
|
||||||
$bluetooth.currentLockInfo.keyRight === 1 &&
|
|
||||||
$bluetooth.currentLockInfo.transportType !== transportType.TRANSPORT_TENCENT_YUN
|
|
||||||
"
|
|
||||||
class="menu-main-view"
|
|
||||||
@click="$basic.routeJump({ name: 'messageReminder' })"
|
|
||||||
>
|
|
||||||
<image
|
<image
|
||||||
class="menu-main-image transform-scale-110"
|
class="menu-main-image transform-scale-110"
|
||||||
src="https://cos-lock.skychip.top/mp/icon_remind.png"
|
src="https://cos-lock.skychip.top/mp/icon_main_set.png"
|
||||||
></image>
|
></image>
|
||||||
<view>消息提醒</view>
|
<view>设置</view>
|
||||||
</view>
|
|
||||||
<view
|
|
||||||
class="menu-main-view transform-scale-105"
|
|
||||||
v-if="$bluetooth.currentLockInfo.transportType === transportType.TRANSPORT_TENCENT_YUN"
|
|
||||||
@click="$basic.routeJump({ name: 'authorizeWechat' })"
|
|
||||||
>
|
|
||||||
<image
|
|
||||||
class="menu-main-image"
|
|
||||||
src="https://oss-lock.xhjcn.ltd/mp/icon_wechat_call.png"
|
|
||||||
></image>
|
|
||||||
<view>微信呼叫</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view
|
|
||||||
class="setting"
|
|
||||||
@click="$basic.routeJump({ name: 'setting' })"
|
|
||||||
v-if="$bluetooth.currentLockInfo.transportType !== transportType.TRANSPORT_TENCENT_YUN"
|
|
||||||
>
|
|
||||||
<image class="setting-image" src="https://cos-lock.skychip.top/mp/icon_setting.png"></image>
|
|
||||||
<view class="setting-text">设置</view>
|
|
||||||
<image
|
|
||||||
class="setting-arrow"
|
|
||||||
mode="aspectFill"
|
|
||||||
src="https://oss-lock.xhjcn.ltd/mp/icon_arrow.png"
|
|
||||||
></image>
|
|
||||||
</view>
|
|
||||||
<view
|
|
||||||
v-if="$bluetooth.currentLockInfo.transportType === transportType.TRANSPORT_TENCENT_YUN"
|
|
||||||
class="fixed bottom-[calc(env(safe-area-inset-bottom)+120rpx)] mt-4 rounded-3xl w-686 h-80 line-height-80rpx text-center mx-32rpx bg-#ec433c text-white text-xl font-bold"
|
|
||||||
@click="deleteLock"
|
|
||||||
>删除
|
|
||||||
</view>
|
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
<view v-else class="not-devices-box">
|
||||||
|
<image class="menu-main-image" src="https://cos-lock.skychip.top/mp/icon_noData.png"></image>
|
||||||
|
<text>暂无智能锁</text>
|
||||||
|
<image
|
||||||
|
src="https://cos-lock.skychip.top/mp/icon_add_round.png"
|
||||||
|
mode="aspectFill"
|
||||||
|
class="button-add-big"
|
||||||
|
@click="toSearchDevice"
|
||||||
|
></image>
|
||||||
|
</view>
|
||||||
|
|
||||||
<up-popup
|
<up-popup
|
||||||
:show="show"
|
:show="show"
|
||||||
@close="closePopup"
|
@close="closePopup"
|
||||||
@ -303,7 +304,7 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { timeFormat } from 'uview-plus'
|
import { timeFormat } from 'uview-plus'
|
||||||
import { onMounted, ref } from 'vue'
|
import { onMounted, onUnmounted, ref } from 'vue'
|
||||||
import { useBluetoothStore } from '@/stores/bluetooth'
|
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||||
import { useBasicStore } from '@/stores/basic'
|
import { useBasicStore } from '@/stores/basic'
|
||||||
import SwitchLoading from '@/components/SwitchLoading/SwitchLoading.vue'
|
import SwitchLoading from '@/components/SwitchLoading/SwitchLoading.vue'
|
||||||
@ -312,6 +313,9 @@
|
|||||||
import { getLockDetailRequest, getLockNetTokenRequest, deleteLockRequest } from '@/api/lock'
|
import { getLockDetailRequest, getLockNetTokenRequest, deleteLockRequest } from '@/api/lock'
|
||||||
import { deleteKeyRequest } from '@/api/key'
|
import { deleteKeyRequest } from '@/api/key'
|
||||||
import { transportType } from '@/constant/transportType'
|
import { transportType } from '@/constant/transportType'
|
||||||
|
import { loginRequest } from '@/api/user'
|
||||||
|
import { setStorage, getStorage } from '@/utils/storage'
|
||||||
|
import { onLoad, onShow } from '@dcloudio/uni-app' // 注意:这里需要正确导入 UniApp 的生命周期钩子!
|
||||||
|
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
import { requestPermission } from '@/uni_modules/xhj-record'
|
import { requestPermission } from '@/uni_modules/xhj-record'
|
||||||
@ -322,7 +326,7 @@
|
|||||||
const $lock = useLockStore()
|
const $lock = useLockStore()
|
||||||
const $user = useUserStore()
|
const $user = useUserStore()
|
||||||
|
|
||||||
const sLoading = ref(null)
|
// const sLoading = ref(null)
|
||||||
|
|
||||||
const time = ref(0)
|
const time = ref(0)
|
||||||
const onlineToken = ref('0')
|
const onlineToken = ref('0')
|
||||||
@ -333,9 +337,133 @@
|
|||||||
|
|
||||||
const deviceInfo = ref(null)
|
const deviceInfo = ref(null)
|
||||||
|
|
||||||
|
// 控制是否应用旋转动画
|
||||||
|
const isRotating = ref(false)
|
||||||
|
|
||||||
|
// 选择器数据源(比如一个字符串数组)
|
||||||
|
const pickerOptions = ref([])
|
||||||
|
|
||||||
|
// 当前选中项的索引(picker 内部使用)
|
||||||
|
const selectedIndex = ref(0)
|
||||||
|
|
||||||
|
// 选中后展示的文本
|
||||||
|
const selectedText = ref(pickerOptions.value[0])
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
deviceInfo.value = await $basic.getDeviceInfo()
|
try {
|
||||||
await getServeTime()
|
// #ifdef MP-WEIXIN
|
||||||
|
const accountInfo = uni.getAccountInfoSync()
|
||||||
|
getApp().globalData.appid = accountInfo.miniProgram.appId
|
||||||
|
getApp().globalData.envVersion = accountInfo.miniProgram.envVersion
|
||||||
|
// #endif
|
||||||
|
uni.showLoading({
|
||||||
|
title: '加载中',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
|
const token = getStorage('token')
|
||||||
|
const list = getStorage('lockList')
|
||||||
|
const userInfo = getStorage('userInfo')
|
||||||
|
|
||||||
|
if (token) {
|
||||||
|
await Promise.all([$lock.getLockList($lock.lockSearch), $user.getUserInfo()]).then(res => {
|
||||||
|
pending.value = false
|
||||||
|
uni.hideLoading()
|
||||||
|
if (res[0].code === -1 && res[1] === -1 && list && userInfo) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '网络访问失败,请检查网络是否正常',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
|
||||||
|
$lock.updateLockList(list)
|
||||||
|
$user.updateUserInfo(userInfo)
|
||||||
|
$user.updateLoginStatus(true)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
// 封装 uni.login() 为 Promise
|
||||||
|
await new Promise((resolve, reject) => {
|
||||||
|
uni.login({
|
||||||
|
provider: 'weixin',
|
||||||
|
success: async loginRes => {
|
||||||
|
try {
|
||||||
|
const { code, data } = await loginRequest({
|
||||||
|
js_code: loginRes.code
|
||||||
|
})
|
||||||
|
if (code === 0) {
|
||||||
|
await setStorage('openid', data.openid)
|
||||||
|
if (data.accessToken) {
|
||||||
|
setStorage('token', data.accessToken)
|
||||||
|
const list = getStorage('lockList')
|
||||||
|
const userInfo = getStorage('userInfo')
|
||||||
|
if (!list && !userInfo) {
|
||||||
|
await $lock.getLockList($lock.lockSearch)
|
||||||
|
await $user.getUserInfo()
|
||||||
|
await $user.updateLoginStatus(true)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$user.updateLoginStatus(false)
|
||||||
|
}
|
||||||
|
resolve() // 登录成功,resolve Promise
|
||||||
|
} else {
|
||||||
|
throw new Error('登录请求失败')
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error('登录过程出错:', err)
|
||||||
|
reject(err) // 登录过程出错,reject Promise
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: err => {
|
||||||
|
console.error('微信登录失败:', err)
|
||||||
|
reject(err) // 微信登录失败,reject Promise
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 取第一个锁的信息作为首页的展示
|
||||||
|
const lock = list.flatMap(item => item.lockList)
|
||||||
|
console.log('lock', lock)
|
||||||
|
if (lock) {
|
||||||
|
const defaultShowLockIndex = 0
|
||||||
|
const data = {
|
||||||
|
...lock[defaultShowLockIndex],
|
||||||
|
name: lock[defaultShowLockIndex].bluetooth.bluetoothDeviceName,
|
||||||
|
deviceId: lock[defaultShowLockIndex].bluetooth.bluetoothDeviceId,
|
||||||
|
commKey: lock[defaultShowLockIndex].bluetooth.privateKey,
|
||||||
|
signKey: lock[defaultShowLockIndex].bluetooth.signKey,
|
||||||
|
publicKey: lock[defaultShowLockIndex].bluetooth.publicKey
|
||||||
|
}
|
||||||
|
await $bluetooth.updateKeyId(lock[defaultShowLockIndex].keyId.toString())
|
||||||
|
await $bluetooth.updateCurrentLockInfo(data)
|
||||||
|
pickerOptions.value = lock.map(item => item.lockAlias)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Object.keys($bluetooth.currentLockInfo).length !== 0) {
|
||||||
|
if (!($bluetooth.bluetoothStatus === 0 || $bluetooth.bluetoothStatus === -1)) {
|
||||||
|
$bluetooth.getBluetoothStatus()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let result = true
|
||||||
|
if (!$bluetooth.isInitBluetooth) {
|
||||||
|
result = await $bluetooth.initAndListenBluetooth()
|
||||||
|
}
|
||||||
|
if (!result) {
|
||||||
|
$bluetooth.checkSetting()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确保登录完成后再执行后续操作
|
||||||
|
deviceInfo.value = await $basic.getDeviceInfo()
|
||||||
|
await getServeTime()
|
||||||
|
} catch (err) {
|
||||||
|
console.error('初始化过程出错:', err)
|
||||||
|
uni.showToast({
|
||||||
|
title: '登录失败,请重试',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
} finally {
|
||||||
|
uni.hideLoading() // 无论成功失败,最后都隐藏 loading
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const jumpToPlayer = async () => {
|
const jumpToPlayer = async () => {
|
||||||
@ -350,10 +478,27 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
$basic.routeJump({ name: 'p2pPlayer' })
|
$basic.routeJump({
|
||||||
|
name: 'p2pPlayer'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const openDoorOperate = async type => {
|
const openDoorOperate = async type => {
|
||||||
|
if (!($bluetooth.bluetoothStatus === 0 || $bluetooth.bluetoothStatus === -1)) {
|
||||||
|
$bluetooth.getBluetoothStatus()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let result = true
|
||||||
|
if (!$bluetooth.isInitBluetooth) {
|
||||||
|
result = await $bluetooth.initAndListenBluetooth()
|
||||||
|
}
|
||||||
|
if (!result) {
|
||||||
|
$bluetooth.checkSetting()
|
||||||
|
}
|
||||||
|
|
||||||
|
isRotating.value = true
|
||||||
|
|
||||||
const timestamp = new Date().getTime()
|
const timestamp = new Date().getTime()
|
||||||
if (
|
if (
|
||||||
$bluetooth.currentLockInfo.faceAuthentication === 1 &&
|
$bluetooth.currentLockInfo.faceAuthentication === 1 &&
|
||||||
@ -365,20 +510,23 @@
|
|||||||
content: '开门前需进行实名认证,小程序暂不支持,请使用APP认证开门',
|
content: '开门前需进行实名认证,小程序暂不支持,请使用APP认证开门',
|
||||||
showCancel: false
|
showCancel: false
|
||||||
})
|
})
|
||||||
|
isRotating.value = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (pending.value) {
|
if (pending.value) {
|
||||||
|
isRotating.value = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if ($bluetooth.currentLockInfo.appUnlockOnline && type !== 'close') {
|
if ($bluetooth.currentLockInfo.appUnlockOnline && type !== 'close') {
|
||||||
const netWork = await $basic.getNetworkType()
|
const netWork = await $basic.getNetworkType()
|
||||||
if (!netWork) {
|
if (!netWork) {
|
||||||
|
isRotating.value = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
uni.vibrateLong()
|
uni.vibrateLong()
|
||||||
pending.value = true
|
pending.value = true
|
||||||
sLoading.value.open()
|
|
||||||
if (type === 'close') {
|
if (type === 'close') {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: `正在尝试闭锁……`,
|
title: `正在尝试闭锁……`,
|
||||||
@ -388,9 +536,11 @@
|
|||||||
// if ($bluetooth.currentLockInfo.appUnlockOnline && type !== 'close') {
|
// if ($bluetooth.currentLockInfo.appUnlockOnline && type !== 'close') {
|
||||||
if ($bluetooth.currentLockInfo.appUnlockOnline) {
|
if ($bluetooth.currentLockInfo.appUnlockOnline) {
|
||||||
const result = await getNetToken()
|
const result = await getNetToken()
|
||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
sLoading.value.close()
|
// sLoading.value.close()
|
||||||
pending.value = false
|
pending.value = false
|
||||||
|
isRotating.value = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -400,6 +550,7 @@
|
|||||||
} else {
|
} else {
|
||||||
openMode = $bluetooth.currentLockInfo.appUnlockOnline ? 1 : 0
|
openMode = $bluetooth.currentLockInfo.appUnlockOnline ? 1 : 0
|
||||||
}
|
}
|
||||||
|
|
||||||
const { code } = await $bluetooth.openDoor({
|
const { code } = await $bluetooth.openDoor({
|
||||||
name: $bluetooth.currentLockInfo.name,
|
name: $bluetooth.currentLockInfo.name,
|
||||||
uid: $user.userInfo.uid.toString(),
|
uid: $user.userInfo.uid.toString(),
|
||||||
@ -465,8 +616,9 @@
|
|||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
sLoading.value.close()
|
|
||||||
pending.value = false
|
pending.value = false
|
||||||
|
isRotating.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
const closePopup = () => {
|
const closePopup = () => {
|
||||||
@ -510,7 +662,10 @@
|
|||||||
lockId: $bluetooth.currentLockInfo.lockId
|
lockId: $bluetooth.currentLockInfo.lockId
|
||||||
})
|
})
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
$bluetooth.updateCurrentLockInfo({ ...$bluetooth.currentLockInfo, ...data })
|
$bluetooth.updateCurrentLockInfo({
|
||||||
|
...$bluetooth.currentLockInfo,
|
||||||
|
...data
|
||||||
|
})
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '刷新成功',
|
title: '刷新成功',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
@ -524,6 +679,12 @@
|
|||||||
refresherTriggered.value = false
|
refresherTriggered.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const toSearchDevice = async () => {
|
||||||
|
$basic.routeJump({
|
||||||
|
name: 'addLockGuid'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const deleteLock = async () => {
|
const deleteLock = async () => {
|
||||||
const netWork = await $basic.getNetworkType()
|
const netWork = await $basic.getNetworkType()
|
||||||
if (!netWork) {
|
if (!netWork) {
|
||||||
@ -575,6 +736,27 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// picker 数据变化时触发
|
||||||
|
const onPickerChange = async e => {
|
||||||
|
const list = getStorage('lockList')
|
||||||
|
// 取第一个锁的信息作为首页的展示
|
||||||
|
const lock = list.flatMap(item => item.lockList)
|
||||||
|
if (lock) {
|
||||||
|
const defaultShowLockIndex = e.detail.value
|
||||||
|
const data = {
|
||||||
|
...lock[defaultShowLockIndex],
|
||||||
|
name: lock[defaultShowLockIndex].bluetooth.bluetoothDeviceName,
|
||||||
|
deviceId: lock[defaultShowLockIndex].bluetooth.bluetoothDeviceId,
|
||||||
|
commKey: lock[defaultShowLockIndex].bluetooth.privateKey,
|
||||||
|
signKey: lock[defaultShowLockIndex].bluetooth.signKey,
|
||||||
|
publicKey: lock[defaultShowLockIndex].bluetooth.publicKey
|
||||||
|
}
|
||||||
|
await $bluetooth.updateKeyId(lock[defaultShowLockIndex].keyId.toString())
|
||||||
|
await $bluetooth.updateCurrentLockInfo(data)
|
||||||
|
pickerOptions.value = lock.map(item => item.lockAlias)
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@ -626,14 +808,6 @@
|
|||||||
background: #faecc9;
|
background: #faecc9;
|
||||||
}
|
}
|
||||||
|
|
||||||
.lock-name {
|
|
||||||
padding: 32rpx 32rpx 0 32rpx;
|
|
||||||
font-size: 32rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
text-align: center;
|
|
||||||
word-break: break-all;
|
|
||||||
}
|
|
||||||
|
|
||||||
.top {
|
.top {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 686rpx;
|
width: 686rpx;
|
||||||
@ -670,32 +844,21 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
height: 50rpx;
|
height: 50rpx;
|
||||||
padding-top: 18rpx;
|
|
||||||
|
|
||||||
.power-icon {
|
.power-icon {
|
||||||
width: 50rpx;
|
width: 50rpx;
|
||||||
height: 30rpx;
|
height: 30rpx;
|
||||||
margin-right: 10rpx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.power-text {
|
.power-text {
|
||||||
margin-right: 10rpx;
|
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
font-weight: bold;
|
|
||||||
line-height: 50rpx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.power-tips {
|
.power-tips {
|
||||||
width: 40rpx;
|
width: 40rpx;
|
||||||
height: 40rpx;
|
height: 40rpx;
|
||||||
margin-right: 32rpx;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.switch-text {
|
|
||||||
margin-top: 10rpx;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.bottom {
|
.bottom {
|
||||||
@ -759,8 +922,8 @@
|
|||||||
margin-bottom: 48rpx;
|
margin-bottom: 48rpx;
|
||||||
|
|
||||||
.menu-main-image {
|
.menu-main-image {
|
||||||
width: 40rpx;
|
width: 48rpx;
|
||||||
height: 40rpx;
|
height: 48rpx;
|
||||||
margin-bottom: 10rpx;
|
margin-bottom: 10rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -796,4 +959,138 @@
|
|||||||
margin-left: 32rpx;
|
margin-left: 32rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.not-devices-box {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: gray;
|
||||||
|
font-size: 24rpx;
|
||||||
|
width: 100%;
|
||||||
|
height: 100vh;
|
||||||
|
gap: 20rpx;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 320rpx;
|
||||||
|
height: 240rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.add-new-lock {
|
||||||
|
background-color: #4777ee;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-add-big {
|
||||||
|
position: absolute;
|
||||||
|
width: 88rpx;
|
||||||
|
height: 88rpx;
|
||||||
|
right: 55rpx;
|
||||||
|
bottom: 55rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.select-lock-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
border-radius: 15rpx;
|
||||||
|
padding: 8rpx 24rpx;
|
||||||
|
|
||||||
|
.lock-name {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 18rpx;
|
||||||
|
border-radius: 50rpx;
|
||||||
|
margin-top: 24rpx;
|
||||||
|
margin-bottom: 32rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
background-color: #4777ee;
|
||||||
|
color: white;
|
||||||
|
padding: 12rpx 32rpx;
|
||||||
|
.icon-down {
|
||||||
|
width: 32rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.power {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12rpx;
|
||||||
|
|
||||||
|
.power-icon {
|
||||||
|
width: 50rpx;
|
||||||
|
height: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.power-text {
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.power-tips {
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.open-lock-btn {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
position: relative;
|
||||||
|
height: 480rpx;
|
||||||
|
margin-top: 18rpx;
|
||||||
|
margin-bottom: 18rpx;
|
||||||
|
.open-lock-btn-image-1 {
|
||||||
|
width: 480rpx;
|
||||||
|
height: 480rpx;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
.open-lock-btn-image-2 {
|
||||||
|
width: 480rpx;
|
||||||
|
height: 480rpx;
|
||||||
|
position: absolute;
|
||||||
|
transition: transform 0.6s ease-in-out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* 旋转动画 class */
|
||||||
|
.rotate {
|
||||||
|
animation: rotate 2s linear infinite; /* 无限旋转动画 */
|
||||||
|
}
|
||||||
|
@keyframes rotate {
|
||||||
|
from {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.switch-text {
|
||||||
|
margin-top: 35rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #414141;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.other-text {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 15rpx;
|
||||||
|
margin-top: 35rpx;
|
||||||
|
|
||||||
|
.bottom-side {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 32rpx;
|
||||||
|
gap: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom-icon {
|
||||||
|
width: 48rpx;
|
||||||
|
height: 48rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -1,448 +1,543 @@
|
|||||||
<template>
|
<template>
|
||||||
<view v-if="buttonInfo">
|
<view v-if="buttonInfo">
|
||||||
<view v-if="isLogin">
|
<view v-if="isLogin">
|
||||||
<view class="view">
|
<view class="account-info" @click="toUsereInfo">
|
||||||
<view class="view-button" @click="toUsereInfo">
|
<image class="avatar" :src="userInfo.headUrl" mode="aspectFill"></image>
|
||||||
<view>个人信息</view>
|
<view class="account-nickname">
|
||||||
<image
|
<text class="nickname">{{ userInfo.nickname }}</text>
|
||||||
class="icon-arrow"
|
<text class="account">{{ userInfo.mobile }}</text>
|
||||||
src="https://oss-lock.xhjcn.ltd/mp/icon_arrow.png"
|
</view>
|
||||||
mode="aspectFill"
|
</view>
|
||||||
></image>
|
<view class="follow-official-account">
|
||||||
</view>
|
<text>关注公众号,接收更多消息提醒</text>
|
||||||
<view class="view-line"></view>
|
<!-- #ifdef MP-WEIXIN -->
|
||||||
<!-- #ifdef MP-WEIXIN -->
|
<official-account><view class="follow-btn">关注公众号</view></official-account>
|
||||||
<label for="contact">
|
<!-- #endif -->
|
||||||
<view class="view-button">
|
<view class="follow-btn" @click="jumpToWeChatfficialAccount">关注公众号</view>
|
||||||
<view>客服</view>
|
</view>
|
||||||
<image
|
<label for="contact">
|
||||||
class="icon-arrow"
|
<view class="option-item">
|
||||||
src="https://oss-lock.xhjcn.ltd/mp/icon_arrow.png"
|
<view class="icon-label">
|
||||||
mode="aspectFill"
|
<image class="left-icon" src="https://cos-lock.skychip.top/mp/icon_customer_service.png">
|
||||||
></image>
|
</image>
|
||||||
</view>
|
<text>人工客服</text>
|
||||||
</label>
|
</view>
|
||||||
<!-- #endif -->
|
<image class="icon-arrow" src="https://cos-lock.skychip.top/mp/icon_arrow.png" mode="aspectFill">
|
||||||
<!-- #ifdef APP-PLUS -->
|
</image>
|
||||||
<view @click="toContact">
|
</view>
|
||||||
<view class="view-button">
|
</label>
|
||||||
<view>客服</view>
|
<view class="view">
|
||||||
<image
|
<!-- #ifdef APP-PLUS -->
|
||||||
class="icon-arrow"
|
<view @click="toContact">
|
||||||
src="https://oss-lock.xhjcn.ltd/mp/icon_arrow.png"
|
<view class="view-button">
|
||||||
mode="aspectFill"
|
<view>客服</view>
|
||||||
></image>
|
<image class="icon-arrow" src="https://cos-lock.skychip.top/mp/icon_arrow.png"
|
||||||
</view>
|
mode="aspectFill">
|
||||||
</view>
|
</image>
|
||||||
<!-- #endif -->
|
</view>
|
||||||
<view class="view-line"></view>
|
</view>
|
||||||
<view class="view-button" @click="toWebview()">
|
<!-- #endif -->
|
||||||
<view>公司介绍</view>
|
<view class="view-button">
|
||||||
<image
|
<view>邮箱 / 商务合作</view>
|
||||||
class="icon-arrow"
|
<text class="right-text">{{env.officialEmail}}</text>
|
||||||
src="https://oss-lock.xhjcn.ltd/mp/icon_arrow.png"
|
</view>
|
||||||
mode="aspectFill"
|
<view class="view-line"></view>
|
||||||
></image>
|
<view class="view-button">
|
||||||
</view>
|
<view>官网</view>
|
||||||
<view class="view-line"></view>
|
<text class="right-text">{{env.officialWebsite}}</text>
|
||||||
<view class="view-button" @click="toWebview('userAgreement')">
|
</view>
|
||||||
<view>用户协议</view>
|
<view class="view-line"></view>
|
||||||
<image
|
<view class="view-button" @click="toWebview()">
|
||||||
class="icon-arrow"
|
<view>公司介绍</view>
|
||||||
src="https://oss-lock.xhjcn.ltd/mp/icon_arrow.png"
|
<image class="icon-arrow" src="https://cos-lock.skychip.top/mp/icon_arrow.png" mode="aspectFill">
|
||||||
mode="aspectFill"
|
</image>
|
||||||
></image>
|
</view>
|
||||||
</view>
|
<view class="view-line"></view>
|
||||||
<view class="view-line"></view>
|
<view class="view-button" @click="toWebview('userAgreement')">
|
||||||
<view class="view-button" @click="toWebview('privacy')">
|
<view>用户协议</view>
|
||||||
<view>隐私政策</view>
|
<image class="icon-arrow" src="https://cos-lock.skychip.top/mp/icon_arrow.png" mode="aspectFill">
|
||||||
<image
|
</image>
|
||||||
class="icon-arrow"
|
</view>
|
||||||
src="https://oss-lock.xhjcn.ltd/mp/icon_arrow.png"
|
<view class="view-line"></view>
|
||||||
mode="aspectFill"
|
<view class="view-button" @click="toWebview('privacy')">
|
||||||
></image>
|
<view>隐私政策</view>
|
||||||
</view>
|
<image class="icon-arrow" src="https://cos-lock.skychip.top/mp/icon_arrow.png" mode="aspectFill">
|
||||||
</view>
|
</image>
|
||||||
<view class="env" v-if="env">
|
</view>
|
||||||
<view class="env-text">{{ env.name }} {{ env.version }}+{{ env.buildNumber }}</view>
|
</view>
|
||||||
<view>{{ env.baseUrl.split('/').slice(0, 3).join('/') }}</view>
|
<view class="env" v-if="env">
|
||||||
<view
|
<view class="env-text">{{ env.name }} {{ env.version }}+{{ env.buildNumber }}</view>
|
||||||
v-if="!(envVersion === 'release' || nodeEnv === 'production') && env"
|
<view>{{ env.baseUrl.split('/').slice(0, 3).join('/') }}</view>
|
||||||
class="env-button"
|
<view v-if="!(envVersion === 'release' || nodeEnv === 'production') && env" class="env-button"
|
||||||
@click="show = true"
|
@click="show = true">切换环境</view>
|
||||||
>切换环境</view
|
</view>
|
||||||
>
|
<!-- #ifdef MP-WEIXIN -->
|
||||||
</view>
|
<label for="changePhone">
|
||||||
<!-- #ifdef MP-WEIXIN -->
|
<view class="switch-account">切换账号</view>
|
||||||
<label for="changePhone">
|
</label>
|
||||||
<view class="switch-account">切换账号</view>
|
<!-- #endif -->
|
||||||
</label>
|
<!-- #ifdef APP-PLUS -->
|
||||||
<!-- #endif -->
|
<view class="switch-account !bg-red-500" @click="logout">退出</view>
|
||||||
<!-- #ifdef APP-PLUS -->
|
<view class="delete-account" @click="deleteAccount">删除账号</view>
|
||||||
<view class="switch-account !bg-red-500" @click="logout">退出</view>
|
<!-- #endif -->
|
||||||
<view class="delete-account" @click="deleteAccount">删除账号</view>
|
</view>
|
||||||
<!-- #endif -->
|
<view v-else>
|
||||||
</view>
|
<view class="tips">因智能门锁与账号绑定,登录为手机号登录</view>
|
||||||
<view v-else>
|
<label for="phone">
|
||||||
<view class="tips">因智能门锁与账号绑定,登录为手机号登录</view>
|
<view class="button-login">登录</view>
|
||||||
<label for="phone">
|
</label>
|
||||||
<view class="button-login">登录</view>
|
<view class="env" v-if="env">
|
||||||
</label>
|
<view class="env-text">{{ env.name }} {{ env.version }}+{{ env.buildNumber }}</view>
|
||||||
<view class="env" v-if="env">
|
<view>{{ env.baseUrl.split('/').slice(0, 3).join('/') }}</view>
|
||||||
<view class="env-text">{{ env.name }} {{ env.version }}+{{ env.buildNumber }}</view>
|
<view v-if="!(envVersion === 'release' || nodeEnv === 'production') && env" class="env-button"
|
||||||
<view>{{ env.baseUrl.split('/').slice(0, 3).join('/') }}</view>
|
@click="show = true">
|
||||||
<view
|
切换环境
|
||||||
v-if="!(envVersion === 'release' || nodeEnv === 'production') && env"
|
</view>
|
||||||
class="env-button"
|
</view>
|
||||||
@click="show = true"
|
</view>
|
||||||
>
|
</view>
|
||||||
切换环境
|
<button open-type="contact" style="display: none" id="contact"></button>
|
||||||
</view>
|
<button open-type="getPhoneNumber" style="display: none" id="phone" @getphonenumber="getphonenumber"></button>
|
||||||
</view>
|
<button open-type="getPhoneNumber" style="display: none" id="changePhone" @getphonenumber="changePhone"></button>
|
||||||
</view>
|
<up-action-sheet :actions="envList" :closeOnClickOverlay="true" title="切换环境" cancelText="取消"
|
||||||
</view>
|
:closeOnClickAction="true" :show="show" :safeAreaInsetBottom="true" @close="show = false"
|
||||||
<button open-type="contact" style="display: none" id="contact"></button>
|
@select="selectEnv"></up-action-sheet>
|
||||||
<button
|
|
||||||
open-type="getPhoneNumber"
|
|
||||||
style="display: none"
|
|
||||||
id="phone"
|
|
||||||
@getphonenumber="getphonenumber"
|
|
||||||
></button>
|
|
||||||
<button
|
|
||||||
open-type="getPhoneNumber"
|
|
||||||
style="display: none"
|
|
||||||
id="changePhone"
|
|
||||||
@getphonenumber="changePhone"
|
|
||||||
></button>
|
|
||||||
<up-action-sheet
|
|
||||||
:actions="envList"
|
|
||||||
:closeOnClickOverlay="true"
|
|
||||||
title="切换环境"
|
|
||||||
cancelText="取消"
|
|
||||||
:closeOnClickAction="true"
|
|
||||||
:show="show"
|
|
||||||
:safeAreaInsetBottom="true"
|
|
||||||
@close="show = false"
|
|
||||||
@select="selectEnv"
|
|
||||||
></up-action-sheet>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapState, mapActions } from 'pinia'
|
import {
|
||||||
import { useBasicStore } from '@/stores/basic'
|
mapState,
|
||||||
import { useUserStore } from '@/stores/user'
|
mapActions
|
||||||
import { useLockStore } from '@/stores/lock'
|
} from 'pinia'
|
||||||
import { phoneLoginRequest, logoutRequest } from '@/api/user'
|
import {
|
||||||
import env from '@/config/env'
|
useBasicStore
|
||||||
import { setStorage, getStorage, removeStorage } from '@/utils/storage'
|
} from '@/stores/basic'
|
||||||
import { useNotificationStore } from '@/stores/notification'
|
import {
|
||||||
import { getAppInfoRequest } from '@/api/system'
|
useUserStore
|
||||||
|
} from '@/stores/user'
|
||||||
|
import {
|
||||||
|
useLockStore
|
||||||
|
} from '@/stores/lock'
|
||||||
|
import {
|
||||||
|
phoneLoginRequest,
|
||||||
|
logoutRequest
|
||||||
|
} from '@/api/user'
|
||||||
|
import env from '@/config/env'
|
||||||
|
import {
|
||||||
|
setStorage,
|
||||||
|
getStorage,
|
||||||
|
removeStorage
|
||||||
|
} from '@/utils/storage'
|
||||||
|
import {
|
||||||
|
useNotificationStore
|
||||||
|
} from '@/stores/notification'
|
||||||
|
import {
|
||||||
|
getAppInfoRequest
|
||||||
|
} from '@/api/system'
|
||||||
|
import {
|
||||||
|
loginRequest
|
||||||
|
} from '@/api/user'
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
buttonInfo: null,
|
||||||
|
env: null,
|
||||||
|
envVersion: '',
|
||||||
|
envList: [],
|
||||||
|
show: false,
|
||||||
|
nodeEnv: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(useUserStore, ['isLogin', 'userInfo']),
|
||||||
|
...mapState(useLockStore, ['lockSearch']),
|
||||||
|
...mapState(useNotificationStore, ['notificationSearch'])
|
||||||
|
},
|
||||||
|
async onLoad() {
|
||||||
|
this.buttonInfo = await this.getButtonInfo()
|
||||||
|
this.env = await env[await getApp().globalData.getEnvConfig()]
|
||||||
|
this.envVersion = getApp().globalData.envVersion
|
||||||
|
this.nodeEnv = process.env.NODE_ENV
|
||||||
|
|
||||||
export default {
|
// eslint-disable-next-line guard-for-in,no-restricted-syntax
|
||||||
data() {
|
for (let key in env) {
|
||||||
return {
|
this.envList.push({
|
||||||
buttonInfo: null,
|
...env[key],
|
||||||
env: null,
|
key
|
||||||
envVersion: '',
|
})
|
||||||
envList: [],
|
}
|
||||||
show: false,
|
},
|
||||||
nodeEnv: ''
|
methods: {
|
||||||
}
|
...mapActions(useBasicStore, ['getButtonInfo', 'routeJump']),
|
||||||
},
|
...mapActions(useLockStore, ['getLockList', 'updateLockSearch']),
|
||||||
computed: {
|
...mapActions(useNotificationStore, ['getNotificationList', 'updateNotificationSearch']),
|
||||||
...mapState(useUserStore, ['isLogin']),
|
...mapActions(useUserStore, [
|
||||||
...mapState(useLockStore, ['lockSearch']),
|
'updateLoginStatus',
|
||||||
...mapState(useNotificationStore, ['notificationSearch'])
|
'phoneLogin',
|
||||||
},
|
'updateUserInfo',
|
||||||
async onLoad() {
|
'getUserInfo',
|
||||||
this.buttonInfo = await this.getButtonInfo()
|
'checkSession'
|
||||||
this.env = await env[await getApp().globalData.getEnvConfig()]
|
]),
|
||||||
this.envVersion = getApp().globalData.envVersion
|
deleteAccount() {
|
||||||
this.nodeEnv = process.env.NODE_ENV
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '删除账号后,你的所有信息及相关记录都会从平台彻底删除,且不可恢复,是否删除?',
|
||||||
|
success: res => {
|
||||||
|
if (res.confirm) {
|
||||||
|
this.routeJump({
|
||||||
|
name: 'deleteAccount'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
selectEnv(env) {
|
||||||
|
setStorage('envVersion', env.key)
|
||||||
|
removeStorage('token')
|
||||||
|
removeStorage('openid')
|
||||||
|
removeStorage('userInfo')
|
||||||
|
removeStorage('lockList')
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/main/home'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
toContact() {
|
||||||
|
getAppInfoRequest().then(res => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
plus.runtime.openURL(res.data.wechat_service_url)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async changePhone(res) {
|
||||||
|
if (res.detail.errMsg === 'getPhoneNumber:fail user deny') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line guard-for-in,no-restricted-syntax
|
const that = this
|
||||||
for (let key in env) {
|
uni.showLoading({
|
||||||
this.envList.push({
|
title: '登录中'
|
||||||
...env[key],
|
})
|
||||||
key
|
uni.login({
|
||||||
})
|
provider: 'weixin',
|
||||||
}
|
async success(loginRes) {
|
||||||
},
|
const openid = getStorage('openid')
|
||||||
methods: {
|
const {
|
||||||
...mapActions(useBasicStore, ['getButtonInfo', 'routeJump']),
|
code,
|
||||||
...mapActions(useLockStore, ['getLockList', 'updateLockSearch']),
|
data,
|
||||||
...mapActions(useNotificationStore, ['getNotificationList', 'updateNotificationSearch']),
|
message
|
||||||
...mapActions(useUserStore, [
|
} = await phoneLoginRequest({
|
||||||
'updateLoginStatus',
|
encryptedData: res.detail.encryptedData,
|
||||||
'phoneLogin',
|
iv: res.detail.iv,
|
||||||
'updateUserInfo',
|
rebind: true,
|
||||||
'getUserInfo',
|
openid,
|
||||||
'checkSession'
|
js_code: loginRes.code
|
||||||
]),
|
})
|
||||||
deleteAccount() {
|
uni.hideLoading()
|
||||||
uni.showModal({
|
if (code === 0) {
|
||||||
title: '提示',
|
removeStorage('userInfo')
|
||||||
content: '删除账号后,你的所有信息及相关记录都会从平台彻底删除,且不可恢复,是否删除?',
|
removeStorage('lockList')
|
||||||
success: res => {
|
setStorage('token', data.accessToken)
|
||||||
if (res.confirm) {
|
that.updateLockSearch({
|
||||||
this.routeJump({
|
...that.lockSearch,
|
||||||
name: 'deleteAccount'
|
pageNo: 1
|
||||||
})
|
})
|
||||||
}
|
that.getUserInfo()
|
||||||
}
|
that.getLockList(that.lockSearch)
|
||||||
})
|
that.updateNotificationSearch({
|
||||||
},
|
pageNo: 1
|
||||||
selectEnv(env) {
|
})
|
||||||
setStorage('envVersion', env.key)
|
that.getNotificationList(that.notificationSearch)
|
||||||
removeStorage('token')
|
uni.showToast({
|
||||||
removeStorage('openid')
|
title: '账号切换成功',
|
||||||
removeStorage('userInfo')
|
icon: 'none'
|
||||||
removeStorage('lockList')
|
})
|
||||||
uni.reLaunch({
|
} else if (code === 438) {
|
||||||
url: '/pages/main/home'
|
/* empty */
|
||||||
})
|
} else {
|
||||||
},
|
uni.showToast({
|
||||||
toContact() {
|
title: message,
|
||||||
getAppInfoRequest().then(res => {
|
icon: 'none'
|
||||||
if (res.code === 0) {
|
})
|
||||||
plus.runtime.openURL(res.data.wechat_service_url)
|
}
|
||||||
}
|
},
|
||||||
})
|
fail() {
|
||||||
},
|
uni.hideLoading()
|
||||||
async changePhone(res) {
|
uni.showToast({
|
||||||
if (res.detail.errMsg === 'getPhoneNumber:fail user deny') {
|
title: '登录失败,请重试'
|
||||||
return
|
})
|
||||||
}
|
}
|
||||||
|
})
|
||||||
const that = this
|
},
|
||||||
uni.showLoading({
|
async getphonenumber(data) {
|
||||||
title: '登录中'
|
if (data.detail.errMsg === 'getPhoneNumber:fail user deny') {
|
||||||
})
|
return
|
||||||
uni.login({
|
}
|
||||||
provider: 'weixin',
|
const that = this
|
||||||
async success(loginRes) {
|
uni.showLoading({
|
||||||
const openid = getStorage('openid')
|
title: '登录中'
|
||||||
const { code, data, message } = await phoneLoginRequest({
|
})
|
||||||
encryptedData: res.detail.encryptedData,
|
uni.login({
|
||||||
iv: res.detail.iv,
|
provider: 'weixin',
|
||||||
rebind: true,
|
async success(loginRes) {
|
||||||
openid,
|
const result = await that.phoneLogin({
|
||||||
js_code: loginRes.code
|
encryptedData: data.detail.encryptedData,
|
||||||
})
|
iv: data.detail.iv,
|
||||||
uni.hideLoading()
|
code: loginRes.code
|
||||||
if (code === 0) {
|
})
|
||||||
removeStorage('userInfo')
|
uni.hideLoading()
|
||||||
removeStorage('lockList')
|
if (!result) {
|
||||||
setStorage('token', data.accessToken)
|
uni.showToast({
|
||||||
that.updateLockSearch({
|
title: result.message,
|
||||||
...that.lockSearch,
|
icon: 'none'
|
||||||
pageNo: 1
|
})
|
||||||
})
|
}
|
||||||
that.getUserInfo()
|
},
|
||||||
that.getLockList(that.lockSearch)
|
fail() {
|
||||||
that.updateNotificationSearch({
|
uni.hideLoading()
|
||||||
pageNo: 1
|
uni.showToast({
|
||||||
})
|
title: '登录失败,请重试'
|
||||||
that.getNotificationList(that.notificationSearch)
|
})
|
||||||
uni.showToast({
|
}
|
||||||
title: '账号切换成功',
|
})
|
||||||
icon: 'none'
|
},
|
||||||
})
|
toUsereInfo() {
|
||||||
} else if (code === 438) {
|
this.routeJump({
|
||||||
/* empty */
|
name: 'userInfo'
|
||||||
} else {
|
})
|
||||||
uni.showToast({
|
},
|
||||||
title: message,
|
toWebview(type) {
|
||||||
icon: 'none'
|
this.routeJump({
|
||||||
})
|
name: 'webview',
|
||||||
}
|
params: {
|
||||||
},
|
type
|
||||||
fail() {
|
}
|
||||||
uni.hideLoading()
|
})
|
||||||
uni.showToast({
|
},
|
||||||
title: '登录失败,请重试'
|
jumpToWeChatfficialAccount(){
|
||||||
})
|
|
||||||
}
|
},
|
||||||
})
|
logout() {
|
||||||
},
|
uni.showModal({
|
||||||
async getphonenumber(data) {
|
title: '提示',
|
||||||
if (data.detail.errMsg === 'getPhoneNumber:fail user deny') {
|
content: '确定退出登录吗?',
|
||||||
return
|
success: async res => {
|
||||||
}
|
if (res.confirm) {
|
||||||
|
await logoutRequest()
|
||||||
const that = this
|
removeStorage('token')
|
||||||
uni.showLoading({
|
removeStorage('openid')
|
||||||
title: '登录中'
|
removeStorage('userInfo')
|
||||||
})
|
removeStorage('lockList')
|
||||||
uni.login({
|
this.routeJump({
|
||||||
provider: 'weixin',
|
name: 'login',
|
||||||
async success(loginRes) {
|
type: 'reLaunch'
|
||||||
const result = await that.phoneLogin({
|
})
|
||||||
encryptedData: data.detail.encryptedData,
|
}
|
||||||
iv: data.detail.iv,
|
}
|
||||||
code: loginRes.code
|
})
|
||||||
})
|
}
|
||||||
uni.hideLoading()
|
}
|
||||||
if (!result) {
|
}
|
||||||
uni.showToast({
|
|
||||||
title: result.message,
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fail() {
|
|
||||||
uni.hideLoading()
|
|
||||||
uni.showToast({
|
|
||||||
title: '登录失败,请重试'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
toUsereInfo() {
|
|
||||||
this.routeJump({
|
|
||||||
name: 'userInfo'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
toWebview(type) {
|
|
||||||
this.routeJump({
|
|
||||||
name: 'webview',
|
|
||||||
params: {
|
|
||||||
type
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
logout() {
|
|
||||||
uni.showModal({
|
|
||||||
title: '提示',
|
|
||||||
content: '确定退出登录吗?',
|
|
||||||
success: async res => {
|
|
||||||
if (res.confirm) {
|
|
||||||
await logoutRequest()
|
|
||||||
removeStorage('token')
|
|
||||||
removeStorage('openid')
|
|
||||||
removeStorage('userInfo')
|
|
||||||
removeStorage('lockList')
|
|
||||||
this.routeJump({
|
|
||||||
name: 'login',
|
|
||||||
type: 'reLaunch'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
page {
|
page {
|
||||||
background-color: $uni-bg-color-grey;
|
background-color: $uni-bg-color-grey;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.background-image {
|
.background-image {
|
||||||
width: 710rpx;
|
width: 710rpx;
|
||||||
height: 156rpx;
|
height: 156rpx;
|
||||||
margin-top: 32rpx;
|
margin-top: 32rpx;
|
||||||
margin-left: 20rpx;
|
margin-left: 20rpx;
|
||||||
border-radius: 32rpx;
|
border-radius: 32rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.view {
|
.view {
|
||||||
width: 710rpx;
|
background: #ffffff;
|
||||||
margin-top: 32rpx;
|
border-radius: 16rpx;
|
||||||
margin-left: 20rpx;
|
display: flex;
|
||||||
background: #ffffff;
|
flex-direction: column;
|
||||||
border-radius: 32rpx;
|
align-items: center;
|
||||||
}
|
margin: 20rpx 20rpx;
|
||||||
|
padding: 20rpx 20rpx;
|
||||||
|
gap: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.view-button {
|
.follow-official-account {
|
||||||
display: flex;
|
margin: 20rpx 20rpx;
|
||||||
align-items: center;
|
background-image: url('https://cos-lock.skychip.top/mp/follow_official_account_bg.png');
|
||||||
justify-content: space-between;
|
background-size: cover;
|
||||||
padding: 0 20rpx 0 40rpx;
|
background-position: center;
|
||||||
font-size: 32rpx;
|
background-repeat: no-repeat;
|
||||||
font-weight: bold;
|
height: 88rpx;
|
||||||
line-height: 80rpx;
|
border-radius: 16rpx;
|
||||||
color: #292826;
|
display: flex;
|
||||||
}
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
color: white;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 28rpx;
|
||||||
|
padding-left: 20rpx;
|
||||||
|
padding-right: 20rpx;
|
||||||
|
|
||||||
.icon-arrow {
|
.follow-btn {
|
||||||
width: 40rpx;
|
display: flex;
|
||||||
height: 40rpx;
|
align-items: center;
|
||||||
}
|
padding: 12rpx 20rpx;
|
||||||
|
background-color: white;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
color: #4777ee;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.view-line {
|
.account-info {
|
||||||
width: 100%;
|
margin: 20rpx 20rpx;
|
||||||
height: 3rpx;
|
padding-left: 20rpx;
|
||||||
background: #ebebeb;
|
padding-top: 20rpx;
|
||||||
}
|
padding-bottom: 20rpx;
|
||||||
|
padding-right: 20rpx;
|
||||||
|
display: flex;
|
||||||
|
gap: 18rpx;
|
||||||
|
align-items: center;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
background-color: white;
|
||||||
|
|
||||||
.switch-account {
|
.avatar {
|
||||||
position: absolute;
|
width: 120rpx;
|
||||||
bottom: 120rpx;
|
height: 120rpx;
|
||||||
width: 600rpx;
|
}
|
||||||
height: 80rpx;
|
|
||||||
margin-left: 75rpx;
|
|
||||||
font-size: 40rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
line-height: 80rpx;
|
|
||||||
color: #ffffff;
|
|
||||||
text-align: center;
|
|
||||||
background: #4777ee;
|
|
||||||
border-radius: 46rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.delete-account {
|
.account-nickname {
|
||||||
position: absolute;
|
display: flex;
|
||||||
right: 75rpx;
|
flex-direction: column;
|
||||||
bottom: 60rpx;
|
gap: 12rpx;
|
||||||
font-size: 28rpx;
|
|
||||||
color: #666;
|
|
||||||
}
|
|
||||||
|
|
||||||
.env {
|
.nickname {
|
||||||
position: absolute;
|
font-size: 32rpx;
|
||||||
bottom: 240rpx;
|
font-weight: 600;
|
||||||
width: 600rpx;
|
}
|
||||||
margin-left: 75rpx;
|
|
||||||
line-height: 80rpx;
|
|
||||||
text-align: center;
|
|
||||||
|
|
||||||
.env-text {
|
.account {
|
||||||
font-size: 30rpx;
|
font-size: 24rpx;
|
||||||
font-weight: bold;
|
color: gray;
|
||||||
color: #999999;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.env-button {
|
.view-button {
|
||||||
font-size: 0.8rem;
|
width: 100%;
|
||||||
color: #022b7c;
|
display: flex;
|
||||||
text-align: right;
|
align-items: center;
|
||||||
text-decoration: underline;
|
justify-content: space-between;
|
||||||
background: inherit;
|
border-radius: 16rpx;
|
||||||
}
|
font-size: 28rpx;
|
||||||
}
|
|
||||||
|
|
||||||
.button-login {
|
.right-text {
|
||||||
width: 650rpx;
|
font-size: 28rpx;
|
||||||
height: 120rpx;
|
color: gray;
|
||||||
margin-left: 50rpx;
|
}
|
||||||
font-size: 48rpx;
|
}
|
||||||
font-weight: bold;
|
|
||||||
line-height: 120rpx;
|
|
||||||
color: #ffffff;
|
|
||||||
text-align: center;
|
|
||||||
background: #4777ee;
|
|
||||||
border-radius: 46rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tips {
|
.icon-arrow {
|
||||||
padding: 32rpx 0;
|
width: 40rpx;
|
||||||
margin-top: 25vh;
|
height: 40rpx;
|
||||||
font-size: 28rpx;
|
}
|
||||||
color: #999999;
|
|
||||||
text-align: center;
|
.view-line {
|
||||||
}
|
width: 100%;
|
||||||
</style>
|
height: 3rpx;
|
||||||
|
background: #ebebeb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.switch-account {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 120rpx;
|
||||||
|
width: 600rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
margin-left: 75rpx;
|
||||||
|
font-size: 40rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
line-height: 80rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
text-align: center;
|
||||||
|
background: #4777ee;
|
||||||
|
border-radius: 46rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-account {
|
||||||
|
position: absolute;
|
||||||
|
right: 75rpx;
|
||||||
|
bottom: 60rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.env {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 240rpx;
|
||||||
|
width: 600rpx;
|
||||||
|
margin-left: 75rpx;
|
||||||
|
line-height: 80rpx;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
.env-text {
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.env-button {
|
||||||
|
font-size: 0.8rem;
|
||||||
|
color: #022b7c;
|
||||||
|
text-align: right;
|
||||||
|
text-decoration: underline;
|
||||||
|
background: inherit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-login {
|
||||||
|
width: 650rpx;
|
||||||
|
height: 120rpx;
|
||||||
|
margin-left: 50rpx;
|
||||||
|
font-size: 48rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
line-height: 120rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
text-align: center;
|
||||||
|
background: #4777ee;
|
||||||
|
border-radius: 46rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tips {
|
||||||
|
padding: 32rpx 0;
|
||||||
|
margin-top: 25vh;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #999999;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.option-item {
|
||||||
|
background-color: white;
|
||||||
|
display: flex;
|
||||||
|
padding: 20rpx 20rpx;
|
||||||
|
margin-left: 20rpx;
|
||||||
|
margin-right: 20rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.left-icon {
|
||||||
|
width: 52rpx;
|
||||||
|
height: 52rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-label {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -71,7 +71,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
:class="[
|
:class="[
|
||||||
canSubmit ? 'bg-[#5eb7ac]' : 'bg-[#9d9da3]',
|
canSubmit ? 'bg-[#4777ee]' : 'bg-[#9d9da3]',
|
||||||
'mx-4',
|
'mx-4',
|
||||||
'h-100',
|
'h-100',
|
||||||
'text-white',
|
'text-white',
|
||||||
|
|||||||
@ -570,6 +570,7 @@
|
|||||||
authUid: $user.userInfo.uid.toString(),
|
authUid: $user.userInfo.uid.toString(),
|
||||||
keyId: $bluetooth.keyId.toString()
|
keyId: $bluetooth.keyId.toString()
|
||||||
})
|
})
|
||||||
|
console.log('resetDeviceCode', resetDeviceCode)
|
||||||
if (resetDeviceCode === 0 || resetDeviceCode === -2) {
|
if (resetDeviceCode === 0 || resetDeviceCode === -2) {
|
||||||
const { code, message } = await deleteLockRequest({
|
const { code, message } = await deleteLockRequest({
|
||||||
lockId: $bluetooth.currentLockInfo.lockId
|
lockId: $bluetooth.currentLockInfo.lockId
|
||||||
@ -602,11 +603,12 @@
|
|||||||
})
|
})
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
$lock.updateLockSearch({
|
await $lock.updateLockSearch({
|
||||||
...$lock.lockSearch,
|
...$lock.lockSearch,
|
||||||
pageNo: 1
|
pageNo: 1
|
||||||
})
|
})
|
||||||
$lock.getLockList($lock.lockSearch)
|
await $lock.getLockList($lock.lockSearch)
|
||||||
|
await $bluetooth.updateCurrentLockInfo({})
|
||||||
$basic.backAndToast('删除成功', 2)
|
$basic.backAndToast('删除成功', 2)
|
||||||
} else {
|
} else {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 3.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 3.6 KiB |
@ -299,12 +299,14 @@ export const useBluetoothStore = defineStore('ble', {
|
|||||||
},
|
},
|
||||||
// 监听蓝牙设备连接状态
|
// 监听蓝牙设备连接状态
|
||||||
onBluetoothConnectStatus() {
|
onBluetoothConnectStatus() {
|
||||||
const that = this
|
// 使用箭头函数,直接继承外层的 this(组件实例)
|
||||||
uni.onBLEConnectionStateChange(function (res) {
|
uni.onBLEConnectionStateChange(res => {
|
||||||
if (res.deviceId === that.currentLockInfo.deviceId) {
|
// 直接访问 this.currentLockInfo(最新值)
|
||||||
|
if (res.deviceId === this.currentLockInfo?.deviceId) {
|
||||||
console.log('设备连接状态改变', res)
|
console.log('设备连接状态改变', res)
|
||||||
that.updateCurrentLockInfo({
|
// 更新 currentLockInfo(确保是响应式更新)
|
||||||
...that.currentLockInfo,
|
this.updateCurrentLockInfo({
|
||||||
|
...this.currentLockInfo,
|
||||||
connected: res.connected
|
connected: res.connected
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -1027,7 +1029,7 @@ export const useBluetoothStore = defineStore('ble', {
|
|||||||
fail(res) {
|
fail(res) {
|
||||||
if (res.errCode === 10006) {
|
if (res.errCode === 10006) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '连接失败,请靠近设备并保持设备处于唤醒状态',
|
title: '连接失败,请靠近设备并保持设备处于唤醒状态1',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -1039,7 +1041,7 @@ export const useBluetoothStore = defineStore('ble', {
|
|||||||
fail(res) {
|
fail(res) {
|
||||||
if (res.errCode === 10006) {
|
if (res.errCode === 10006) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '连接失败,请靠近设备并保持设备处于唤醒状态',
|
title: '连接失败,请靠近设备并保持设备处于唤醒状态2',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -1191,6 +1193,7 @@ export const useBluetoothStore = defineStore('ble', {
|
|||||||
uuid &&
|
uuid &&
|
||||||
uuid.slice(2, 8) === '758824' &&
|
uuid.slice(2, 8) === '758824' &&
|
||||||
(uuid.slice(30, 32) === '01' ||
|
(uuid.slice(30, 32) === '01' ||
|
||||||
|
uuid.slice(30, 32) === '03' ||
|
||||||
that.bindedDeviceNameList.includes(that.currentLockInfo.name))
|
that.bindedDeviceNameList.includes(that.currentLockInfo.name))
|
||||||
) {
|
) {
|
||||||
uni.stopBluetoothDevicesDiscovery()
|
uni.stopBluetoothDevicesDiscovery()
|
||||||
@ -1458,20 +1461,17 @@ export const useBluetoothStore = defineStore('ble', {
|
|||||||
)
|
)
|
||||||
|
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
setTimeout(
|
setTimeout(() => {
|
||||||
() => {
|
uni.writeBLECharacteristicValue({
|
||||||
uni.writeBLECharacteristicValue({
|
deviceId: that.currentLockInfo.deviceId,
|
||||||
deviceId: that.currentLockInfo.deviceId,
|
serviceId: that.currentLockInfo.serviceId,
|
||||||
serviceId: that.currentLockInfo.serviceId,
|
characteristicId: that.currentLockInfo.writeCharacteristicId,
|
||||||
characteristicId: that.currentLockInfo.writeCharacteristicId,
|
value: writeData.buffer,
|
||||||
value: writeData.buffer,
|
fail(res) {
|
||||||
fail(res) {
|
console.log('写入失败', res)
|
||||||
console.log('写入失败', res)
|
}
|
||||||
}
|
})
|
||||||
})
|
}, (i + 1) * 250)
|
||||||
},
|
|
||||||
(i + 1) * 250
|
|
||||||
)
|
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef MP
|
// #ifdef MP
|
||||||
@ -2320,6 +2320,7 @@ export const useBluetoothStore = defineStore('ble', {
|
|||||||
this.currentLockInfo.transportType !== transportType.TRANSPORT_TENCENT_YUN
|
this.currentLockInfo.transportType !== transportType.TRANSPORT_TENCENT_YUN
|
||||||
) {
|
) {
|
||||||
const searchResult = await this.searchAndConnectDevice()
|
const searchResult = await this.searchAndConnectDevice()
|
||||||
|
console.log('searchResult', searchResult)
|
||||||
if (searchResult.code === 0) {
|
if (searchResult.code === 0) {
|
||||||
log.info({
|
log.info({
|
||||||
code: searchResult.code,
|
code: searchResult.code,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user