调整登录逻辑

This commit is contained in:
2024-03-27 17:37:11 +08:00
parent 61bcbf6f69
commit 049782f96b
18 changed files with 113 additions and 30 deletions

View File

@@ -38,9 +38,9 @@ Component({
})
},
async setAdmin(e) {
const { user } = e.currentTarget.dataset;
const { user, tenement } = e.currentTarget.dataset;
await wxModal({ content: `你的管理员身份将转交给${user.nickName}` })
const { code, message } = await approveUser({ userId: user.id, type: 2 })
const { code, message } = await approveUser({ userId: user.id, type: 2, tenement })
if (code !== OK) {
alertInfo(message)
return;
@@ -54,9 +54,9 @@ Component({
})
},
async remove(e) {
const { user } = e.currentTarget.dataset;
await wxModal({ content: `将移除${user.nickName}` })
const { code, message } = await removeUser(user.id)
const { user, tenement } = e.currentTarget.dataset;
await wxModal({ content: `将移除${user.name}` })
const { code, message } = await removeUser(user.id, tenement)
if (code !== OK) {
alertInfo(message)
return;

View File

@@ -1,4 +1,7 @@
{
"component": true,
"usingComponents": {}
"usingComponents": {
"van-tab": "@vant/weapp/tab/index",
"van-tabs": "@vant/weapp/tabs/index"
}
}

View File

@@ -1,8 +1,20 @@
<!--pages/member/components/memberManage/index.wxml-->
<view wx:for="{{list}}" wx:key="index" wx:for-item="item" class="item">
<!-- <view wx:for="{{list}}" wx:key="index" wx:for-item="item" class="item">
<view class="nickName"> {{ item.nickName }} </view>
<view class="operate">
<view class="primaryTextBtn" data-user="{{item}}" bind:tap="setAdmin"> 设为管理员 </view>
<view class="disAgree dangerTextBtn" data-user="{{item}}" bind:tap="remove"> 移除 </view>
</view>
</view>
</view> -->
<van-tabs active="{{ active }}" bind:change="onChange">
<van-tab wx:for="{{list}}" wx:key="index" title="{{item.name}}">
<view wx:for="{{item.users}}" wx:key="index" wx:for-item="ele" class="item">
<view class="nickName"> {{ ele.name }} </view>
<view class="operate">
<view class="primaryTextBtn" data-user="{{ele}}" bind:tap="setAdmin" data-tenement="{{item.id}}"> 设为管理员 </view>
<view class="disAgree dangerTextBtn" data-user="{{ele}}" bind:tap="remove" data-tenement="{{item.id}}"> 移除 </view>
</view>
</view>
</van-tab>
</van-tabs>

View File

@@ -1,3 +1,4 @@
@import "/app.wxss";
.item {
display: flex;