소스 검색

忘记密码置后

lrf402788946 5 년 전
부모
커밋
a8ea36ee4d
2개의 변경된 파일51개의 추가작업 그리고 35개의 파일을 삭제
  1. 1 5
      src/store.js
  2. 50 30
      src/views/login/login.vue

+ 1 - 5
src/store.js

@@ -27,7 +27,7 @@ const api = {
   resumesInfo: '/api/jobs/resumes/{id}',
   letters: '/api/jobs/letters',
   lettersinfo: '/api/jobs/letters/{id}',
-  userReg: '/api/stud/registers/{id}',
+  userReg: '/api/corp/users/{id}',
   connection: '/weixin/qrcode/create',
   wxtoken: '/weixin/qrcode/{qrcode}/token',
   corpBind: '/api/corp/bind', //post=>query;corpid;body:mobile,wxtoken
@@ -62,10 +62,6 @@ export default new Vuex.Store({
     //用户信息
     async userOperation({ state }, { type, data }) {
       let result;
-      if (type === 'search') {
-        let { id } = data;
-        result = await this.$axios.$get(api.userReg, { id: id });
-      }
       if (type === 'passwd') {
         let { id, info } = data;
         result = await this.$axios.$post(api.userReg, info, { id: id });

+ 50 - 30
src/views/login/login.vue

@@ -33,14 +33,14 @@
                       <el-input placeholder="验证码" prefix-icon="el-icon-lock" v-model="verifyForm.code" @keyup.enter="toSubmit"></el-input>
                     </el-col>
                     <el-col :span="8" class="firmRightImg">
-                      <!-- <img :src="pic3" /> -->
                       <verify v-model="verifyForm.code_id" ref="verifyPic"></verify>
                     </el-col>
                   </el-form-item>
                 </el-form>
               </el-col>
               <el-col :span="24" class="firmRightName firmRightBtn">
-                <el-col :span="8"><el-checkbox v-model="checked">记住登陆账号</el-checkbox></el-col>
+                <!-- <el-col :span="8"><el-checkbox v-model="checked">记住登陆账号</el-checkbox></el-col> -->
+                <el-col :span="8">&nbsp;</el-col>
                 <el-col :span="8"><el-button type="success" @click="toSubmit">登录</el-button></el-col>
                 <el-col :span="8"><el-button type="success" @click="$router.push({ path: '/register' })">注册</el-button></el-col>
               </el-col>
@@ -62,39 +62,41 @@
         </el-col>
       </el-col>
     </el-row>
-    <el-dialog title="" :visible.sync="dialogFormVisible">
+    <el-dialog title="找回密码" :visible.sync="dialogFormVisible" width="30%" :center="true">
       <el-row>
-        <el-col :span="16" class="forget">
-          <el-form :model="form" label-width="auto" label-position="left">
+        <el-col :span="24" class="forget">
+          <el-form :model="lost" label-width="auto" label-position="left" :rules="rules" ref="lost">
             <el-form-item label="手机" prop="mobile">
-              <el-col :span="24"><el-input v-model="form.mobile" autocomplete="off" placeholder="必填"></el-input></el-col>
+              <el-input v-model="lost.mobile" placeholder="必填"></el-input>
             </el-form-item>
-            <el-form-item label="新密码" prop="mobile">
-              <el-col :span="24"><el-input v-model="form.passwd" autocomplete="off" placeholder="必填" suffix-icon="el-icon-view"></el-input></el-col>
-            </el-form-item>
-            <!-- <el-form-item label="图形码">
-              <el-col :span="10"><el-input v-model="form.name" autocomplete="off" placeholder="图形验证码"></el-input></el-col>
-              <el-col :span="14"><img :src="pic3" style="width:101px;height:30px;padding: 4px 0 0 5px;"/></el-col>
+            <el-form-item label="新密码" prop="passwd">
+              <el-input v-model="lost.passwd" placeholder="必填" type="password" show-password></el-input>
             </el-form-item>
             <el-form-item label="验证码">
-              <el-col :span="10"><el-input v-model="form.name" autocomplete="off" placeholder="必填" style="width:148px;"></el-input></el-col>
-              <el-col :span="14"><el-button type="success" style="width: 86px;height: 33px;padding: 0;">获取验证码</el-button></el-col>
-            </el-form-item> -->
+              <el-col :span="10"><el-input v-model="lost.code" autocomplete="off" placeholder="必填"></el-input></el-col>
+              <el-col :span="8"><verify-message :mobile="lost.mobile"></verify-message></el-col>
+            </el-form-item>
           </el-form>
         </el-col>
-        <el-col :span="1" style="text-align:center;">
+        <!-- <el-col :span="1" style="text-align:center;">
           <span style="width: 1px;height: 80px; background: #e7e7e7;display: inline-block;text-align: center;"></span>
           <p style="padding: 5px 0;margin: 0;">或</p>
           <span style=" width: 1px;height: 80px;background: #e7e7e7;display: inline-block;"></span>
         </el-col>
         <el-col :span="7">
-          <!-- <img :src="codes" width="184" height="190" /> -->
-          <!-- <p style="font-size:12px;padding:0 15px;">请用微信扫一扫并关注云校招企业服务号,免费获得更多校招服务</p> -->
-        </el-col>
+          <img :src="codes" width="184" height="190" />
+          <p style="font-size:12px;padding:0 15px;">请用微信扫一扫并关注云校招企业服务号,免费获得更多校招服务</p>
+        </el-col> -->
       </el-row>
       <template #footer>
-        <el-button type="success" @click="dialogFormVisible = false">提交</el-button>
-        <el-button type="text" @click="dialogFormVisible = false">已有账号?去登录</el-button>
+        <el-row>
+          <el-col :span="24">
+            <el-button type="success" @click="toLost">提交</el-button>
+          </el-col>
+          <el-col :span="24">
+            <el-button type="text" @click="dialogFormVisible = false">已有账号?去登录</el-button>
+          </el-col>
+        </el-row>
       </template>
     </el-dialog>
   </div>
@@ -103,6 +105,7 @@
 <script>
 import qrcode from '@/components/qrcode.vue';
 import verify from '@publics/src/components/verify.vue';
+import verifyMessage from '@publics/src/components/verify-message.vue';
 import { mapActions, mapState } from 'vuex';
 const jwt = require('jsonwebtoken');
 
@@ -112,6 +115,7 @@ export default {
   components: {
     qrcode,
     verify,
+    verifyMessage,
   },
   data: () => ({
     pic: require('@/assets/head.jpg'),
@@ -125,17 +129,21 @@ export default {
     form: {},
     formLabelWidth: '60px',
     verifyForm: {},
+    lost: {},
+    rules: {
+      mobile: [{ required: true, message: '请输入手机号', trigger: 'blur' }],
+      passwd: [{ required: true, message: '请输入新密码', trigger: 'blur' }],
+    },
   }),
   created() {
     this.initQrcode();
   },
   computed: {},
   methods: {
-    ...mapActions(['corpLogin', 'createConnection', 'getWxtoken', 'verifyOperation']),
+    ...mapActions(['corpLogin', 'createConnection', 'getWxtoken', 'verifyOperation', `userOperation`]),
     toSubmit() {
       this.$refs.form.validate(valid => {
         if (valid) {
-          // this.submit();
           this.checkVerify();
         }
         return false;
@@ -177,6 +185,25 @@ export default {
       let result = await this.getWxtoken(this.qrcode);
       this.submit(result);
     },
+    async toLost() {
+      this.$refs.lost.validate(valid => {
+        if (valid) {
+          this.lostPw();
+        }
+        return false;
+      });
+    },
+    async lostPw() {
+      let result = await this.userOperation({ type: 'passwd', data: { info: { passwd: this.lost.passwd }, id: this.lost.mobile } });
+      this.$message({
+        type: `${result.errcode}` === '0' ? 'success' : 'error',
+        message: `${result.errcode}` === '0' ? '修改成功' : result.errmsg,
+      });
+      if (`${result.errcode}` === '0') {
+        this.form = {};
+        this.dialog = false;
+      }
+    },
   },
 };
 </script>
@@ -275,13 +302,6 @@ export default {
   height: 33px;
   border-radius: 0;
 }
-/deep/.el-dialog__header {
-  display: none;
-}
-/deep/.el-dialog__footer {
-  text-align: left;
-  padding: 10px 210px 20px;
-}
 .forget {
   padding: 20px 0 0 0;
 }