diff --git a/api/notification.js b/api/notification.js
new file mode 100644
index 0000000..472a636
--- /dev/null
+++ b/api/notification.js
@@ -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
+ })
+}
diff --git a/manifest.json b/manifest.json
index bca47ef..4f4f363 100644
--- a/manifest.json
+++ b/manifest.json
@@ -2,8 +2,8 @@
"name" : "wx-starlock",
"appid" : "__UNI__933D519",
"description" : "",
- "versionName" : "1.0.2",
- "versionCode" : "22",
+ "versionName" : "1.1.1",
+ "versionCode" : "28",
"transformPx" : false,
/* 小程序特有相关 */
"mp-weixin" : {
diff --git a/pages.json b/pages.json
index 66fb723..342e554 100644
--- a/pages.json
+++ b/pages.json
@@ -1,155 +1,180 @@
{
- "easycom": {
- "autoscan": true,
- "custom": {
- "^u--(.*)": "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"
- }
- },
- "pages": [
- {
- "path": "pages/home/home"
- },
- {
- "path": "pages/selectAddress/selectAddress",
- "style": {
- "navigationBarTitleText": "锁地址",
- "disableScroll": true
- }
- },
- {
- "path": "pages/mine/mine"
- },
- {
- "path": "pages/userInfo/userInfo",
- "style": {
- "navigationBarTitleText": "个人信息"
- }
- },
- {
- "path": "pages/updateName/updateName",
- "style": {
- "navigationBarTitleText": "修改昵称"
- }
- },
- {
- "path": "pages/updatePassword/updatePassword",
- "style": {
- "navigationBarTitleText": "重置密码"
- }
- },
- {
- "path": "pages/updateEmail/updateEmail",
- "style": {
- "navigationBarTitleText": "修改邮箱"
- }
- },
- {
- "path": "pages/verifyEmail/verifyEmail",
- "style": {
- "navigationBarTitleText": "验证邮箱"
- }
- },
- {
- "path": "pages/webview/webview",
- "style": {
- "navigationBarTitleText": "介绍"
- }
- },
- {
- "path": "pages/lockDetail/lockDetail",
- "style": {
- "navigationBarTitleText": "星星锁"
- }
- },
- {
- "path": "pages/bindLock/bindLock",
- "style": {
- "navigationBarTitleText": "添加锁"
- }
- },
- {
- "path": "pages/searchDevice/searchDevice",
- "style": {
- "disableScroll": true,
- "navigationBarTitleText": "附近设备"
- }
- },
- {
- "path": "pages/setting/setting",
- "style": {
- "navigationBarTitleText": "设置"
- }
- },
- {
- "path": "pages/keyList/keyList",
- "style": {
- "disableScroll": true,
- "navigationBarTitleText": "电子钥匙"
- }
- },
- {
- "path": "pages/createKey/createKey",
- "style": {
- "navigationBarTitleText": "发送钥匙"
- }
- },
- {
- "path": "pages/passwordList/passwordList",
- "style": {
- "disableScroll": true,
- "navigationBarTitleText": "密码"
- }
- },
- {
- "path": "pages/createPassword/createPassword",
- "style": {
- "disableScroll": true,
- "navigationBarTitleText": "获取密码"
- }
- },
- {
- "path": "pages/passwordDetail/passwordDetail",
- "style": {
- "disableScroll": true,
- "navigationBarTitleText": "密码详情"
- }
- },
- {
- "path": "pages/keyDetail/keyDetail",
- "style": {
- "disableScroll": true,
- "navigationBarTitleText": "钥匙详情"
- }
- }
- ],
- "globalStyle": {
- "navigationBarTextStyle": "white",
- "navigationBarTitleText": "星星锁",
- "navigationBarBackgroundColor": "#63b8af",
- "backgroundColor": "#F3F3F3",
- "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/mine/mine",
- "iconPath": "static/images/tabbar_mine_no_select.png",
- "selectedIconPath": "static/images/tabbar_mine_select.png",
- "text": "我的"
- }
- ]
- }
+ "easycom": {
+ "autoscan": true,
+ "custom": {
+ "^u--(.*)": "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"
+ }
+ },
+ "pages": [
+ {
+ "path": "pages/home/home"
+ },
+ {
+ "path": "pages/selectAddress/selectAddress",
+ "style": {
+ "navigationBarTitleText": "锁地址",
+ "disableScroll": true
+ }
+ },
+ {
+ "path": "pages/mine/mine"
+ },
+ {
+ "path": "pages/userInfo/userInfo",
+ "style": {
+ "navigationBarTitleText": "个人信息"
+ }
+ },
+ {
+ "path": "pages/updateName/updateName",
+ "style": {
+ "navigationBarTitleText": "修改昵称"
+ }
+ },
+ {
+ "path": "pages/updatePassword/updatePassword",
+ "style": {
+ "navigationBarTitleText": "重置密码"
+ }
+ },
+ {
+ "path": "pages/updateEmail/updateEmail",
+ "style": {
+ "navigationBarTitleText": "修改邮箱"
+ }
+ },
+ {
+ "path": "pages/verifyEmail/verifyEmail",
+ "style": {
+ "navigationBarTitleText": "验证邮箱"
+ }
+ },
+ {
+ "path": "pages/webview/webview",
+ "style": {
+ "navigationBarTitleText": "介绍"
+ }
+ },
+ {
+ "path": "pages/lockDetail/lockDetail",
+ "style": {
+ "navigationBarTitleText": "星星锁"
+ }
+ },
+ {
+ "path": "pages/bindLock/bindLock",
+ "style": {
+ "navigationBarTitleText": "添加锁"
+ }
+ },
+ {
+ "path": "pages/searchDevice/searchDevice",
+ "style": {
+ "disableScroll": true,
+ "navigationBarTitleText": "附近设备"
+ }
+ },
+ {
+ "path": "pages/setting/setting",
+ "style": {
+ "navigationBarTitleText": "设置"
+ }
+ },
+ {
+ "path": "pages/keyList/keyList",
+ "style": {
+ "disableScroll": true,
+ "navigationBarTitleText": "电子钥匙"
+ }
+ },
+ {
+ "path": "pages/createKey/createKey",
+ "style": {
+ "navigationBarTitleText": "发送钥匙"
+ }
+ },
+ {
+ "path": "pages/passwordList/passwordList",
+ "style": {
+ "disableScroll": true,
+ "navigationBarTitleText": "密码"
+ }
+ },
+ {
+ "path": "pages/createPassword/createPassword",
+ "style": {
+ "disableScroll": true,
+ "navigationBarTitleText": "获取密码"
+ }
+ },
+ {
+ "path": "pages/passwordDetail/passwordDetail",
+ "style": {
+ "disableScroll": true,
+ "navigationBarTitleText": "密码详情"
+ }
+ },
+ {
+ "path": "pages/keyDetail/keyDetail",
+ "style": {
+ "disableScroll": true,
+ "navigationBarTitleText": "钥匙详情"
+ }
+ },
+ {
+ "path": "pages/notificationList/notificationList",
+ "style": {
+ "navigationBarTitleText": "通知列表"
+ }
+ },
+ {
+ "path": "pages/notificationDetail/notificationDetail",
+ "style": {
+ "navigationBarTitleText": "消息详情"
+ }
+ },
+ {
+ "path": "pages/addLockGuid/addLockGuid",
+ "style": {
+ "navigationBarTitleText": "添加锁",
+ "disableScroll": true
+ }
+ }
+ ],
+ "globalStyle": {
+ "navigationBarTextStyle": "white",
+ "navigationBarTitleText": "星星锁",
+ "navigationBarBackgroundColor": "#63b8af",
+ "backgroundColor": "#F3F3F3",
+ "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": "我的"
+ }
+ ]
+ }
}
diff --git a/pages/addLockGuid/addLockGuid.vue b/pages/addLockGuid/addLockGuid.vue
new file mode 100644
index 0000000..02fbbb7
--- /dev/null
+++ b/pages/addLockGuid/addLockGuid.vue
@@ -0,0 +1,80 @@
+
+
+ 摸亮触摸屏
+
+ 摸亮触摸屏,锁进入可添加状态,点击下一步
+ 下一步
+
+
+
+
+
+
diff --git a/pages/home/home.vue b/pages/home/home.vue
index fd34b7b..98bb142 100644
--- a/pages/home/home.vue
+++ b/pages/home/home.vue
@@ -5,16 +5,16 @@
-
+
+ v-model="lockSearch.searchStr" bgColor="#ffffff" :showAction="false" maxlength="50">
- 填加锁时,手机必须在锁旁边
+ 添加锁时,手机必须在锁旁边
@@ -77,7 +77,7 @@
-
@@ -124,7 +124,7 @@
...mapState(useLockStore, ['lockList', 'lockTotal', 'lockSearch']),
...mapState(useBluetoothStore, ['bluetoothStatus', 'isInitBluetooth', 'keyId', 'currentLockInfo']),
},
- async onLoad() {
+ async onLoad(data) {
uni.showLoading({
title: '加载中',
mask: true
@@ -158,6 +158,8 @@
this.penging = false
uni.hideLoading()
}
+ const _data = JSON.parse(JSON.stringify(data))
+ this.shareJump(_data)
},
methods: {
timeFormat,
@@ -165,7 +167,7 @@
...mapActions(useLockStore, ['getLockList', 'updateLockList', 'getRole', 'getTimeLimit', 'updateLockSearch', 'getPowerIcon']),
...mapActions(useBluetoothStore, ['getBluetoothStatus', 'initAndListenBluetooth', 'updateCurrentLockInfo',
'checkSetting', 'updateKeyId', 'resetDevice']),
- ...mapActions(useBasicStore, ['routeJump', 'getDeviceInfo', 'getNetworkType']),
+ ...mapActions(useBasicStore, ['routeJump', 'getDeviceInfo', 'getNetworkType', 'shareJump']),
async deleteLock(lock, groupIndex, lockIndex) {
const that = this
const netWork = await this.getNetworkType()
@@ -403,21 +405,9 @@
this.focus = false
},
async toSearchDevice() {
- if(this.bluetoothStatus !== 0) {
- this.getBluetoothStatus()
- return
- }
- let result = true
- if(!this.isInitBluetooth) {
- result = await this.initAndListenBluetooth()
- }
- if(result) {
- this.routeJump({
- name: 'searchDevice'
- })
- } else {
- this.checkSetting()
- }
+ this.routeJump({
+ name: 'addLockGuid'
+ })
},
async toLockDeatil(lock) {
if(!(this.bluetoothStatus === 0 || this.bluetoothStatus === -1)) {
@@ -620,7 +610,7 @@ page {
.button-add-big {
width: 400rpx;
height: 400rpx;
- margin-top: 250rpx;
+ margin-top: 300rpx;
margin-left: 136rpx;
}
diff --git a/pages/keyList/keyList.vue b/pages/keyList/keyList.vue
index eab770d..6ee125f 100644
--- a/pages/keyList/keyList.vue
+++ b/pages/keyList/keyList.vue
@@ -6,7 +6,7 @@
+ v-model="keySearch.searchStr" bgColor="#ffffff" :showAction="false" maxlength="50">
diff --git a/pages/mine/mine.vue b/pages/mine/mine.vue
index 7ae0dea..208e83e 100644
--- a/pages/mine/mine.vue
+++ b/pages/mine/mine.vue
@@ -1,7 +1,5 @@
-
@@ -67,6 +65,7 @@
import { phoneLoginRequest } from '@/api/user'
import env from '@/config/env'
import { setStorage, getStorage, removeStorage } from '@/utils/storage'
+ import { useNotificationStore } from '../../stores/notification'
export default {
data() {
@@ -80,7 +79,8 @@
},
computed: {
...mapState(useUserStore, ['isLogin']),
- ...mapState(useLockStore, ['lockSearch'])
+ ...mapState(useLockStore, ['lockSearch']),
+ ...mapState(useNotificationStore, ['notificationSearch'])
},
async onLoad() {
this.buttonInfo = await this.getButtonInfo()
@@ -97,6 +97,7 @@
methods: {
...mapActions(useBasicStore, ['getButtonInfo', 'routeJump']),
...mapActions(useLockStore, ['getLockList', 'updateLockSearch']),
+ ...mapActions(useNotificationStore, ['getNotificationList', 'updateNotificationSearch']),
...mapActions(useUserStore, ['updateLoginStatus', 'phoneLogin', 'updateUserInfo', 'getUserInfo',
'checkSession']),
selectEnv(env) {
@@ -138,6 +139,10 @@
})
this.getUserInfo()
this.getLockList(this.lockSearch)
+ this.updateNotificationSearch({
+ pageNo: 1
+ })
+ this.getNotificationList(this.notificationSearch)
uni.showToast({
title: '账号切换成功',
icon: 'none'
diff --git a/pages/notificationDetail/notificationDetail.vue b/pages/notificationDetail/notificationDetail.vue
new file mode 100644
index 0000000..aa3ec18
--- /dev/null
+++ b/pages/notificationDetail/notificationDetail.vue
@@ -0,0 +1,56 @@
+
+
+ 创建时间:{{ timeFormat(notification.createdAt, 'yyyy-mm-dd h:M') }}
+ {{notification.data}}
+
+
+
+
+
+
+
+
diff --git a/pages/notificationList/notificationList.vue b/pages/notificationList/notificationList.vue
new file mode 100644
index 0000000..e2d3e46
--- /dev/null
+++ b/pages/notificationList/notificationList.vue
@@ -0,0 +1,371 @@
+
+
+
+
+
+
+ 暂无数据
+
+
+
+
+
+
+
+
+
+
+ {{ notification.data
+ }}
+ {{ timeFormat(notification.createdAt, 'yyyy-mm-dd h:M') }}
+
+
+
+
+
+
+
+ 因智能门锁与账号绑定,登录为手机号登录
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/passwordList/passwordList.vue b/pages/passwordList/passwordList.vue
index 3ed0ea8..aef2bea 100644
--- a/pages/passwordList/passwordList.vue
+++ b/pages/passwordList/passwordList.vue
@@ -6,7 +6,7 @@
+ v-model="passwordSearch.searchStr" bgColor="#ffffff" :showAction="false" maxlength="50">
@@ -193,7 +193,7 @@ export default {
if(code === 0) {
const { code: requestCode, message } = await resetPsaawordListRequest({
lockId: that.currentLockInfo.lockId,
- passwordKey: that.currentLockInfo.bluetooth.passwordKey
+ passwordKey: that.currentLockInfo.encrpyKey
})
console.log('重置密码返回', requestCode, message)
if(requestCode === 0) {
diff --git a/pages/setting/setting.vue b/pages/setting/setting.vue
index 9149230..39f3c1b 100644
--- a/pages/setting/setting.vue
+++ b/pages/setting/setting.vue
@@ -2,7 +2,7 @@
- 名称
+ 名称
{{currentLockInfo.lockAlias}}
diff --git a/pages/verifyEmail/verifyEmail.vue b/pages/verifyEmail/verifyEmail.vue
index 1e5519e..3e530f3 100644
--- a/pages/verifyEmail/verifyEmail.vue
+++ b/pages/verifyEmail/verifyEmail.vue
@@ -2,7 +2,7 @@
为了你的账号安全,修改账号前请先使用验证码验证
-
{{text}}
diff --git a/static/images/background_mine.png b/static/images/background_mine.png
deleted file mode 100644
index 41ee0d6..0000000
Binary files a/static/images/background_mine.png and /dev/null differ
diff --git a/static/images/icon_delete.png b/static/images/icon_delete.png
new file mode 100644
index 0000000..0c990ec
Binary files /dev/null and b/static/images/icon_delete.png differ
diff --git a/static/images/icon_lock_touch_screen.png b/static/images/icon_lock_touch_screen.png
new file mode 100755
index 0000000..de3f363
Binary files /dev/null and b/static/images/icon_lock_touch_screen.png differ
diff --git a/static/images/icon_notification_read.png b/static/images/icon_notification_read.png
new file mode 100755
index 0000000..95dc3cb
Binary files /dev/null and b/static/images/icon_notification_read.png differ
diff --git a/static/images/icon_notification_unread.png b/static/images/icon_notification_unread.png
new file mode 100755
index 0000000..be7a877
Binary files /dev/null and b/static/images/icon_notification_unread.png differ
diff --git a/static/images/img.png b/static/images/img.png
deleted file mode 100644
index e6d877c..0000000
Binary files a/static/images/img.png and /dev/null differ
diff --git a/static/images/tabbar_notification_no_select.png b/static/images/tabbar_notification_no_select.png
new file mode 100644
index 0000000..9ea5288
Binary files /dev/null and b/static/images/tabbar_notification_no_select.png differ
diff --git a/static/images/tabbar_notification_select.png b/static/images/tabbar_notification_select.png
new file mode 100644
index 0000000..c2b0925
Binary files /dev/null and b/static/images/tabbar_notification_select.png differ
diff --git a/stores/basic.js b/stores/basic.js
index b5ae7c6..127e622 100644
--- a/stores/basic.js
+++ b/stores/basic.js
@@ -96,6 +96,21 @@ const pages = [
name: 'keyDetail',
path: '/pages/keyDetail/keyDetail',
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,
// 胶囊按钮的位置信息
- buttonInfo: null
+ buttonInfo: null,
+ // 分享配置
+ shareConfig: {}
}
},
actions: {
@@ -207,6 +224,47 @@ export const useBasicStore = defineStore('basic', {
}, 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
+ }
+ },
}
})
diff --git a/stores/notification.js b/stores/notification.js
new file mode 100644
index 0000000..4ed4ce3
--- /dev/null
+++ b/stores/notification.js
@@ -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 }
+ }
+ },
+ }
+})
diff --git a/stores/user.js b/stores/user.js
index a133d9a..4d0e2f7 100644
--- a/stores/user.js
+++ b/stores/user.js
@@ -5,6 +5,7 @@ import { defineStore } from 'pinia'
import { getUserInfoRequest, loginRequest, phoneLoginRequest } from '@/api/user'
import { useLockStore } from '@/stores/lock'
import { setStorage, getStorage } from '@/utils/storage'
+import { useNotificationStore } from '@/stores/notification'
export const useUserStore = defineStore('user', {
state() {
@@ -35,7 +36,7 @@ export const useUserStore = defineStore('user', {
async phoneLogin(params) {
const { iv, encryptedData } = params
const openid = getStorage('openid')
- const { code, data, message } = await phoneLoginRequest({ iv, encryptedData, openid })
+ const { code, data } = await phoneLoginRequest({ iv, encryptedData, openid })
if(code === 0) {
setStorage('token', data.accessToken)
this.getUserInfo()
@@ -44,6 +45,11 @@ export const useUserStore = defineStore('user', {
pageNo: 1
})
useLockStore().getLockList(useLockStore().lockSearch)
+ useNotificationStore().updateNotificationSearch({
+ ...useNotificationStore().notificationSearch,
+ pageNo: 1
+ })
+ useNotificationStore().getNotificationList(useNotificationStore().notificationSearch)
return true
} else {
return false