diff --git a/App.vue b/App.vue index 15ddf32..6d7b2f9 100644 --- a/App.vue +++ b/App.vue @@ -10,6 +10,25 @@ // 更新登录状态 updateIsLogin(isLogin) { useUserStore().updateLoginStatus(isLogin) + }, + // 账号信息 + appid: '', + // 小程序版本 + envVersion: '', + // 获取环境配置 + getEnvConfig() { + const envVserionStorage = uni.getStorageSync('envVersion') + if(envVserionStorage) { + return envVserionStorage + } else { + if(this.envVersion === 'develop') { + return 'DEV' + } else if(this.envVersion === 'trial') { + return 'PRE' + } else { + return 'PROD' + } + } } }, computed: { @@ -22,7 +41,7 @@ const checkResult = await this.checkSetting() console.log(checkResult) if(checkResult === true) { - this.initAndListenBluetooth() + this.initAndListenBluetooth(false) } }, onShow() { diff --git a/api/check.js b/api/check.js new file mode 100644 index 0000000..215667c --- /dev/null +++ b/api/check.js @@ -0,0 +1,12 @@ +import request from '../utils/request' + +// check 检查模块 + +// 获取服务器时间 +export function getServerDatetime(data) { + return request({ + url: '/check/getServerDatetime', + method: 'POST', + data + }) +} diff --git a/api/geocode.js b/api/geocode.js new file mode 100644 index 0000000..dd85388 --- /dev/null +++ b/api/geocode.js @@ -0,0 +1,12 @@ +import request from '../utils/request' + +// geocode 地理编码模块 + +// 获取地址信息 +export function getGeocodeAddress(data) { + return request({ + url: '/geocode/getAddress', + method: 'POST', + data + }) +} diff --git a/api/key.js b/api/key.js new file mode 100644 index 0000000..5733885 --- /dev/null +++ b/api/key.js @@ -0,0 +1,57 @@ +import request from '../utils/request' + +// key 电子钥匙模块 + +// 获取电子钥匙列表 +export function getKeyListRequest(data) { + return request({ + url: '/key/listUser', + method: 'POST', + data + }) +} + +// 重置电子钥匙 +export function resetKeyRequest(data) { + return request({ + url: '/key/reset', + method: 'POST', + data + }) +} + +// 创建电子钥匙 +export function createKeyRequest(data) { + return request({ + url: '/v2/key/send', + method: 'POST', + data + }) +} + +// 删除电子钥匙 +export function deleteKeyRequest(data) { + return request({ + url: '/key/delete', + method: 'POST', + data + }) +} + +// 更新锁用户 +export function updateLockUserNoRequest(data) { + return request({ + url: '/key/updateLockUserNo', + method: 'POST', + data + }) +} + +// 获取所有锁用户 +export function getUserNoListRequest(data) { + return request({ + url: '/key/getUserNoList', + method: 'POST', + data + }) +} diff --git a/api/keyboardPwd.js b/api/keyboardPwd.js new file mode 100644 index 0000000..59afe24 --- /dev/null +++ b/api/keyboardPwd.js @@ -0,0 +1,39 @@ +import request from '../utils/request' + +// keyboardPwd 锁密码模块 + +// 获取密码列表 +export function getPsaawordListRequest(data) { + return request({ + url: '/keyboardPwd/listSendRecords', + method: 'POST', + data + }) +} + +// 重置密码 +export function resetPsaawordListRequest(data) { + return request({ + url: '/keyboardPwd/reset', + method: 'POST', + data + }) +} + +// 创建密码 +export function createPsaawordRequest(data) { + return request({ + url: '/keyboardPwd/get', + method: 'POST', + data + }) +} + +// 删除密码 +export function deletePsaawordRequest(data) { + return request({ + url: '/keyboardPwd/delete', + method: 'POST', + data + }) +} diff --git a/api/lock.js b/api/lock.js index d1f39b7..cc58004 100644 --- a/api/lock.js +++ b/api/lock.js @@ -10,3 +10,30 @@ export function getLockListRequest(data) { data }) } + +// 绑定锁管理员 +export function bindLockAdmin(data) { + return request({ + url: '/v2/lock/bindAdmin', + method: 'POST', + data + }) +} + +// 获取手机联网token +export function getLockNetTokenRequest(data) { + return request({ + url: '/lock/getLockNetToken', + method: 'POST', + data + }) +} + +// 删除智能门锁 +export function deleteLockRequest(data) { + return request({ + url: '/lock/delete', + method: 'POST', + data + }) +} diff --git a/api/lockRecords.js b/api/lockRecords.js new file mode 100644 index 0000000..ff27aef --- /dev/null +++ b/api/lockRecords.js @@ -0,0 +1,12 @@ +import request from '../utils/request' + +// lockRecords 锁记录模块 + +// 电子钥匙开门上报 +export function reportOpenDoorRequest(data) { + return request({ + url: '/lockRecords/fromLock', + method: 'POST', + data + }) +} diff --git a/api/lockSetting.js b/api/lockSetting.js new file mode 100644 index 0000000..3a04683 --- /dev/null +++ b/api/lockSetting.js @@ -0,0 +1,12 @@ +import request from '../utils/request' + +// lockSetting 锁设置模块 + +// 更新锁设置 +export function updateLockSettingRequest(data) { + return request({ + url: '/lockSetting/updateLockSetting', + method: 'POST', + data + }) +} diff --git a/api/room.js b/api/room.js new file mode 100644 index 0000000..2670416 --- /dev/null +++ b/api/room.js @@ -0,0 +1,12 @@ +import request from '../utils/request' + +// room 房间模块 + +// 更新锁电量 +export function updateElectricQuantityRequest(data) { + return request({ + url: '/room/uploadElectricQuantity', + method: 'POST', + data + }) +} diff --git a/api/user.js b/api/user.js index 2c2d68d..eef6c04 100644 --- a/api/user.js +++ b/api/user.js @@ -55,3 +55,49 @@ export function getEmailCodeRequest(data) { data }) } + +// 登录 +export function loginRequest(data) { + return request({ + url: '/wechat/mini/login', + method: 'POST', + data + }) +} + +// 注册 +export function phoneLoginRequest(data) { + return request({ + url: '/wechat/mini/phone/login', + method: 'POST', + data + }) +} + +// 更换绑定手机号 +export function rebindPhoneRequest(data) { + return request({ + url: '/wechat/mini/rebindPhone', + method: 'POST', + data + }) +} + +// 验证码更换密码 +export function changePasswordRequest(data) { + return request({ + url: '/wechat/mini/changePassword', + method: 'POST', + data + }) +} + +// 更新云用户时区偏移 +export function updateTimezoneOffsetRequest(data) { + return request({ + url: '/cloudUser/updateSettings', + method: 'POST', + data + }) +} + diff --git a/components/LockDatetimePicker/LockDatetimePicker.vue b/components/LockDatetimePicker/LockDatetimePicker.vue new file mode 100644 index 0000000..5a2219e --- /dev/null +++ b/components/LockDatetimePicker/LockDatetimePicker.vue @@ -0,0 +1,75 @@ + + + + + diff --git a/components/LockInput/LockInput.vue b/components/LockInput/LockInput.vue new file mode 100644 index 0000000..056de2d --- /dev/null +++ b/components/LockInput/LockInput.vue @@ -0,0 +1,60 @@ + + + + + diff --git a/components/SwitchLoading/SwitchLoading.vue b/components/SwitchLoading/SwitchLoading.vue new file mode 100644 index 0000000..569f1cb --- /dev/null +++ b/components/SwitchLoading/SwitchLoading.vue @@ -0,0 +1,95 @@ + + + + + diff --git a/config/env.js b/config/env.js index e30867e..ac08042 100644 --- a/config/env.js +++ b/config/env.js @@ -1,25 +1,30 @@ import request from '@/utils/request' -const version = '1.0.0.0' +const version = '1.0.0' +const buildNumber = 0 const DEV = { name: '开发', baseUrl: 'https://dev.lock.star-lock.cn/api', webviewBaseUrl: 'https://dev.lock.star-lock.cn', - version: version + version, + buildNumber } const PRE = { name: '预发', baseUrl: 'https://pre.lock.star-lock.cn/api', webviewBaseUrl: 'https://pre.lock.star-lock.cn', - version: version + version, + buildNumber } const PROD = { name: '线上', - baseUrl: '', - version: version + baseUrl: 'https://lock.xhjcn.ltd/api', + webviewBaseUrl: 'https://lock.xhjcn.ltd', + version, + buildNumber } // 更换环境的时候 切换导出就行 -export default PRE +export default { DEV, PRE, PROD } diff --git a/manifest.json b/manifest.json index 5330fd3..e7753ea 100644 --- a/manifest.json +++ b/manifest.json @@ -5,49 +5,6 @@ "versionName" : "1.0.0", "versionCode" : "100", "transformPx" : false, - /* 5+App特有相关 */ - "app-plus" : { - "usingComponents" : true, - "nvueStyleCompiler" : "uni-app", - "compilerVersion" : 3, - "splashscreen" : { - "alwaysShowBeforeRender" : true, - "waiting" : true, - "autoclose" : true, - "delay" : 0 - }, - /* 模块配置 */ - "modules" : {}, - /* 应用发布信息 */ - "distribute" : { - /* android打包配置 */ - "android" : { - "permissions" : [ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "" - ] - }, - /* ios打包配置 */ - "ios" : {}, - /* SDK配置 */ - "sdkConfigs" : {} - } - }, - /* 快应用特有相关 */ - "quickapp" : {}, /* 小程序特有相关 */ "mp-weixin" : { "appid" : "wx9829a39e65550757", @@ -55,20 +12,17 @@ "urlCheck" : true, "minified" : true }, + "permission" : { + "scope.bluetooth" : { + "desc" : "蓝牙将用于控制和管理您的智能门锁" + }, + "scope.userLocation" : { + "desc" : "获取您的位置信息将用于智能门锁的位置服务" + } + }, + "requiredPrivateInfos" : [ "getLocation" ], "usingComponents" : true, "lazyCodeLoading" : "requiredComponents" }, - "mp-alipay" : { - "usingComponents" : true - }, - "mp-baidu" : { - "usingComponents" : true - }, - "mp-toutiao" : { - "usingComponents" : true - }, - "uniStatistics" : { - "enable" : false - }, "vueVersion" : "3" } diff --git a/pages.json b/pages.json index 9c0ec72..c8331f0 100644 --- a/pages.json +++ b/pages.json @@ -9,123 +9,139 @@ }, "pages": [ { - "path": "pages/home/home", + "path": "pages/home/home" + }, + { + "path": "pages/selectAddress/selectAddress", "style": { - "navigationBarTitleText": "星星锁", - "navigationBarTextStyle": "white", - "navigationBarBackgroundColor": "#63b8af", - "navigationStyle": "default" + "navigationBarTitleText": "锁地址", + "disableScroll": true } }, { - "path": "pages/mine/mine", - "style": { - "navigationBarTitleText": "星星锁", - "navigationBarTextStyle": "white", - "navigationBarBackgroundColor": "#63b8af", - "navigationStyle": "default" - } - }, - { - "path": "pages/index/index" + "path": "pages/mine/mine" }, { "path": "pages/userInfo/userInfo", "style": { - "navigationBarTitleText": "个人信息", - "navigationBarTextStyle": "white", - "navigationBarBackgroundColor": "#63b8af", - "navigationStyle": "default" + "navigationBarTitleText": "个人信息" } }, { "path": "pages/updateName/updateName", "style": { - "navigationBarTitleText": "修改昵称", - "navigationBarTextStyle": "white", - "navigationBarBackgroundColor": "#63b8af", - "navigationStyle": "default" + "navigationBarTitleText": "修改昵称" } }, { "path": "pages/updatePassword/updatePassword", "style": { - "navigationBarTitleText": "重置密码", - "navigationBarTextStyle": "white", - "navigationBarBackgroundColor": "#63b8af", - "navigationStyle": "default" + "navigationBarTitleText": "重置密码" } }, { "path": "pages/updateEmail/updateEmail", "style": { - "navigationBarTitleText": "修改邮箱", - "navigationBarTextStyle": "white", - "navigationBarBackgroundColor": "#63b8af", - "navigationStyle": "default" + "navigationBarTitleText": "修改邮箱" } }, { "path": "pages/verifyEmail/verifyEmail", "style": { - "navigationBarTitleText": "验证邮箱", - "navigationBarTextStyle": "white", - "navigationBarBackgroundColor": "#63b8af", - "navigationStyle": "default" + "navigationBarTitleText": "验证邮箱" } }, { "path": "pages/safeQuestion/safeQuestion", "style": { - "navigationBarTitleText": "安全问题", - "navigationBarTextStyle": "white", - "navigationBarBackgroundColor": "#63b8af", - "navigationStyle": "default" + "navigationBarTitleText": "安全问题" } }, { "path": "pages/updateSafeQuestion/updateSafeQuestion", "style": { - "navigationBarTitleText": "修改安全问题", - "navigationBarTextStyle": "white", - "navigationBarBackgroundColor": "#63b8af", - "navigationStyle": "default" + "navigationBarTitleText": "修改安全问题" } }, { "path": "pages/webview/webview", "style": { - "navigationBarTitleText": "介绍", - "navigationBarTextStyle": "white", - "navigationBarBackgroundColor": "#63b8af", - "navigationStyle": "default" + "navigationBarTitleText": "介绍" } }, { "path": "pages/lockDetail/lockDetail", "style": { - "navigationBarTitleText": "星星锁", - "navigationBarTextStyle": "white", - "navigationBarBackgroundColor": "#63b8af", - "navigationStyle": "default" + "navigationBarTitleText": "星星锁" + } + }, + { + "path": "pages/bindLock/bindLock", + "style": { + "navigationBarTitleText": "添加锁" } }, { "path": "pages/searchDevice/searchDevice", "style": { - "navigationBarTitleText": "搜索", - "navigationBarTextStyle": "white", - "navigationBarBackgroundColor": "#63b8af", - "navigationStyle": "default" + "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": "black", + "navigationBarTextStyle": "white", "navigationBarTitleText": "星星锁", - "navigationBarBackgroundColor": "#F3F3F3", + "navigationBarBackgroundColor": "#63b8af", "backgroundColor": "#F3F3F3", - "navigationStyle": "custom" + "navigationStyle": "default" }, "tabBar": { "color": "#a3a3a3", diff --git a/pages/bindLock/bindLock.vue b/pages/bindLock/bindLock.vue new file mode 100644 index 0000000..c8232df --- /dev/null +++ b/pages/bindLock/bindLock.vue @@ -0,0 +1,177 @@ + + + + + + + diff --git a/pages/createKey/createKey.vue b/pages/createKey/createKey.vue new file mode 100644 index 0000000..f6d9f4e --- /dev/null +++ b/pages/createKey/createKey.vue @@ -0,0 +1,237 @@ + + + + + + + diff --git a/pages/createPassword/createPassword.vue b/pages/createPassword/createPassword.vue new file mode 100644 index 0000000..dd1dfad --- /dev/null +++ b/pages/createPassword/createPassword.vue @@ -0,0 +1,200 @@ + + + + + + + diff --git a/pages/home/home.vue b/pages/home/home.vue index d96a461..1426b33 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -2,17 +2,18 @@ - + v-model="lockSearch.searchStr" bgColor="#ffffff" :showAction="false" maxlength="20"> - - + + 填加锁时,手机必须在锁旁边 @@ -32,9 +33,9 @@ {{getRole(lock.userType)}} - {{lock.lockName}} + {{lock.lockAlias}} - {{ getTimeLimit(lock.keyType) }} + {{ getTimeLimit(lock.keyType) }} {{ timeFormat(lock.startDate, 'yyyy-mm-dd h:M') }} {{ timeFormat(lock.endDate, 'yyyy-mm-dd h:M ') + getTimeLimit(lock.keyType) }} @@ -45,19 +46,23 @@ - - + 因智能门锁与账号绑定,登录为手机号登录 + + - - diff --git a/pages/keyDetail/keyDetail.vue b/pages/keyDetail/keyDetail.vue new file mode 100644 index 0000000..aa9aa4a --- /dev/null +++ b/pages/keyDetail/keyDetail.vue @@ -0,0 +1,120 @@ + + + + + + + diff --git a/pages/keyList/keyList.vue b/pages/keyList/keyList.vue new file mode 100644 index 0000000..303b8ce --- /dev/null +++ b/pages/keyList/keyList.vue @@ -0,0 +1,313 @@ + + + + + + + diff --git a/pages/lockDetail/lockDetail.vue b/pages/lockDetail/lockDetail.vue index 608c2be..65c3c2d 100644 --- a/pages/lockDetail/lockDetail.vue +++ b/pages/lockDetail/lockDetail.vue @@ -1,17 +1,332 @@ - diff --git a/pages/mine/mine.vue b/pages/mine/mine.vue index 05c5914..f848844 100644 --- a/pages/mine/mine.vue +++ b/pages/mine/mine.vue @@ -31,35 +31,132 @@ - 退出 + + {{env.name}}环境 版本号:{{env.version}}+{{env.buildNumber}} + 切换环境 + + - + 因智能门锁与账号绑定,登录为手机号登录 + + + {{env.name}}环境 版本号:{{env.version}}+{{env.buildNumber}} + 切换环境 + - + + + + @@ -136,23 +220,48 @@ page { background: #EBEBEB; } -.button-logout { +.switch-account { position: absolute; border-radius: 46rpx; bottom: 60rpx; - width: 710rpx; + width: 600rpx; height: 80rpx; line-height: 80rpx; text-align: center; - margin-left: 20rpx; - background: #ec433c; + margin-left: 75rpx; + background: #63b8af; color: #ffffff; font-size: 40rpx; font-weight: bold; } +.env { + position: absolute; + bottom: 180rpx; + width: 600rpx; + line-height: 80rpx; + text-align: center; + margin-left: 75rpx; + font-size: 40rpx; + font-weight: bold; + + .env-text { + color: #999999; + font-size: 30rpx; + } + + .env-button { + border-radius: 46rpx; + background: #f0ad4e; + color: #ffffff; + font-size: 40rpx; + font-weight: bold; + width: 600rpx; + height: 80rpx; + } +} + .button-login { - margin-top: 40vh; border-radius: 46rpx; width: 650rpx; height: 120rpx; @@ -164,4 +273,12 @@ page { font-size: 48rpx; font-weight: bold; } + +.tips { + margin-top: 35vh; + padding: 32rpx 0; + text-align: center; + font-size: 28rpx; + color: #999999; +} diff --git a/pages/passwordDetail/passwordDetail.vue b/pages/passwordDetail/passwordDetail.vue new file mode 100644 index 0000000..abfd8bc --- /dev/null +++ b/pages/passwordDetail/passwordDetail.vue @@ -0,0 +1,148 @@ + + + + + + + diff --git a/pages/passwordList/passwordList.vue b/pages/passwordList/passwordList.vue new file mode 100644 index 0000000..da16990 --- /dev/null +++ b/pages/passwordList/passwordList.vue @@ -0,0 +1,334 @@ + + + + + + + diff --git a/pages/searchDevice/searchDevice.vue b/pages/searchDevice/searchDevice.vue index 608c2be..3a33715 100644 --- a/pages/searchDevice/searchDevice.vue +++ b/pages/searchDevice/searchDevice.vue @@ -1,17 +1,162 @@ + + diff --git a/pages/selectAddress/selectAddress.vue b/pages/selectAddress/selectAddress.vue new file mode 100644 index 0000000..516ade8 --- /dev/null +++ b/pages/selectAddress/selectAddress.vue @@ -0,0 +1,256 @@ + + + + + + + diff --git a/pages/setting/setting.vue b/pages/setting/setting.vue new file mode 100644 index 0000000..dd5b8f6 --- /dev/null +++ b/pages/setting/setting.vue @@ -0,0 +1,218 @@ + + + + + + + diff --git a/pages/updateEmail/updateEmail.vue b/pages/updateEmail/updateEmail.vue index cc45226..59136d1 100644 --- a/pages/updateEmail/updateEmail.vue +++ b/pages/updateEmail/updateEmail.vue @@ -42,7 +42,7 @@ export default { }, methods: { ...mapActions(useUserStore, ['updateUserInfo']), - ...mapActions(useBasicStore, ['routeJump']), + ...mapActions(useBasicStore, ['routeJump', 'backAndToast']), updateInputEmail(data) { this.email = data.detail.value }, @@ -100,14 +100,7 @@ export default { ...this.userInfo, email: this.email }) - uni.navigateBack({ - complete () { - uni.showToast({ - title: '邮箱更新成功', - icon: 'none' - }) - } - }) + this.backAndToast('邮箱绑定成功') } else { uni.showToast({ title: message, diff --git a/pages/updateName/updateName.vue b/pages/updateName/updateName.vue index 97f7538..572c12b 100644 --- a/pages/updateName/updateName.vue +++ b/pages/updateName/updateName.vue @@ -10,6 +10,7 @@ import { mapActions, mapState } from 'pinia' import { useUserStore } from '@/stores/user' import { updateUserInfoRequest } from '@/api/user' +import { useBasicStore } from '@/stores/basic' export default { data() { @@ -26,6 +27,7 @@ export default { }, methods: { ...mapActions(useUserStore, ['updateUserInfo']), + ...mapActions(useBasicStore, ['backAndToast']), updateInput(data) { this.nickname = data.detail.value console.log(data) @@ -50,14 +52,7 @@ export default { ...this.userInfo, nickname: this.nickname }) - uni.navigateBack({ - complete() { - uni.showToast({ - title: '昵称更新成功', - icon: 'none' - }) - } - }) + this.backAndToast('昵称更新成功') } else { uni.showToast({ title: '昵称更新失败', diff --git a/pages/updatePassword/updatePassword.vue b/pages/updatePassword/updatePassword.vue index 11462b3..87e9317 100644 --- a/pages/updatePassword/updatePassword.vue +++ b/pages/updatePassword/updatePassword.vue @@ -1,11 +1,12 @@