zhaoxiaohai 3 лет назад
Родитель
Сommit
370270fb7b

+ 151 - 150
pages/tabbar/mine/index.js

@@ -2,154 +2,155 @@ const _Http = getApp().globalData.http;
 let downCount = null;
 Page({
 
-	/**
-	 * 页面的初始数据
-	 */
-	data: {
-		userMsg: {},
-		pathList: [], //功能权限
-		teamAuth: '', //团队管理权限列表 JSON字符串 用于传递
-	},
-	onLoad(options) {
-		this.queryUserMsg();
-		let authlist = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['通用'], ['个人中心']);
-		let pathList = [{
-			name: "修改登录密码",
-			icon: "icon-a-wodeguanyuyingyong",
-			color: "var(--warning)",
-			path: `/pages/tabbar/mine/changePassword/index`
-		}]
-		if (authlist.length) {
-			authlist[0].apps.forEach(v => {
-				switch (v.name) {
-					case "teamManagement":
-						pathList.unshift({
-							name: "团队管理",
-							icon: "icon-a-wodetuanduiguanli",
-							color: "var(--assist)",
-							path: `/${v.path}`
-						})
-						this.setData({
-							teamAuth: JSON.stringify(v.meta.auth)
-						})
-						break;
-				}
-			});
-			this.setData({
-				pathList
-			})
-		};
-	},
-	/* 查询用户信息 */
-	queryUserMsg() {
-		_Http.basic({
-			"classname": "common.usercenter.usercenter",
-			"method": "queryUserMsg",
-			"content": {
-				"nocache": true
-			}
-		}).then(res => {
-			if (res.msg != '成功') return wx.showToast({
-				title: res.msg,
-				icon: "none"
-			})
-			this.setData({
-				userMsg: res.data
-			})
-		})
-	},
-	onShow() {
-		this.getTabBar().init();
-	},
-	/* 退出登录 */
-	outLogin() {
-		clearTimeout(downCount);
-		wx.showLoading({
-			title: '正在退出...',
-		})
-		downCount = setTimeout(() => {
-			_Http.logout().then(res => {
-				wx.showToast({
-					title: '退出成功'
-				});
-				let loginMsg = wx.getStorageSync("loginMsg");
-				wx.clearStorageSync();
-				wx.setStorageSync('loginMsg', loginMsg)
-				setTimeout(() => {
-					wx.reLaunch({
-						url: '/pages/login/phone',
-					})
-				}, 300)
-			})
-		}, 300);
-	},
-	/* 去修改用户信息 */
-	changeUserMsg() {
-		let {
-			name,
-			phonenumber,
-			attinfos,
-			hr
-		} = this.data.userMsg;
-		wx.navigateTo({
-			url: `./userMsg/index?attinfos=${JSON.stringify(attinfos)}&name=${name}&phonenumber=${phonenumber}&email=${hr.email}`
-		})
-	},
-	/* 绑定或解绑微信 */
-	bindingWechat(e) {
-		if (this.data.userMsg.iswechatbinding) {
-			let that = this;
-			wx.showModal({
-				title: "提示",
-				content: "是否解除绑定",
-				success: (res) => {
-					if (res.confirm) that.handleBDWechat(0);
-				}
-			})
-		} else {
-			this.handleBDWechat(1);
-		}
-	},
-	handleBDWechat(isbinging) {
-		let that = this;
-		wx.getUserProfile({
-			desc: '用于完善用户资料',
-			success: ({
-				userInfo
-			}) => {
-				wx.login({
-					success(res) {
-						if (res.code) _Http.basic({
-							"classname": "common.usercenter.usercenter",
-							"method": "WechatBinding",
-							content: {
-								"wechat_code": res.code,
-								isbinging, // 0解绑 1绑定
-								wechatuserinfo: userInfo
-							}
-						}).then(s => {
-							if (s.msg != '成功') return wx.showToast({
-								title: s.data,
-								icon: "none"
-							});
-							setTimeout(() => {
-								wx.showToast({
-									title: isbinging == 0 ? '解除成功' : '绑定成功',
-									icon: "none"
-								})
-							}, 100);
-							that.queryUserMsg();
-						})
-					}
-				})
-			},
-			fail: () => {
-				wx.showToast({
-					title: '操作失败,未获得授权',
-					icon: "none"
-				})
-			}
-		})
-	},
-	onShareAppMessage() {}
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        userMsg: {},
+        pathList: [], //功能权限
+        teamAuth: '', //团队管理权限列表 JSON字符串 用于传递
+    },
+    onLoad(options) {
+        this.queryUserMsg();
+        let authlist = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['通用'], ['个人中心']);
+        let pathList = [{
+            name: "修改登录密码",
+            icon: "icon-a-wodeguanyuyingyong",
+            color: "var(--warning)",
+            path: `/pages/tabbar/mine/changePassword/index`
+        }]
+        if (authlist.length) {
+            authlist[0].apps.forEach(v => {
+                switch (v.name) {
+                    case "teamManagement":
+                        pathList.unshift({
+                            name: "团队管理",
+                            icon: "icon-a-wodetuanduiguanli",
+                            color: "var(--assist)",
+                            path: `/${v.path}`
+                        })
+                        this.setData({
+                            teamAuth: JSON.stringify(v.meta.auth)
+                        })
+                        break;
+                }
+            });
+            this.setData({
+                pathList
+            })
+        };
+    },
+    /* 查询用户信息 */
+    queryUserMsg() {
+        _Http.basic({
+            "classname": "common.usercenter.usercenter",
+            "method": "queryUserMsg",
+            "content": {
+                "nocache": true
+            }
+        }).then(res => {
+            if (res.msg != '成功') return wx.showToast({
+                title: res.msg,
+                icon: "none"
+            })
+            this.setData({
+                userMsg: res.data
+            })
+        })
+    },
+    onShow() {
+        this.getTabBar().init();
+    },
+    /* 退出登录 */
+    outLogin() {
+        clearTimeout(downCount);
+        wx.showLoading({
+            title: '正在退出...',
+        })
+        downCount = setTimeout(() => {
+            _Http.logout().then(res => {
+                wx.showToast({
+                    title: '退出成功'
+                });
+                let loginMsg = wx.getStorageSync("loginMsg");
+                wx.clearStorageSync();
+                wx.setStorageSync('loginMsg', loginMsg)
+                setTimeout(() => {
+                    wx.reLaunch({
+                        url: '/pages/login/phone',
+                    })
+                }, 300)
+            })
+        }, 300);
+    },
+    /* 去修改用户信息 */
+    changeUserMsg() {
+        let {
+            name,
+            phonenumber,
+            attinfos,
+            hr,
+            accountno
+        } = this.data.userMsg;
+        wx.navigateTo({
+            url: `./userMsg/index?attinfos=${JSON.stringify(attinfos)}&name=${name}&phonenumber=${phonenumber}&email=${hr.email}&accountno=${accountno}`
+        })
+    },
+    /* 绑定或解绑微信 */
+    bindingWechat(e) {
+        if (this.data.userMsg.iswechatbinding) {
+            let that = this;
+            wx.showModal({
+                title: "提示",
+                content: "是否解除绑定",
+                success: (res) => {
+                    if (res.confirm) that.handleBDWechat(0);
+                }
+            })
+        } else {
+            this.handleBDWechat(1);
+        }
+    },
+    handleBDWechat(isbinging) {
+        let that = this;
+        wx.getUserProfile({
+            desc: '用于完善用户资料',
+            success: ({
+                userInfo
+            }) => {
+                wx.login({
+                    success(res) {
+                        if (res.code) _Http.basic({
+                            "classname": "common.usercenter.usercenter",
+                            "method": "WechatBinding",
+                            content: {
+                                "wechat_code": res.code,
+                                isbinging, // 0解绑 1绑定
+                                wechatuserinfo: userInfo
+                            }
+                        }).then(s => {
+                            if (s.msg != '成功') return wx.showToast({
+                                title: s.data,
+                                icon: "none"
+                            });
+                            setTimeout(() => {
+                                wx.showToast({
+                                    title: isbinging == 0 ? '解除成功' : '绑定成功',
+                                    icon: "none"
+                                })
+                            }, 100);
+                            that.queryUserMsg();
+                        })
+                    }
+                })
+            },
+            fail: () => {
+                wx.showToast({
+                    title: '操作失败,未获得授权',
+                    icon: "none"
+                })
+            }
+        })
+    },
+    onShareAppMessage() {}
 })

