Merge branch 'fanpeng' into 'develop'
Fanpeng See merge request StarlockTeam/wx-starlock!42
This commit is contained in:
commit
8a80d498de
@ -10,7 +10,8 @@ module.exports = {
|
|||||||
getApp: 'writable',
|
getApp: 'writable',
|
||||||
wx: 'writable',
|
wx: 'writable',
|
||||||
getCurrentPages: 'writable',
|
getCurrentPages: 'writable',
|
||||||
requirePlugin: 'writable'
|
requirePlugin: 'writable',
|
||||||
|
plus: 'writable'
|
||||||
},
|
},
|
||||||
// 指定如何解析语法
|
// 指定如何解析语法
|
||||||
parser: 'vue-eslint-parser',
|
parser: 'vue-eslint-parser',
|
||||||
|
|||||||
5
App.vue
5
App.vue
@ -23,13 +23,15 @@
|
|||||||
if (envVersionStorage) {
|
if (envVersionStorage) {
|
||||||
return envVersionStorage
|
return envVersionStorage
|
||||||
}
|
}
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
if (this.envVersion === 'develop') {
|
if (this.envVersion === 'develop') {
|
||||||
return 'XHJ'
|
return 'XHJ'
|
||||||
}
|
}
|
||||||
if (this.envVersion === 'trial') {
|
if (this.envVersion === 'trial') {
|
||||||
return 'XHJ'
|
return 'XHJ'
|
||||||
}
|
}
|
||||||
return 'DEV'
|
// #endif
|
||||||
|
return 'XHJ'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -47,7 +49,6 @@
|
|||||||
this.onBluetoothState()
|
this.onBluetoothState()
|
||||||
// 检查蓝牙权限
|
// 检查蓝牙权限
|
||||||
const checkResult = await this.checkSetting()
|
const checkResult = await this.checkSetting()
|
||||||
console.log(checkResult)
|
|
||||||
if (checkResult === true) {
|
if (checkResult === true) {
|
||||||
this.initAndListenBluetooth(false)
|
this.initAndListenBluetooth(false)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,3 +10,12 @@ export function getCountryListRequest(data) {
|
|||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取app信息
|
||||||
|
export function getAppInfoRequest(data) {
|
||||||
|
return request({
|
||||||
|
url: '/app/getAppInfo',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@ -136,3 +136,12 @@ export function getWebUrlRequest(data) {
|
|||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 退出登录
|
||||||
|
export function logoutRequest(data) {
|
||||||
|
return request({
|
||||||
|
url: '/v3/user/logout',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@ -4,12 +4,6 @@ export const myRequest = async (option = {}) => {
|
|||||||
const envConfig = getApp().globalData.getEnvConfig()
|
const envConfig = getApp().globalData.getEnvConfig()
|
||||||
const baseConfig = env[envConfig]
|
const baseConfig = env[envConfig]
|
||||||
|
|
||||||
console.log('=== 请求入参 ===')
|
|
||||||
console.log('URL:', baseConfig.baseUrl + option.url)
|
|
||||||
console.log('Data:', JSON.stringify(option.data || {}, null, 2))
|
|
||||||
console.log('Method:', option.method || 'GET')
|
|
||||||
console.log('================')
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
uni.request({
|
uni.request({
|
||||||
url: baseConfig.baseUrl + option.url,
|
url: baseConfig.baseUrl + option.url,
|
||||||
@ -21,10 +15,14 @@ export const myRequest = async (option = {}) => {
|
|||||||
...option.header
|
...option.header
|
||||||
},
|
},
|
||||||
success: result => {
|
success: result => {
|
||||||
console.log('=== 请求出参 ===')
|
console.log({
|
||||||
console.log('StatusCode:', result.statusCode)
|
url: baseConfig.baseUrl + option.url,
|
||||||
console.log('Response:', JSON.stringify(result.data, null, 2))
|
request: option.data,
|
||||||
console.log('================')
|
response: result.data,
|
||||||
|
statusCode: result.statusCode,
|
||||||
|
method: option.method,
|
||||||
|
header: option.header
|
||||||
|
})
|
||||||
|
|
||||||
if (result.statusCode === 200) {
|
if (result.statusCode === 200) {
|
||||||
resolve(result)
|
resolve(result)
|
||||||
|
|||||||
@ -323,31 +323,14 @@
|
|||||||
xWidth: Math.round(moveLeftDistance)
|
xWidth: Math.round(moveLeftDistance)
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('=== 滑动验证请求参数 ===')
|
|
||||||
console.log('params:', JSON.stringify(_this.params, null, 2))
|
|
||||||
console.log('moveLeftDistance:', moveLeftDistance)
|
|
||||||
console.log('captchaVerification:', captchaVerification)
|
|
||||||
console.log('token:', _this.backToken)
|
|
||||||
console.log('data:', JSON.stringify(data, null, 2))
|
|
||||||
console.log('=====================')
|
|
||||||
|
|
||||||
myRequest({
|
myRequest({
|
||||||
url: `/user/sendValidationCode`,
|
url: `/user/sendValidationCode`,
|
||||||
data,
|
data,
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
})
|
})
|
||||||
.then(result => {
|
.then(result => {
|
||||||
console.log('=== 滑动验证响应数据 ===')
|
|
||||||
console.log('result:', JSON.stringify(result, null, 2))
|
|
||||||
console.log('=====================')
|
|
||||||
|
|
||||||
if (result && result.data) {
|
if (result && result.data) {
|
||||||
let res = result.data
|
let res = result.data
|
||||||
console.log('=== 验证结果详情 ===')
|
|
||||||
console.log('errorCode:', res.errorCode)
|
|
||||||
console.log('errorMsg:', res.errorMsg)
|
|
||||||
console.log('res.data:', JSON.stringify(res.data, null, 2))
|
|
||||||
console.log('==================')
|
|
||||||
|
|
||||||
if (res.errorCode === 0) {
|
if (res.errorCode === 0) {
|
||||||
this.moveBlockBackgroundColor = '#5cb85c'
|
this.moveBlockBackgroundColor = '#5cb85c'
|
||||||
@ -377,9 +360,8 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.log('=== 滑动验证请求错误 ===')
|
|
||||||
console.log('error:', error)
|
console.log('error:', error)
|
||||||
console.log('=====================')
|
|
||||||
this.handleValidationError('网络错误,请重试')
|
this.handleValidationError('网络错误,请重试')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -455,11 +437,6 @@
|
|||||||
captchaType: this.captchaType || 'blockPuzzle'
|
captchaType: this.captchaType || 'blockPuzzle'
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('=== getPictrue 请求参数 ===')
|
|
||||||
console.log('params:', JSON.stringify(this.params, null, 2))
|
|
||||||
console.log('data:', JSON.stringify(data, null, 2))
|
|
||||||
console.log('========================')
|
|
||||||
|
|
||||||
myRequest({
|
myRequest({
|
||||||
url: '/user/getSliderVerifyImg',
|
url: '/user/getSliderVerifyImg',
|
||||||
data,
|
data,
|
||||||
@ -469,9 +446,6 @@
|
|||||||
this.loading = false
|
this.loading = false
|
||||||
if (result && result.data) {
|
if (result && result.data) {
|
||||||
let res = result.data
|
let res = result.data
|
||||||
console.log('=== getPictrue 响应数据 ===')
|
|
||||||
console.log('res:', JSON.stringify(res, null, 2))
|
|
||||||
console.log('========================')
|
|
||||||
|
|
||||||
if (res.errorCode === 0 && res.data) {
|
if (res.errorCode === 0 && res.data) {
|
||||||
this.backImgBase = res.data.bigImg
|
this.backImgBase = res.data.bigImg
|
||||||
|
|||||||
145
manifest.json
145
manifest.json
@ -1,42 +1,109 @@
|
|||||||
{
|
{
|
||||||
"name" : "wx-starlock",
|
"name": "星星锁Lite",
|
||||||
"appid" : "__UNI__933D519",
|
"appid": "__UNI__933D519",
|
||||||
"description" : "",
|
"description": "",
|
||||||
"versionName" : "1.3.0",
|
"versionName": "1.3.0",
|
||||||
"versionCode" : "37",
|
"versionCode": "37",
|
||||||
"mp-weixin" : {
|
"mp-weixin": {
|
||||||
"appid" : "wx9829a39e65550757",
|
"appid": "wx9829a39e65550757",
|
||||||
"setting" : {
|
"setting": {
|
||||||
"urlCheck" : true,
|
"urlCheck": true,
|
||||||
"minified" : true
|
"minified": true
|
||||||
},
|
|
||||||
"permission" : {
|
|
||||||
"scope.bluetooth" : {
|
|
||||||
"desc" : "蓝牙将用于控制和管理您的智能门锁"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"requiredPrivateInfos" : [ "getLocation" ],
|
|
||||||
"usingComponents" : true,
|
|
||||||
"lazyCodeLoading" : "requiredComponents",
|
|
||||||
"optimization" : {
|
|
||||||
"subPackages" : true
|
|
||||||
},
|
|
||||||
"plugins" : {
|
|
||||||
"xp2p" : {
|
|
||||||
"version" : "latest",
|
|
||||||
"provider" : "wx1319af22356934bf",
|
|
||||||
"export" : "exportForXp2pPlugin.js"
|
|
||||||
},
|
|
||||||
"wmpf-voip" : {
|
|
||||||
"version" : "latest",
|
|
||||||
"provider" : "wxf830863afde621eb",
|
|
||||||
"genericsImplementation" : {
|
|
||||||
"call-page-plugin" : {
|
|
||||||
"custombox" : "pages/main/customBox"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"vueVersion" : "3"
|
"permission": {
|
||||||
|
"scope.bluetooth": {
|
||||||
|
"desc": "蓝牙将用于控制和管理您的智能门锁"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"requiredPrivateInfos": ["getLocation"],
|
||||||
|
"usingComponents": true,
|
||||||
|
"lazyCodeLoading": "requiredComponents",
|
||||||
|
"optimization": {
|
||||||
|
"subPackages": true
|
||||||
|
},
|
||||||
|
"plugins": {
|
||||||
|
"xp2p": {
|
||||||
|
"version": "latest",
|
||||||
|
"provider": "wx1319af22356934bf",
|
||||||
|
"export": "exportForXp2pPlugin.js"
|
||||||
|
},
|
||||||
|
"wmpf-voip": {
|
||||||
|
"version": "latest",
|
||||||
|
"provider": "wxf830863afde621eb",
|
||||||
|
"genericsImplementation": {
|
||||||
|
"call-page-plugin": {
|
||||||
|
"custombox": "pages/main/customBox"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"vueVersion": "3",
|
||||||
|
"app-plus": {
|
||||||
|
"distribute": {
|
||||||
|
"icons": {
|
||||||
|
"android": {
|
||||||
|
"hdpi": "unpackage/res/icons/72x72.png",
|
||||||
|
"xhdpi": "unpackage/res/icons/96x96.png",
|
||||||
|
"xxhdpi": "unpackage/res/icons/144x144.png",
|
||||||
|
"xxxhdpi": "unpackage/res/icons/192x192.png"
|
||||||
|
},
|
||||||
|
"ios": {
|
||||||
|
"appstore": "unpackage/res/icons/1024x1024.png",
|
||||||
|
"ipad": {
|
||||||
|
"app": "unpackage/res/icons/76x76.png",
|
||||||
|
"app@2x": "unpackage/res/icons/152x152.png",
|
||||||
|
"notification": "unpackage/res/icons/20x20.png",
|
||||||
|
"notification@2x": "unpackage/res/icons/40x40.png",
|
||||||
|
"proapp@2x": "unpackage/res/icons/167x167.png",
|
||||||
|
"settings": "unpackage/res/icons/29x29.png",
|
||||||
|
"settings@2x": "unpackage/res/icons/58x58.png",
|
||||||
|
"spotlight": "unpackage/res/icons/40x40.png",
|
||||||
|
"spotlight@2x": "unpackage/res/icons/80x80.png"
|
||||||
|
},
|
||||||
|
"iphone": {
|
||||||
|
"app@2x": "unpackage/res/icons/120x120.png",
|
||||||
|
"app@3x": "unpackage/res/icons/180x180.png",
|
||||||
|
"notification@2x": "unpackage/res/icons/40x40.png",
|
||||||
|
"notification@3x": "unpackage/res/icons/60x60.png",
|
||||||
|
"settings@2x": "unpackage/res/icons/58x58.png",
|
||||||
|
"settings@3x": "unpackage/res/icons/87x87.png",
|
||||||
|
"spotlight@2x": "unpackage/res/icons/80x80.png",
|
||||||
|
"spotlight@3x": "unpackage/res/icons/120x120.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"android": {
|
||||||
|
"permissions": [
|
||||||
|
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||||
|
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||||
|
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" />",
|
||||||
|
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\" />",
|
||||||
|
"<uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\" />",
|
||||||
|
"<uses-permission android:name=\"android.permission.BLUETOOTH\" />",
|
||||||
|
"<uses-permission android:name=\"android.permission.BLUETOOTH_SCAN\" />",
|
||||||
|
"<uses-permission android:name=\"android.permission.BLUETOOTH_CONNECT\" />"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"modules": {
|
||||||
|
"Bluetooth": {}
|
||||||
|
},
|
||||||
|
"splashscreen": {
|
||||||
|
"waiting": false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -116,19 +116,22 @@
|
|||||||
{
|
{
|
||||||
"path": "login",
|
"path": "login",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "登录"
|
"navigationBarTitleText": "登录",
|
||||||
|
"disableScroll": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "register",
|
"path": "register",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "注册"
|
"navigationBarTitleText": "注册",
|
||||||
|
"disableScroll": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "forgotPassword",
|
"path": "forgotPassword",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "忘记密码"
|
"navigationBarTitleText": "忘记密码",
|
||||||
|
"disableScroll": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -130,8 +130,8 @@
|
|||||||
nowTime: this.serverTimestamp,
|
nowTime: this.serverTimestamp,
|
||||||
localTime: timestamp
|
localTime: timestamp
|
||||||
})
|
})
|
||||||
|
uni.hideLoading()
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
uni.hideLoading()
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '连接失败,请靠近设备并保持设备处于唤醒状态',
|
title: '连接失败,请靠近设备并保持设备处于唤醒状态',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
|
|||||||
@ -275,7 +275,9 @@
|
|||||||
}
|
}
|
||||||
const { code, data, message } = await createKeyRequest(params)
|
const { code, data, message } = await createKeyRequest(params)
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
uni.reportEvent('create_key', {})
|
uni.reportEvent('create_key', {})
|
||||||
|
// #endif
|
||||||
this.updateKeySearch({
|
this.updateKeySearch({
|
||||||
...this.keySearch,
|
...this.keySearch,
|
||||||
pageNo: 1
|
pageNo: 1
|
||||||
|
|||||||
@ -455,7 +455,9 @@
|
|||||||
})
|
})
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
if (requestCode === 0) {
|
if (requestCode === 0) {
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
uni.reportEvent('create_password', {})
|
uni.reportEvent('create_password', {})
|
||||||
|
// #endif
|
||||||
$lock.updatePasswordSearch({
|
$lock.updatePasswordSearch({
|
||||||
...$lock.passwordSearch,
|
...$lock.passwordSearch,
|
||||||
pageNo: 1
|
pageNo: 1
|
||||||
@ -562,7 +564,10 @@
|
|||||||
}
|
}
|
||||||
const { code, data, message } = await createPsaawordRequest(params)
|
const { code, data, message } = await createPsaawordRequest(params)
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
uni.reportEvent('create_password', {})
|
uni.reportEvent('create_password', {})
|
||||||
|
// #endif
|
||||||
|
|
||||||
$lock.updatePasswordSearch({
|
$lock.updatePasswordSearch({
|
||||||
...$lock.passwordSearch,
|
...$lock.passwordSearch,
|
||||||
pageNo: 1
|
pageNo: 1
|
||||||
@ -638,23 +643,23 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.text {
|
.text {
|
||||||
|
padding: 0 32rpx;
|
||||||
margin-top: 40rpx;
|
margin-top: 40rpx;
|
||||||
margin-bottom: 50rpx;
|
margin-bottom: 50rpx;
|
||||||
color: #262626;
|
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
padding: 0 32rpx;
|
color: #262626;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button {
|
.button {
|
||||||
border-radius: 64rpx;
|
|
||||||
width: 686rpx;
|
width: 686rpx;
|
||||||
margin-left: 32rpx;
|
|
||||||
height: 100rpx;
|
height: 100rpx;
|
||||||
line-height: 100rpx;
|
margin-left: 32rpx;
|
||||||
text-align: center;
|
|
||||||
background-color: #63b8af;
|
|
||||||
color: #fff;
|
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
line-height: 100rpx;
|
||||||
|
color: #fff;
|
||||||
|
text-align: center;
|
||||||
|
background-color: #63b8af;
|
||||||
|
border-radius: 64rpx;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -129,10 +129,12 @@
|
|||||||
$bluetooth.closeBluetoothConnection()
|
$bluetooth.closeBluetoothConnection()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
uni.reportEvent('open_door', {
|
uni.reportEvent('open_door', {
|
||||||
result: code,
|
result: code,
|
||||||
duration: new Date().getTime() - timestamp
|
duration: new Date().getTime() - timestamp
|
||||||
})
|
})
|
||||||
|
// #endif
|
||||||
|
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|||||||
@ -363,15 +363,19 @@
|
|||||||
onlineToken: onlineToken.value
|
onlineToken: onlineToken.value
|
||||||
})
|
})
|
||||||
if (type === 'open') {
|
if (type === 'open') {
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
uni.reportEvent('open_door', {
|
uni.reportEvent('open_door', {
|
||||||
result: code,
|
result: code,
|
||||||
duration: new Date().getTime() - timestamp
|
duration: new Date().getTime() - timestamp
|
||||||
})
|
})
|
||||||
|
// #endif
|
||||||
} else if (type === 'close') {
|
} else if (type === 'close') {
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
uni.reportEvent('close_door', {
|
uni.reportEvent('close_door', {
|
||||||
result: code,
|
result: code,
|
||||||
duration: new Date().getTime() - timestamp
|
duration: new Date().getTime() - timestamp
|
||||||
})
|
})
|
||||||
|
// #endif
|
||||||
}
|
}
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
$bluetooth
|
$bluetooth
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
></image>
|
></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="view-line"></view>
|
<view class="view-line"></view>
|
||||||
|
<!-- #ifdef MP-WEIXIN -->
|
||||||
<label for="contact">
|
<label for="contact">
|
||||||
<view class="view-button">
|
<view class="view-button">
|
||||||
<view>客服</view>
|
<view>客服</view>
|
||||||
@ -21,6 +22,19 @@
|
|||||||
></image>
|
></image>
|
||||||
</view>
|
</view>
|
||||||
</label>
|
</label>
|
||||||
|
<!-- #endif -->
|
||||||
|
<!-- #ifdef APP-PLUS -->
|
||||||
|
<view @click="toContact">
|
||||||
|
<view class="view-button">
|
||||||
|
<view>客服</view>
|
||||||
|
<image
|
||||||
|
class="icon-arrow"
|
||||||
|
src="https://oss-lock.xhjcn.ltd/mp/icon_arrow.png"
|
||||||
|
mode="aspectFill"
|
||||||
|
></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- #endif -->
|
||||||
<view class="view-line"></view>
|
<view class="view-line"></view>
|
||||||
<view class="view-button" @click="toWebview()">
|
<view class="view-button" @click="toWebview()">
|
||||||
<view>公司介绍</view>
|
<view>公司介绍</view>
|
||||||
@ -56,9 +70,14 @@
|
|||||||
>切换环境</view
|
>切换环境</view
|
||||||
>
|
>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- #ifdef MP-WEIXIN -->
|
||||||
<label for="changePhone">
|
<label for="changePhone">
|
||||||
<view class="switch-account">切换账号</view>
|
<view class="switch-account">切换账号</view>
|
||||||
</label>
|
</label>
|
||||||
|
<!-- #endif -->
|
||||||
|
<!-- #ifdef APP-PLUS -->
|
||||||
|
<view class="switch-account !bg-red-500" @click="logout">退出</view>
|
||||||
|
<!-- #endif -->
|
||||||
</view>
|
</view>
|
||||||
<view v-else>
|
<view v-else>
|
||||||
<view class="tips">因智能门锁与账号绑定,登录为手机号登录</view>
|
<view class="tips">因智能门锁与账号绑定,登录为手机号登录</view>
|
||||||
@ -68,9 +87,13 @@
|
|||||||
<view class="env" v-if="env">
|
<view class="env" v-if="env">
|
||||||
<view class="env-text">{{ env.name }} {{ env.version }}+{{ env.buildNumber }}</view>
|
<view class="env-text">{{ env.name }} {{ env.version }}+{{ env.buildNumber }}</view>
|
||||||
<view>{{ env.baseUrl.split('/').slice(0, 3).join('/') }}</view>
|
<view>{{ env.baseUrl.split('/').slice(0, 3).join('/') }}</view>
|
||||||
<view v-if="envVersion !== 'release' && env" class="env-button" @click="show = true"
|
<view
|
||||||
>切换环境</view
|
v-if="(envVersion !== 'release' || nodeEnv === 'development') && env"
|
||||||
|
class="env-button"
|
||||||
|
@click="show = true"
|
||||||
>
|
>
|
||||||
|
切换环境
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -105,10 +128,11 @@
|
|||||||
import { useBasicStore } from '@/stores/basic'
|
import { useBasicStore } from '@/stores/basic'
|
||||||
import { useUserStore } from '@/stores/user'
|
import { useUserStore } from '@/stores/user'
|
||||||
import { useLockStore } from '@/stores/lock'
|
import { useLockStore } from '@/stores/lock'
|
||||||
import { phoneLoginRequest } from '@/api/user'
|
import { phoneLoginRequest, logoutRequest } from '@/api/user'
|
||||||
import env from '@/config/env'
|
import env from '@/config/env'
|
||||||
import { setStorage, getStorage, removeStorage } from '@/utils/storage'
|
import { setStorage, getStorage, removeStorage } from '@/utils/storage'
|
||||||
import { useNotificationStore } from '@/stores/notification'
|
import { useNotificationStore } from '@/stores/notification'
|
||||||
|
import { getAppInfoRequest } from '@/api/system'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@ -117,7 +141,8 @@
|
|||||||
env: null,
|
env: null,
|
||||||
envVersion: '',
|
envVersion: '',
|
||||||
envList: [],
|
envList: [],
|
||||||
show: false
|
show: false,
|
||||||
|
nodeEnv: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -129,6 +154,8 @@
|
|||||||
this.buttonInfo = await this.getButtonInfo()
|
this.buttonInfo = await this.getButtonInfo()
|
||||||
this.env = await env[await getApp().globalData.getEnvConfig()]
|
this.env = await env[await getApp().globalData.getEnvConfig()]
|
||||||
this.envVersion = getApp().globalData.envVersion
|
this.envVersion = getApp().globalData.envVersion
|
||||||
|
this.nodeEnv = process.env.NODE_ENV
|
||||||
|
|
||||||
// eslint-disable-next-line guard-for-in,no-restricted-syntax
|
// eslint-disable-next-line guard-for-in,no-restricted-syntax
|
||||||
for (let key in env) {
|
for (let key in env) {
|
||||||
this.envList.push({
|
this.envList.push({
|
||||||
@ -136,7 +163,6 @@
|
|||||||
key
|
key
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
console.log(this.envList)
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(useBasicStore, ['getButtonInfo', 'routeJump']),
|
...mapActions(useBasicStore, ['getButtonInfo', 'routeJump']),
|
||||||
@ -159,6 +185,13 @@
|
|||||||
url: '/pages/main/home'
|
url: '/pages/main/home'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
toContact() {
|
||||||
|
getAppInfoRequest().then(res => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
plus.runtime.openURL(res.data.wechat_service_url)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
async changePhone(res) {
|
async changePhone(res) {
|
||||||
if (res.detail.errMsg === 'getPhoneNumber:fail user deny') {
|
if (res.detail.errMsg === 'getPhoneNumber:fail user deny') {
|
||||||
return
|
return
|
||||||
@ -260,6 +293,25 @@
|
|||||||
type
|
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'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -322,18 +322,18 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.u-swipe-action {
|
.u-swipe-action {
|
||||||
overflow: inherit !important;
|
|
||||||
width: 700rpx;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
width: 700rpx;
|
||||||
padding-bottom: 140rpx !important;
|
padding-bottom: 140rpx !important;
|
||||||
|
overflow: inherit !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.u-swipe-action-item {
|
.u-swipe-action-item {
|
||||||
overflow: inherit !important;
|
overflow: inherit !important;
|
||||||
border-radius: 32rpx !important;
|
|
||||||
background: transparent !important;
|
background: transparent !important;
|
||||||
|
border-radius: 32rpx !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.u-swipe-action-item__right {
|
.u-swipe-action-item__right {
|
||||||
@ -342,8 +342,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.u-swipe-action-item__content {
|
.u-swipe-action-item__content {
|
||||||
border-radius: 32rpx !important;
|
|
||||||
margin-left: 25rpx;
|
margin-left: 25rpx;
|
||||||
|
border-radius: 32rpx !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.u-swipe-action-item__right__button {
|
.u-swipe-action-item__right__button {
|
||||||
@ -357,14 +357,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.notification {
|
.notification {
|
||||||
border-radius: 32rpx;
|
position: relative;
|
||||||
margin-top: 32rpx;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
width: 636rpx;
|
width: 636rpx;
|
||||||
padding: 32rpx;
|
padding: 32rpx;
|
||||||
justify-content: space-between;
|
margin-top: 32rpx;
|
||||||
align-items: center;
|
border-radius: 32rpx;
|
||||||
position: relative;
|
|
||||||
box-shadow: 2rpx 2rpx 10rpx rgba(0, 0, 0, 0.3);
|
box-shadow: 2rpx 2rpx 10rpx rgba(0, 0, 0, 0.3);
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
@ -373,44 +373,44 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.point {
|
.point {
|
||||||
|
position: absolute;
|
||||||
|
top: 41rpx;
|
||||||
|
left: 72rpx;
|
||||||
width: 16rpx;
|
width: 16rpx;
|
||||||
height: 16rpx;
|
height: 16rpx;
|
||||||
background-color: #ff0000;
|
background-color: #ff0000;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
position: absolute;
|
|
||||||
top: 41rpx;
|
|
||||||
left: 72rpx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
width: 550rpx;
|
width: 550rpx;
|
||||||
font-size: 28rpx;
|
|
||||||
color: #6c6c6c;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
font-size: 28rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
color: #6c6c6c;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.time {
|
.time {
|
||||||
font-size: 24rpx;
|
|
||||||
color: #6c6c6c;
|
|
||||||
margin-top: 5rpx;
|
margin-top: 5rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
color: #6c6c6c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.delete {
|
.delete {
|
||||||
|
position: fixed;
|
||||||
|
right: 30rpx;
|
||||||
|
bottom: 80rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
width: 100rpx;
|
width: 100rpx;
|
||||||
height: 100rpx;
|
height: 100rpx;
|
||||||
border-radius: 50%;
|
|
||||||
background-color: #5db5aa;
|
background-color: #5db5aa;
|
||||||
position: fixed;
|
border-radius: 50%;
|
||||||
bottom: 80rpx;
|
|
||||||
right: 30rpx;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
.delete-image {
|
.delete-image {
|
||||||
width: 45rpx;
|
width: 45rpx;
|
||||||
@ -426,29 +426,29 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.empty-list-text {
|
.empty-list-text {
|
||||||
text-align: center;
|
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
color: #999999;
|
color: #999999;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tips {
|
.tips {
|
||||||
margin-top: 40vh;
|
|
||||||
padding: 32rpx 0;
|
padding: 32rpx 0;
|
||||||
text-align: center;
|
margin-top: 40vh;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #999999;
|
color: #999999;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-login {
|
.button-login {
|
||||||
border-radius: 46rpx;
|
|
||||||
width: 650rpx;
|
width: 650rpx;
|
||||||
height: 120rpx;
|
height: 120rpx;
|
||||||
line-height: 120rpx;
|
|
||||||
text-align: center;
|
|
||||||
margin-left: 50rpx;
|
margin-left: 50rpx;
|
||||||
background: #63b8af;
|
|
||||||
color: #ffffff;
|
|
||||||
font-size: 48rpx;
|
font-size: 48rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
line-height: 120rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
text-align: center;
|
||||||
|
background: #63b8af;
|
||||||
|
border-radius: 46rpx;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -78,15 +78,20 @@
|
|||||||
|
|
||||||
const data = list.value.find(item => item.sn === authResult.data.wxDeviceSn)
|
const data = list.value.find(item => item.sn === authResult.data.wxDeviceSn)
|
||||||
|
|
||||||
if (authResult?.code === 0 && authResult?.data?.wxOpenid === getStorage('openid') && data) {
|
if (authResult?.code === 0 && data) {
|
||||||
isAuthorized.value = true
|
if (authResult?.data?.wxOpenid === getStorage('openid')) {
|
||||||
requestFinish.value = true
|
if (data.status === 1) {
|
||||||
if (data.status === 1) {
|
reject.value = false
|
||||||
reject.value = false
|
} else if (data.status === 0) {
|
||||||
} else if (data.status === 0) {
|
reject.value = false
|
||||||
|
weChatTicketsFlag.value = false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
reject.value = true
|
reject.value = true
|
||||||
weChatTicketsFlag.value = true
|
weChatTicketsFlag.value = true
|
||||||
}
|
}
|
||||||
|
isAuthorized.value = true
|
||||||
|
requestFinish.value = true
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
} else {
|
} else {
|
||||||
requestFinish.value = true
|
requestFinish.value = true
|
||||||
@ -125,6 +130,8 @@
|
|||||||
})
|
})
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
isAuthorized.value = true
|
isAuthorized.value = true
|
||||||
|
reject.value = false
|
||||||
|
weChatTicketsFlag.value = false
|
||||||
} else {
|
} else {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@ -165,10 +172,10 @@
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
const weChatTickets = async (snTicket, sn) => {
|
const weChatTickets = async () => {
|
||||||
let ticket = snTicket
|
let ticket = null
|
||||||
let snResult = sn
|
let snResult = null
|
||||||
if (!snTicket) {
|
if (!ticket) {
|
||||||
const result = await getInfo()
|
const result = await getInfo()
|
||||||
ticket = result.data.WXIoTDeviceInfo.SNTicket
|
ticket = result.data.WXIoTDeviceInfo.SNTicket
|
||||||
snResult = result.data.WXIoTDeviceInfo.SN
|
snResult = result.data.WXIoTDeviceInfo.SN
|
||||||
@ -220,6 +227,8 @@
|
|||||||
wxDeviceSn: result.data.WXIoTDeviceInfo.SN
|
wxDeviceSn: result.data.WXIoTDeviceInfo.SN
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
reject.value = false
|
||||||
|
weChatTicketsFlag.value = false
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '授权成功',
|
title: '授权成功',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
|
|||||||
@ -286,10 +286,12 @@
|
|||||||
$bluetooth.closeBluetoothConnection()
|
$bluetooth.closeBluetoothConnection()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
uni.reportEvent('open_door', {
|
uni.reportEvent('open_door', {
|
||||||
result: code,
|
result: code,
|
||||||
duration: new Date().getTime() - timestamp
|
duration: new Date().getTime() - timestamp
|
||||||
})
|
})
|
||||||
|
// #endif
|
||||||
|
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|||||||
@ -131,6 +131,8 @@
|
|||||||
const seconds = ref(120)
|
const seconds = ref(120)
|
||||||
const uCodeRef = ref(null)
|
const uCodeRef = ref(null)
|
||||||
|
|
||||||
|
const pending = ref(false)
|
||||||
|
|
||||||
const codeChange = text => {
|
const codeChange = text => {
|
||||||
tips.value = text
|
tips.value = text
|
||||||
}
|
}
|
||||||
@ -142,7 +144,8 @@
|
|||||||
const params = {
|
const params = {
|
||||||
account: username.value,
|
account: username.value,
|
||||||
codeType: 2,
|
codeType: 2,
|
||||||
countryCode: country.value.code
|
countryCode: country.value.code,
|
||||||
|
channel: EMAIL_REG.test(username.value) ? 2 : 1
|
||||||
}
|
}
|
||||||
$basic.routeJump({
|
$basic.routeJump({
|
||||||
name: 'safeVerify',
|
name: 'safeVerify',
|
||||||
@ -202,14 +205,28 @@
|
|||||||
if (!canResetPassword.value) {
|
if (!canResetPassword.value) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (pending.value) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
pending.value = true
|
||||||
|
uni.showLoading({
|
||||||
|
title: '重置中'
|
||||||
|
})
|
||||||
const res = await resetPasswordRequest({
|
const res = await resetPasswordRequest({
|
||||||
account: username.value,
|
account: username.value,
|
||||||
newPassword: password.value,
|
newPassword: password.value,
|
||||||
countryCode: country.value.code,
|
countryCode: country.value.code,
|
||||||
verificationCode: code.value
|
verificationCode: code.value
|
||||||
})
|
})
|
||||||
if (res) {
|
pending.value = false
|
||||||
|
uni.hideLoading()
|
||||||
|
if (res.code === 0) {
|
||||||
$basic.backAndToast('密码重置成功')
|
$basic.backAndToast('密码重置成功')
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -99,6 +99,8 @@
|
|||||||
|
|
||||||
const select = ref(false)
|
const select = ref(false)
|
||||||
|
|
||||||
|
const pending = ref(false)
|
||||||
|
|
||||||
const isValidUsername = computed(() => {
|
const isValidUsername = computed(() => {
|
||||||
if (!username.value) return false
|
if (!username.value) return false
|
||||||
return PHONE_REG.test(username.value) || EMAIL_REG.test(username.value)
|
return PHONE_REG.test(username.value) || EMAIL_REG.test(username.value)
|
||||||
@ -155,11 +157,16 @@
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (pending.value) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
pending.value = true
|
||||||
const res = await $user.passwordLogin({
|
const res = await $user.passwordLogin({
|
||||||
username: username.value,
|
username: username.value,
|
||||||
password: password.value,
|
password: password.value,
|
||||||
countryCode: country.value.code
|
countryCode: country.value.code
|
||||||
})
|
})
|
||||||
|
pending.value = false
|
||||||
if (res) {
|
if (res) {
|
||||||
$basic.routeJump({
|
$basic.routeJump({
|
||||||
name: 'home',
|
name: 'home',
|
||||||
|
|||||||
@ -170,6 +170,8 @@
|
|||||||
const uCodeRef = ref(null)
|
const uCodeRef = ref(null)
|
||||||
const select = ref(false)
|
const select = ref(false)
|
||||||
|
|
||||||
|
const pending = ref(false)
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
const res = await $basic.getDeviceInfo()
|
const res = await $basic.getDeviceInfo()
|
||||||
if (res.language !== 'zh-CN') {
|
if (res.language !== 'zh-CN') {
|
||||||
@ -263,6 +265,11 @@
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (pending.value) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
pending.value = true
|
||||||
const res = await $user.register({
|
const res = await $user.register({
|
||||||
account: username.value,
|
account: username.value,
|
||||||
password: password.value,
|
password: password.value,
|
||||||
@ -270,6 +277,7 @@
|
|||||||
countryCode: country.value.code,
|
countryCode: country.value.code,
|
||||||
verificationCode: code.value
|
verificationCode: code.value
|
||||||
})
|
})
|
||||||
|
pending.value = false
|
||||||
if (res) {
|
if (res) {
|
||||||
$basic.routeJump({
|
$basic.routeJump({
|
||||||
name: 'home',
|
name: 'home',
|
||||||
|
|||||||
@ -168,28 +168,27 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.input-email {
|
.input-email {
|
||||||
border-radius: 16rpx;
|
|
||||||
background: #ffffff;
|
|
||||||
margin-left: 35rpx;
|
|
||||||
margin-top: 48rpx;
|
|
||||||
height: 108rpx;
|
|
||||||
width: 616rpx;
|
width: 616rpx;
|
||||||
padding-left: 32rpx;
|
height: 108rpx;
|
||||||
padding-right: 32rpx;
|
padding-right: 32rpx;
|
||||||
|
padding-left: 32rpx;
|
||||||
|
margin-top: 48rpx;
|
||||||
|
margin-left: 35rpx;
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-verify {
|
.button-verify {
|
||||||
margin-top: 48rpx;
|
|
||||||
height: 108rpx;
|
|
||||||
width: 265rpx;
|
width: 265rpx;
|
||||||
line-height: 108rpx;
|
height: 108rpx;
|
||||||
border-radius: 16rpx;
|
margin-top: 48rpx;
|
||||||
text-align: center;
|
|
||||||
font-size: 32rpx;
|
|
||||||
margin-left: 35rpx;
|
margin-left: 35rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
background: #63b8af;
|
line-height: 108rpx;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
|
text-align: center;
|
||||||
|
background: #63b8af;
|
||||||
|
border-radius: 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.view-top {
|
.view-top {
|
||||||
@ -198,14 +197,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.input-verify {
|
.input-verify {
|
||||||
border-radius: 16rpx;
|
|
||||||
background: #ffffff;
|
|
||||||
margin-left: 35rpx;
|
|
||||||
margin-top: 48rpx;
|
|
||||||
height: 108rpx;
|
|
||||||
width: 316rpx;
|
width: 316rpx;
|
||||||
padding-left: 32rpx;
|
height: 108rpx;
|
||||||
padding-right: 32rpx;
|
padding-right: 32rpx;
|
||||||
|
padding-left: 32rpx;
|
||||||
|
margin-top: 48rpx;
|
||||||
|
margin-left: 35rpx;
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-placeholder {
|
.input-placeholder {
|
||||||
@ -216,15 +215,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.button {
|
.button {
|
||||||
margin-top: 32rpx;
|
|
||||||
margin-left: 35rpx;
|
|
||||||
width: 680rpx;
|
width: 680rpx;
|
||||||
height: 96rpx;
|
height: 96rpx;
|
||||||
|
margin-top: 32rpx;
|
||||||
|
margin-left: 35rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
line-height: 96rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
text-align: center;
|
||||||
background: #63b8af;
|
background: #63b8af;
|
||||||
border-radius: 16rpx;
|
border-radius: 16rpx;
|
||||||
line-height: 96rpx;
|
|
||||||
text-align: center;
|
|
||||||
font-size: 32rpx;
|
|
||||||
color: #ffffff;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -84,14 +84,14 @@
|
|||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.input {
|
.input {
|
||||||
border-radius: 16rpx;
|
|
||||||
background: #ffffff;
|
|
||||||
margin-left: 35rpx;
|
|
||||||
margin-top: 48rpx;
|
|
||||||
height: 108rpx;
|
|
||||||
width: 616rpx;
|
width: 616rpx;
|
||||||
padding-left: 32rpx;
|
height: 108rpx;
|
||||||
padding-right: 32rpx;
|
padding-right: 32rpx;
|
||||||
|
padding-left: 32rpx;
|
||||||
|
margin-top: 48rpx;
|
||||||
|
margin-left: 35rpx;
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-placeholder {
|
.input-placeholder {
|
||||||
@ -102,15 +102,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.button {
|
.button {
|
||||||
margin-top: 32rpx;
|
|
||||||
margin-left: 35rpx;
|
|
||||||
width: 680rpx;
|
width: 680rpx;
|
||||||
height: 96rpx;
|
height: 96rpx;
|
||||||
|
margin-top: 32rpx;
|
||||||
|
margin-left: 35rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
line-height: 96rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
text-align: center;
|
||||||
background: #63b8af;
|
background: #63b8af;
|
||||||
border-radius: 16rpx;
|
border-radius: 16rpx;
|
||||||
line-height: 96rpx;
|
|
||||||
text-align: center;
|
|
||||||
font-size: 32rpx;
|
|
||||||
color: #ffffff;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -145,14 +145,14 @@
|
|||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.input {
|
.input {
|
||||||
border-radius: 16rpx;
|
|
||||||
background: #ffffff;
|
|
||||||
margin-left: 35rpx;
|
|
||||||
margin-top: 48rpx;
|
|
||||||
height: 108rpx;
|
|
||||||
width: 616rpx;
|
width: 616rpx;
|
||||||
padding-left: 32rpx;
|
height: 108rpx;
|
||||||
padding-right: 32rpx;
|
padding-right: 32rpx;
|
||||||
|
padding-left: 32rpx;
|
||||||
|
margin-top: 48rpx;
|
||||||
|
margin-left: 35rpx;
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-placeholder {
|
.input-placeholder {
|
||||||
@ -163,23 +163,23 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.button {
|
.button {
|
||||||
margin-top: 32rpx;
|
|
||||||
margin-left: 35rpx;
|
|
||||||
width: 680rpx;
|
width: 680rpx;
|
||||||
height: 96rpx;
|
height: 96rpx;
|
||||||
|
margin-top: 32rpx;
|
||||||
|
margin-left: 35rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
line-height: 96rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
text-align: center;
|
||||||
background: #63b8af;
|
background: #63b8af;
|
||||||
border-radius: 16rpx;
|
border-radius: 16rpx;
|
||||||
line-height: 96rpx;
|
|
||||||
text-align: center;
|
|
||||||
font-size: 32rpx;
|
|
||||||
color: #ffffff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.text-tips {
|
.text-tips {
|
||||||
text-align: center;
|
|
||||||
margin-top: 32rpx;
|
margin-top: 32rpx;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #9b9b9b;
|
color: #9b9b9b;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.view-top {
|
.view-top {
|
||||||
@ -188,27 +188,26 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.input-verify {
|
.input-verify {
|
||||||
border-radius: 16rpx;
|
|
||||||
background: #ffffff;
|
|
||||||
margin-left: 35rpx;
|
|
||||||
margin-top: 48rpx;
|
|
||||||
height: 108rpx;
|
|
||||||
width: 316rpx;
|
width: 316rpx;
|
||||||
padding-left: 32rpx;
|
height: 108rpx;
|
||||||
padding-right: 32rpx;
|
padding-right: 32rpx;
|
||||||
|
padding-left: 32rpx;
|
||||||
|
margin-top: 48rpx;
|
||||||
|
margin-left: 35rpx;
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-verify {
|
.button-verify {
|
||||||
margin-top: 48rpx;
|
|
||||||
height: 108rpx;
|
|
||||||
width: 265rpx;
|
width: 265rpx;
|
||||||
line-height: 108rpx;
|
height: 108rpx;
|
||||||
border-radius: 16rpx;
|
margin-top: 48rpx;
|
||||||
text-align: center;
|
|
||||||
font-size: 32rpx;
|
|
||||||
margin-left: 35rpx;
|
margin-left: 35rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
background: #63b8af;
|
line-height: 108rpx;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
|
text-align: center;
|
||||||
|
background: #63b8af;
|
||||||
|
border-radius: 16rpx;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<view class="view">
|
<view class="view">
|
||||||
|
<!-- #ifdef MP-WEIXIN -->
|
||||||
<label for="avatar">
|
<label for="avatar">
|
||||||
<view class="view-button">
|
<view class="view-button">
|
||||||
<view>头像</view>
|
<view>头像</view>
|
||||||
@ -14,6 +15,22 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</label>
|
</label>
|
||||||
|
<!-- #endif -->
|
||||||
|
<!-- #ifdef APP-PLUS -->
|
||||||
|
<view @click="chooseImage">
|
||||||
|
<view class="view-button">
|
||||||
|
<view>头像</view>
|
||||||
|
<view class="view-button" style="padding: 0">
|
||||||
|
<image class="avatar" :src="userInfo.headUrl" mode="aspectFill"></image>
|
||||||
|
<image
|
||||||
|
class="icon-arrow"
|
||||||
|
src="https://oss-lock.xhjcn.ltd/mp/icon_arrow.png"
|
||||||
|
mode="aspectFill"
|
||||||
|
></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- #endif -->
|
||||||
<view class="view-line"></view>
|
<view class="view-line"></view>
|
||||||
<view class="view-button" @click="toUpdateName">
|
<view class="view-button" @click="toUpdateName">
|
||||||
<view>昵称</view>
|
<view>昵称</view>
|
||||||
@ -146,13 +163,33 @@
|
|||||||
}
|
}
|
||||||
this.pending = false
|
this.pending = false
|
||||||
},
|
},
|
||||||
|
chooseImage() {
|
||||||
|
const that = this
|
||||||
|
uni.chooseImage({
|
||||||
|
count: 1,
|
||||||
|
sourceType: ['camera', 'album'],
|
||||||
|
crop: {
|
||||||
|
quality: 60,
|
||||||
|
width: 108,
|
||||||
|
height: 108
|
||||||
|
},
|
||||||
|
success: res => {
|
||||||
|
const data = res.tempFiles[0]
|
||||||
|
const list = data.path.split('/')
|
||||||
|
const filename = list[list.length - 1]
|
||||||
|
that.uploadRequest({
|
||||||
|
...data,
|
||||||
|
filename
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
chooseAvatar(e) {
|
chooseAvatar(e) {
|
||||||
const that = this
|
const that = this
|
||||||
if (that.pending) {
|
if (that.pending) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
that.pending = true
|
that.pending = true
|
||||||
|
|
||||||
const path = e.detail.avatarUrl
|
const path = e.detail.avatarUrl
|
||||||
const list = path.split('/')
|
const list = path.split('/')
|
||||||
const filename = list[list.length - 1]
|
const filename = list[list.length - 1]
|
||||||
@ -160,58 +197,65 @@
|
|||||||
filePath: path,
|
filePath: path,
|
||||||
async success(res) {
|
async success(res) {
|
||||||
const size = res.size
|
const size = res.size
|
||||||
const { code, data } = await getUploadParamsRequest({
|
that.uploadRequest({
|
||||||
size,
|
size,
|
||||||
module: 'avatar',
|
filename,
|
||||||
userId: that.userInfo.userId,
|
path
|
||||||
filename
|
|
||||||
})
|
})
|
||||||
if (code === 0) {
|
}
|
||||||
uni.uploadFile({
|
})
|
||||||
url: data.uploadUrl,
|
},
|
||||||
filePath: path,
|
async uploadRequest(params) {
|
||||||
name: 'file',
|
const that = this
|
||||||
formData: data.formData,
|
const { code, data } = await getUploadParamsRequest({
|
||||||
async success() {
|
size: params.size,
|
||||||
const { code: updateCode } = await updateUserInfoRequest({
|
module: 'avatar',
|
||||||
headUrl: data.fileUrl
|
userId: that.userInfo.userId,
|
||||||
})
|
filename: params.filename
|
||||||
if (updateCode === 0) {
|
})
|
||||||
that.updateUserInfo({
|
if (code === 0) {
|
||||||
...that.userInfo,
|
uni.uploadFile({
|
||||||
headUrl: data.fileUrl
|
url: data.uploadUrl,
|
||||||
})
|
filePath: params.path,
|
||||||
uni.showToast({
|
name: 'file',
|
||||||
title: '头像更新成功',
|
formData: data.formData,
|
||||||
icon: 'none'
|
async success() {
|
||||||
})
|
const { code: updateCode } = await updateUserInfoRequest({
|
||||||
} else {
|
headUrl: data.fileUrl
|
||||||
uni.showToast({
|
|
||||||
title: '头像更新失败',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
that.pending = false
|
|
||||||
},
|
|
||||||
fail(res) {
|
|
||||||
console.log('上传失败', res)
|
|
||||||
console.log(data.uploadUrl, path, data.formData)
|
|
||||||
uni.showToast({
|
|
||||||
title: '头像更新失败',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
that.pending = false
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
} else {
|
if (updateCode === 0) {
|
||||||
|
that.updateUserInfo({
|
||||||
|
...that.userInfo,
|
||||||
|
headUrl: data.fileUrl
|
||||||
|
})
|
||||||
|
uni.showToast({
|
||||||
|
title: '头像更新成功',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '头像更新失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
that.pending = false
|
||||||
|
},
|
||||||
|
fail(res) {
|
||||||
|
console.log('上传失败', res)
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '头像更新失败',
|
title: '头像更新失败',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
that.pending = false
|
that.pending = false
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
})
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '头像更新失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
that.pending = false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
toUpdateName() {
|
toUpdateName() {
|
||||||
this.routeJump({
|
this.routeJump({
|
||||||
|
|||||||
@ -122,17 +122,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.button-verify {
|
.button-verify {
|
||||||
margin-top: 48rpx;
|
|
||||||
height: 108rpx;
|
|
||||||
width: 265rpx;
|
width: 265rpx;
|
||||||
line-height: 108rpx;
|
height: 108rpx;
|
||||||
border-radius: 16rpx;
|
margin-top: 48rpx;
|
||||||
text-align: center;
|
|
||||||
font-size: 32rpx;
|
|
||||||
margin-left: 35rpx;
|
margin-left: 35rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
background: #63b8af;
|
line-height: 108rpx;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
|
text-align: center;
|
||||||
|
background: #63b8af;
|
||||||
|
border-radius: 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.view-top {
|
.view-top {
|
||||||
@ -141,14 +140,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.input {
|
.input {
|
||||||
border-radius: 16rpx;
|
|
||||||
background: #ffffff;
|
|
||||||
margin-left: 35rpx;
|
|
||||||
margin-top: 48rpx;
|
|
||||||
height: 108rpx;
|
|
||||||
width: 316rpx;
|
width: 316rpx;
|
||||||
padding-left: 32rpx;
|
height: 108rpx;
|
||||||
padding-right: 32rpx;
|
padding-right: 32rpx;
|
||||||
|
padding-left: 32rpx;
|
||||||
|
margin-top: 48rpx;
|
||||||
|
margin-left: 35rpx;
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-placeholder {
|
.input-placeholder {
|
||||||
@ -159,15 +158,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.button {
|
.button {
|
||||||
margin-top: 32rpx;
|
|
||||||
margin-left: 35rpx;
|
|
||||||
width: 680rpx;
|
width: 680rpx;
|
||||||
height: 96rpx;
|
height: 96rpx;
|
||||||
|
margin-top: 32rpx;
|
||||||
|
margin-left: 35rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
line-height: 96rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
text-align: center;
|
||||||
background: #63b8af;
|
background: #63b8af;
|
||||||
border-radius: 16rpx;
|
border-radius: 16rpx;
|
||||||
line-height: 96rpx;
|
|
||||||
text-align: center;
|
|
||||||
font-size: 32rpx;
|
|
||||||
color: #ffffff;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -440,7 +440,7 @@ export const useBasicStore = defineStore('basic', {
|
|||||||
// 设备信息
|
// 设备信息
|
||||||
deviceInfo: null,
|
deviceInfo: null,
|
||||||
// 胶囊按钮的位置信息
|
// 胶囊按钮的位置信息
|
||||||
buttonInfo: null,
|
buttonInfo: {},
|
||||||
// 分享配置
|
// 分享配置
|
||||||
shareConfig: {}
|
shareConfig: {}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -190,7 +190,9 @@ export const useBluetoothStore = defineStore('ble', {
|
|||||||
},
|
},
|
||||||
// 关闭全部蓝牙监听并关闭蓝牙模拟
|
// 关闭全部蓝牙监听并关闭蓝牙模拟
|
||||||
closeAllBluetooth() {
|
closeAllBluetooth() {
|
||||||
|
// #ifdef MP
|
||||||
uni.offBluetoothAdapterStateChange()
|
uni.offBluetoothAdapterStateChange()
|
||||||
|
// #endif
|
||||||
uni.closeBluetoothAdapter({
|
uni.closeBluetoothAdapter({
|
||||||
success(res) {
|
success(res) {
|
||||||
console.log('关闭蓝牙模块', res)
|
console.log('关闭蓝牙模块', res)
|
||||||
@ -858,7 +860,7 @@ export const useBluetoothStore = defineStore('ble', {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log('设备列表', that.deviceList)
|
// console.log('设备列表', that.deviceList)
|
||||||
},
|
},
|
||||||
async fail(res) {
|
async fail(res) {
|
||||||
console.log('获取设备列表失败', res)
|
console.log('获取设备列表失败', res)
|
||||||
@ -943,6 +945,9 @@ export const useBluetoothStore = defineStore('ble', {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
// #endif
|
// #endif
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
resolve(true)
|
||||||
|
// #endif
|
||||||
resolve(false)
|
resolve(false)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -962,63 +967,74 @@ export const useBluetoothStore = defineStore('ble', {
|
|||||||
success(res) {
|
success(res) {
|
||||||
console.log('连接成功', res)
|
console.log('连接成功', res)
|
||||||
// 获取设备服务
|
// 获取设备服务
|
||||||
uni.getBLEDeviceServices({
|
const executeBluetoothOperation = () => {
|
||||||
deviceId: that.currentLockInfo.deviceId,
|
uni.getBLEDeviceServices({
|
||||||
success(res) {
|
deviceId: that.currentLockInfo.deviceId,
|
||||||
let serviceId
|
success(res) {
|
||||||
for (let i = 0; i < res.services.length; i++) {
|
let serviceId
|
||||||
if (res.services[i].uuid.indexOf('FFF0') !== -1) {
|
for (let i = 0; i < res.services.length; i++) {
|
||||||
serviceId = res.services[i].uuid
|
if (res.services[i].uuid.indexOf('FFF0') !== -1) {
|
||||||
}
|
serviceId = res.services[i].uuid
|
||||||
}
|
|
||||||
// 获取设备对应服务的特征值
|
|
||||||
uni.getBLEDeviceCharacteristics({
|
|
||||||
deviceId: that.currentLockInfo.deviceId,
|
|
||||||
serviceId,
|
|
||||||
success(res) {
|
|
||||||
let notifyCharacteristicId
|
|
||||||
let writeCharacteristicId
|
|
||||||
for (let i = 0; i < res.characteristics.length; i++) {
|
|
||||||
const characteristic = res.characteristics[i]
|
|
||||||
if (characteristic.properties.notify) {
|
|
||||||
notifyCharacteristicId = characteristic.uuid
|
|
||||||
}
|
|
||||||
if (characteristic.properties.write) {
|
|
||||||
writeCharacteristicId = characteristic.uuid
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
that.updateCurrentLockInfo({
|
}
|
||||||
...that.currentLockInfo,
|
|
||||||
serviceId,
|
// 获取设备对应服务的特征值
|
||||||
notifyCharacteristicId,
|
uni.getBLEDeviceCharacteristics({
|
||||||
writeCharacteristicId
|
deviceId: that.currentLockInfo.deviceId,
|
||||||
})
|
serviceId,
|
||||||
that.notifyBluetoothCharacteristicValueChange()
|
success(res) {
|
||||||
resolve(true)
|
let notifyCharacteristicId
|
||||||
},
|
let writeCharacteristicId
|
||||||
fail(res) {
|
for (let i = 0; i < res.characteristics.length; i++) {
|
||||||
if (res.errCode === 10006) {
|
const characteristic = res.characteristics[i]
|
||||||
uni.showToast({
|
if (characteristic.properties.notify) {
|
||||||
title: '连接失败,请靠近设备并保持设备处于唤醒状态',
|
notifyCharacteristicId = characteristic.uuid
|
||||||
icon: 'none'
|
}
|
||||||
|
if (characteristic.properties.write) {
|
||||||
|
writeCharacteristicId = characteristic.uuid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
that.updateCurrentLockInfo({
|
||||||
|
...that.currentLockInfo,
|
||||||
|
serviceId,
|
||||||
|
notifyCharacteristicId,
|
||||||
|
writeCharacteristicId
|
||||||
})
|
})
|
||||||
|
that.notifyBluetoothCharacteristicValueChange()
|
||||||
|
resolve(true)
|
||||||
|
},
|
||||||
|
fail(res) {
|
||||||
|
if (res.errCode === 10006) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '连接失败,请靠近设备并保持设备处于唤醒状态',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
console.log('获取设备特征值失败', res)
|
||||||
|
resolve(false)
|
||||||
}
|
}
|
||||||
console.log('获取设备特征值失败', res)
|
|
||||||
resolve(false)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
fail(res) {
|
|
||||||
if (res.errCode === 10006) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '连接失败,请靠近设备并保持设备处于唤醒状态',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
fail(res) {
|
||||||
|
if (res.errCode === 10006) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '连接失败,请靠近设备并保持设备处于唤醒状态',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
console.log('获取设备服务失败', res)
|
||||||
|
resolve(false)
|
||||||
}
|
}
|
||||||
console.log('获取设备服务失败', res)
|
})
|
||||||
resolve(false)
|
}
|
||||||
}
|
|
||||||
})
|
// #ifdef APP-PLUS
|
||||||
|
setTimeout(executeBluetoothOperation, 800)
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef MP
|
||||||
|
executeBluetoothOperation()
|
||||||
|
// #endif
|
||||||
},
|
},
|
||||||
async fail(res) {
|
async fail(res) {
|
||||||
console.log('连接失败', res)
|
console.log('连接失败', res)
|
||||||
@ -1412,6 +1428,24 @@ export const useBluetoothStore = defineStore('ble', {
|
|||||||
i === count - 1 ? binaryData.length : (i + 1) * 20
|
i === count - 1 ? binaryData.length : (i + 1) * 20
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
setTimeout(
|
||||||
|
() => {
|
||||||
|
uni.writeBLECharacteristicValue({
|
||||||
|
deviceId: that.currentLockInfo.deviceId,
|
||||||
|
serviceId: that.currentLockInfo.serviceId,
|
||||||
|
characteristicId: that.currentLockInfo.writeCharacteristicId,
|
||||||
|
value: writeData.buffer,
|
||||||
|
fail(res) {
|
||||||
|
console.log('写入失败', res)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
(i + 1) * 200
|
||||||
|
)
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef MP
|
||||||
uni.writeBLECharacteristicValue({
|
uni.writeBLECharacteristicValue({
|
||||||
deviceId: that.currentLockInfo.deviceId,
|
deviceId: that.currentLockInfo.deviceId,
|
||||||
serviceId: that.currentLockInfo.serviceId,
|
serviceId: that.currentLockInfo.serviceId,
|
||||||
@ -1421,6 +1455,7 @@ export const useBluetoothStore = defineStore('ble', {
|
|||||||
console.log('写入失败', res)
|
console.log('写入失败', res)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
// #endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -43,6 +43,9 @@ export const useUserStore = defineStore('user', {
|
|||||||
return code
|
return code
|
||||||
},
|
},
|
||||||
async register(params) {
|
async register(params) {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '注册中'
|
||||||
|
})
|
||||||
const { account, password, receiverType, countryCode, verificationCode } = params
|
const { account, password, receiverType, countryCode, verificationCode } = params
|
||||||
const $basic = useBasicStore()
|
const $basic = useBasicStore()
|
||||||
const deviceInfo = await $basic.getDeviceInfo()
|
const deviceInfo = await $basic.getDeviceInfo()
|
||||||
@ -62,6 +65,7 @@ export const useUserStore = defineStore('user', {
|
|||||||
platId: 2,
|
platId: 2,
|
||||||
deviceInfo: info
|
deviceInfo: info
|
||||||
})
|
})
|
||||||
|
uni.hideLoading()
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
setStorage('token', data.accessToken)
|
setStorage('token', data.accessToken)
|
||||||
return true
|
return true
|
||||||
@ -73,6 +77,9 @@ export const useUserStore = defineStore('user', {
|
|||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
async passwordLogin(params) {
|
async passwordLogin(params) {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '登录中'
|
||||||
|
})
|
||||||
const { username, password, countryCode } = params
|
const { username, password, countryCode } = params
|
||||||
const $basic = useBasicStore()
|
const $basic = useBasicStore()
|
||||||
const deviceInfo = await $basic.getDeviceInfo()
|
const deviceInfo = await $basic.getDeviceInfo()
|
||||||
@ -91,6 +98,7 @@ export const useUserStore = defineStore('user', {
|
|||||||
platId: 2,
|
platId: 2,
|
||||||
deviceInfo: info
|
deviceInfo: info
|
||||||
})
|
})
|
||||||
|
uni.hideLoading()
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
setStorage('token', data.accessToken)
|
setStorage('token', data.accessToken)
|
||||||
return true
|
return true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user