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

@ -1,58 +1,130 @@
// pages/setting/index.js // pages/setting/index.js
const app = getApp(); const app = getApp();
import { customRequest } from '../../utils/request.js';
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
version: app.globalData.version, version: app.globalData.version,
userInfo: {},
drawerShow: false,
teamList: [],
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) {}, onLoad (options) { },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady() {}, onReady () { },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
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()
})
},
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide() {}, onHide () { },
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload() {}, onUnload () { },
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh() {}, onPullDownRefresh () { },
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom() {}, onReachBottom () { },
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage1() {}, onShareAppMessage1 () { },
loginOut: function () { loginOut: function () {
wx.showModal({ wx.showModal({
title: "退出登录", title: "退出登录",
content: "确定要退出登录吗?", content: "确定要退出登录吗?",
confirmColor: "#1890ff", confirmColor: "#1890ff",
success(res) { success (res) {
if (res.confirm) { if (res.confirm) {
console.log("用户点击确定"); console.log("用户点击确定");
app.logout().then(() => { app.logout().then(() => {
@ -79,13 +151,13 @@ Page({
title: "注销账号", title: "注销账号",
content: "确定要注销账号吗?该操作不可逆!", content: "确定要注销账号吗?该操作不可逆!",
confirmColor: "#1890ff", confirmColor: "#1890ff",
success(res) { success (res) {
if (res.confirm) { if (res.confirm) {
customRequest("/yishoudan/updatePasswordByPwd", { customRequest("/yishoudan/updatePasswordByPwd", {
header: 'headers', method: 'post', data: { header: 'headers', method: 'post', data: {
tel: app.globalData.user.tel, tel: app.globalData.user.tel,
oldPassword: 'qqqq1111', oldPassword: 'qqqq1111',
password:'1111qqqq', password: '1111qqqq',
} }
}).then(({ data }) => { }).then(({ data }) => {
if (data.status == 200) { if (data.status == 200) {
@ -109,5 +181,4 @@ Page({
}, },
}); });
}, },
}); });

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

@ -1,5 +1,5 @@
<view class="container"> <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 class="changePsw fsa">
<view>修改密码</view> <view>修改密码</view>
<view> <view>
@ -36,19 +36,46 @@
</view> </view>
</navigator> </navigator>
</view> </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="loginOut" catchtap="loginOut" hover-class="thover">
<view class> <view class>
<text class="f16">退出登录</text> <text class="f16">退出登录</text>
</view> </view>
</view> </view>
<view catchtap="logOff" style="position: absolute;bottom:40px; left: 50%;transform: translateX(-50%);" hover-class="thover">
<view catchtap="logOff" style="position: absolute;bottom:20px; left: 50%;transform: translateX(-50%);" hover-class="thover">
<view class="tc mt120"> <view class="tc mt120">
<text class="f12 c9">注销账号</text> <text class="f12 c9">注销账号</text>
</view> </view>
</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> </view>

Loading…
Cancel
Save