Merge branch 'fanpeng' into 'master'
Fanpeng See merge request StarlockTeam/wx-starlock!13
39
api/notification.js
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
import request from '../utils/request'
|
||||||
|
|
||||||
|
// Notification 通知模块
|
||||||
|
|
||||||
|
// 获取通知列表
|
||||||
|
export function getNotificationList(data) {
|
||||||
|
return request({
|
||||||
|
url: '/notifications/list',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 标记消息为已读
|
||||||
|
export function markAsReadNotification(data) {
|
||||||
|
return request({
|
||||||
|
url: '/notifications/markAsRead',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除所有通知
|
||||||
|
export function deleteAllNotification(data) {
|
||||||
|
return request({
|
||||||
|
url: '/notifications/deleteAll',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除通知
|
||||||
|
export function deleteNotification(data) {
|
||||||
|
return request({
|
||||||
|
url: '/notifications/delete',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -2,8 +2,8 @@
|
|||||||
"name" : "wx-starlock",
|
"name" : "wx-starlock",
|
||||||
"appid" : "__UNI__933D519",
|
"appid" : "__UNI__933D519",
|
||||||
"description" : "",
|
"description" : "",
|
||||||
"versionName" : "1.0.2",
|
"versionName" : "1.1.1",
|
||||||
"versionCode" : "22",
|
"versionCode" : "28",
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
/* 小程序特有相关 */
|
/* 小程序特有相关 */
|
||||||
"mp-weixin" : {
|
"mp-weixin" : {
|
||||||
|
|||||||
331
pages.json
@ -1,155 +1,180 @@
|
|||||||
{
|
{
|
||||||
"easycom": {
|
"easycom": {
|
||||||
"autoscan": true,
|
"autoscan": true,
|
||||||
"custom": {
|
"custom": {
|
||||||
"^u--(.*)": "uview-plus/components/u-$1/u-$1.vue",
|
"^u--(.*)": "uview-plus/components/u-$1/u-$1.vue",
|
||||||
"^up-(.*)": "uview-plus/components/u-$1/u-$1.vue",
|
"^up-(.*)": "uview-plus/components/u-$1/u-$1.vue",
|
||||||
"^u-([^-].*)": "uview-plus/components/u-$1/u-$1.vue"
|
"^u-([^-].*)": "uview-plus/components/u-$1/u-$1.vue"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"pages": [
|
"pages": [
|
||||||
{
|
{
|
||||||
"path": "pages/home/home"
|
"path": "pages/home/home"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/selectAddress/selectAddress",
|
"path": "pages/selectAddress/selectAddress",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "锁地址",
|
"navigationBarTitleText": "锁地址",
|
||||||
"disableScroll": true
|
"disableScroll": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/mine/mine"
|
"path": "pages/mine/mine"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/userInfo/userInfo",
|
"path": "pages/userInfo/userInfo",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "个人信息"
|
"navigationBarTitleText": "个人信息"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/updateName/updateName",
|
"path": "pages/updateName/updateName",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "修改昵称"
|
"navigationBarTitleText": "修改昵称"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/updatePassword/updatePassword",
|
"path": "pages/updatePassword/updatePassword",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "重置密码"
|
"navigationBarTitleText": "重置密码"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/updateEmail/updateEmail",
|
"path": "pages/updateEmail/updateEmail",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "修改邮箱"
|
"navigationBarTitleText": "修改邮箱"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/verifyEmail/verifyEmail",
|
"path": "pages/verifyEmail/verifyEmail",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "验证邮箱"
|
"navigationBarTitleText": "验证邮箱"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/webview/webview",
|
"path": "pages/webview/webview",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "介绍"
|
"navigationBarTitleText": "介绍"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/lockDetail/lockDetail",
|
"path": "pages/lockDetail/lockDetail",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "星星锁"
|
"navigationBarTitleText": "星星锁"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/bindLock/bindLock",
|
"path": "pages/bindLock/bindLock",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "添加锁"
|
"navigationBarTitleText": "添加锁"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/searchDevice/searchDevice",
|
"path": "pages/searchDevice/searchDevice",
|
||||||
"style": {
|
"style": {
|
||||||
"disableScroll": true,
|
"disableScroll": true,
|
||||||
"navigationBarTitleText": "附近设备"
|
"navigationBarTitleText": "附近设备"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/setting/setting",
|
"path": "pages/setting/setting",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "设置"
|
"navigationBarTitleText": "设置"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/keyList/keyList",
|
"path": "pages/keyList/keyList",
|
||||||
"style": {
|
"style": {
|
||||||
"disableScroll": true,
|
"disableScroll": true,
|
||||||
"navigationBarTitleText": "电子钥匙"
|
"navigationBarTitleText": "电子钥匙"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/createKey/createKey",
|
"path": "pages/createKey/createKey",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "发送钥匙"
|
"navigationBarTitleText": "发送钥匙"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/passwordList/passwordList",
|
"path": "pages/passwordList/passwordList",
|
||||||
"style": {
|
"style": {
|
||||||
"disableScroll": true,
|
"disableScroll": true,
|
||||||
"navigationBarTitleText": "密码"
|
"navigationBarTitleText": "密码"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/createPassword/createPassword",
|
"path": "pages/createPassword/createPassword",
|
||||||
"style": {
|
"style": {
|
||||||
"disableScroll": true,
|
"disableScroll": true,
|
||||||
"navigationBarTitleText": "获取密码"
|
"navigationBarTitleText": "获取密码"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/passwordDetail/passwordDetail",
|
"path": "pages/passwordDetail/passwordDetail",
|
||||||
"style": {
|
"style": {
|
||||||
"disableScroll": true,
|
"disableScroll": true,
|
||||||
"navigationBarTitleText": "密码详情"
|
"navigationBarTitleText": "密码详情"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/keyDetail/keyDetail",
|
"path": "pages/keyDetail/keyDetail",
|
||||||
"style": {
|
"style": {
|
||||||
"disableScroll": true,
|
"disableScroll": true,
|
||||||
"navigationBarTitleText": "钥匙详情"
|
"navigationBarTitleText": "钥匙详情"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
],
|
{
|
||||||
"globalStyle": {
|
"path": "pages/notificationList/notificationList",
|
||||||
"navigationBarTextStyle": "white",
|
"style": {
|
||||||
"navigationBarTitleText": "星星锁",
|
"navigationBarTitleText": "通知列表"
|
||||||
"navigationBarBackgroundColor": "#63b8af",
|
}
|
||||||
"backgroundColor": "#F3F3F3",
|
},
|
||||||
"navigationStyle": "default"
|
{
|
||||||
},
|
"path": "pages/notificationDetail/notificationDetail",
|
||||||
"tabBar": {
|
"style": {
|
||||||
"color": "#a3a3a3",
|
"navigationBarTitleText": "消息详情"
|
||||||
"selectedColor": "#63b8af",
|
}
|
||||||
"borderStyle": "white",
|
},
|
||||||
"backgroundColor": "#FFFFFF",
|
{
|
||||||
"position": "bottom",
|
"path": "pages/addLockGuid/addLockGuid",
|
||||||
"list": [
|
"style": {
|
||||||
{
|
"navigationBarTitleText": "添加锁",
|
||||||
"pagePath": "pages/home/home",
|
"disableScroll": true
|
||||||
"iconPath": "static/images/tabbar_key_no_select.png",
|
}
|
||||||
"selectedIconPath": "static/images/tabbar_key_select.png",
|
}
|
||||||
"text": "设备"
|
],
|
||||||
},
|
"globalStyle": {
|
||||||
{
|
"navigationBarTextStyle": "white",
|
||||||
"pagePath": "pages/mine/mine",
|
"navigationBarTitleText": "星星锁",
|
||||||
"iconPath": "static/images/tabbar_mine_no_select.png",
|
"navigationBarBackgroundColor": "#63b8af",
|
||||||
"selectedIconPath": "static/images/tabbar_mine_select.png",
|
"backgroundColor": "#F3F3F3",
|
||||||
"text": "我的"
|
"navigationStyle": "default"
|
||||||
}
|
},
|
||||||
]
|
"tabBar": {
|
||||||
}
|
"color": "#a3a3a3",
|
||||||
|
"selectedColor": "#63b8af",
|
||||||
|
"borderStyle": "white",
|
||||||
|
"backgroundColor": "#FFFFFF",
|
||||||
|
"position": "bottom",
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"pagePath": "pages/home/home",
|
||||||
|
"iconPath": "static/images/tabbar_key_no_select.png",
|
||||||
|
"selectedIconPath": "static/images/tabbar_key_select.png",
|
||||||
|
"text": "设备"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pagePath": "pages/notificationList/notificationList",
|
||||||
|
"iconPath": "static/images/tabbar_notification_no_select.png",
|
||||||
|
"selectedIconPath": "static/images/tabbar_notification_select.png",
|
||||||
|
"text": "消息"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pagePath": "pages/mine/mine",
|
||||||
|
"iconPath": "static/images/tabbar_mine_no_select.png",
|
||||||
|
"selectedIconPath": "static/images/tabbar_mine_select.png",
|
||||||
|
"text": "我的"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
80
pages/addLockGuid/addLockGuid.vue
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view class="title">摸亮触摸屏</view>
|
||||||
|
<image src="/static/images/icon_lock_touch_screen.png" mode="aspectFill" class="icon"></image>
|
||||||
|
<view class="tips">摸亮触摸屏,锁进入可添加状态,点击下一步</view>
|
||||||
|
<view @click="toSearchDevice" class="button">下一步</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { mapActions, mapState } from 'pinia'
|
||||||
|
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||||
|
import { useBasicStore } from '@/stores/basic'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data () {
|
||||||
|
return {}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(useBluetoothStore, ['bluetoothStatus', 'isInitBluetooth']),
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapActions(useBluetoothStore, ['getBluetoothStatus', 'initAndListenBluetooth', 'checkSetting']),
|
||||||
|
...mapActions(useBasicStore, ['routeJump']),
|
||||||
|
async toSearchDevice() {
|
||||||
|
if(this.bluetoothStatus !== 0) {
|
||||||
|
this.getBluetoothStatus()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let result = true
|
||||||
|
if(!this.isInitBluetooth) {
|
||||||
|
result = await this.initAndListenBluetooth()
|
||||||
|
}
|
||||||
|
if(result) {
|
||||||
|
this.routeJump({
|
||||||
|
type: 'redirectTo',
|
||||||
|
name: 'searchDevice'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.checkSetting()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.title {
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 200rpx;
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
width: 300rpx;
|
||||||
|
height: 300rpx;
|
||||||
|
margin: 150rpx 225rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tips {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #999;
|
||||||
|
margin-bottom: 100rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
width: 600rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
line-height: 100rpx;
|
||||||
|
text-align: center;
|
||||||
|
background-color: #63b8af;
|
||||||
|
color: #fff;
|
||||||
|
border-radius: 50rpx;
|
||||||
|
margin: 0 auto;
|
||||||
|
font-size: 36rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -5,16 +5,16 @@
|
|||||||
<scroll-view v-if="deviceInfo" scroll-y="true" :style="{ height: deviceInfo.windowHeight + 'px' }"
|
<scroll-view v-if="deviceInfo" scroll-y="true" :style="{ height: deviceInfo.windowHeight + 'px' }"
|
||||||
lower-threshold="100" @refresherrefresh="refresherList" :refresher-enabled="true" @scrolltolower="nextPage"
|
lower-threshold="100" @refresherrefresh="refresherList" :refresher-enabled="true" @scrolltolower="nextPage"
|
||||||
:refresher-triggered="refresherTriggered">
|
:refresher-triggered="refresherTriggered">
|
||||||
<view class="search">
|
<view class="search" v-if="!(lockList.length === 0 && lockSearch.searchStr === '' && !focus)">
|
||||||
<up-search :searchIconSize="48" :inputStyle="{ fontSize: '32rpx' }" @focus="getFocus" @blur="getBlur"
|
<up-search :searchIconSize="48" :inputStyle="{ fontSize: '32rpx' }" @focus="getFocus" @blur="getBlur"
|
||||||
:height="80" placeholder="搜索" :clearabled="false" @change="changeSearch"
|
:height="80" placeholder="搜索" :clearabled="false" @change="changeSearch"
|
||||||
v-model="lockSearch.searchStr" bgColor="#ffffff" :showAction="false" maxlength="20"></up-search>
|
v-model="lockSearch.searchStr" bgColor="#ffffff" :showAction="false" maxlength="50"></up-search>
|
||||||
</view>
|
</view>
|
||||||
<view class="lock-list" v-if="!penging">
|
<view class="lock-list" v-if="!penging">
|
||||||
<view v-if="lockList.length === 0 && lockSearch.searchStr === '' && !focus">
|
<view v-if="lockList.length === 0 && lockSearch.searchStr === '' && !focus">
|
||||||
<image src="/static/images/icon_add_round.png" mode="aspectFill" class="button-add-big"
|
<image src="/static/images/icon_add_round.png" mode="aspectFill" class="button-add-big"
|
||||||
@click="toSearchDevice"></image>
|
@click="toSearchDevice"></image>
|
||||||
<view class="text">填加锁时,手机必须在锁旁边</view>
|
<view class="text">添加锁时,手机必须在锁旁边</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-else>
|
<view v-else>
|
||||||
<view class="group" v-for="(group, grounIndex) in lockList" :key="group.groupId">
|
<view class="group" v-for="(group, grounIndex) in lockList" :key="group.groupId">
|
||||||
@ -77,7 +77,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<button open-type="getPhoneNumber" style="display:none" id="phone" @getphonenumber="getphonenumber"></button>
|
<button open-type="getPhoneNumber" style="display:none" id="phone" @getphonenumber="getphonenumber"></button>
|
||||||
<up-modal :show="showModal" title="是否删除授权管理员钥匙?" :showCancelButton="true" width="600rpx" @cancel="cancelModal"
|
<up-modal :show="showModal" title="是否删除授权管理员钥匙?" :showCancelButton="true" width="600rpx" @cancel="cancelModal"
|
||||||
@confirm="confirmModal">
|
@confirm="confirmModal">
|
||||||
<view class="slot-content" @click="changeRadio">
|
<view class="slot-content" @click="changeRadio">
|
||||||
<view style="display: flex;align-items: center;">
|
<view style="display: flex;align-items: center;">
|
||||||
@ -124,7 +124,7 @@
|
|||||||
...mapState(useLockStore, ['lockList', 'lockTotal', 'lockSearch']),
|
...mapState(useLockStore, ['lockList', 'lockTotal', 'lockSearch']),
|
||||||
...mapState(useBluetoothStore, ['bluetoothStatus', 'isInitBluetooth', 'keyId', 'currentLockInfo']),
|
...mapState(useBluetoothStore, ['bluetoothStatus', 'isInitBluetooth', 'keyId', 'currentLockInfo']),
|
||||||
},
|
},
|
||||||
async onLoad() {
|
async onLoad(data) {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '加载中',
|
title: '加载中',
|
||||||
mask: true
|
mask: true
|
||||||
@ -158,6 +158,8 @@
|
|||||||
this.penging = false
|
this.penging = false
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
}
|
}
|
||||||
|
const _data = JSON.parse(JSON.stringify(data))
|
||||||
|
this.shareJump(_data)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
timeFormat,
|
timeFormat,
|
||||||
@ -165,7 +167,7 @@
|
|||||||
...mapActions(useLockStore, ['getLockList', 'updateLockList', 'getRole', 'getTimeLimit', 'updateLockSearch', 'getPowerIcon']),
|
...mapActions(useLockStore, ['getLockList', 'updateLockList', 'getRole', 'getTimeLimit', 'updateLockSearch', 'getPowerIcon']),
|
||||||
...mapActions(useBluetoothStore, ['getBluetoothStatus', 'initAndListenBluetooth', 'updateCurrentLockInfo',
|
...mapActions(useBluetoothStore, ['getBluetoothStatus', 'initAndListenBluetooth', 'updateCurrentLockInfo',
|
||||||
'checkSetting', 'updateKeyId', 'resetDevice']),
|
'checkSetting', 'updateKeyId', 'resetDevice']),
|
||||||
...mapActions(useBasicStore, ['routeJump', 'getDeviceInfo', 'getNetworkType']),
|
...mapActions(useBasicStore, ['routeJump', 'getDeviceInfo', 'getNetworkType', 'shareJump']),
|
||||||
async deleteLock(lock, groupIndex, lockIndex) {
|
async deleteLock(lock, groupIndex, lockIndex) {
|
||||||
const that = this
|
const that = this
|
||||||
const netWork = await this.getNetworkType()
|
const netWork = await this.getNetworkType()
|
||||||
@ -403,21 +405,9 @@
|
|||||||
this.focus = false
|
this.focus = false
|
||||||
},
|
},
|
||||||
async toSearchDevice() {
|
async toSearchDevice() {
|
||||||
if(this.bluetoothStatus !== 0) {
|
this.routeJump({
|
||||||
this.getBluetoothStatus()
|
name: 'addLockGuid'
|
||||||
return
|
})
|
||||||
}
|
|
||||||
let result = true
|
|
||||||
if(!this.isInitBluetooth) {
|
|
||||||
result = await this.initAndListenBluetooth()
|
|
||||||
}
|
|
||||||
if(result) {
|
|
||||||
this.routeJump({
|
|
||||||
name: 'searchDevice'
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.checkSetting()
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
async toLockDeatil(lock) {
|
async toLockDeatil(lock) {
|
||||||
if(!(this.bluetoothStatus === 0 || this.bluetoothStatus === -1)) {
|
if(!(this.bluetoothStatus === 0 || this.bluetoothStatus === -1)) {
|
||||||
@ -620,7 +610,7 @@ page {
|
|||||||
.button-add-big {
|
.button-add-big {
|
||||||
width: 400rpx;
|
width: 400rpx;
|
||||||
height: 400rpx;
|
height: 400rpx;
|
||||||
margin-top: 250rpx;
|
margin-top: 300rpx;
|
||||||
margin-left: 136rpx;
|
margin-left: 136rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
<view class="search">
|
<view class="search">
|
||||||
<up-search shape="square" :searchIconSize="48" :inputStyle="{ fontSize: '32rpx' }" :height="80" placeholder="搜索"
|
<up-search shape="square" :searchIconSize="48" :inputStyle="{ fontSize: '32rpx' }" :height="80" placeholder="搜索"
|
||||||
:clearabled="false" @change="changeSearch"
|
:clearabled="false" @change="changeSearch"
|
||||||
v-model="keySearch.searchStr" bgColor="#ffffff" :showAction="false" maxlength="20"></up-search>
|
v-model="keySearch.searchStr" bgColor="#ffffff" :showAction="false" maxlength="50"></up-search>
|
||||||
</view>
|
</view>
|
||||||
<view style="padding: 32rpx 0 calc(env(safe-area-inset-bottom) + 250rpx) 0">
|
<view style="padding: 32rpx 0 calc(env(safe-area-inset-bottom) + 250rpx) 0">
|
||||||
<view v-if="keyList.length === 0 && requestFinished">
|
<view v-if="keyList.length === 0 && requestFinished">
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<view v-if="buttonInfo">
|
<view v-if="buttonInfo">
|
||||||
<image src="/static/images/background_mine.png"
|
|
||||||
class="background-image"></image>
|
|
||||||
<view v-if="isLogin">
|
<view v-if="isLogin">
|
||||||
<view class="view">
|
<view class="view">
|
||||||
<view class="view-button" @click="toUsereInfo">
|
<view class="view-button" @click="toUsereInfo">
|
||||||
@ -67,6 +65,7 @@
|
|||||||
import { phoneLoginRequest } from '@/api/user'
|
import { phoneLoginRequest } 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'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@ -80,7 +79,8 @@
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useUserStore, ['isLogin']),
|
...mapState(useUserStore, ['isLogin']),
|
||||||
...mapState(useLockStore, ['lockSearch'])
|
...mapState(useLockStore, ['lockSearch']),
|
||||||
|
...mapState(useNotificationStore, ['notificationSearch'])
|
||||||
},
|
},
|
||||||
async onLoad() {
|
async onLoad() {
|
||||||
this.buttonInfo = await this.getButtonInfo()
|
this.buttonInfo = await this.getButtonInfo()
|
||||||
@ -97,6 +97,7 @@
|
|||||||
methods: {
|
methods: {
|
||||||
...mapActions(useBasicStore, ['getButtonInfo', 'routeJump']),
|
...mapActions(useBasicStore, ['getButtonInfo', 'routeJump']),
|
||||||
...mapActions(useLockStore, ['getLockList', 'updateLockSearch']),
|
...mapActions(useLockStore, ['getLockList', 'updateLockSearch']),
|
||||||
|
...mapActions(useNotificationStore, ['getNotificationList', 'updateNotificationSearch']),
|
||||||
...mapActions(useUserStore, ['updateLoginStatus', 'phoneLogin', 'updateUserInfo', 'getUserInfo',
|
...mapActions(useUserStore, ['updateLoginStatus', 'phoneLogin', 'updateUserInfo', 'getUserInfo',
|
||||||
'checkSession']),
|
'checkSession']),
|
||||||
selectEnv(env) {
|
selectEnv(env) {
|
||||||
@ -138,6 +139,10 @@
|
|||||||
})
|
})
|
||||||
this.getUserInfo()
|
this.getUserInfo()
|
||||||
this.getLockList(this.lockSearch)
|
this.getLockList(this.lockSearch)
|
||||||
|
this.updateNotificationSearch({
|
||||||
|
pageNo: 1
|
||||||
|
})
|
||||||
|
this.getNotificationList(this.notificationSearch)
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '账号切换成功',
|
title: '账号切换成功',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
|
|||||||
56
pages/notificationDetail/notificationDetail.vue
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<template>
|
||||||
|
<view v-if="notification">
|
||||||
|
<view class="time">创建时间:{{ timeFormat(notification.createdAt, 'yyyy-mm-dd h:M') }}</view>
|
||||||
|
<view class="content">{{notification.data}}</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { timeFormat } from 'uview-plus'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
notification: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(options) {
|
||||||
|
this.notification = JSON.parse(options.notification)
|
||||||
|
console.log(this.notification)
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
timeFormat,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
page {
|
||||||
|
background-color: $uni-bg-color-grey;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.time {
|
||||||
|
margin-top: 24rpx;
|
||||||
|
margin-left: 25rpx;
|
||||||
|
color: #6c6c6c;
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #6c6c6c;
|
||||||
|
width: 652rpx;
|
||||||
|
margin-left: 25rpx;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding: 24rpx;
|
||||||
|
box-shadow: 2rpx 2rpx 10rpx rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
371
pages/notificationList/notificationList.vue
Normal file
@ -0,0 +1,371 @@
|
|||||||
|
<template>
|
||||||
|
<scroll-view v-if="deviceInfo" scroll-y="true" :style="{ height: deviceInfo.windowHeight + 'px' }"
|
||||||
|
lower-threshold="100" @refresherrefresh="refresherList" :refresher-enabled="true" @scrolltolower="nextPage"
|
||||||
|
:refresher-triggered="refresherTriggered" @scroll="scroll">
|
||||||
|
<view v-if="isLogin">
|
||||||
|
<view class="list" v-if="requestFinished">
|
||||||
|
<view v-if="notificationList.length === 0">
|
||||||
|
<image class="empty-list" src="/static/images/background_empty_list.png" mode="aspectFill"></image>
|
||||||
|
<view class="empty-list-text">暂无数据</view>
|
||||||
|
</view>
|
||||||
|
<up-swipe-action v-else>
|
||||||
|
<up-swipe-action-item class="item" ref="swipeItem" :options="options"
|
||||||
|
v-for="(notification,index) in notificationList" :key="notification.id"
|
||||||
|
:threshold="50" @click="deleteNotification(notification, index)" :index="index"
|
||||||
|
:name="index">
|
||||||
|
<view class="notification" @click="toDetail(index,notification)">
|
||||||
|
<view v-if="notification.readAt === 0">
|
||||||
|
<image class="icon" src="/static/images/icon_notification_unread.png" mode="aspectFill"></image>
|
||||||
|
<view class="point"></view>
|
||||||
|
</view>
|
||||||
|
<image v-else class="icon" src="/static/images/icon_notification_read.png" mode="aspectFill"></image>
|
||||||
|
<view>
|
||||||
|
<view class="content" :style="{color:notification.readAt === 0?'#000000':'#6c6c6c'}">{{ notification.data
|
||||||
|
}}</view>
|
||||||
|
<view class="time" :style="{color:notification.readAt === 0?'#000000':'#6c6c6c'}">{{ timeFormat(notification.createdAt, 'yyyy-mm-dd h:M') }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</up-swipe-action-item>
|
||||||
|
</up-swipe-action>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view v-else>
|
||||||
|
<view class="tips">因智能门锁与账号绑定,登录为手机号登录</view>
|
||||||
|
<label for="phone">
|
||||||
|
<view class="button-login">登录</view>
|
||||||
|
</label>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
<view class="delete" @click="deleteAllNotification" v-if="isLogin && requestFinished && notificationList.length !==
|
||||||
|
0">
|
||||||
|
<image class="delete-image" src="/static/images/icon_delete.png" mode="aspectFill"></image>
|
||||||
|
</view>
|
||||||
|
<button open-type="getPhoneNumber" style="display:none" id="phone" @getphonenumber="getphonenumber"></button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { mapActions, mapState } from 'pinia'
|
||||||
|
import { useNotificationStore } from '@/stores/notification'
|
||||||
|
import { useBasicStore } from '@/stores/basic'
|
||||||
|
import { timeFormat } from 'uview-plus'
|
||||||
|
import { deleteAllNotification, deleteNotification, markAsReadNotification } from '@/api/notification'
|
||||||
|
import { useUserStore } from '@/stores/user'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
refresherTriggered: false,
|
||||||
|
requestFinished: false,
|
||||||
|
deviceInfo: null,
|
||||||
|
options: [{
|
||||||
|
text: '删除',
|
||||||
|
style: {
|
||||||
|
backgroundColor: '#f56c6c'
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(useNotificationStore, ['notificationTotal', 'notificationList', 'notificationSearch']),
|
||||||
|
...mapState(useUserStore, ['isLogin']),
|
||||||
|
},
|
||||||
|
async onLoad () {
|
||||||
|
this.deviceInfo = await this.getDeviceInfo()
|
||||||
|
if(this.isLogin) {
|
||||||
|
await this.getList()
|
||||||
|
}
|
||||||
|
this.requestFinished = true
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
timeFormat,
|
||||||
|
...mapActions(useNotificationStore, ['getNotificationList', 'updateNotificationSearch', 'updateNotificationItem','deleteNotificationItem']),
|
||||||
|
...mapActions(useBasicStore, ['routeJump', 'getDeviceInfo', 'getNetworkType']),
|
||||||
|
...mapActions(useUserStore, ['phoneLogin']),
|
||||||
|
async getList() {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '加载中',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
|
const { code, message } = await this.getNotificationList(this.notificationSearch)
|
||||||
|
uni.hideLoading()
|
||||||
|
if (code !== 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async getphonenumber(data) {
|
||||||
|
if(data.detail.errMsg === 'getPhoneNumber:fail user deny') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const result = await this.phoneLogin({
|
||||||
|
encryptedData: data.detail.encryptedData,
|
||||||
|
iv: data.detail.iv
|
||||||
|
})
|
||||||
|
if(!result) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '登录失败,请重试',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
scroll() {
|
||||||
|
this.$refs.swipeItem.forEach(item => {
|
||||||
|
if(item.show) {
|
||||||
|
item.closeHandler()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async deleteNotification (notification, index) {
|
||||||
|
const netWork = await this.getNetworkType()
|
||||||
|
if (!netWork) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$refs.swipeItem[index].closeHandler()
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '确定要删除该通知吗?',
|
||||||
|
success: async (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
const { code, message } = await deleteNotification({
|
||||||
|
id: notification.id
|
||||||
|
})
|
||||||
|
if (code === 0) {
|
||||||
|
this.deleteNotificationItem(index)
|
||||||
|
uni.showToast({
|
||||||
|
title: '删除成功',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
deleteAllNotification() {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '确定要删除所有通知吗?',
|
||||||
|
success: async (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
const { code, message } = await deleteAllNotification()
|
||||||
|
if (code === 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '删除成功',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
this.updateNotificationSearch({
|
||||||
|
pageNo: 1
|
||||||
|
})
|
||||||
|
await this.getNotificationList(this.notificationSearch)
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
toDetail(index, notification) {
|
||||||
|
if(notification.readAt === 0) {
|
||||||
|
notification.readAt = 1
|
||||||
|
this.updateNotificationItem(index,notification)
|
||||||
|
markAsReadNotification({
|
||||||
|
id: notification.id
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.routeJump({
|
||||||
|
name: 'notificationDetail',
|
||||||
|
params: {
|
||||||
|
notification: JSON.stringify(notification)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async refresherList() {
|
||||||
|
this.refresherTriggered = true
|
||||||
|
this.updateNotificationSearch({
|
||||||
|
pageNo: 1
|
||||||
|
})
|
||||||
|
const { code, message } = await this.getNotificationList(this.notificationSearch)
|
||||||
|
if(code === 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '刷新成功',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.refresherTriggered = false
|
||||||
|
},
|
||||||
|
async nextPage() {
|
||||||
|
if(this.notificationTotal <= this.notificationSearch.pageNo * this.notificationSearch.pageSize) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const pageNo = this.notificationSearch.pageNo + 1
|
||||||
|
const params = {
|
||||||
|
...this.notificationSearch,
|
||||||
|
pageNo
|
||||||
|
}
|
||||||
|
const { code, message } = await this.getNotificationList(params)
|
||||||
|
if(code === 0) {
|
||||||
|
this.updateNotificationSearch({
|
||||||
|
pageNo
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
page {
|
||||||
|
background-color: $uni-bg-color-grey;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-swipe-action {
|
||||||
|
overflow: inherit !important;
|
||||||
|
width: 700rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding-bottom: 140rpx !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-swipe-action-item {
|
||||||
|
overflow: inherit !important;
|
||||||
|
border-radius: 32rpx !important;
|
||||||
|
background: transparent !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-swipe-action-item__right {
|
||||||
|
margin-top: 32rpx;
|
||||||
|
border-radius: 32rpx !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-swipe-action-item__content {
|
||||||
|
border-radius: 32rpx !important;
|
||||||
|
margin-left: 25rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-swipe-action-item__right__button {
|
||||||
|
border-radius: 32rpx !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.item {
|
||||||
|
border-radius: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notification {
|
||||||
|
border-radius: 32rpx;
|
||||||
|
margin-top: 32rpx;
|
||||||
|
display: flex;
|
||||||
|
width: 636rpx;
|
||||||
|
padding: 32rpx;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
position: relative;
|
||||||
|
box-shadow: 2rpx 2rpx 10rpx rgba(0, 0, 0, 0.3);
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
width: 50rpx;
|
||||||
|
height: 50rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.point {
|
||||||
|
width: 16rpx;
|
||||||
|
height: 16rpx;
|
||||||
|
background-color: #ff0000;
|
||||||
|
border-radius: 50%;
|
||||||
|
position: absolute;
|
||||||
|
top: 41rpx;
|
||||||
|
left: 72rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
width: 550rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #6c6c6c;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.time {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #6c6c6c;
|
||||||
|
margin-top: 5rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete {
|
||||||
|
width: 100rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: #5db5aa;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 80rpx;
|
||||||
|
right: 30rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.delete-image {
|
||||||
|
width: 45rpx;
|
||||||
|
height: 45rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-list {
|
||||||
|
width: 150rpx;
|
||||||
|
height: 150rpx;
|
||||||
|
margin: 400rpx auto 20rpx 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-list-text {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tips {
|
||||||
|
margin-top: 40vh;
|
||||||
|
padding: 32rpx 0;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-login {
|
||||||
|
border-radius: 46rpx;
|
||||||
|
width: 650rpx;
|
||||||
|
height: 120rpx;
|
||||||
|
line-height: 120rpx;
|
||||||
|
text-align: center;
|
||||||
|
margin-left: 50rpx;
|
||||||
|
background: #63b8af;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 48rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -6,7 +6,7 @@
|
|||||||
<view class="search">
|
<view class="search">
|
||||||
<up-search shape="square" :searchIconSize="48" :inputStyle="{ fontSize: '32rpx' }" :height="80" placeholder="搜索"
|
<up-search shape="square" :searchIconSize="48" :inputStyle="{ fontSize: '32rpx' }" :height="80" placeholder="搜索"
|
||||||
:clearabled="false" @change="changeSearch"
|
:clearabled="false" @change="changeSearch"
|
||||||
v-model="passwordSearch.searchStr" bgColor="#ffffff" :showAction="false" maxlength="20"></up-search>
|
v-model="passwordSearch.searchStr" bgColor="#ffffff" :showAction="false" maxlength="50"></up-search>
|
||||||
</view>
|
</view>
|
||||||
<view style="padding: 32rpx 0 calc(env(safe-area-inset-bottom) + 250rpx) 0">
|
<view style="padding: 32rpx 0 calc(env(safe-area-inset-bottom) + 250rpx) 0">
|
||||||
<view v-if="passwordList.length === 0 && requestFinished">
|
<view v-if="passwordList.length === 0 && requestFinished">
|
||||||
@ -193,7 +193,7 @@ export default {
|
|||||||
if(code === 0) {
|
if(code === 0) {
|
||||||
const { code: requestCode, message } = await resetPsaawordListRequest({
|
const { code: requestCode, message } = await resetPsaawordListRequest({
|
||||||
lockId: that.currentLockInfo.lockId,
|
lockId: that.currentLockInfo.lockId,
|
||||||
passwordKey: that.currentLockInfo.bluetooth.passwordKey
|
passwordKey: that.currentLockInfo.encrpyKey
|
||||||
})
|
})
|
||||||
console.log('重置密码返回', requestCode, message)
|
console.log('重置密码返回', requestCode, message)
|
||||||
if(requestCode === 0) {
|
if(requestCode === 0) {
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<view>
|
<view>
|
||||||
<view class="view">
|
<view class="view">
|
||||||
<view class="view-button">
|
<view class="view-button">
|
||||||
<view style="width: 350rpx">名称</view>
|
<view style="width: 150rpx">名称</view>
|
||||||
<view class="view-button" style="padding: 20rpx 0">
|
<view class="view-button" style="padding: 20rpx 0">
|
||||||
<view class="info" style="line-height: 40rpx;word-break: break-all;">{{currentLockInfo.lockAlias}}</view>
|
<view class="info" style="line-height: 40rpx;word-break: break-all;">{{currentLockInfo.lockAlias}}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<view>
|
<view>
|
||||||
<view class="tips">为了你的账号安全,修改账号前请先使用验证码验证</view>
|
<view class="tips">为了你的账号安全,修改账号前请先使用验证码验证</view>
|
||||||
<view class="view-top">
|
<view class="view-top">
|
||||||
<input type="number" class="input" :value="verificationCode" maxlength="20" placeholder="请输入验证码"
|
<input type="number" class="input" :value="verificationCode" maxlength="6" placeholder="请输入验证码"
|
||||||
placeholder-class="input-placeholder" @input="updateInput"></input>
|
placeholder-class="input-placeholder" @input="updateInput"></input>
|
||||||
<view class="button-verify" @click="getEmailCode">{{text}}</view>
|
<view class="button-verify" @click="getEmailCode">{{text}}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 49 KiB |
BIN
static/images/icon_delete.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
static/images/icon_lock_touch_screen.png
Executable file
|
After Width: | Height: | Size: 38 KiB |
BIN
static/images/icon_notification_read.png
Executable file
|
After Width: | Height: | Size: 11 KiB |
BIN
static/images/icon_notification_unread.png
Executable file
|
After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
BIN
static/images/tabbar_notification_no_select.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
static/images/tabbar_notification_select.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
@ -96,6 +96,21 @@ const pages = [
|
|||||||
name: 'keyDetail',
|
name: 'keyDetail',
|
||||||
path: '/pages/keyDetail/keyDetail',
|
path: '/pages/keyDetail/keyDetail',
|
||||||
tabBar: false
|
tabBar: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'notificationList',
|
||||||
|
path: '/pages/notificationList/notificationList',
|
||||||
|
tabBar: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'notificationDetail',
|
||||||
|
path: '/pages/notificationDetail/notificationDetail',
|
||||||
|
tabBar: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'addLockGuid',
|
||||||
|
path: '/pages/addLockGuid/addLockGuid',
|
||||||
|
tabBar: false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -106,7 +121,9 @@ export const useBasicStore = defineStore('basic', {
|
|||||||
// 设备信息
|
// 设备信息
|
||||||
deviceInfo: null,
|
deviceInfo: null,
|
||||||
// 胶囊按钮的位置信息
|
// 胶囊按钮的位置信息
|
||||||
buttonInfo: null
|
buttonInfo: null,
|
||||||
|
// 分享配置
|
||||||
|
shareConfig: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
@ -207,6 +224,47 @@ export const useBasicStore = defineStore('basic', {
|
|||||||
}, 300)
|
}, 300)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
|
// 分享跳转
|
||||||
|
shareJump(data = this.shareConfig) {
|
||||||
|
if (data.path) {
|
||||||
|
const target = data.path.split('/')
|
||||||
|
if (target.length > 1) {
|
||||||
|
data.path = data.path.slice(target[0].length + 1, data.path.length)
|
||||||
|
} else {
|
||||||
|
delete data.path
|
||||||
|
}
|
||||||
|
const page = pages.find((page) => {
|
||||||
|
return page.name === target[0]
|
||||||
|
})
|
||||||
|
if (page) {
|
||||||
|
if (page.tabBar) {
|
||||||
|
wx.switchTab({
|
||||||
|
url: page.path
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
const url = page.path + '?' + getParams(data)
|
||||||
|
wx.navigateTo({ url })
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
delete data.path
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
delete data.path
|
||||||
|
}
|
||||||
|
this.shareConfig = data
|
||||||
|
|
||||||
|
function getParams(params) {
|
||||||
|
let paramStr = ''
|
||||||
|
Object.keys(params).forEach((item) => {
|
||||||
|
if (paramStr === '') {
|
||||||
|
paramStr = `${item}=${params[item]}`
|
||||||
|
} else {
|
||||||
|
paramStr = `${paramStr}&${item}=${params[item]}`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return paramStr
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
47
stores/notification.js
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
import { defineStore } from 'pinia'
|
||||||
|
import { getNotificationList } from '../api/notification'
|
||||||
|
|
||||||
|
export const useNotificationStore = defineStore('notification', {
|
||||||
|
state() {
|
||||||
|
return {
|
||||||
|
// 通知列表
|
||||||
|
notificationList: [],
|
||||||
|
// 通知总数
|
||||||
|
notificationTotal: 0,
|
||||||
|
// 通知列表搜索数据
|
||||||
|
notificationSearch: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 50,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
// 删除通知列表某一项数据
|
||||||
|
deleteNotificationItem (index) {
|
||||||
|
this.notificationList.splice(index, 1)
|
||||||
|
},
|
||||||
|
// 更新某一项通知列表数据
|
||||||
|
updateNotificationItem (index, params) {
|
||||||
|
this.notificationList[index] = { ...this.notificationList[index], ...params }
|
||||||
|
},
|
||||||
|
// 更新通知列表搜索数据
|
||||||
|
updateNotificationSearch (params) {
|
||||||
|
this.notificationSearch = { ...this.notificationSearch, ...params }
|
||||||
|
},
|
||||||
|
// 获取通知列表
|
||||||
|
async getNotificationList (params) {
|
||||||
|
const { code, data, message } = await getNotificationList({ pageNo: params.pageNo, pageSize: params.pageSize })
|
||||||
|
if(code === 0) {
|
||||||
|
this.notificationTotal = data.total
|
||||||
|
if(params.pageNo === 1) {
|
||||||
|
this.notificationList = data.list
|
||||||
|
} else {
|
||||||
|
this.notificationList = this.notificationList.concat(data.list)
|
||||||
|
}
|
||||||
|
return { code }
|
||||||
|
} else {
|
||||||
|
return { code, message }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
})
|
||||||
@ -5,6 +5,7 @@ import { defineStore } from 'pinia'
|
|||||||
import { getUserInfoRequest, loginRequest, phoneLoginRequest } from '@/api/user'
|
import { getUserInfoRequest, loginRequest, phoneLoginRequest } from '@/api/user'
|
||||||
import { useLockStore } from '@/stores/lock'
|
import { useLockStore } from '@/stores/lock'
|
||||||
import { setStorage, getStorage } from '@/utils/storage'
|
import { setStorage, getStorage } from '@/utils/storage'
|
||||||
|
import { useNotificationStore } from '@/stores/notification'
|
||||||
|
|
||||||
export const useUserStore = defineStore('user', {
|
export const useUserStore = defineStore('user', {
|
||||||
state() {
|
state() {
|
||||||
@ -35,7 +36,7 @@ export const useUserStore = defineStore('user', {
|
|||||||
async phoneLogin(params) {
|
async phoneLogin(params) {
|
||||||
const { iv, encryptedData } = params
|
const { iv, encryptedData } = params
|
||||||
const openid = getStorage('openid')
|
const openid = getStorage('openid')
|
||||||
const { code, data, message } = await phoneLoginRequest({ iv, encryptedData, openid })
|
const { code, data } = await phoneLoginRequest({ iv, encryptedData, openid })
|
||||||
if(code === 0) {
|
if(code === 0) {
|
||||||
setStorage('token', data.accessToken)
|
setStorage('token', data.accessToken)
|
||||||
this.getUserInfo()
|
this.getUserInfo()
|
||||||
@ -44,6 +45,11 @@ export const useUserStore = defineStore('user', {
|
|||||||
pageNo: 1
|
pageNo: 1
|
||||||
})
|
})
|
||||||
useLockStore().getLockList(useLockStore().lockSearch)
|
useLockStore().getLockList(useLockStore().lockSearch)
|
||||||
|
useNotificationStore().updateNotificationSearch({
|
||||||
|
...useNotificationStore().notificationSearch,
|
||||||
|
pageNo: 1
|
||||||
|
})
|
||||||
|
useNotificationStore().getNotificationList(useNotificationStore().notificationSearch)
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
|
|||||||