| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- <template>
- <view class="container">
- <view class="login-wrap">
- <view class="login-form">
- <u--form
- labelPosition="left"
- :model="userInfo"
- :rules="rules"
- ref="form1"
- >
- <u-form-item
- label="账号密码"
- prop="password"
- borderBottom
- labelWidth="auto"
- labelAlign="right"
- >
- <u--input
- v-model="userInfo.password"
- placeholder="请输入账号密码"
- border="bottom"
- type="password"
- ></u--input>
- </u-form-item>
- </u--form>
- </view>
- </view>
- <view @click="submitAccountPasswordVerify()" class="op-btn-wrap">
- <view class="h-btn">
- <text>确定</text>
- </view>
- </view>
- <!-- 密码正确 -->
- <u-popup :show="show" :round="10" mode="center" @close="close" @open="open">
- <view class="h-popo-content">
- <view class="h-img">
- <u-icon name="checkbox-mark" color="green" size="40"></u-icon>
- </view>
- <view class="text">
- <text>账号找回成功</text>
- </view>
- <view class="text">
- <text> 是否立即绑定新的微信号</text>
- </view>
- <view class="h-btn-wrap">
- <view @click="show = false" class="h-left-btn">
- <text>取消</text>
- </view>
- <view @click="gotoBindWechat()" class="h-right-btn">
- <text>立即绑定</text>
- </view>
- </view>
- </view>
- </u-popup>
- <!-- 密码正确 -->
- <u-popup :show="passwordErrShow" :round="10" mode="center" @close="close" @open="open">
- <view class="h-popo-content">
- <view class="h-img">
- <!-- <u-icon name="close" color="red" size="40"></u-icon> -->
- <u-icon name="/static/login/u01.png" color="red" size="50"></u-icon>
- </view>
- <view class="h-text">
- <text>密码错误</text>
- </view>
- <view class="h-btn-wrap">
- <view @click="passwordErrShow = false" class="h-right-btn">
- <text>确定</text>
- </view>
- </view>
- </view>
- </u-popup>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- passwordErrShow: false,
- show: false,
- userInfo: {
- phone: '',
- password: '',
- },
- rules: {
- password:{
- required: true,
- message: '请输入账号密码',
- trigger: ['blur', 'change'],
- },
- },
- }
- },
- onLoad(option) {
- // 判断Openid是否为空
- if(!this.$isDataEmpty(option)){
- this.userInfo.phone = option.data;
- }
- },
- onReady() {
- this.$refs.form1.setRules(this.rules)
- },
- methods: {
- // 提交账号密码验证
- submitAccountPasswordVerify(){
- this.$refs.form1.validate().then(res => {
- // 验证找回
- this.wechatRetrieveAccountPwdLogin();
- }).catch(errors => {
- uni.$u.toast('校验失败,请认真填写')
- })
- },
- // 去绑定微信
- gotoBindWechat(){
- this.show = false;
- uni.$u.route({
- url: '/pages/setting/setting-wechat',
- params: {
- name: 'lisa'
- }
- })
- },
- // 账号密码找回登录
- wechatRetrieveAccountPwdLogin(){
- let that = this;
- // 根据手机和密码找回账号,成功自动登录
- wechatRetrieveAccountPwdLogin(null,{data:this.userInfo}).then((res)=>{
- if(!this.$isDataEmpty(res.access_token)){
- let loginState = {
- status: 1,
- accessToken: ""
- }
- // 数据获取token
- loginState.accessToken = res.access_token;
- that.$store.commit('updateLoginState', loginState);
- that.$store.commit('updateLoginUserInfo', res.userInfo)
- that.show = true;
- } else {
- uni.showToast({
- title: "操作失败"
- })
- }
- }).catch(() =>{
- uni.showToast({
- title: "操作失败"
- })
- });
- },
- open() {
- },
- close() {
- }
- }
- }
- </script>
- <style lang="scss">
- page,body{
- background: #fff;
- }
- .container{
- background: #fff;
- height: 300px;
- .login-wrap {
- display: flex;
- justify-content: center;
- .login-form{
- width: 90%;
- }
- .account{
- display: flex;
- }
- .identifying-code{
- }
- }
- .op-btn-wrap{
- margin-top: 30px;
- display: flex;
- justify-content: center;
- align-items: center;
- .h-btn{
- text-align: center;
- width: 343px;
- height: 42px;
- background: #FFE05C;
- border-radius: 27px;
- line-height: 42px;
- }
- }
- }
- .h-popo-content{
- height: 160px;
- padding: 12px;
- width: 300px;
- text-align: center;
- font-size: 14px;
- font-family: PingFangSC-Semibold, PingFang SC;
- .h-img{
- display: flex;
- justify-content: center;
- }
- .h-text{
- margin-top: 12px;
- font-weight: 400;
- color: #666666;
- }
- .text{
- margin-top: 6px;
- font-weight: 400;
- color: #666666;
- }
- .h-btn-wrap{
- display: flex;
- justify-content: space-between;
- color: #333333;
- text-align: center;
- margin-top: 14px;
- .h-left-btn{
- height: 32px;
- line-height: 30px;
- background: #EEEEEE;
- width: 100px;
- text-align: center;
- border-radius: 16px;
- margin: 0 auto;
- }
- .h-right-btn{
- height: 32px;
- line-height: 30px;
- background: #FFE05C;
- width: 100px;
- border-radius: 16px;
- margin: 0 auto;
- }
- }
- }
- </style>
|