diff --git a/app.js b/app.js index 4671a20..3593186 100644 --- a/app.js +++ b/app.js @@ -32,6 +32,15 @@ App({ icon: 'none', duration: 2000 }) + wx.removeStorage({ + key: 'userInfoTemp', + }) + wx.removeStorage({ + key: 'userInfo', + }) + wx.removeStorage({ + key: 'X-Access-Token', + }) } }) }) diff --git a/pages/forgetPassword/forgetPassword.js b/pages/forgetPassword/forgetPassword.js index ffcb768..e6c3bfe 100644 --- a/pages/forgetPassword/forgetPassword.js +++ b/pages/forgetPassword/forgetPassword.js @@ -209,7 +209,7 @@ Page({ let pattern = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/]).{8,}$/ if(!pattern.test(e.detail.value.password)){ wx.showToast({ - title: '新密码由8位及以上数字、大小写字母和特殊符号组成!', + title: '密码由8位及以上数字、大小写字母和特殊符号组成!', icon: 'none' }) this.data.flag = false @@ -225,18 +225,6 @@ Page({ icon: 'none' }) return - } else { - let pattern = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/]).{8,}$/ - if(!pattern.test(e.detail.value.verifyPassword)){ - wx.showToast({ - title: '确认密码由8位及以上数字、大小写字母和特殊符号组成!', - icon: 'none' - }) - this.data.flag = false - return - } else { - this.data.flag = true - } } if(e.detail.value.password === e.detail.value.verifyPassword) { this.data.flag = true diff --git a/pages/mineInfo/mineInfo.js b/pages/mineInfo/mineInfo.js new file mode 100644 index 0000000..dfe29e6 --- /dev/null +++ b/pages/mineInfo/mineInfo.js @@ -0,0 +1,231 @@ +// pages/meeting/meeting.js +import UserApi from '../../assets/js/http/userApi' + +Page({ + + /** + * 页面的初始数据 + */ + data: { + userId: '', + form: { + name: '', + companyName: '', + post: '', + gender: '1', + phone: '', + contactAddress: '', + email: '', + postalCode: '', + remarks: '' + }, + isDisabled: true, + selects: [ // 自定义选择框参数 + { + select: '状态', + active: false, + tabIndex: 1 + }, + { + select: '会议类型', + active: false, + tabIndex: 2 + }, + { + select: '时间', + active: false, + tabIndex: 3 + } + ], + sexArr: [{ + value: '1', + name: '男', + checked: '' + }, + { + value: '2', + name: '女', + checked: '' + } + ] + }, + postInput(e) { + this.setData({ + "form.post": e.detail.value + }) + }, + contactAddressInput(e) { + this.setData({ + "form.contactAddress": e.detail.value + }) + }, + postalCodeInput(e) { + this.setData({ + "form.postalCode": e.detail.value + }) + }, + remarksInput(e) { + this.setData({ + "form.remarks": e.detail.value + }) + }, + // 编辑 + editForm() { + this.setData({ + isDisabled: false + }) + }, + // 提交 + formSubmit(e) { + let flag = false + // 通讯地址校验 + if (!e.detail.value.contactAddress) { + wx.showToast({ + title: '请输入通讯地址', + icon: 'none' + }) + flag = false + return + } else { + flag = true + } + // 邮箱校验 + + if(e.detail.value.email){ + let isEmail = /^\w[-\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\.)+[A-Za-z]{2,14}/.test(e.detail.value.email) + if (!isEmail) { + wx.showToast({ + title: '邮箱格式不正确', + icon: 'none' + }) + flag = false + return + } else { + flag = true + } + }else{ + wx.showToast({ + title: '请输入邮箱', + icon: 'none' + }) + flag = false + return + } + + // 邮政编码校验 + if (e.detail.value.postalCode) { + let isPost = /^[0-9]\d{5}$/.test(e.detail.value.postalCode) + if (!isPost) { + wx.showToast({ + title: '邮政编码格式不正确', + icon: 'none' + }) + flag = false + return + } else { + flag = true + } + }else{ + wx.showToast({ + title: '请输入邮政编码', + icon: 'none' + }) + flag = false + return + } + let params = Object.assign(this.data.form, e.detail.value) + params.id = this.data.userId + if (flag) { + UserApi.editMineInfo(params).then(res => { + if (res.success) { + wx.showToast({ + title: res.result, + }) + // 编辑成功之后,显示查看页 + this.setData({ + isDisabled: true + }) + }else{ + wx.showToast({ + title: res.message, + icon: 'none', + duration: 2000 + }) + } + }).catch(err => { + wx.showToast({ + title: '加载失败', + icon: 'none', + duration: 2000 + }) + }) + } else { + wx.showToast({ + title: '检查表单是否填写正确', + }) + } + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + wx.showToast({ + title: '加载中...', + icon: 'loading' + }) + const that = this + let userInfo = wx.getStorageSync('userInfo') + that.setData({ + userId: userInfo.id + }) + UserApi.mineInfo({ + id: this.data.userId + }).then(res => { + if(res.success){ + res.result.gender = res.result.gender.toString() + this.setData({ + form: res.result + }) + // 性别处理 + if (this.data.form.gender === '1') { + this.data.sexArr[0].checked = "true" + this.setData({ + sexArr: this.data.sexArr, + }) + } + if (this.data.form.gender === '2') { + this.data.sexArr[1].checked = "true" + this.setData({ + sexArr: this.data.sexArr, + }) + } + }else{ + wx.showToast({ + title: res.message, + icon: 'none', + duration: 2000 + }) + } + }).catch(err => { + wx.showToast({ + title: '加载失败', + icon: 'none', + duration: 2000 + }) + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + } +}) \ No newline at end of file diff --git a/pages/mineInfo/mineInfo.json b/pages/mineInfo/mineInfo.json new file mode 100644 index 0000000..5abf709 --- /dev/null +++ b/pages/mineInfo/mineInfo.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "个人信息", + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mineInfo/mineInfo.wxml b/pages/mineInfo/mineInfo.wxml new file mode 100644 index 0000000..9a5304a --- /dev/null +++ b/pages/mineInfo/mineInfo.wxml @@ -0,0 +1,76 @@ + + + 编辑 +
+ + 姓名 + + + + + + 企业名称 + + + + + + 职务 + + + + + + 性别 + + + + + + 性别 + + + + + + + + 手机号 + + + + + + * 通讯地址 + + + + + + * 邮箱 + + + + + + * 邮政编码 + + + + + + 备注 + + + + + + + +
+
diff --git a/pages/mineInfo/mineInfo.wxss b/pages/mineInfo/mineInfo.wxss new file mode 100644 index 0000000..ec75104 --- /dev/null +++ b/pages/mineInfo/mineInfo.wxss @@ -0,0 +1,62 @@ +/* pages/meeting/meeting.wxss */ +.text-label{ + width: 80px !important; +} +/* 列表start */ +.edit-text{ + display: flex; + width: 100%; + box-sizing: border-box; + padding-right: 15pt; + height: 40px; + justify-content: flex-end; + align-items: center; + color: #07c160; +} +.list{ + padding: 15px; +} +.list-item{ + height: 90px; + background-color: #fff; + border-radius: 5px; + padding: 10px 15px; + display: flex; + justify-content: space-around; + align-items: center; + flex-direction: column; +} +.list-item:not(:first-child) { + margin-top: 10px; +} +.list-item .title{ + width: 100%; + display: flex; + justify-content: space-between; + align-items: center; +} +.list-item .title text:nth-child(1){ + font-size: 14px; + color: #333; + flex: 1; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.list-item .title text:nth-child(2){ + font-size: 12px; + color: #999; + width: 70px; + text-align: right; + flex-shrink: 0; +} +.content-text{ + width: 100%; + color: #999; + font-size: 12px; +} +.content-text image{ + width: 11px; + height: 11px; + margin-right: 10px; +} \ No newline at end of file diff --git a/pages/phonePassword/phonePassword.js b/pages/phonePassword/phonePassword.js index 2fa6889..cf4bb7f 100644 --- a/pages/phonePassword/phonePassword.js +++ b/pages/phonePassword/phonePassword.js @@ -149,8 +149,7 @@ Page({ if(res.message == '请先用手机号登录'){ wx.showToast({ title: '首次登录请用验证码方式登录', - icon: 'none', - duration: 3000 + icon: 'none' }) setTimeout(() => { wx.navigateBack() @@ -176,16 +175,16 @@ Page({ }else{ wx.showToast({ title: res.message, - icon: 'none', - duration: 3000 + icon: 'none' }) - this.handleChangeCheckCode() + setTimeout(() => { + this.handleChangeCheckCode() + }, 2000); } }).catch(err=>{ wx.showToast({ title: err.message, - icon: 'none', - duration: 3000 + icon: 'none' }) }) } diff --git a/pages/setPassword/setPassword.js b/pages/setPassword/setPassword.js index 97cff3a..e98d0ae 100644 --- a/pages/setPassword/setPassword.js +++ b/pages/setPassword/setPassword.js @@ -121,7 +121,7 @@ Page({ let pattern = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/]).{8,}$/ if(!pattern.test(e.detail.value.newPassword)){ wx.showToast({ - title: '密码由8位及以上数字、大小写字母和特殊符号组成!', + title: '密码由8位及以上数字、大小写字母和特殊符号组成!', icon: 'none' }) this.data.flag = false @@ -137,18 +137,6 @@ Page({ icon: 'none' }) return - } else { - let pattern = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/]).{8,}$/ - if(!pattern.test(e.detail.value.verifyPassword)){ - wx.showToast({ - title: '密码由8位及以上数字、大小写字母和特殊符号组成!', - icon: 'none' - }) - this.data.flag = false - return - } else { - this.data.flag = true - } } if(e.detail.value.newPassword === e.detail.value.verifyPassword) { this.data.flag = true diff --git a/pages/upDateInfo/upDateInfo.js b/pages/upDateInfo/upDateInfo.js index 95154fb..7284753 100644 --- a/pages/upDateInfo/upDateInfo.js +++ b/pages/upDateInfo/upDateInfo.js @@ -168,7 +168,7 @@ Page({ let pattern = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/]).{8,}$/ if(!pattern.test(e.detail.value.oldpassword)){ wx.showToast({ - title: '旧密码由8位及以上数字、大小写字母和特殊符号组成!', + title: '密码由8位及以上数字、大小写字母和特殊符号组成!', icon: 'none' }) this.data.flag = false @@ -188,7 +188,7 @@ Page({ let pattern = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/]).{8,}$/ if(!pattern.test(e.detail.value.password)){ wx.showToast({ - title: '新密码由8位及以上数字、大小写字母和特殊符号组成!', + title: '密码由8位及以上数字、大小写字母和特殊符号组成!', icon: 'none' }) this.data.flag = false @@ -208,7 +208,7 @@ Page({ let pattern = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/]).{8,}$/ if(!pattern.test(e.detail.value.confirmpassword)){ wx.showToast({ - title: '确认新密码由8位及以上数字、大小写字母和特殊符号组成!!', + title: '密码由8位及以上数字、大小写字母和特殊符号组成!', icon: 'none' }) this.data.flag = false