فهرست منبع

登录注册页面

xuqiang 4 سال پیش
والد
کامیت
3ca2e35c0b

+ 2 - 2
src/main/pc-space/src/components/GoodsInfo.vue

@@ -72,9 +72,9 @@ export default {
         .line();
         width: 276px;
         height: 416px;
-       .imgBox {
+        .imgBox {
             height: 266px;
-            width: 276px;
+            width: 100%;
             border-radius: 8px 8px 0px 0px;
         }
         .introduce {

+ 117 - 9
src/main/pc-space/src/components/LoginInfo.vue

@@ -3,7 +3,7 @@
         <div class="content" v-if="!flag">
             <el-form v-if="!phoneLogin" :model="form" ref="form" :rules="rules" label-width="0">
                 <el-form-item
-                    prop="username"
+                    prop="phone"
                     :rules="{
                         pattern: /^1[3-9]\d{9}$/,
                         message: '请输入正确的手机号',
@@ -11,7 +11,7 @@
                     }"
                 >
                     <span class="el-icon-mobile-phone"></span>
-                    <el-input style="width: 300px" v-model="form.username" placeholder="请输入手机号"></el-input>
+                    <el-input style="width: 300px" v-model="form.phone" placeholder="请输入手机号"></el-input>
                 </el-form-item>
                 <div @keyup.enter="Login">
                     <el-form-item prop="password" :rules="{ required: true, message: '请输入', trigger: 'blur' }">
@@ -56,7 +56,7 @@
                 <el-link type="danger" v-if="!phoneLogin" @click="passwordFn">忘记密码?</el-link>
             </div>
             <div class="sub-btn">
-                <div v-if="!phoneLogin" class="btn1">登录</div>
+                <div v-if="!phoneLogin" @click="Login2" class="btn1">登录</div>
                 <div class="btn1" v-else @click="loginPhone">登录</div>
                 <el-button style="background: #f2f3f5; color: #292c33" type="info" class="btn-block" @click="Register"
                     >还没有账号?立即注册</el-button
@@ -100,11 +100,11 @@
                             placeholder="请输入8-16位密码,建议数字、大小写字母组合"
                         ></el-input>
                     </el-form-item>
-                    <el-form-item prop="pass">
+                    <el-form-item prop="password2">
                         <span class="el-icon-unlock"></span>
                         <el-input
                             style="width: 300px"
-                            v-model="form.pass"
+                            v-model="form.password2"
                             type="password"
                             autocomplete="off"
                             placeholder="请再次输入密码"
@@ -141,7 +141,9 @@
     </el-dialog>
 </template>
 <script>
+import phone from '../mixins/phone';
 export default {
+    mixins: [phone],
     props: {
         dialogVisible: {
             type: Boolean,
@@ -153,9 +155,25 @@ export default {
             show: false,
             phoneLogin: false,
             flag: false,
-            rules: {},
+            rules: {
+                password: [{ min: 8, max: 16, message: '密码长度在 8 到 16 个字符', trigger: 'blur' }],
+                password2: [
+                    {
+                        validator: (rule, value, callback) => {
+                            if (value !== this.form.password) {
+                                callback(new Error('两次密码输入不一致'));
+                            } else {
+                                callback();
+                            }
+                        },
+                        trigger: 'blur'
+                    },
+                    { required: true, message: '请再次输入密码', trigger: 'blur' }
+                ]
+            },
             form: {},
             time: 0,
+            // isSend: false,
             checked: false
         };
     },
@@ -167,11 +185,101 @@ export default {
         passwordFn() {
             this.flag = true;
             this.flag1 = false;
+            this.form.phone = '';
+            this.form.password = '';
+            this.form.password2 = '';
+        },
+        doRegister() {
+            this.$http;
+            this.verifyMsg(this.form.phone, this.form.code)
+                .then(() => {
+                    return this.$http.post(
+                        '/auth/phoneRegister?phone=' +
+                            this.form.phone +
+                            '&password=' +
+                            this.form.password +
+                            '&code=' +
+                            this.form.code
+                    );
+                })
+                .then(res => {
+                    console.log(res);
+                    localStorage.setItem('nineToken', res);
+                    return this.$store.dispatch('getUserInfo');
+                })
+                .then(() => {
+                    this.$message.warning('注册成功');
+                    this.flag = false;
+                    // this.form = '';
+                    // setTimeout(() => {
+                    //     this.$router.back();
+                    // }, 1500);
+                })
+                .catch(e => {
+                    if (e) {
+                        this.$message.error(e.error);
+                    }
+                });
         },
-        loginPhone() {},
-        doRegister() {},
         send() {
-            this.sendCode();
+            this.sendMsg(this.form.phone);
+        },
+        Login2() {
+            this.loading = true;
+            this.$http
+                .post('/auth/login', {
+                    phone: this.form.phone,
+                    password: this.form.password
+                })
+                .then(res => {
+                    localStorage.setItem('webToken', res);
+                    this.$message.warning('登录成功');
+                    // this.$store.commit('loginTypeFn', true);
+                    return this.$store.dispatch('getUserInfo');
+                })
+                // .then(() => {
+                //     this.$router.replace('/');
+                // })
+                .catch(e => {
+                    this.loading = false;
+                    this.$message.error(e.error);
+                });
+        },
+        loginPhone() {
+            // return this.$http
+            //     .post('/auth/phoneLogin', {
+            //         phone: this.form.phone,
+            //         code: this.form.code
+            //     })
+            //     .catch(e => {
+            //         if (e) {
+            //             this.$message.error(e.error);
+            //         }
+            //         return Promise.reject();
+            //     })
+            //     .then(res => {
+            //         localStorage.setItem('nineToken', res);
+            //         return this.$store.dispatch('getUserInfo');
+            //     });
+            // this.$toast.loading({
+            //     message: '加载中...',
+            //     forbidClick: true
+            // });
+            this.verifyMsg(this.form.phone, this.form.code)
+                .then(() => {
+                    return this.$http.post('/user/bindPhone?phone=' + this.form.phone);
+                })
+                .then(() => {
+                    this.$toast.success('修改成功');
+                    // setTimeout(() => {
+                    //     this.$router.back();
+                    // }, 1500);
+                })
+                .catch(e => {
+                    if (e) {
+                        this.$toast(e.error);
+                    }
+                });
         },
         closeDialog() {
             this.$emit('close');

+ 8 - 1
src/main/pc-space/src/components/SearchInfo.vue

@@ -1,6 +1,13 @@
 <template>
     <div class="search">
-        <el-input prefix-icon="el-icon-zoom-out" placeholder="请输入内容" v-model="input" clearable> </el-input>
+        <el-input
+            class="search"
+            prefix-icon="el-icon-search"
+            placeholder="请输入您想找到的作者名称…"
+            v-model="search"
+            clearable
+        >
+        </el-input>
         <el-dropdown @command="onCommand">
             <el-button type="primary"> 综合排序<i class="el-icon-arrow-down el-icon--right"></i> </el-button>
             <el-dropdown-menu slot="dropdown">

+ 17 - 7
src/main/pc-space/src/mixins/phone.js

@@ -6,26 +6,27 @@ export default {
             isSend: false,
             msgCode: '',
             sendNum: 60,
+            time: 60,
             timer: null
         };
     },
     methods: {
         sendMsg(phone) {
-            this.isSend = true;
-            this.setTime(60);
+            // this.isSend = true;
+            this.checkTime(60);
             this.$http
                 .get('/sms/sendVerify', {
                     phone: phone
                 })
                 .then(res => {
                     this.msgCode = res;
-                    this.$toast.success('发送成功');
+                    this.$message.warning('发送成功');
                 })
                 .catch(e => {
                     if (e) {
-                        this.$toast(e.error);
+                        this.$message.error(e.error);
                     }
-                    this.setTime(0);
+                    this.checkTime(0);
                 });
         },
         setTime(num) {
@@ -43,6 +44,15 @@ export default {
                 }, 1000);
             }
         },
+        checkTime() {
+            this.time = 60;
+            let i = setInterval(() => {
+                this.time--;
+                if (this.time === 0) {
+                    clearInterval(i);
+                }
+            }, 1000);
+        },
         verifyMsg(phone, code) {
             return this.$http
                 .get('/sms/verify', {
@@ -51,7 +61,7 @@ export default {
                 })
                 .catch(e => {
                     if (e) {
-                        this.$toast(e.error);
+                        this.$message.error(e.error);
                     }
                     return Promise.reject();
                 });
@@ -64,7 +74,7 @@ export default {
                 })
                 .catch(e => {
                     if (e) {
-                        this.$toast(e.error);
+                        this.$message.error(e.error);
                     }
                     return Promise.reject();
                 })

+ 9 - 4
src/main/pc-space/src/views/StoreDetail.vue

@@ -127,9 +127,13 @@
             </div>
             <div v-if="showMore2" class="border"></div>
             <div class="info4 rad1" v-if="!showMore2">
-                <div class="text1">Hash地址:f6b1a265b50717b4b1bae9dc6…</div>
-                <div class="text1">区块高度: 77259404</div>
-                <div class="text1">令牌ID: ID57896044618658097711785492504…</div>
+                <template>
+                    <el-table :data="tableData" stripe style="width: 100%">
+                        <el-table-column prop="date" label="日期" width="180"> </el-table-column>
+                        <el-table-column prop="name" label="姓名" width="180"> </el-table-column>
+                        <el-table-column prop="address" label="地址"> </el-table-column>
+                    </el-table>
+                </template>
             </div>
         </div>
         <div class="nft">
@@ -154,7 +158,8 @@ export default {
         return {
             showMore: false,
             showMore1: false,
-            showMore2: false
+            showMore2: false,
+            tableData: []
         };
     },
     methods: {}