+ 185 - 185
pages/tabbar/mine/userMsg/index.js

@@ -1,191 +1,191 @@
 let time = null;
 const _Http = getApp().globalData.http;
 const MD5 = require('../../../../utils/md5'),
-	deletMark = require("../../../../utils/deleteMark");
+    deletMark = require("../../../../utils/deleteMark");
 Page({
-	/**
-	 * 页面的初始数据
-	 */
-	data: {
-		attinfos: [],
-		fromList1: [{
-			label: "姓名",
-			error: false,
-			errMsg: "",
-			type: "text",
-			value: "",
-			placeholder: "请填写",
-			valueName: "name", //绑定的字段名称
-			required: true, //必填
-		}, {
-			label: "邮箱",
-			error: false,
-			errMsg: "",
-			type: "text",
-			value: "",
-			placeholder: "请填写",
-			valueName: "email", //绑定的字段名称
-			required: true //必填
-		}],
-		disabled: true, //禁用按钮
-		show: false, //显示验证码输入框
-		password: "", //验证码
-		countDown: 0, //倒计时
-		loading: false
-	},
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        attinfos: [],
+        fromList1: [{
+            label: "姓名",
+            error: false,
+            errMsg: "",
+            type: "text",
+            value: "",
+            placeholder: "请填写",
+            valueName: "name", //绑定的字段名称
+            required: true, //必填
+        }, {
+            label: "邮箱",
+            error: false,
+            errMsg: "",
+            type: "text",
+            value: "",
+            placeholder: "请填写",
+            valueName: "email", //绑定的字段名称
+            required: true //必填
+        }],
+        disabled: true, //禁用按钮
+        show: false, //显示验证码输入框
+        password: "", //验证码
+        countDown: 0, //倒计时
+        loading: false
+    },
 
-	/**
-	 * 生命周期函数--监听页面加载
-	 */
-	onLoad(options) {
-		const that = this;
-		console.log(options.email)
-		this.setData({
-			attinfos: JSON.parse(options.attinfos),
-			"fromList1[0].value": options.name,
-			"fromList1[1].value": options.email == "undefined" ? "" : options.email,
-			"copyPhonenumber": options.phonenumber
-		});
-		this.data.fromList1.push({
-			label: "手机号",
-			error: false,
-			errMsg: "",
-			type: "text",
-			value: options.phonenumber,
-			placeholder: "请填写",
-			valueName: "phonenumber", //绑定的字段名称
-			required: true, //必填
-			callback: function ({
-				value
-			}) {
-				that.setData({
-					show: (value != that.data.copyPhonenumber) ? true : false,
-					newPhone: value
-				})
-			},
-		})
-		this.setData({
-			fromList1: this.data.fromList1
-		})
-	},
-	/* from1监听 */
-	form1CompletedOrNot({
-		detail
-	}) {
-		this.setData({
-			disabled: !detail
-		})
-		if (this.data.show) this.setData({
-			disabled: this.data.password.length == 6
-		})
-	},
-	/* 开始倒计时 */
-	startCountDown() {
-		let countDown = this.data.countDown;
-		if (countDown != 0) return wx.showToast({
-			title: '已发送验证码,请勿重新发送',
-			icon: "none"
-		});
-		if (!deletMark.CheckPhoneNumber(this.data.newPhone.trim() - 0)) return;
-		_Http.basic({
-			"classname": "common.usercenter.usercenter",
-			"method": "updateUserMsg_getPassWord",
-			"content": {
-				"phonenumber": this.data.newPhone.trim()
-			}
-		}).then(res => {
-			console.log(res)
-			wx.showToast({
-				title: res.msg,
-				icon: "none"
-			})
-			if (res.code != 1) return;
-			this.setData({
-				countDown: 30
-			})
-			time = setInterval(() => {
-				if (this.data.countDown == '0') return clearInterval(time);
-				this.setData({
-					countDown: this.data.countDown - 1
-				})
-			}, 1000);
-		})
-	},
-	/* 提交 */
-	submit() {
-		if (this.data.disabled || this.data.loading) return;
-		let data = this.selectComponent("#form1").getData().returnData;
-		if (!deletMark.CheckPhoneNumber(data.phonenumber.trim() - 0)) return;
-		if (!deletMark.CheckEmail(data.email.trim())) return;
-		if (this.data.show && this.data.password.length == 0) return wx.showToast({
-			title: '请输入短信验证码',
-			icon: "none"
-		});
-		this.setData({
-			loading: true
-		});
-		_Http.basic({
-			"classname": "common.usercenter.usercenter",
-			"method": "updateUserMsg",
-			"content": {
-				"name": data.name,
-				"phonenumber": data.phonenumber,
-				"email": data.email,
-				"password": MD5.hexMD5(this.data.password.trim())
-			}
-		}).then(res => {
-			this.setData({
-				loading: false
-			})
-			if (res.code != 1) return wx.showToast({
-				title: res.msg,
-				icon: "none"
-			});
-			wx.showToast({
-				title: '修改成功'
-			});
-			this.changeUserMsg();
-			setTimeout(() => {
-				wx.navigateBack({
-					delta: 0,
-				})
-			}, 300);
-		})
-	},
-	changeUserMsg() {
-		let pages = getCurrentPages();
-		let prevPage = pages[pages.length - 2];
-		prevPage.queryUserMsg();
-	},
-	changeUserImage({
-		detail
-	}) {
-		_Http.basic({
-			"classname": "system.attachment.Attachment",
-			"method": "createFileLink",
-			"content": {
-				"ownertable": "sys_users",
-				"ownerid": wx.getStorageSync('userMsg').userid,
-				"usetype": "headportrait",
-				"attachmentids": detail
-			}
-		}).then(async res => {
-			if (res.msg != '成功') return wx.showToast({
-				title: res.msg,
-				icon: "none"
-			})
-			let linksids = this.data.attinfos.map(v => v.linksid);
-			if (linksids.length) await _Http.basic({
-				"classname": "system.attachment.Attachment",
-				"method": "deleteFileLink",
-				"content": {
-					"linksids": linksids
-				}
-			});
-			this.setData({
-				attinfos: res.data
-			})
-			this.changeUserMsg();
-		})
-	},
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad(options) {
+        const that = this;
+        this.setData({
+            attinfos: JSON.parse(options.attinfos),
+            "fromList1[0].value": options.name,
+            "fromList1[1].value": options.email == "undefined" ? "" : options.email,
+            "copyPhonenumber": options.phonenumber,
+            accountno: options.accountno
+        });
+        this.data.fromList1.push({
+            label: "手机号",
+            error: false,
+            errMsg: "",
+            type: "text",
+            value: options.phonenumber,
+            placeholder: "请填写",
+            valueName: "phonenumber", //绑定的字段名称
+            required: true, //必填
+            callback: function ({
+                value
+            }) {
+                that.setData({
+                    show: (value != that.data.copyPhonenumber) ? true : false,
+                    newPhone: value
+                })
+            },
+        })
+        this.setData({
+            fromList1: this.data.fromList1
+        })
+    },
+    /* from1监听 */
+    form1CompletedOrNot({
+        detail
+    }) {
+        this.setData({
+            disabled: !detail
+        })
+        if (this.data.show) this.setData({
+            disabled: this.data.password.length == 6
+        })
+    },
+    /* 开始倒计时 */
+    startCountDown() {
+        let countDown = this.data.countDown;
+        if (countDown != 0) return wx.showToast({
+            title: '已发送验证码,请勿重新发送',
+            icon: "none"
+        });
+        if (!deletMark.CheckPhoneNumber(this.data.newPhone.trim() - 0)) return;
+        _Http.basic({
+            "classname": "common.usercenter.usercenter",
+            "method": "updateUserMsg_getPassWord",
+            "content": {
+                "phonenumber": this.data.newPhone.trim()
+            }
+        }).then(res => {
+            console.log(res)
+            wx.showToast({
+                title: res.msg,
+                icon: "none"
+            })
+            if (res.code != 1) return;
+            this.setData({
+                countDown: 30
+            })
+            time = setInterval(() => {
+                if (this.data.countDown == '0') return clearInterval(time);
+                this.setData({
+                    countDown: this.data.countDown - 1
+                })
+            }, 1000);
+        })
+    },
+    /* 提交 */
+    submit() {
+        if (this.data.disabled || this.data.loading) return;
+        let data = this.selectComponent("#form1").getData().returnData;
+        if (!deletMark.CheckPhoneNumber(data.phonenumber.trim() - 0)) return;
+        if (!deletMark.CheckEmail(data.email.trim())) return;
+        if (this.data.show && this.data.password.length == 0) return wx.showToast({
+            title: '请输入短信验证码',
+            icon: "none"
+        });
+        this.setData({
+            loading: true
+        });
+        _Http.basic({
+            "classname": "common.usercenter.usercenter",
+            "method": "updateUserMsg",
+            "content": {
+                "name": data.name,
+                "phonenumber": data.phonenumber,
+                "email": data.email,
+                "password": MD5.hexMD5(this.data.password.trim())
+            }
+        }).then(res => {
+            this.setData({
+                loading: false
+            })
+            if (res.code != 1) return wx.showToast({
+                title: res.msg,
+                icon: "none"
+            });
+            wx.showToast({
+                title: '修改成功'
+            });
+            this.changeUserMsg();
+            setTimeout(() => {
+                wx.navigateBack({
+                    delta: 0,
+                })
+            }, 300);
+        })
+    },
+    changeUserMsg() {
+        let pages = getCurrentPages();
+        let prevPage = pages[pages.length - 2];
+        prevPage.queryUserMsg();
+    },
+    changeUserImage({
+        detail
+    }) {
+        _Http.basic({
+            "classname": "system.attachment.Attachment",
+            "method": "createFileLink",
+            "content": {
+                "ownertable": "sys_users",
+                "ownerid": wx.getStorageSync('userMsg').userid,
+                "usetype": "headportrait",
+                "attachmentids": detail
+            }
+        }).then(async res => {
+            if (res.msg != '成功') return wx.showToast({
+                title: res.msg,
+                icon: "none"
+            })
+            let linksids = this.data.attinfos.map(v => v.linksid);
+            if (linksids.length) await _Http.basic({
+                "classname": "system.attachment.Attachment",
+                "method": "deleteFileLink",
+                "content": {
+                    "linksids": linksids
+                }
+            });
+            this.setData({
+                attinfos: res.data
+            })
+            this.changeUserMsg();
+        })
+    },
 })

