cyl/develop
zsk 12 months ago
parent 67bd0b8c07
commit 515f628846

@ -1,11 +1,15 @@
// pages/setting/index.js
const app = getApp();
import { customRequest } from '../../utils/request.js';
Page({
/**
* 页面的初始数据
*/
data: {
version: app.globalData.version,
userInfo: {},
drawerShow: false,
teamList: [],
},
/**
@ -21,8 +25,76 @@ Page({
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
onShow () {
this.setData({
userInfo: wx.getStorageSync('loginUser'),
});
this.getTeamList()
},
showToggle () {
this.setData({
drawerShow: true
})
},
toogleTeam (e) {
console.log(e);
let that = this
let item = e.currentTarget.dataset.item;
console.log(item);
if (wx.getStorageSync("LOGINUSER_ID") == item.id) {
return false
}
wx.showLoading({
title: '切换中...',
});
customRequest(`/yishoudan/agency/group/user/changeGroup/${item.id}`, { header: 'headers', method: 'GET', data: {} }).then((res) => {
console.log(res);
if (res.data.status == 200) {
that.checkToken(item)
app.getConfigInfo()
app.getServiceInfo()
wx.hideLoading();
wx.showToast({
title: '切换成功',
icon: 'success',
duration: 2000
})
} else {
that.getTeamList()
}
})
},
getTeamList () {
let that = this
customRequest("/yishoudan/agency/group/user/listByUser", { header: 'headers', method: 'GET', data: {} }).then((res) => {
console.log(res);
res.data.data.forEach(item => {
if (item.id == app.globalData.loginUserInfo.user.agencyId) {
item.checked = true;
}
});
console.log('res.data.data', res.data.data);
that.setData({
teamList: res.data.data
})
})
},
checkToken (_item) {
let that = this
wx.setStorageSync("LOGINUSER_ID", _item.id);
customRequest('/appLoginByToken', { header: 'headers', method: 'GET', data: {} }).then((res) => {
console.log(res);
app.globalData.agencyStatus = res.data.data.agencyStatus;
app.globalData.loginUserInfo = res.data.data;
wx.setStorageSync("loginUser", res.data.data);
wx.setStorageSync("LOGINUSER_ID", res.data.data.user.agencyId);
this.setData({
drawerShow: false
})
that.onLoad()
that.onShow()
})
},
/**
* 生命周期函数--监听页面隐藏
*/
@ -109,5 +181,4 @@ Page({
},
});
},
});

@ -1,5 +1,7 @@
{
"usingComponents": {
"bottom-drawer": "../../components/bottom-drawer/index"
},
"navigationBarTitleText": "设置",
"usingComponents": {},
"backgroundColor": "#f5f5f5"
}

@ -1,5 +1,5 @@
<view class="container">
<navigator class='mt16' target url="../changePsw/index?type=2" hover-class="hcb" open-type="navigate">
<navigator class="pt16" target url="../changePsw/index?type=2" hover-class="hcb" open-type="navigate">
<view class="changePsw fsa">
<view>修改密码</view>
<view>
@ -36,19 +36,46 @@
</view>
</navigator>
</view>
<view class="br_8 bgf" catchtap="showToggle" hover-class="hcb" style hover-stop-propagation="false" wx:if="{{ userInfo.agencyStatus == 1 }}">
<view class="setting mt_10 fsa ml10 mr10" style="height:56px" hover-stop-propagation="false">
<view style>
<!-- <view class="t-icon t-icon-qiehuantuandui mr6" style="width:24px;height:24px"></view> -->
<view class="c3" style="line-height:16px">当前团队</view>
</view>
<view style="flex: 1;" class="g_flex_column_center">
<view class="g_flex_row_end" style="width: 100%;position: relative;">
<view class="g_flex_column_center g_flex_1">
<view class="g_flex_1 g_ell_1 c9" style="text-align: right;">{{userInfo.agencyName || '-'}}</view>
</view>
<view class="g_flex_column_center g_flex_none">
<view class="iconfont icon-gengduo11 c9 ml4 mt2"></view>
</view>
</view>
</view>
</view>
<bottom-drawer show="{{drawerShow}}" touchClose="{{false}}" hideTabbar="{{true}}" drawerType="drawerShow" height="60vh">
<view slot="title" class="tac fw500 f18 bb1" style="line-height:56px" hover-class="none" hover-stop-propagation="false">切换团队</view>
<scroll-view class="pb32" scroll-y="true" hover-class="none" hover-stop-propagation="{{false}}" style="height:calc(100% - 82px)">
<!-- <radio-group class="radio-group mb32" bindchange="radioChange" hover-class="none"> -->
<view class="weui-check__label fsa p16 bb1" hover-class="thover" hover-stop-propagation="true" wx:for="{{teamList}}" wx:key="name" wx:for-index="index" bindtap="toogleTeam" data-item="{{item}}">
<view class="weui-cell__bd">
<view class="f17">{{item.agencyName}}</view>
</view>
<view class style="color:#1890ff" hover-class="none" hover-stop-propagation="false">{{item.checked ? '当前':''}}</view>
</view>
<!-- </radio-group> -->
</scroll-view>
</bottom-drawer>
</view>
<view class="loginOut" catchtap="loginOut" hover-class="thover">
<view class>
<text class="f16">退出登录</text>
</view>
</view>
<view catchtap="logOff" style="position: absolute;bottom:20px; left: 50%;transform: translateX(-50%);" hover-class="thover">
<view catchtap="logOff" style="position: absolute;bottom:40px; left: 50%;transform: translateX(-50%);" hover-class="thover">
<view class="tc mt120">
<text class="f12 c9">注销账号</text>
</view>
</view>
<view class="c9 f12 tc" style="position: absolute;bottom:0; left: 50%;transform: translateX(-50%);">豫ICP备2023001993号-27A</view>
<view class="c9 f12 tc" style="position: absolute;bottom:20px; left: 50%;transform: translateX(-50%);">豫ICP备2023001993号-27A</view>
</view>

Loading…
Cancel
Save