修改首页获取商户,发票选商户没反应的问题,,新增退出登录

This commit is contained in:
qiaomu 2024-04-10 09:31:26 +08:00
parent e3390db414
commit 7249c430b8
8 changed files with 30 additions and 20 deletions

View File

@ -1,12 +1,12 @@
{
"pages": [
"pages/home/index",
"pages/rechargeRecord/index",
"pages/invoiceList/index",
"pages/member/index",
"pages/login/index",
"pages/handleLogin/index",
"pages/my/index",
"pages/rechargeRecord/index",
"pages/waitApprove/index",
"pages/apply/index",
"pages/qrCode/index",

View File

@ -3,6 +3,7 @@ import { getOwnTenementList } from "../../service/tenement";
import { alertInfo } from "../../utils/index";
import request from '../../utils/request';
import { getDot } from "../../utils/system";
import { getUserInfo } from "../../service/user"
const { OK } = request;
// pages/home/index.js
Page({
@ -79,7 +80,7 @@ Page({
})
break;
case "tenement":
const currentTenement = this.data.tenement;
// const currentTenement = this.data.tenement;
// if (value.id === currentTenement?.id) {
// this.setData({ show: false })
// return
@ -97,7 +98,7 @@ Page({
},
async handleGetMeterDetail(meterCode) {
const { tenement } = this.data;
const { code, message, data } = await getMeterDetail({ tenement, code: meterCode });
const { code, message, data } = await getMeterDetail({ tenement: tenement?.id, code: meterCode });
if (code !== OK) {
alertInfo(message);
return;
@ -177,15 +178,17 @@ Page({
})
},
async setUser() {
// const result = await getUserInfo();
// if (result.code !== OK) {
// alertInfo(result.message)
// return;
// }
// this.setData({ user: result.data })
// wx.setStorageSync('user', result.data)
const user = wx.getStorageSync('user')
this.setData({ user: user })
const result = await getUserInfo();
if (result.code !== OK) {
// alertInfo(result.message)
const user = wx.getStorageSync('user')
this.setData({ user: user })
return;
}
this.setData({ user: result.data })
wx.setStorageSync('user', result.data)
// const user = wx.getStorageSync('user')
// this.setData({ user: user })
},
async getAllList() {
const { code, message, data } = await getOwnTenementList()

View File

@ -24,7 +24,7 @@
<view class="logined" wx:else>
<avatar text="{{ user.nickName }}" />
<view>
<van-button type="info" size="small" plain="{{true}}" class="loginBtn" bind:click="chooseTenement">{{user.tenement.name}} <van-icon name="arrow-down" style="margin-left: 16rpx;" /></van-button>
<van-button type="info" size="small" plain="{{true}}" class="loginBtn" bind:click="chooseTenement">{{tenement.name}} <van-icon name="arrow-down" style="margin-left: 16rpx;" /></van-button>
<view class="welcome"> 欢迎使用华昌宝能用电管理系统! </view>
</view>
</view>

View File

@ -73,6 +73,12 @@ Page({
dot
})
},
logout() {
wx.clearStorageSync()
wx.switchTab({
url: '/pages/home/index',
})
},
bindTenement() {
wx.navigateTo({
url: '/pages/handleLogin/index',

View File

@ -16,6 +16,7 @@
</view>
</van-cell>
<van-cell title="绑定企业" value="" is-link bind:tap="bindTenement" />
<van-cell title="退出登录" value="" is-link bind:tap="logout" />
<!-- </van-cell-group> -->
<!-- <van-cell-group title=" ">
<van-cell title="单元格" value="内容" is-link />

View File

@ -47,7 +47,7 @@ Page({
return;
}
if (type === "tenement") {
this.onChangeTenement(value.id)
this.onChangeTenement(value)
return;
}
},
@ -76,11 +76,13 @@ Page({
this.init(currentYear, tenement)
},
onChangeTenement(e) {
const { id, name } = e;
const { year } = this.data;
// const currentYear = years[Number(e)]
this.setData({
// year: currentYear,
tenement: e,
tenement: id,
tenementName: name,
type: "",
show: false,
title: ""

View File

@ -77,13 +77,13 @@ const request = async function (options, config = {}) {
}
// 处理返回结果,默认直接返回数据
const parseResponse = function (response) {
const parseResponse = function (response, url) {
console.log('url', url, 'response', response)
if (!response) {
alertError("服务异常")
return
}
const { statusCode } = response;
console.log('response', response)
if (statusCode === 401) {
wx.redirectTo({
url: '/pages/login/index',
@ -110,7 +110,7 @@ const GET = async function (uri) {
});
return parseResponse(response);
return parseResponse(response, uri);
};
// 创建、更新和删除请求

View File

@ -4,13 +4,11 @@ const { OK } = request
export const getDot = async () => {
console.log("获取dot数")
const user = wx.getStorageSync('user')
if (!user || !user.id) {
return;
}
const { code, message, data } = await getUnReadApproveNumber();
console.log('data', data)
if (data > 0) {
wx.showTabBarRedDot({
index: 1,