修改项目配置,完成要加入的等待和审批操作,修改了部分接口定义和参数

This commit is contained in:
qiaomu 2024-03-22 16:45:36 +08:00
parent e07641732f
commit 2c79edb80c
24 changed files with 378 additions and 30 deletions

View File

@ -1,29 +1,36 @@
{
"pages": [
"pages/login/index",
"pages/invoiceList/index",
"pages/apply/index",
"pages/qrCode/index",
"pages/waitApprove/index",
"pages/home/index",
"pages/rechargeRecord/index",
"pages/invoiceList/index",
"pages/meterList/index",
"pages/recharge/index",
"pages/handleLogin/index",
"pages/member/index",
"pages/my/index",
"pages/questions/index",
"pages/home/index",
"pages/index/index",
"pages/qrCode/index",
"pages/invoiceDetail/index",
"pages/editInvoice/index"
],
"tabBar": {
"list": [
{
"pagePath": "pages/home/index",
"text": "首页"
"text": "首页",
"iconPath": "/assets/tabbar/home.png",
"selectedIconPath": "/assets/tabbar/home_select.png"
},
{
"pagePath": "pages/my/index",
"text": "我的"
"text": "我的",
"iconPath": "/assets/tabbar/my.png",
"selectedIconPath": "/assets/tabbar/my_select.png"
}
]
},

BIN
assets/tabbar/home.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
assets/tabbar/my.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

BIN
assets/tabbar/my_select.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

88
pages/apply/index.js Normal file
View 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
View File

@ -0,0 +1,5 @@
{
"usingComponents": {
"van-button": "@vant/weapp/button/index"
}
}

11
pages/apply/index.wxml Normal file
View 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
View 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;
}

View File

@ -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) {

View File

@ -32,7 +32,7 @@ Component({
*/
methods: {
async init() {
const result = await getApproveList()
const result = await getApproveList(1)
this.setData({
list: result.data
})

View File

@ -5,14 +5,15 @@ Page({
* 页面的初始数据
*/
data: {
user: {}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const user = wx.getStorageSync('user');
this.setData({ user })
},
/**

View File

@ -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 />

View File

@ -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
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/

View File

@ -1,3 +1,7 @@
{
"usingComponents": {}
"usingComponents": {
"van-image": "@vant/weapp/image/index"
},
"navigationBarTitleText": "二维码"
}

View File

@ -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>

View File

@ -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;
}

View 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() {
}
})

View File

@ -0,0 +1,6 @@
{
"usingComponents": {
"van-button": "@vant/weapp/button/index"
},
"navigationBarTitleText": ""
}

View 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>

View 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;
}

View File

@ -1,36 +1,55 @@
{
"compileType": "miniprogram",
"libVersion": "trial",
"packOptions": {
"ignore": [],
"include": []
},
"setting": {
"coverView": true,
"urlCheck": false,
"es6": true,
"postcss": true,
"minified": true,
"enhance": true,
"postcss": true,
"preloadBackgroundData": false,
"ignoreDevUnusedFiles": false,
"ignoreUploadUnusedFiles": false,
"minified": true,
"newFeature": false,
"coverView": true,
"nodeModules": false,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"lazyloadPlaceholderEnable": false,
"useMultiFrameRuntime": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"condition": false,
"compileWorklet": true,
"enableEngineNative": false,
"useIsolateContext": true,
"userConfirmedBundleSwitch": false,
"packNpmManually": true,
"packNpmRelationList": [
{
"packageJsonPath": "./package.json",
"miniprogramNpmDistDir": "./"
}
]
],
"minifyWXSS": true,
"showES6CompileOption": false,
"condition": false
},
"condition": {},
"editorSetting": {
"tabIndent": "auto",
"tabIndent": "insertSpaces",
"tabSize": 2
},
"libVersion": "2.12.3",
"packOptions": {
"ignore": [],
"include": []
},
"appid": "wxb34b4e70f8a5c6f1"
}

View File

@ -17,8 +17,8 @@ export const getWxCode = async function(data) {
}
// 获取扫描二维码的列表
export const getApproveList = async function(data) {
return await GET('/wx/getApproveList', data);
export const getApproveList = async function(status=0) {
return await GET('/wx/getApproveList?status=' + status, );
}
// 审批用户加入
@ -29,4 +29,19 @@ export const approveUser = async function(data) {
// 移除用户
export const removeUser = async function(data) {
return await DELETE(`/wx/removeUser/${uid}`);
}
// 获取用户最新信息
export const getUserInfo = async function() {
return await GET('/wx/getUserInfo');
}
// 非管理员重新提交申请
export const reApprove = async function() {
return await POST('/wx/reApprove');
}
// 非管理员重新提交申请
export const userApply = async function(data) {
return await POST('/wx/apply', data);
}

View File

@ -48,6 +48,7 @@ export function getConfigByEnv() {
break;
// 体验版
case 'trial':
api = "https://zgd.hbhcbn.com/wxApi"
break;
// 正式版
case 'release':