+ 18 - 0
pages/tabbar/mine/userMsg/index.scss

@@ -20,6 +20,7 @@
         display: flex;
         align-items: center;
         color: #CCCCCC;
+
         .user-img {
             width: 64rpx !important;
             height: 64rpx !important;
@@ -31,6 +32,23 @@
 
 }
 
+.mimic {
+    width: 100vw;
+    background-color: #fff;
+    font-size: 26rpx;
+    padding: 0rpx 30rpx;
+    box-sizing: border-box;
+
+    .box {
+        display: flex;
+        justify-content: space-between;
+        box-sizing: border-box;
+        height: 80rpx;
+        line-height: 80rpx;
+        border-bottom: 1rpx solid rgb(245, 245, 245);
+    }
+}
+
 /* 职务 */
 .duty-box {
     width: 750rpx;

+ 6 - 0
pages/tabbar/mine/userMsg/index.wxml

@@ -9,6 +9,12 @@
     </navigator>
 </My_upload>
 <view style="height: 20rpx;" />
+<view class="mimic">
+    <view class="box">
+        <view class="label">登录账号</view>
+        <view class="value">{{accountno || " --"}}</view>
+    </view>
+</view>
 <My_form id='form1' fromList='{{fromList1}}' bindCompletedOrNot='form1CompletedOrNot' />
 <van-cell-group wx:if="{{show}}">
     <van-field model:value="{{ password }}" required center clearable label="短信验证码" placeholder="请输入短信验证码" border="{{ false }}" use-button-slot>