Bläddra i källkod

Merge branch 'master' of http://git.izouma.com/xiongzhu/9th

panhui 4 år sedan
förälder
incheckning
ae1913ef37

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 107 - 748
src/main/pc-space/package-lock.json


+ 1 - 1
src/main/pc-space/package.json

@@ -17,7 +17,7 @@
         "vue-awesome-swiper": "^4.1.1",
         "vue-clipboard2": "^0.3.3",
         "vue-router": "^3.2.0",
-        "vue-social-share": "^0.0.3",
+        "vue-social-share": "0.0.3",
         "vuex": "^3.4.0"
     },
     "devDependencies": {

BIN
src/main/pc-space/src/assets/img/login_icon_yanzhengma@3x (2).png


+ 176 - 203
src/main/pc-space/src/components/LoginInfo.vue

@@ -1,71 +1,8 @@
 <template>
-    <el-dialog title="提示" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" @close="closeDialog">
-        <div class="content" v-if="!flag">
-            <el-form v-if="!phoneLogin" :model="form" ref="form" :rules="rules" label-width="0">
-                <el-form-item
-                    prop="phone"
-                    :rules="{
-                        pattern: /^1[3-9]\d{9}$/,
-                        message: '请输入正确的手机号',
-                        trigger: 'blur'
-                    }"
-                >
-                    <span class="el-icon-mobile-phone"></span>
-                    <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' }">
-                        <span class="el-icon-unlock"></span>
-                        <el-input
-                            style="width: 300px"
-                            v-model="form.password"
-                            placeholder="请输入密码"
-                            type="password"
-                        ></el-input>
-                    </el-form-item>
-                </div>
-            </el-form>
-            <el-form v-if="phoneLogin" :model="form" ref="form" label-width="0">
-                <el-form-item
-                    prop="phone"
-                    :rules="{
-                        pattern: /^1[3-9]\d{9}$/,
-                        message: '请输入正确的手机号',
-                        trigger: 'blur'
-                    }"
-                >
-                    <span class="el-icon-mobile-phone"></span>
-                    <el-input v-model="form.phone" style="width: 300px" placeholder="请输入手机号"> </el-input>
-                </el-form-item>
-                <div @keyup.enter="loginPhone">
-                    <el-form-item prop="code" :rules="{ required: true, message: '请输入', trigger: 'blur' }">
-                        <span class="el-icon-mobile-phone"></span>
-                        <el-input style="width: 300px" v-model="form.code" placeholder="请输入短信验证码">
-                            <span
-                                @click="send"
-                                style="color: #ff4f50; cursor: pointer; font-size: 13px"
-                                slot="suffix"
-                                >{{ time === 0 ? '发送验证码' : `重新发送${time}s` }}</span
-                            >
-                        </el-input>
-                    </el-form-item>
-                </div>
-            </el-form>
-            <div class="btn">
-                <el-link @click="phoneLogin = !phoneLogin">{{ phoneLogin ? '密码登录' : '短信验证码登录' }}</el-link>
-                <el-link type="danger" v-if="!phoneLogin" @click="passwordFn">忘记密码?</el-link>
-            </div>
-            <div class="sub-btn">
-                <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
-                >
-            </div>
-        </div>
-        <div class="content" v-if="flag">
+    <div>
+        <el-dialog :title="Title" :visible.sync="Show" width="30%" :before-close="handleClose" @close="closeDialog">
             <div class="content">
-                <el-form :model="form" ref="form" :rules="rules" label-width="0">
+                <el-form v-if="!phoneLogin" :model="form" ref="form" :rules="rules" label-width="0">
                     <el-form-item
                         prop="phone"
                         :rules="{
@@ -77,9 +14,35 @@
                         <span class="el-icon-mobile-phone"></span>
                         <el-input style="width: 300px" v-model="form.phone" placeholder="请输入手机号"></el-input>
                     </el-form-item>
-                    <el-form-item prop="code">
+                    <div @keyup.enter="Login2">
+                        <el-form-item prop="password" :rules="{ required: true, message: '请输入', trigger: 'blur' }">
+                            <span class="el-icon-unlock"></span>
+                            <el-input
+                                style="width: 300px"
+                                v-model="form.password"
+                                placeholder="请输入密码"
+                                type="password"
+                            ></el-input>
+                        </el-form-item>
+                    </div>
+                </el-form>
+                <el-form v-if="phoneLogin" :model="form" ref="form" label-width="0">
+                    <el-form-item
+                        prop="phone"
+                        :rules="{
+                            pattern: /^1[3-9]\d{9}$/,
+                            message: '请输入正确的手机号',
+                            trigger: 'blur'
+                        }"
+                    >
+                        <span class="el-icon-mobile-phone"></span>
+                        <el-input v-model="form.phone" style="width: 300px" placeholder="请输入手机号"> </el-input>
+                    </el-form-item>
+                    <div @keyup.enter="loginPhone">
                         <el-form-item prop="code" :rules="{ required: true, message: '请输入', trigger: 'blur' }">
