panhui 3 年之前
父節點
當前提交
fa463f12fc
共有 6 個文件被更改,包括 102 次插入95 次删除
  1. 1 2
      src/router/index.js
  2. 1 1
      src/views/Home.vue
  3. 2 2
      src/views/Mine.vue
  4. 81 72
      src/views/account/Forget.vue
  5. 4 6
      src/views/account/Register.vue
  6. 13 12
      src/views/account/Security.vue

+ 1 - 2
src/router/index.js

@@ -198,9 +198,8 @@ const routes = [
         name: 'userForget',
         component: () => import('../views/account/Forget.vue'),
         meta: {
-            pageType: Page.Login,
             // menuPage: true,
-            title: '忘记密码'
+            title: '修改登录密码'
         }
     },
     {

+ 1 - 1
src/views/Home.vue

@@ -158,7 +158,7 @@ export default {
             if (this.active === 0) {
                 return {
                     zone: this.zone,
-                    // status: 'WAITING,GAMING',
+                    status: 'WAITING,GAMING',
                     id: this.search
                 };
             } else {

+ 2 - 2
src/views/Mine.vue

@@ -15,10 +15,10 @@
                 <div class="user-text">
                     <div class="text1">
                         <div class="name">{{ userInfo.nickname }}</div>
-                        <div class="auth not" @click.stop="goAuth">
+                        <!-- <div class="auth not" @click.stop="goAuth">
                             <img src="@assets/renzheng_icon.png" alt="" />
                             <span>未实名认证</span>
-                        </div>
+                        </div> -->
                     </div>
                     <div class="text2">ID:{{ userInfo.id }}</div>
                 </div>

+ 81 - 72
src/views/account/Forget.vue

@@ -1,39 +1,21 @@
 <template>
     <div class="login">
-        <div class="tabs">
-            <div class="tab active">设置新密码</div>
+        <div class="phone" v-if="step === 0">
+            <div class="text1">{{ phone }}</div>
+            <div class="text2">修改密码需先验证当前手机号</div>
         </div>
-
         <van-form ref="form" @submit="submit">
-            <van-field
-                type="tel"
-                name="手机号码"
-                placeholder="请输入手机号码"
-                v-model="form.phone"
-                :maxlength="11"
-                :rules="[
-                    { required: true, message: '请输入手机号码' },
-                    {
-                        pattern: phonePattern,
-                        message: '手机号码格式错误'
-                    }
-                ]"
-            >
-                <template #left-icon>
-                    <img :src="require('@assets/login_icon_zhanghao.png')" class="icon" />
-                </template>
-            </van-field>
-
             <van-field
                 type="digit"
                 name="验证码"
+                v-if="step === 0"
                 placeholder="请输入验证码"
                 v-model="form.code"
                 :maxlength="4"
                 :rules="[{ required: true, message: '请输入验证码' }]"
             >
                 <template #left-icon>
-                    <img :src="require('@assets/login_icon_mima (1).png')" class="icon" />
+                    <img :src="require('@assets/svgs/login_icon_code.svg')" class="icon" />
                 </template>
                 <template #button>
                     <van-button
@@ -41,59 +23,56 @@
                         class="sub-code"
                         size="small"
                         plain
+                        type="warning"
                         :disabled="isSend"
-                        type="primary"
                     >
                         {{ isSend ? `已发送(${sendNum})S` : '发送验证码' }}
                     </van-button>
                 </template>
             </van-field>
 
-            <van-field
-                type="password"
-                name="密码"
-                placeholder="请输入密码"
-                v-model="form.password"
-                :rules="[{ required: true, message: '请填写密码' }]"
-            >
-                <template #left-icon>
-                    <img :src="require('@assets/login_icon_mima.png')" class="icon" />
-                </template>
-            </van-field>
-
-            <van-field
-                type="password"
-                name="密码"
-                placeholder="请再次输入密码"
-                v-model="form.password2"
-                :rules="[
-                    { required: true, message: '请再次填写密码' },
-                    {
-                        validator: val => {
-                            if (val == form.password) {
-                                return true;
-                            } else {
-                                return false;
-                            }
-                        },
-                        message: '两次密码输入不一致'
-                    }
-                ]"
-            >
-                <template #left-icon>
-                    <img :src="require('@assets/login_icon_mima.png')" class="icon" />
-                </template>
-            </van-field>
+            <template v-else>
+                <van-field
+                    type="password"
+                    name="密码"
+                    placeholder="请输入密码"
+                    v-model="form.password"
+                    :rules="[{ required: true, message: '请填写密码' }]"
+                >
+                    <template #left-icon>
+                        <img :src="require('@assets/svgs/login_icon_mima.svg')" class="icon" />
+                    </template>
+                </van-field>
+
+                <van-field
+                    type="password"
+                    name="密码"
+                    placeholder="请再次输入密码"
+                    v-model="form.password2"
+                    :rules="[
+                        { required: true, message: '请再次填写密码' },
+                        {
+                            validator: val => {
+                                if (val == form.password) {
+                                    return true;
+                                } else {
+                                    return false;
+                                }
+                            },
+                            message: '两次密码输入不一致'
+                        }
+                    ]"
+                >
+                    <template #left-icon>
+                        <img :src="require('@assets/svgs/login_icon_mima.svg')" class="icon" />
+                    </template>
+                </van-field>
+            </template>
 
             <div class="button">
