修复安卓设备回退toast无法显示bug
This commit is contained in:
parent
86c398b754
commit
053d14db47
@ -14,6 +14,7 @@ import { useUserStore } from '@/stores/user'
|
||||
import { mapActions, mapState } from 'pinia'
|
||||
import { bindLockAdmin } from '@/api/lock'
|
||||
import { useLockStore } from '@/stores/lock'
|
||||
import { useBasicStore } from '@/stores/basic'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
@ -34,6 +35,7 @@ export default {
|
||||
methods: {
|
||||
...mapActions(useBluetoothStore, ['addLockUser']),
|
||||
...mapActions(useLockStore, ['getLockList', 'updateLockSearch']),
|
||||
...mapActions(useBasicStore, ['backAndToast']),
|
||||
uopdateName(data) {
|
||||
this.name = data.detail.value
|
||||
},
|
||||
@ -71,15 +73,8 @@ export default {
|
||||
password
|
||||
})
|
||||
if(addUserCode !== 0) {
|
||||
uni.navigateBack({
|
||||
complete() {
|
||||
uni.showToast({
|
||||
title: '添加失败,请重试',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
uni.hideLoading()
|
||||
this.backAndToast('添加失败,请重试')
|
||||
return
|
||||
}
|
||||
const params = {
|
||||
@ -122,14 +117,7 @@ export default {
|
||||
})
|
||||
this.getLockList(this.lockSearch)
|
||||
uni.hideLoading()
|
||||
uni.navigateBack({
|
||||
complete() {
|
||||
uni.showToast({
|
||||
title: '添加成功',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
this.backAndToast('添加成功')
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
|
||||
@ -80,7 +80,7 @@ export default {
|
||||
this.temporaryInvalidTime = this.setTime()
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useBasicStore, ['getDeviceInfo']),
|
||||
...mapActions(useBasicStore, ['getDeviceInfo', 'backAndToast']),
|
||||
...mapActions(useLockStore, ['getKeyList', 'updateKeySearch']),
|
||||
setTime () {
|
||||
const now = new Date()
|
||||
@ -154,14 +154,7 @@ export default {
|
||||
pageNo: 1
|
||||
})
|
||||
this.getKeyList(this.keySearch)
|
||||
uni.navigateBack({
|
||||
complete: () => {
|
||||
uni.showToast({
|
||||
title: '钥匙已发送',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
this.backAndToast('钥匙已发送')
|
||||
} else if(code === 425) {
|
||||
this.pending = false
|
||||
await this.createKey(type, true)
|
||||
|
||||
@ -70,7 +70,7 @@ export default {
|
||||
this.temporaryTime = this.setTime()
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useBasicStore, ['getDeviceInfo']),
|
||||
...mapActions(useBasicStore, ['getDeviceInfo', 'backAndToast']),
|
||||
...mapActions(useLockStore, ['getPasswordList', 'updatePasswordSearch']),
|
||||
setTime() {
|
||||
const now = new Date()
|
||||
@ -80,6 +80,7 @@ export default {
|
||||
return now.getTime()
|
||||
},
|
||||
async createPassword(type) {
|
||||
const that = this
|
||||
if((type === 'temporary' && this.temporaryName === '') || (type === 'permanent' && this.permanentName === '')) {
|
||||
uni.showToast({
|
||||
title: '名称不能为空',
|
||||
@ -131,14 +132,7 @@ export default {
|
||||
uni.setClipboardData({
|
||||
data: data.keyboardPwd,
|
||||
success: () => {
|
||||
uni.navigateBack({
|
||||
complete: () => {
|
||||
uni.showToast({
|
||||
title: '复制成功',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
that.backAndToast('复制成功')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -33,6 +33,7 @@ import { mapActions, mapState } from 'pinia'
|
||||
import { useLockStore } from '@/stores/lock'
|
||||
import { timeFormat } from 'uview-plus'
|
||||
import { deleteKeyRequest } from '@/api/key'
|
||||
import { useBasicStore } from '@/stores/basic'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
@ -44,6 +45,7 @@ export default {
|
||||
methods: {
|
||||
timeFormat,
|
||||
...mapActions(useLockStore, ['updateKeySearch', 'getKeyList']),
|
||||
...mapActions(useBasicStore, ['backAndToast']),
|
||||
async deleteKey () {
|
||||
const that = this
|
||||
uni.showModal({
|
||||
@ -65,14 +67,7 @@ export default {
|
||||
pageNo: 1
|
||||
})
|
||||
await that.getKeyList(that.keySearch)
|
||||
uni.navigateBack({
|
||||
complete: () => {
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
that.backAndToast('删除成功')
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
|
||||
@ -52,7 +52,7 @@
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { useLockStore } from '@/stores/lock'
|
||||
import { mapState, mapActions } from 'pinia'
|
||||
import { getUserInfoRequest, phoneLoginRequest } from '@/api/user'
|
||||
import { phoneLoginRequest } from '@/api/user'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@ -70,7 +70,8 @@
|
||||
methods: {
|
||||
...mapActions(useBasicStore, ['getButtonInfo', 'routeJump']),
|
||||
...mapActions(useLockStore, ['getLockList', 'updateLockSearch']),
|
||||
...mapActions(useUserStore, ['updateLoginStatus', 'phoneLogin', 'updateUserInfo', 'getUserInfo', 'checkSession']),
|
||||
...mapActions(useUserStore, ['updateLoginStatus', 'phoneLogin', 'updateUserInfo', 'getUserInfo',
|
||||
'checkSession']),
|
||||
async changePhone(res) {
|
||||
if(res.detail.errMsg === 'getPhoneNumber:fail user deny') {
|
||||
return
|
||||
@ -93,9 +94,10 @@
|
||||
if(code === 0) {
|
||||
uni.setStorageSync('token', data.accessToken)
|
||||
this.updateLockSearch({
|
||||
...that.lockSearch,
|
||||
...this.lockSearch,
|
||||
pageNo: 1
|
||||
})
|
||||
this.getUserInfo()
|
||||
this.getLockList(this.lockSearch)
|
||||
uni.showToast({
|
||||
title: '账号切换成功',
|
||||
|
||||
@ -36,6 +36,7 @@ import { timeFormat } from 'uview-plus'
|
||||
import { deletePsaawordRequest } from '@/api/keyboardPwd'
|
||||
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { useBasicStore } from '@/stores/basic'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
@ -44,12 +45,13 @@ export default {
|
||||
computed: {
|
||||
...mapState(useLockStore, ['currentPasswordInfo', 'passwordSearch']),
|
||||
...mapState(useBluetoothStore, ['currentLockInfo', 'keyId']),
|
||||
...mapState(useUserStore, ['userInfo']),
|
||||
...mapState(useUserStore, ['userInfo'])
|
||||
},
|
||||
methods: {
|
||||
timeFormat,
|
||||
...mapActions(useBluetoothStore, ['setLockPassword']),
|
||||
...mapActions(useLockStore, ['updatePasswordSearch', 'getPasswordList']),
|
||||
...mapActions(useBasicStore, ['backAndToast']),
|
||||
async deletePassword () {
|
||||
const that = this
|
||||
uni.showModal({
|
||||
@ -86,14 +88,7 @@ export default {
|
||||
pageNo: 1
|
||||
})
|
||||
that.getPasswordList(that.passwordSearch)
|
||||
uni.navigateBack({
|
||||
complete: () => {
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
that.backAndToast('删除成功')
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
|
||||
@ -49,6 +49,7 @@ import { deleteLockRequest } from '@/api/lock'
|
||||
import { useLockStore } from '@/stores/lock'
|
||||
import { updateLockSettingRequest } from '@/api/lockSetting'
|
||||
import { deleteKeyRequest } from '@/api/key'
|
||||
import { useBasicStore } from '@/stores/basic'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
@ -67,6 +68,7 @@ export default {
|
||||
methods: {
|
||||
...mapActions(useBluetoothStore, ['resetDevice', 'updateCurrentLockInfo']),
|
||||
...mapActions(useLockStore, ['getLockList', 'updateLockSearch']),
|
||||
...mapActions(useBasicStore, ['backAndToast']),
|
||||
async changeUnlockApp(value) {
|
||||
uni.showLoading({
|
||||
title: '更新中',
|
||||
@ -122,15 +124,7 @@ export default {
|
||||
pageNo: 1
|
||||
})
|
||||
that.getLockList(that.lockSearch)
|
||||
uni.navigateBack({
|
||||
delta: 2,
|
||||
complete: () => {
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
that.backAndToast('删除成功', 2)
|
||||
uni.navigateBack()
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
@ -157,15 +151,7 @@ export default {
|
||||
pageNo: 1
|
||||
})
|
||||
that.getLockList(that.lockSearch)
|
||||
uni.navigateBack({
|
||||
delta: 2,
|
||||
complete: () => {
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
that.backAndToast('删除成功', 2)
|
||||
uni.navigateBack()
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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: '昵称更新失败',
|
||||
|
||||
@ -17,6 +17,7 @@ import { mapActions, mapState } from 'pinia'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { changePasswordRequest, getEmailCodeRequest, updatePasswordRequest } from '@/api/user'
|
||||
import { test } from 'uview-plus'
|
||||
import { useBasicStore } from '@/stores/basic'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
@ -32,6 +33,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useUserStore, ['updateUserInfo']),
|
||||
...mapActions(useBasicStore, ['backAndToast']),
|
||||
updateNewPassword (data) {
|
||||
this.password = data.detail.value
|
||||
},
|
||||
@ -100,18 +102,7 @@ export default {
|
||||
channel: '1'
|
||||
})
|
||||
if (code === 0) {
|
||||
this.updateUserInfo({
|
||||
...this.userInfo,
|
||||
nickname: this.nickname
|
||||
})
|
||||
uni.navigateBack({
|
||||
complete () {
|
||||
uni.showToast({
|
||||
title: '密码重置成功',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
this.backAndToast('密码重置成功')
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
|
||||
@ -46,6 +46,7 @@
|
||||
import { getQuestionAnswerRequest, getQuestionListRequest, updateQuestionAnswerRequest } from '@/api/safeAnswer'
|
||||
import { mapActions, mapState } from 'pinia'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { useBasicStore } from '@/stores/basic'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@ -75,6 +76,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useUserStore, ['updateUserInfo']),
|
||||
...mapActions(useBasicStore, ['backAndToast']),
|
||||
async updateAnswer() {
|
||||
console.log('答案', this.answer)
|
||||
for(let i = 0; i < this.answer.length; i++) {
|
||||
@ -107,14 +109,7 @@ export default {
|
||||
...this.userInfo,
|
||||
haveSafeAnswer: 1
|
||||
})
|
||||
uni.navigateBack({
|
||||
complete() {
|
||||
uni.showToast({
|
||||
title: '安全问题设置成功',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
this.backAndToast('设置成功')
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
|
||||
@ -82,9 +82,9 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useBasicStore, ['routeJump']),
|
||||
...mapActions(useUserStore, ['updateUserInfo', 'checkSession']),
|
||||
...mapActions(useUserStore, ['updateUserInfo', 'checkSession', 'getUserInfo']),
|
||||
async rebindPhone(detail) {
|
||||
if(data.detail.errMsg === 'getPhoneNumber:fail user deny') {
|
||||
if(detail.detail.errMsg === 'getPhoneNumber:fail user deny') {
|
||||
return
|
||||
}
|
||||
if(this.pending) {
|
||||
@ -98,12 +98,13 @@ export default {
|
||||
iv: detail.detail.iv
|
||||
})
|
||||
if(code === 0) {
|
||||
this.updateUserInfo({
|
||||
...this.userInfo,
|
||||
mobile: data.mobile
|
||||
})
|
||||
this.getUserInfo()
|
||||
// this.updateUserInfo({
|
||||
// ...this.userInfo,
|
||||
// mobile: data.mobile
|
||||
// })
|
||||
uni.showToast({
|
||||
title: '手机号换绑成功',
|
||||
title: '更换成功',
|
||||
icon: 'none'
|
||||
})
|
||||
} else {
|
||||
@ -113,10 +114,7 @@ export default {
|
||||
})
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '手机号换绑失败,请重试',
|
||||
icon: 'none'
|
||||
})
|
||||
this.rebindPhone()
|
||||
}
|
||||
this.pending = false
|
||||
},
|
||||
|
||||
@ -87,37 +87,6 @@ export default {
|
||||
},
|
||||
updateInput(data) {
|
||||
this.verificationCode = data.detail.value
|
||||
},
|
||||
async updateName() {
|
||||
if(this.nickname === '') {
|
||||
uni.showToast({
|
||||
title: '昵称不能为空',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
const { code } = await updateUserInfoRequest({
|
||||
nickname: this.nickname
|
||||
})
|
||||
if(code === 0) {
|
||||
this.updateUserInfo({
|
||||
...this.userInfo,
|
||||
nickname: this.nickname
|
||||
})
|
||||
uni.navigateBack({
|
||||
complete() {
|
||||
uni.showToast({
|
||||
title: '昵称更新成功',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '昵称更新失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,6 +181,21 @@ export const useBasicStore = defineStore('basic', {
|
||||
}
|
||||
}
|
||||
return totalWidth
|
||||
},
|
||||
// 回退页面并弹出toast提示
|
||||
backAndToast(message, delta = 1) {
|
||||
const that = this
|
||||
uni.navigateBack({
|
||||
delta: delta,
|
||||
complete: function () {
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}, 200)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user