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

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

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