-                <van-button
-                    round
-                    block
-                    native-type="submit"
-                    :color="`linear-gradient(to right, ${$colors.prim}, ${$colors.warn})`"
-                    class="sure"
-                    >确定修改</van-button
-                >
+                <van-button round block native-type="submit" type="primary" class="sure">
+                    {{ step === 0 ? '下一步' : '确定修改' }}
+                </van-button>
                 <!-- <van-button
           class="del"
           round
@@ -108,6 +87,7 @@
 </template>
 
 <script>
+import { mapState } from 'vuex';
 import phone from '../../mixins/phone';
 export default {
     mixins: [phone],
@@ -119,22 +99,35 @@ export default {
                 password: '',
                 password2: '',
                 code: ''
-            }
+            },
+            step: 0
         };
     },
+    computed: {
+        ...mapState(['userInfo']),
+        phone() {
+            let phone = this.userInfo.phone || '';
+            return phone.substr(0, 3) + '****' + phone.substr(-4, 4);
+        }
+    },
     methods: {
         sendPhone() {
-            this.$refs.form.validate('手机号码').then(() => {
-                this.sendMsg(this.form.phone);
-            });
+            this.sendMsg(this.userInfo.phone);
         },
         submit() {
+            if (this.step === 0) {
+                this.step = 1;
+                return;
+            }
             this.$toast.loading({
                 message: '加载中...',
                 forbidClick: true
             });
             this.$http
-                .post(`/user/changePassword?password=${this.form.password}&code=${this.form.code}`)
+                .post('/user/userChangePassword', {
+                    password: this.form.password,
+                    code: this.form.code
+                })
                 .then(res => {
                     this.$toast.success('修改成功');
                     setTimeout(() => {
@@ -219,4 +212,20 @@ export default {
     padding-right: 0;
     border-width: 0;
 }
+
+.phone {
+    .flex-col();
+    align-items: center;
+    .text1 {
+        font-size: 24px;
+        font-weight: bold;
+        color: #ffffff;
+        line-height: 34px;
+    }
+    .text2 {
+        font-size: 14px;
+        color: #6a6d83;
+        margin-top: 10px;
+    }
+}
 </style>

+ 4 - 6
src/views/account/Register.vue

@@ -10,7 +10,7 @@
                 type="tel"
                 name="手机号码"
                 placeholder="请输入手机号码"
-                v-model="form.username"
+                v-model="form.phone"
                 :maxlength="11"
                 :rules="[
                     { required: true, message: '请输入手机号码' },
@@ -140,12 +140,10 @@ export default {
         return {
             active: 'phone',
             form: {
-                username: '',
+                phone: '',
                 password: '',
                 password2: '',
-                code: '',
-                inviteCode: this.$store.state.inviteCode || '',
-                showroomId: this.$store.state.showRoomId || ''
+                code: ''
             },
             checked: false,
             showInvite: true,
@@ -178,7 +176,7 @@ export default {
                 forbidClick: true
             });
             this.$http
-                .post('/user/register', this.form)
+                .post('/auth/phoneRegister', this.form)
                 .then(res => {
                     localStorage.setItem('dianjinToken', res);
                     return this.$store.dispatch('getUserInfo');

+ 13 - 12
src/views/account/Security.vue

@@ -2,9 +2,10 @@
     <div class="page">
         <van-cell-group :border="false">
             <van-cell title="修改登录密码" :to="{ path: '/forget' }" is-link />
-            <van-cell title="修改支付密码" :to="{ path: '/tradingPassword' }" is-link />
-            <!-- <van-cell title="修改手机号" :to="{ path: '/changePhone' }" is-link /> -->
+            <!-- <van-cell title="修改支付密码" :to="{ path: '/tradingPassword' }" is-link /> -->
+            <!-- <van-cell title="修改手机号" :to="{ path: '/changePhone' }" :value="userInfo.phone" is-link /> -->
             <van-cell title="注销账号" @click="cancel" is-link />
+            <van-cell title="当前版本" value="1.0.0" />
         </van-cell-group>
         <div class="logout">
             <van-button type="primary" @click="logout" plain block round>退出登录</van-button>
@@ -13,7 +14,11 @@
 </template>
 
 <script>
+import { mapState } from 'vuex';
 export default {
+    computed: {
+        ...mapState(['userInfo'])
+    },
     methods: {
         logout() {
             this.$dialog
@@ -27,16 +32,12 @@ export default {
                 });
         },
         cancel() {
-            this.$dialog
-                .confirm({
-                    title: '提示',
-                    message:
-                        '亲爱的用户,你确定要注销该账号吗?注销账号涉及个人信息与链上资产,建议提交客服进行人工审核与处理。',
-                    confirmButtonText: '确认注销'
-                })
-                .then(() => {
-                    this.$router.push('/messageAdd');
-                });
+            this.$dialog.confirm({
+                title: '提示',
+                message:
+                    '亲爱的用户,你确定要注销该账号吗?注销账号涉及个人信息与链上资产,建议提交客服进行人工审核与处理。',
+                confirmButtonText: '确认注销'
+            });
         }
     }
 };