调整登录逻辑
This commit is contained in:
@@ -19,8 +19,12 @@ Page({
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
console.log('options', options)
|
||||
const querys = decodeURIComponent(options.scene)
|
||||
const { id } = querys;
|
||||
console.log('querys', querys)
|
||||
// const { id } = querys;
|
||||
const id = querys.slice(querys.indexOf("=") + 1)
|
||||
console.log('id', id)
|
||||
// this.setData({ id, name })
|
||||
this.getInfo(id);
|
||||
},
|
||||
@@ -67,6 +71,11 @@ Page({
|
||||
})
|
||||
},
|
||||
getPhoneNumber(e) {
|
||||
const { nickName } = this.data;
|
||||
if (!nickName) {
|
||||
alertInfo("请填写你的名字")
|
||||
return;
|
||||
}
|
||||
const { errno, code: phoneCode } = e.detail;
|
||||
switch(errno) {
|
||||
case 103:
|
||||
|
@@ -15,7 +15,6 @@ Page({
|
||||
*/
|
||||
onLoad(options) {
|
||||
const { id } = options;
|
||||
console.log('options', options)
|
||||
if (id !== "-1") {
|
||||
this.init(id);
|
||||
}
|
||||
|
@@ -5,14 +5,15 @@ Page({
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
user: {}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
const user = wx.getStorageSync('user')
|
||||
this.setData({ user })
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -21,7 +22,11 @@ Page({
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
jumpToLogin() {
|
||||
wx.navigateTo({
|
||||
url: '/pages/login/index',
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
|
@@ -3,7 +3,8 @@
|
||||
"custom-status-bar": "/components/customStatusBar/index",
|
||||
"van-icon": "@vant/weapp/icon/index",
|
||||
"van-button": "@vant/weapp/button/index",
|
||||
"van-image": "@vant/weapp/image/index"
|
||||
"van-image": "@vant/weapp/image/index",
|
||||
"avatar": "/components/avatar/index"
|
||||
},
|
||||
"navigationStyle": "custom"
|
||||
}
|
@@ -13,7 +13,14 @@
|
||||
</view>
|
||||
<view class="login" wx:if="{{!user || !user.id}}" class="notLoginWrapper">
|
||||
<van-image width="100rpx" height="100rpx" src="/assets/images/defaultAvatar.png" class="defaultAvatar"/>
|
||||
<van-button type="info" size="small" plain="{{true}}" class="loginBtn">请登录</van-button>
|
||||
<van-button type="info" size="small" plain="{{true}}" class="loginBtn" bind:tap="jumpToLogin">请登录</van-button>
|
||||
</view>
|
||||
<view class="logined" wx:else>
|
||||
<avatar text="11" />
|
||||
<view>
|
||||
<van-button type="info" size="small" plain="{{true}}" class="loginBtn" bind:tap="jumpToLogin">{{user.tenement.name}}</van-button>
|
||||
<view></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="rechargeWrapper">
|
||||
<view class="card">
|
||||
|
@@ -23,7 +23,7 @@
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.notLoginWrapper {
|
||||
.notLoginWrapper, .logined {
|
||||
padding: 30rpx 32rpx;
|
||||
background-color: var(--middle-green);
|
||||
display: flex;
|
||||
|
@@ -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;
|
||||
|
@@ -1,4 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
"usingComponents": {
|
||||
"van-tab": "@vant/weapp/tab/index",
|
||||
"van-tabs": "@vant/weapp/tabs/index"
|
||||
}
|
||||
}
|
@@ -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>
|
@@ -1,3 +1,4 @@
|
||||
@import "/app.wxss";
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
|
Reference in New Issue
Block a user