-                            <span class="el-icon-mobile-phone"></span>
+                            <span class="icon">
+                                <img src="../assets/img/login_icon_yanzhengma@3x (2).png" alt="" />
+                            </span>
                             <el-input style="width: 300px" v-model="form.code" placeholder="请输入短信验证码">
                                 <span
                                     @click="send"
@@ -89,63 +52,44 @@
                                 >
                             </el-input>
                         </el-form-item>
-                    </el-form-item>
-                    <el-form-item prop="password">
-                        <span class="el-icon-unlock"></span>
-                        <el-input
-                            style="width: 300px"
-                            v-model="form.password"
-                            type="password"
-                            autocomplete="off"
-                            placeholder="请输入8-16位密码,建议数字、大小写字母组合"
-                        ></el-input>
-                    </el-form-item>
-                    <el-form-item prop="password2">
-                        <span class="el-icon-unlock"></span>
-                        <el-input
-                            style="width: 300px"
-                            v-model="form.password2"
-                            type="password"
-                            autocomplete="off"
-                            placeholder="请再次输入密码"
-                        ></el-input>
-                    </el-form-item>
+                    </div>
                 </el-form>
-                <template>
-                    <el-checkbox v-model="checked" v-if="flag1">
-                        <el-link style="margin-bottom: 2px">点击同意注册协议</el-link>
-                    </el-checkbox>
-                </template>
-                <div class="sub-btn" style="width: 300px" v-if="flag1">
-                    <div class="btn1" @click="doRegister">立即注册</div>
-                    <el-button
-                        style="background: #f2f3f5; color: #292c33"
-                        type="info"
-                        class="btn-block"
-                        @click="flag = false"
-                        >已有账号,立即登录</el-button
-                    >
+                <div class="btn">
+                    <el-link @click="phoneLogin = !phoneLogin">{{
+                        phoneLogin ? '密码登录' : '短信验证码登录'
+                    }}</el-link>
+                    <el-link type="danger" v-if="!phoneLogin" @click="passwordFn">忘记密码?</el-link>
                 </div>
-                <div class="sub-btn" style="width: 300px" v-else>
-                    <el-button type="primary" class="btn-block" @click="passwordFn2">确定</el-button>
+                <div class="sub-btn">
+                    <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="flag = false"
-                        >想起密码,立即登录</el-button
+                        @click="Register"
+                        >还没有账号?立即注册</el-button
                     >
                 </div>
             </div>
-        </div>
-    </el-dialog>
+        </el-dialog>
+        <register-info
+            :isShow="isShow"
+            :isShow2="isShow2"
+            @init="init"
+            @close1="isShow2 = false"
+            @refreash="refreash"
+        ></register-info>
+    </div>
 </template>
 <script>
 import phone from '../mixins/phone';
