修改项目配置,完成要加入的等待和审批操作,修改了部分接口定义和参数
This commit is contained in:
88
pages/apply/index.js
Normal file
88
pages/apply/index.js
Normal file
@@ -0,0 +1,88 @@
|
||||
import { userApply } from "../../service/user";
|
||||
import { alertInfo, alertSuccess } from "../../utils/index";
|
||||
import request from '../../utils/request'
|
||||
const { OK } = request;
|
||||
// pages/apply/index.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
id: "",
|
||||
name: "",
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
const { id, name } = options;
|
||||
this.setData({ id, name })
|
||||
},
|
||||
exit() {
|
||||
wx.exitMiniProgram()
|
||||
},
|
||||
async join() {
|
||||
const { id } = this.data;
|
||||
const { code, message } = await userApply({ id })
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return;
|
||||
}
|
||||
alertSuccess("加入成功")
|
||||
setTimeout(() => {
|
||||
wx.switchTab({
|
||||
url: '/pages/home/index',
|
||||
})
|
||||
}, 500)
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
5
pages/apply/index.json
Normal file
5
pages/apply/index.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"van-button": "@vant/weapp/button/index"
|
||||
}
|
||||
}
|
11
pages/apply/index.wxml
Normal file
11
pages/apply/index.wxml
Normal file
@@ -0,0 +1,11 @@
|
||||
<!--pages/apply/index.wxml-->
|
||||
|
||||
<view class="content">
|
||||
<view class="contentWrapper">
|
||||
<view class="text"> 确定要加入{{name}}吗? </view>
|
||||
<view class="operate">
|
||||
<van-button type="default" block style="flex: 1;" bind:click="exit">退出</van-button>
|
||||
<van-button type="info" block style="flex:1;margin-left: 20rpx;">确认</van-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
26
pages/apply/index.wxss
Normal file
26
pages/apply/index.wxss
Normal file
@@ -0,0 +1,26 @@
|
||||
/* pages/apply/index.wxss */
|
||||
|
||||
.content {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.text {
|
||||
text-align: center;
|
||||
margin-bottom: 10vh;
|
||||
}
|
||||
|
||||
.operate {
|
||||
display: flex;
|
||||
margin-bottom: 6vh;
|
||||
}
|
||||
|
||||
.contentWrapper {
|
||||
width: 60%;
|
||||
margin-left: 40rpx;
|
||||
margin-right: 40rpx;
|
||||
}
|
||||
|
@@ -24,6 +24,12 @@ Page({
|
||||
if (!user || !user.id) {
|
||||
return;
|
||||
}
|
||||
if (user.status === 0 || user.status === 2) {
|
||||
wx.redirectTo({
|
||||
url: '/pages/waitApprove/index',
|
||||
})
|
||||
return
|
||||
}
|
||||
wx.switchTab({
|
||||
url: '/pages/home/index',
|
||||
})
|
||||
@@ -58,6 +64,9 @@ Page({
|
||||
const { token, ...user } = data
|
||||
wx.setStorageSync('user', user)
|
||||
wx.setStorageSync('token', data?.token)
|
||||
wx.switchTab({
|
||||
url: '/pages/home/index',
|
||||
})
|
||||
})
|
||||
},
|
||||
getPhoneNumber(e) {
|
||||
|
@@ -32,7 +32,7 @@ Component({
|
||||
*/
|
||||
methods: {
|
||||
async init() {
|
||||
const result = await getApproveList()
|
||||
const result = await getApproveList(1)
|
||||
this.setData({
|
||||
list: result.data
|
||||
})
|
||||
|
@@ -5,14 +5,15 @@ Page({
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
user: {}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
const user = wx.getStorageSync('user');
|
||||
this.setData({ user })
|
||||
},
|
||||
|
||||
/**
|
||||
|
@@ -5,7 +5,7 @@
|
||||
|
||||
<!-- <van-cell-group title=" "> -->
|
||||
<van-cell title="二维码" value="" is-link bind:click="jumpToQrCode" />
|
||||
<van-cell title="成员管理" value="" is-link bind:click="jumpToMember" />
|
||||
<van-cell wx:if="{{!!user.isAdmin}}" title="成员管理" value="" is-link bind:click="jumpToMember" />
|
||||
<!-- </van-cell-group> -->
|
||||
<!-- <van-cell-group title=" ">
|
||||
<van-cell title="单元格" value="内容" is-link />
|
||||
|
@@ -1,20 +1,34 @@
|
||||
// pages/qrCode/index.js
|
||||
import request from "../../utils/request"
|
||||
import { getWxCode } from "../../service/user"
|
||||
import { alertInfo } from "../../utils/index";
|
||||
|
||||
const { OK } = request;
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
url: ""
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
this.getCode()
|
||||
},
|
||||
async getCode() {
|
||||
const { code, message, data } = await getWxCode()
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
url: data
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
|
@@ -1,3 +1,7 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
"usingComponents": {
|
||||
"van-image": "@vant/weapp/image/index"
|
||||
},
|
||||
"navigationBarTitleText": "二维码"
|
||||
|
||||
}
|
@@ -1,5 +1,7 @@
|
||||
<!--pages/qrCode/index.wxml-->
|
||||
<view class="wrapper">
|
||||
<view style="margin-bottom: 10vh;">
|
||||
<van-image width="400rpx" height="400rpx" src="{{url}}" />
|
||||
</view>
|
||||
<view class="text"> 扫码二维码,管理员同意后可进入 </view>
|
||||
<van-icon name="qr" />
|
||||
</view>
|
@@ -5,9 +5,10 @@
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.text {
|
||||
text-align: center;
|
||||
margin-bottom: 10vh;
|
||||
margin-bottom: 15vh;
|
||||
}
|
93
pages/waitApprove/index.js
Normal file
93
pages/waitApprove/index.js
Normal file
@@ -0,0 +1,93 @@
|
||||
import { getUserInfo, reApprove } from "../../service/user"
|
||||
import { alertInfo, alertSuccess } from '../../utils/index'
|
||||
import request from "../../utils/request"
|
||||
const { OK } = request;
|
||||
// pages/waitApprove/index.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
user: {}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
this.getInfo()
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
async getInfo() {
|
||||
const { code, message, data } = await getUserInfo();
|
||||
// if (code !== OK) {
|
||||
// alertInfo(message)
|
||||
// return;
|
||||
// }
|
||||
this.setData({
|
||||
user: data
|
||||
})
|
||||
},
|
||||
jumpToHome() {
|
||||
wx.switchTab({
|
||||
url: '/page/home/index',
|
||||
})
|
||||
},
|
||||
async handleReApprove() {
|
||||
const { code, message, } = await reApprove();
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return;
|
||||
}
|
||||
alertSuccess("提交成功");
|
||||
this.getInfo();
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
6
pages/waitApprove/index.json
Normal file
6
pages/waitApprove/index.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"van-button": "@vant/weapp/button/index"
|
||||
},
|
||||
"navigationBarTitleText": ""
|
||||
}
|
21
pages/waitApprove/index.wxml
Normal file
21
pages/waitApprove/index.wxml
Normal file
@@ -0,0 +1,21 @@
|
||||
<!--pages/waitApprove/index.wxml-->
|
||||
<view class="wrapper">
|
||||
<view class="content" wx:if="{{user.status === 0}}">
|
||||
<view class="status"> 等待管理员审批中 </view>
|
||||
<view class="operate">
|
||||
<van-button type="default" bind:tap="getInfo">刷新</van-button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="content" wx:if="{{user.status === 1}}">
|
||||
<view class="status"> 管理员已同意 </view>
|
||||
<view class="operate">
|
||||
<van-button type="default" bind:tap="jumpToHome">进入系统</van-button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="content" wx:if="{{user.status === 2}}">
|
||||
<view class="status"> 管理员已拒绝 </view>
|
||||
<view class="operate">
|
||||
<van-button type="default">重新提交</van-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
25
pages/waitApprove/index.wxss
Normal file
25
pages/waitApprove/index.wxss
Normal file
@@ -0,0 +1,25 @@
|
||||
/* pages/waitApprove/index.wxss */
|
||||
.content {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
margin: auto;
|
||||
width: 600rpx;
|
||||
height: 50vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.status {
|
||||
text-align: center;
|
||||
margin-bottom: 60rpx;
|
||||
}
|
||||
|
||||
.operate {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
Reference in New Issue
Block a user