Skip to content

Commit

Permalink
fixed(frontend:totp): totp 创建后未自动刷新列表 (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
yansongda authored Nov 8, 2023
1 parent 9c5d420 commit 17ab72f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 15 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## v1.1.3 - TBD

### fixed

- fixed(frontend:totp): totp 创建后未自动刷新列表(#15)

## v1.1.2

### optimized

- optimized: totp 页面使用 weui-slideview 左滑功能提升性能(#11)
- optimized(frontend:totp): totp 页面使用 weui-slideview 左滑功能提升性能(#11)
5 changes: 3 additions & 2 deletions miniprogram/pages/totp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@ Page({

api.create(scan.result).catch(async (e) => {
this.setData({toptipError: e.message})
}).finally(async () => {
await this.all()
})
},
async slideviewButtontap(e: any) {
async slideviewButtonTap(e: any) {
const id = Number(e.currentTarget.id)

switch(e.detail.index) {
Expand All @@ -100,7 +101,7 @@ Page({
return;
}

api.deleteTotp(id).catch((e) => {
api.deleteTotp(id).catch((e: any) => {
this.setData({toptipError: e.message})
}).finally(async () => {
await this.all()
Expand Down
2 changes: 1 addition & 1 deletion miniprogram/pages/totp/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<view class="{{ items.length > 0 ? 'has-data' : 'no-data' }}">暂无数据</view>

<view class="items">
<mp-slideview class="item" wx:for="{{items}}" wx:for-index="index" wx:key="id" buttons="{{slideViewButtons}}" bindbuttontap="slideviewButtontap" id="{{ item.id }}">
<mp-slideview class="item" wx:for="{{items}}" wx:for-index="index" wx:key="id" buttons="{{slideViewButtons}}" bindbuttontap="slideviewButtonTap" id="{{ item.id }}">
<view class="item-body">
<view class="item-body-info">
<view class="item-body-info-issuer">{{item.issuer}}</view>
Expand Down
27 changes: 16 additions & 11 deletions miniprogram/pages/user/edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,25 @@ Page({
async submit(e: any) {
await wx.showToast({title: '更新中', icon: 'loading', mask: true, duration: 3000})

api.update(e.detail.value as IUserUpdateRequest).catch((e) => {
this.setData({toptipError: e.message})
}).then(async () => {
try {
await api.update(e.detail.value as IUserUpdateRequest)

// 同步完成之后更新下全局的用户信息状态
await utils.sync()
} catch (e: any) {
this.setData({toptipError: e.message})
await wx.hideToast()

wx.showToast({
title: '修改成功',
icon: 'success',
mask: true,
success: () => {
setTimeout(() => wx.navigateBack(), 1000);
}
})
return;
}

wx.showToast({
title: '修改成功',
icon: 'success',
mask: true,
success: () => {
setTimeout(() => wx.navigateBack(), 1000);
}
})
},
async cancel() {
Expand Down

0 comments on commit 17ab72f

Please sign in to comment.