+import RegisterInfo from './RegisterInfo.vue';
 export default {
     mixins: [phone],
+    components: { RegisterInfo },
     props: {
-        dialogVisible: {
+        Show: {
             type: Boolean,
             default: false
         }
@@ -153,119 +97,137 @@ export default {
     data() {
         return {
             show: false,
+            isShow: false,
+            isShow2: false,
             phoneLogin: false,
-            flag: false,
-            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' }
-                ]
-            },
+            rules: {},
             form: {},
-            time: 0,
-            // isSend: false,
-            checked: false
+            time: 0
         };
     },
+    computed: {
+        Title() {
+            if (!this.phoneLogin) {
+                return '登录';
+            } else {
+                return '短信验证码登录';
+            }
+        }
+    },
     methods: {
         Register() {
-            this.flag = true;
-            this.flag1 = true;
+            this.Show = false;
+            this.isShow = true;
+            this.isShow2 = true;
+        },
+        refreash() {
+            this.Show = false;
+            this.isShow = false;
+        },
+        init() {
+            this.isShow = false;
+            this.Show = true;
+            this.phoneLogin = false;
+        },
+        handleClose() {
+            this.Show = false;
+            this.phoneLogin = false;
         },
         // 忘记密码
         passwordFn() {
-            this.flag = true;
-            this.flag1 = false;
-            // this.form.phone = '';
-            // this.form.password = '';
-            // this.form.password2 = '';
+            this.Show = false;
+            this.isShow = true;
+            this.isShow2 = false;
         },
         // 注册
-        doRegister() {
-            // console.log(this.form.phone, this.form.password);
-            this.$http;
-            this.verifyMsg(this.form.phone, this.form.code).then(() => {
-                return (
-                    this.$http
-                        .post('/user/phoneRegister', {
-                            phone: this.form.phone,
-                            password: this.form.password,
-                            code: this.form.code
-                        })
-                        // })
-                        .then(res => {
-                            console.log(res);
-                            localStorage.setItem('webToken', res);
-                            return this.$store.dispatch('getUserInfo');
-                        })
-                        .then(() => {
-                            this.$message.warning('注册成功');
-                            this.flag = false;
-                        })
-                        .catch(e => {
-                            if (e) {
-                                this.$message.error(e.error);
-                            }
-                        })
-                );
-            });
-        },
+        // 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('webToken', res);
+        //                     return this.$store.dispatch('getUserInfo');
+        //                 })
+        //                 .then(() => {
+        //                     this.$message.success('注册成功');
+        //                     // this.flag = false;
+        //                     this.Show = false;
+        //                 })
+        //                 .catch(e => {
+        //                     if (e) {
+        //                         this.$message.error(e.error);
+        //                     }
+        //                 })
+        //         );
+        //     });
+        // },
         // 验证码
         send() {
             this.sendMsg(this.form.phone);
         },
         // 修改密码
-        passwordFn2() {
-            this.verifyMsg(this.form.phone, this.form.code).then(() => {
-                this.$http
-                    .post('/user/forgotPassword', {
-                        phone: this.form.phone,
-                        password: this.form.password,
-                        code: this.form.code
-                    })
-                    // })
-                    .then(() => {
-                        this.$toast.success('修改成功');
-                    })
-                    .catch(e => {
-                        if (e) {
-                            this.$toast(e.error);
-                        }
-                    });
-            });
-        },
+        // passwordFn2() {
+        //     this.verifyMsg(this.form.phone, this.form.code)
+        //         .then(() => {
+        //             this.$http
+        //                 .post('/auth/forgotPassword', {
+        //                     phone: this.form.phone,
+        //                     password: this.form.password,
+        //                     code: this.form.code
+        //                 })
+        //                 // })
+        //                 .then(() => {
+        //                     this.$toast.success('修改成功');
+        //                     this.Show = false;
+        //                 })
+        //                 .catch(e => {
+        //                     if (e) {
+        //                         this.$message.error(e.error);
+        //                     }
+        //                 });
+        //         })
+        //         .catch(e => {
+        //             if (e) {
+        //                 this.$message.error(e.error);
+        //             }
+        //         });
+        // },
         // 密码登录
-        Login2() {
-            this.loading = true;
+        check() {
             this.$http
-                .post('/user/loginByPhonePwd', {
+                .post('/auth/phonePwdLogin', {
                     phone: this.form.phone,
                     password: this.form.password
                 })
+                .catch(e => {
+                    if (e) {
+                        this.$message.error(e.error);
+                    }
+                    return Promise.reject();
+                })
                 .then(res => {
                     localStorage.setItem('webToken', res);
-                    this.$message.warning('登录成功');
                     return this.$store.dispatch('getUserInfo');
-                })
-                .catch(e => {
-                    this.loading = false;
-                    this.$message.error(e.error);
                 });
         },
+        Login2() {
+            this.check().then(() => {
+                this.$toast.success('登录成功');
+                this.Show = false;
+            });
+        },
         // 验证码登录
         loginPhone() {
             return this.$http
-                .post('/user/phoneLogin', {
+                .post('/auth/phoneLogin', {
                     phone: this.form.phone,
                     code: this.form.code
                 })
@@ -278,17 +240,14 @@ export default {
                 .then(res => {
                     localStorage.setItem('webToken', res);
                     return this.$store.dispatch('getUserInfo');
+                })
+                .then(() => {
+                    this.$message.success('登录成功');
+                    this.Show = false;
                 });
         },
         closeDialog() {
             this.$emit('close');
-        },
-        handleClose(done) {
-            this.$confirm('确认关闭?')
-                .then(_ => {
-                    done();
-                })
-                .catch(_ => {});
         }
     }
 };
@@ -299,12 +258,26 @@ export default {
     padding-bottom: 55px;
     background: #ffffff;
     border-radius: 8px;
+    .el-dialog__title {
+        font-size: 20px;
+        font-weight: 500;
+        color: #292c33;
+        line-height: 28px;
+    }
 }
 /deep/ .el-dialog__header {
-    padding-left: 80px;
+    padding: 30px 0 45px 80px;
 }
 /deep/ .el-dialog__headerbtn {
-    margin-right: 50px;
+    margin: 14px 50px 0 0;
+    &::before {
+        width: 24px;
+        height: 24px;
+    }
+}
+/deep/ .el-dialog__close {
+    width: 24px;
+    height: 24px;
 }
 /deep/ .el-dialog__body {
     padding: 0;

+ 1 - 1
src/main/pc-space/src/components/PageHeader.vue

@@ -19,7 +19,7 @@
                 <div class="login login1">中文</div>
             </div>
         </div>
-        <login-info :dialogVisible="show" @close="show = false" ref="public"></login-info>
+        <login-info :Show="show" @close="show = false"></login-info>
     </div>
 </template>
 <script>

+ 305 - 0
src/main/pc-space/src/components/RegisterInfo.vue

@@ -0,0 +1,305 @@
+<template>
+    <el-dialog :title="Title" :visible.sync="isShow" width="30%" :before-close="handleClose" @close="closeDialog">
+        <div class="content">
+            <el-form :model="form" ref="form" :rules="rules" label-width="0">
+                <el-form-item
+                    prop="phone"
+                    :rules="{
+                        pattern: /^1[3-9]\d{9}$/,
+                        message: '请输入正确的手机号',
+                        trigger: 'blur'
+                    }"
+                >
+                    <span class="el-icon-mobile-phone"></span>
+                    <el-input style="width: 300px" v-model="form.phone" placeholder="请输入手机号"></el-input>
+                </el-form-item>
+                <el-form-item prop="code">
+                    <el-form-item prop="code" :rules="{ required: true, message: '请输入', trigger: 'blur' }">
+                        <span class="icon">
+                            <img src="../assets/img/login_icon_yanzhengma@3x (2).png" alt="" />
+                        </span>
+                        <el-input style="width: 300px" v-model="form.code" placeholder="请输入短信验证码">
+                            <span
+                                @click="send"
+                                style="color: #ff4f50; cursor: pointer; font-size: 13px"
+                                slot="suffix"
+                                >{{ time === 0 ? '发送验证码' : `重新发送${time}s` }}</span
+                            >
+                        </el-input>
+                    </el-form-item>
+                </el-form-item>
+                <el-form-item prop="password">
+                    <span class="el-icon-unlock"></span>
+                    <el-input
+                        style="width: 300px"
+                        v-model="form.password"
+                        type="password"
+                        autocomplete="off"
+                        placeholder="请输入8-16位密码,建议数字、大小写字母组合"
+                    ></el-input>
+                </el-form-item>
+                <el-form-item prop="password2">
+                    <span class="el-icon-unlock"></span>
+                    <el-input
+                        style="width: 300px"
+                        v-model="form.password2"
+                        type="password"
+                        autocomplete="off"
+                        placeholder="请再次输入密码"
+                    ></el-input>
+                </el-form-item>
+            </el-form>
+            <template>
+                <el-checkbox v-model="checked" v-if="isShow2">
+                    <el-link style="margin-bottom: 2px">点击同意注册协议</el-link>
+                </el-checkbox>
+            </template>
+            <div class="sub-btn" style="width: 300px" v-if="isShow2">
+                <div class="btn1" @click="doRegister">立即注册</div>
+                <el-button style="background: #f2f3f5; color: #292c33" type="info" class="btn-block" @click="Login"
+                    >已有账号,立即登录</el-button
+                >
+            </div>
+            <div class="sub-btn" style="width: 300px" v-else>
+                <el-button type="primary" class="btn-block" @click="passwordFn2">确定</el-button>
+                <el-button style="background: #f2f3f5; color: #292c33" type="info" class="btn-block" @click="Login"
+                    >想起密码,立即登录</el-button
+                >
+            </div>
+        </div>
+    </el-dialog>
+</template>
+<script>
+import phone from '../mixins/phone';
+export default {
+    mixins: [phone],
+    props: {
+        isShow: {
+            type: Boolean,
+            default: false
+        },
+        isShow2: {
+            type: Boolean,
+            default: false
+        }
+    },
+    data() {
+        return {
+            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,
+            checked: false
+        };
+    },
+    computed: {
+        Title() {
+            if (this.isShow2) {
+                return '注册';
+            } else {
+                return '修改密码';
+            }
+        }
+    },
+    methods: {
+        Login() {
+            this.$emit('init');
+        },
+        // 注册
+        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('webToken', res);
+                            return this.$store.dispatch('getUserInfo');
+                        })
+                        .then(() => {
+                            this.$message.success('注册成功');
+                            this.$emit('init');
+                        })
+                        .catch(e => {
+                            if (e) {
+                                this.$message.error(e.error);
+                            }
+                        })
+                );
+            });
+        },
+        // 验证码
+        send() {
+            this.sendMsg(this.form.phone);
+        },
+        handleClose() {
+            this.$emit('refreash');
+        },
+        // 修改密码
+        passwordFn2() {
+            this.verifyMsg(this.form.phone, this.form.code)
+                .then(() => {
+                    this.$http
+                        .post('/auth/forgotPassword', {
+                            phone: this.form.phone,
+                            password: this.form.password,
+                            code: this.form.code
+                        })
+                        .then(() => {
+                            this.$toast.success('修改成功');
+                            this.$emit('init');
+                        })
+                        .catch(e => {
+                            if (e) {
+                                this.$message.error(e.error);
+                            }
+                        });
+                })
+                .catch(e => {
+                    if (e) {
+                        this.$message.error(e.error);
+                    }
+                });
+        },
+        closeDialog() {
+            this.$emit('close1');
+        }
+    }
+};
+</script>
+<style lang="less" scoped>
+/deep/ .el-dialog {
+    width: 480px !important;
+    padding-bottom: 55px;
+    background: #ffffff;
+    border-radius: 8px;
+    .el-dialog__title {
+        font-size: 20px;
+        font-weight: 500;
+        color: #292c33;
+        line-height: 28px;
+    }
+}
+/deep/ .el-dialog__header {
+    padding: 30px 0 45px 80px;
+}
+/deep/ .el-dialog__headerbtn {
+    margin: 14px 50px 0 0;
+    &::before {
+        width: 24px;
+        height: 24px;
+    }
+}
+/deep/ .el-dialog__close {
+    width: 24px;
+    height: 24px;
+}
+/deep/ .el-dialog__body {
+    padding: 0;
+}
+/deep/ .el-checkbox {
+    margin-left: -127px;
+}
+/deep/ .el-checkbox__inner {
+    border-radius: 50%;
+}
+/deep/ .el-form-item__error {
+    left: 110px;
+}
+/deep/ .el-form-item__content {
+    display: flex;
+    justify-content: center;
+}
+.content {
+    .el-form {
+        /deep/ .el-input {
+            .el-input__inner {
+                border-width: 0px;
+                border-bottom: 1px solid #f2f3f5;
+                padding: 0 0 0;
+                height: 50px;
+                background: none;
+                line-height: 50px;
+                margin-left: 10px;
+            }
+            .el-input__prefix {
+                color: #292c33;
+                font-size: 18px;
+            }
+            .el-input-group__append {
+                background-color: transparent;
+                border-width: 0;
+            }
+        }
+    }
+    text-align: center;
+    .el-icon-mobile-phone {
+        color: #000;
+        font-size: 24px;
+        margin-top: 13px;
+    }
+    .el-icon-unlock {
+        color: #000;
+        font-size: 24px;
+        margin-top: 12px;
+    }
+    .icon {
+        color: #000;
+        img {
+            width: 28px;
+            height: 28px;
+            padding-top: 10px;
+        }
+    }
+    .btn {
+        display: flex;
+        align-items: center;
+        width: 330px;
+        justify-content: space-between;
+        margin-left: 80px;
+    }
+    .sub-btn {
+        padding-top: 62px;
+        text-align: center;
+        width: 300px;
+        margin-left: 78px;
+        .btn1 {
+            width: 330px;
+            height: 40px;
+            line-height: 40px;
+            background: linear-gradient(135deg, #00ffcb 0%, #006eff 100%);
+            border-radius: 4px;
+            font-size: 13px;
+            color: #fff;
+            text-align: center;
+        }
+        .el-button {
+            font-size: 12px;
+            line-height: 16px;
+            width: 330px;
+            border-width: 0px;
+            margin-top: 20px;
+        }
+    }
+}
+</style>

Vissa filer visades inte eftersom för många filer har ändrats