Jelajahi Sumber

添加密码找回

ljm 6 tahun lalu
induk
melakukan
3893367edf

+ 12 - 4
src/dashoo.cn/frontend_web/src/pages/login.vue

@@ -181,10 +181,18 @@
                     <el-input type="password" v-model="model.password" placeholder="请输入密码" @keyup.enter.native="login()" />
                   </el-form-item>
                   <el-button type="primary" :loading="loading" @click="login()">{{ loading ? '登录中...' : '登录' }}</el-button>
-                  <router-link :to="'/signup'">
-                    <el-button type="text" round>没有账户?请注册</el-button>
-                  </router-link>
-
+                  <el-row>
+                    <el-col :span="12">
+                      <router-link :to="'/signup'">
+                        <el-button type="text" round>没有账户?请注册</el-button>
+                      </router-link>
+                    </el-col>
+                    <el-col :span="12">
+                      <router-link :to="'/passwordback'">
+                        <el-button type="text" round>忘记密码?</el-button>
+                      </router-link>
+                    </el-col>
+                  </el-row>
                 </el-form>
               </el-card>
 

+ 692 - 0
src/dashoo.cn/frontend_web/src/pages/passwordback.vue

@@ -0,0 +1,692 @@
+<template>
+  <div style="width: 100%; background-color: white" >
+    <sticky class-name="sub-navbar2">
+      <div class="top-wrapper">
+        <div style="margin-top: 5px; float: left;">
+          <router-link to="/">
+            <img src="../assets/img/title_gongfang.png" style="height:35px;" />
+          </router-link>
+        </div>
+        <div style="float: right;">
+          <router-link :to="'/login'">
+            <el-button type="info" size="small" round>登录供方管理系统</el-button>
+          </router-link>
+        </div>
+      </div>
+    </sticky>
+
+    <div style="background-color: white;">
+      <div class="top-wrapper">
+        <el-menu  :default-active="activeIndex" @select="handleSelect" mode="horizontal">
+          <el-menu-item index="1" style="font-size: large;">
+            <span>密码找回</span>
+          </el-menu-item>
+        </el-menu>
+      </div>
+      
+      <el-card>
+        <div class="home-wrapper" v-if="activeIndex==1">
+            <el-form label-width="135px" ref="formData" :model="formData" :rules="rules">
+              <el-row>
+                <el-col :span="24">
+                  <el-form-item label="公司名称" label-width="150px" style="width: 100%" prop="SupplierName">
+                    <el-input v-model="formData.SupplierName"  placeholder="请输入公司名称"></el-input>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="24">
+                  <el-form-item label="组织机构代码" label-width="150px" style="width: 100%" prop="OrganCode">
+                    <el-input v-model="formData.OrganCode"  placeholder="请输入组织机构代码"></el-input>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="24">
+                  <el-form-item label="法定代表人姓名" label-width="150px" style="width: 100%" prop="LegalPerson">
+                    <el-input v-model="formData.LegalPerson"  placeholder="请输入法定代表人姓名"></el-input>           
+                  </el-form-item>
+                </el-col>
+                <el-col :span="16">
+                  <el-form-item label="法定代表人身份证号" label-width="150px" style="width: 100%" prop="LegalPersonId">
+                    <el-input v-model="formData.LegalPersonId"  placeholder="请输入法定代表人身份证号"></el-input>           
+                  </el-form-item>
+                </el-col>
+                <el-col :span="8">
+                  <el-form-item label="" label-width="60px" prop="LegalPersonImg">
+                    <el-upload action="" ref="LegalPersonUpload"
+                      :limit="2"
+                      :http-request="uploadRequest"
+                      :show-file-list="true"
+                      :before-upload="beforeUpload">
+                      <el-button size="small" type="primary">上传身份证扫描件<i class="el-icon-upload el-icon--right"></i></el-button>
+                    </el-upload>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="24">
+                  <el-form-item label="联系人姓名" label-width="150px" style="width: 100%" prop="ContactName">
+                    <el-input v-model="formData.ContactName"  placeholder="请输入联系人姓名"></el-input>           
+                  </el-form-item>
+                </el-col>
+                <el-col :span="16">
+                  <el-form-item label="联系人身份证号" label-width="150px" style="width: 100%" prop="ContactId">
+                    <el-input v-model="formData.ContactId"  placeholder="请输入联系人身份证号"></el-input>           
+                  </el-form-item>
+                </el-col>
+                <el-col :span="8">
+                  <el-form-item label="" label-width="60px" prop="ContactImg">
+                    <el-upload action="" ref="ContactUpload"
+                      :limit="2"
+                      :http-request="uploadRequest"
+                      :show-file-list="true"
+                      :before-upload="beforeUpload">
+                      <el-button size="small" type="primary">上传身份证扫描件<i class="el-icon-upload el-icon--right"></i></el-button>
+                    </el-upload>
+                  </el-form-item>
+                </el-col>
+              </el-row>
+              <el-row>
+                <el-col :span="24">
+                  <el-form-item label="账号/Email" label-width="150px" style="width: 100%" prop="UserName">
+                    <el-input v-model="formData.UserName" placeholder="请输入账号"></el-input>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="12">
+                  <el-form-item label="用户名"  label-width="150px" style="width: 100%" prop="Realname">
+                    <el-input v-model="formData.Realname" placeholder="请输入用户名"></el-input>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="12">
+                  <el-form-item label="手机号"   style="width: 100%" prop="Telephone">
+                    <el-input v-model="formData.Telephone" placeholder="用于审核通知和密码找回"></el-input>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="12">              
+                  <el-form-item label="密码" label-width="150px" style="width: 100%" prop="UserPass" >
+                    <el-input type="password" v-model="formData.UserPass"  auto-complete="off" placeholder="请输入密码(8-20位,字母数字组合)"></el-input>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="12">
+                  <el-form-item label="确认密码"  style="width: 100%" prop="UserPass2" >
+                    <el-input type="password" v-model="formData.UserPass2" auto-complete="off" placeholder="请输入确认密码"></el-input>
+                  </el-form-item>
+                </el-col>
+                <!-- <el-form-item label="验证码" prop="telep"  style="width: 100%">
+                  </el-form-item>                           
+                  <el-form-item label="短信验证码" prop="phober"  style="width: 100%">
+                  </el-form-item>             
+                  <el-checkbox v-model="checked1" style="margin-left: 80px">阅读并同意</el-checkbox>
+                <router-link to="#">《麦吉轮用户注册协议》</router-link><router-link to="#">《隐私政策》</router-link> -->
+              </el-row>
+              <el-row style="margin-left: 50%; margin-top: 10px; margin-bottom: 20px;">
+                <el-button type="primary" @click="register" style="width: 30%">立即注册</el-button>
+              </el-row>
+            </el-form>
+        </div>
+      </el-card>
+    </div>
+
+    <div>
+      <footer class="login-footer1">
+        <div class="foot-wrapper" style="height: 30px; background-color: transparent; color:#A9A9A9; padding-top: 10px; text-align: right">
+          ©大港油田信息中心 版权所有
+        </div>
+      </footer>
+    </div>
+
+  </div>
+</template>
+
+<script>
+
+  import Vue from 'vue'
+  import Component from 'class-component'
+  import Sticky from '@/components/Sticky'
+  import axios from 'axios'
+  import api from '@/api/oilsupplier/supplier'
+  import uploadajax from '../assets/js/uploadajax.js'
+
+  @Component({
+    data () {
+      var checkSupplierName =  (rule, value, callback) => {
+        if (value === '') {
+          callback(new Error('请输入公司名称!'));
+        } else {
+          for (let i = 0; i < this.supplierNameList.length; i++) {
+            if (value == this.supplierNameList[i].SupplierName) {
+              this.$alert('该公司已注册!', '提示:', {
+                confirmButtonText: '确定',
+              })
+            } else {
+              callback();
+            }
+          }
+        }
+      };
+      var checkUpload = (rule, value, callback) => {
+        if (value === '') {
+          callback(new Error('请上传身份证扫描件! '))
+        } else {
+          callback()
+        }
+      };
+      return {
+        activeIndex: '1',
+
+        supplierNameList: [], //公司名列表
+        waituploads: [], // 等待上传的文件列表
+
+        formData: {
+          Id: '', //int
+          UserId: '', //int
+          UserName: '', //账号/Email
+          Realname: '', //用户名
+          Telephone: '', //用户手机号
+          UserPass: '',
+          UserPass2: '',
+          SupplierName: '',
+          OilCertificateNo: '',
+          Grade: '',
+          MgrUnit: '',
+          OperType: '',
+          Country: '',
+          CommercialNo: '',
+          OrganCode: '',
+          CountryTaxNo: '',
+          LocalTaxNo: '',
+          Address: '',
+          DetailAddress: '',
+          Province: '',
+          City: '',
+          Street: '',
+          HouseNo: '',
+          ZipCode: '',
+          BusinessScope: '',
+          LegalPerson: '',
+          LegalPersonId: '',
+          LegalPersonURL: '',
+          CategoryCode: '',
+          CategoryName: '',
+          RegCapital: 0, //float32
+          Currency: '',
+          ContactName: '',
+          ContactId: '',
+          ContactURL: '',
+          CompanyType: '',
+          SetupTime: '', //time
+          DepositBank: '',
+          BankAccount: '',
+          EMail: '',
+          BankCreditRating: '',
+          Mobile: '',
+          Telphone: '',
+          Fax: '',
+          CompanyTel: '',
+          QQ: '',
+          CompanyUrl: '',
+          Remark: '',
+          CheckStatus: 0, //二级单位审核状态,0:未通过,1:通过
+          IsDelete: 0, //删除状态,0正常,1已删除
+          LinkAddress: '',
+          LinkProvince: '',
+          LinkCity: '',
+          LinkStreet: '',
+          LinkHouseNo: '',
+          LinkZipCode: '',
+          HseTraining: ''
+        },
+
+        rules: {
+          SupplierName: [
+            { required: true, 
+              validator: checkSupplierName,
+              trigger: 'blur'
+            }
+          ],
+          OrganCode: [
+            { required: true, message: '请输入组织机构代码', trigger: 'blur' }
+          ],
+          LegalPerson: [
+            { required: true, message: '请输入法定代表人姓名', trigger: 'blur' }
+          ],
+          LegalPersonId: [
+            { required: true, message: '请输入法定代表人身份证号', trigger: 'blur' }
+          ],
+          LegalPersonImg: [
+            { required: true,
+              validator: checkUpload,
+              trigger: 'blur'
+            }
+          ],
+          ContactName: [
+            { required: true, message: '请输入联系人姓名', trigger: 'blur' }
+          ],
+          ContactId: [
+            { required: true, message: '请输入联系人身份证号', trigger: 'blur' }
+          ],
+          ContactImg: [
+            { required: true,
+              validator: checkUpload,
+              trigger: 'blur'
+            }
+          ],
+          UserName: [
+            { required: true, message: '请输入账号', trigger: 'blur' }
+          ],
+          Realname: [
+            { required: true, message: '请输入用户名', trigger: 'blur' }
+          ],
+          Telephone: [
+            { required: true, message: '请输入手机号', trigger: 'blur' }
+          ],
+          UserPass: [
+            { required: true, message: '请输入密码', trigger: 'blur' }
+          ],
+          UserPass2: [
+            { required: true, 
+              message: '请输入确认密码',
+              trigger: 'blur' 
+            }
+          ],
+        }
+      }
+    },
+
+    created () {
+      this.getSupplierNameList() //获取已注册的公司
+    },
+    components: {
+      Sticky
+    },
+    methods: {
+      //注册
+      register () {
+        let _this = this
+
+        //判断公司是否注册
+        for (let i = 0; i < _this.supplierNameList.length; i++) {
+          if (_this.formData.SupplierName == _this.supplierNameList[i].SupplierName) {
+            this.$alert('该公司已注册!', '提示:', {
+              confirmButtonText: '确定',
+            })
+            return
+          }
+        }
+
+        //身份证号验证
+        let re1 = /(^\d{18}$)|(^\d{17}(\d|X|x)$)/
+        if (!re1.test(_this.formData.LegalPersonId)) {
+          this.$alert('请填写正确的法定代表人身份证号!', '提示', {
+            confirmButtonText: '确定',
+          })
+          return
+        }
+        if (!re1.test(_this.formData.ContactId)) {
+          this.$alert('请填写正确的联系人身份证号!', '提示', {
+            confirmButtonText: '确定',
+          })
+          return
+        }
+
+        // 判断法定代表人身份证文件上传是否完成
+        if (!_this.checkSuccess(_this.$refs.LegalPersonUpload.uploadFiles)) {
+          this.$alert('上传文件失败,请重新上传法定代表人身份证文件! ', '提示', {
+            confirmButtonText: '确定',
+          })
+          return
+        }
+        _this.formData.LegalPersonURL = _this.getFileURL(_this.$refs.LegalPersonUpload.uploadFiles) //获取地址
+
+        // 判断联系人身份证文件上传是否完成
+        if (!_this.checkSuccess(_this.$refs.ContactUpload.uploadFiles)) {
+          this.$alert('上传文件失败,请重新上传联系人身份证文件! ', '提示', {
+            confirmButtonText: '确定',
+          })
+          return
+        }
+        _this.formData.ContactURL = _this.getFileURL(_this.$refs.ContactUpload.uploadFiles)
+
+        //手机号验证
+        let re3 = /^[1][3456789]\d{9}$/
+        if (!re3.test(_this.formData.Telephone)) {
+          this.$alert('请填写正确的手机号!', '提示', {
+            confirmButtonText: '确定',
+          })
+          return
+        }
+
+        //密码验证 字母数字组成8-20位 正向断言
+        let re2 = /^(?=.*[0-9])[0-9A-Za-z]{8,20}$/g
+        if (!re2.test(_this.formData.UserPass)) {
+          this.$alert('请输入正确格式的密码(8——20位,包含英文字母、数字)!', '提示', {
+            confirmButtonText: '确定',
+          })
+          return
+        }
+        if (_this.formData.UserPass != _this.formData.UserPass2) {
+          this.$alert('两次输入的密码不一致,请重新输入!', '提示', {
+            confirmButtonText: '确定',
+          })
+          return
+        }
+
+        _this.$axios.post('/register/addentity', _this.formData)
+          .then(function (response) {
+            if (response.data.code === 0) {
+              _this.$message({
+                type: 'success',
+                message: response.data.message
+              });
+              _this.$router.push('/login') //跳转到登录页
+            } else {
+              _this.$alert(response.data.message, '提示', {
+                confirmButtonText: '确定',
+              })
+            }
+          })
+          .catch(function (error) {
+            console.log(error)
+          })
+      },
+
+      //获取已注册的公司
+      getSupplierNameList() {
+        let _this = this
+        _this.$axios.get('/register/getsuppliername', {})
+          .then(res => {
+            _this.supplierNameList = res.data.items
+          })
+          .catch(err => {
+            console.error(err)
+          })
+      },
+
+      //图片格式以及文件大小限制
+      beforeUpload(file) {
+        let isLt10m = file.size / 1024 / 1024 / 10 < 1
+        let isIMAGE1 = file.name.split('.')[1] === 'jpg'
+        let isIMAGE2 = file.name.split('.')[1] === 'jpeg'
+        let isIMAGE3 = file.name.split('.')[1] === 'png'
+
+        if (!isIMAGE1 && !isIMAGE2 && !isIMAGE3) {
+          this.$message.error('上传文件只能是图片格式(jpg/jpeg/png)!')
+        }
+        if (!isLt10m) {
+          this.$message.error('上传文件大小不能超过 10MB!')
+        }
+        return isIMAGE1 || isIMAGE2 || isIMAGE3 && isLt10m
+      },
+
+      //判断是否上传成功
+      checkSuccess(uploadFiles) {
+        if (uploadFiles.length < 1) {
+          return false
+        } else {
+          for (let i = 0; i < uploadFiles.length; i++) {
+            if (uploadFiles[i].status !== 'success') {
+              return false
+            }
+          }
+        }
+        return true
+      },
+
+      //上传请求
+      uploadRequest(option) {
+        let _this = this
+        axios.post(process.env.upfilehost, {})
+          .then(function (res) {
+            if (res.data && res.data.fid && res.data.fid !== '') {
+              option.action = `http://${res.data.url}/${res.data.fid}`
+              _this.waituploads.push({
+                uid: option.file.uid,
+                url: res.data.publicUrl,
+                fid: res.data.fid
+              })
+              uploadajax(option)
+            } else {
+              _this.$message({
+                type: 'warning',
+                message: '未上传成功!请重新上传!'
+              })
+            }
+          })
+          .catch(function (error) {
+            console.log(error)
+            _this.$message({
+              type: 'warning',
+              message: '未上传成功!请重新上传!'
+            })
+          })
+      },
+
+      //获取上传文件的路径
+      getFileURL(uploadFiles) {
+        let fileURL = ''
+        if (uploadFiles && uploadFiles.length > 0) {
+          for (let i = 0; i < uploadFiles.length; i++) {
+            if (uploadFiles[i].status === 'success') {
+              for (let j = 0; j < this.waituploads.length; j++) {
+                if (this.waituploads[j].uid === uploadFiles[i].uid) {
+                  fileURL =  `${this.waituploads[j].url}/${this.waituploads[j].fid}|${uploadFiles[i].name}`
+                }
+              }
+            }
+          }
+        }
+        return fileURL
+      },
+
+      //格式化页面到数据库的时间格式
+      formatDateTime(date) {
+        var y = date.getFullYear()
+        var m = date.getMonth() + 1
+        m = m < 10 ? ('0' + m) : m
+        var d = date.getDate()
+        d = d < 10 ? ('0' + d) : d
+        var h = date.getHours()
+        var minute = date.getMinutes()
+        minute = minute < 10 ? ('0' + minute) : minute
+        return y + '-' + m + '-' + d + ' ' + h + ':' + minute
+      },
+
+      //格式化时间
+      jstimehandle(val) {
+        if (val === '') {
+          return '----'
+        } else if (val === '0001-01-01T08:00:00+08:00') {
+          return '----'
+        } else if (val === '5000-01-01T23:59:59+08:00') {
+          return '永久'
+        } else {
+          val = val.replace('T', ' ')
+          return val.substring(0, 10)
+        }
+      },
+
+      handleSelect (key, keyPath) {
+        this.activeIndex = key
+      }
+    }
+
+  })
+  export default class Register extends Vue {
+    layout() {
+      return 'empty'
+    }
+  }
+
+</script>
+
+<style lang="scss">
+  @import '../assets/styles/base/variables';
+
+  body {
+    overflow: auto;
+  }
+  .top-wrapper {
+    margin: 0px auto;
+    width: 1004px;
+    /*text-align: right;
+    alignment: right;*/
+    flex-direction: row;
+  }
+  .home-wrapper{
+    margin:0px auto;
+    width: 1004px;
+    flex-direction: column;
+    margin-bottom: 45px;
+    background-color: white;
+    overflow: auto;
+  }
+
+  .foot-wrapper{
+    margin:0px auto;
+    width: 1004px;
+    display: flex;
+    // alignment: center;
+    align-items: center;
+    flex-direction: column;
+  }
+
+  .back-width1 {
+    background-color: #2F79F6;
+    margin: 0px auto;
+    left: 0;
+    right: 0;
+    top: 20px;
+    width: 1004px;
+  }
+
+
+  .login-footer1 {
+    position: fixed;
+    background-color: #34393D;
+    font-size: 10px;
+    clear: both;
+    display: block;
+    text-align: center;
+    margin: 0px auto;
+    bottom: 0px;
+    width: 100%;
+  }
+
+  .time {
+    font-size: 13px;
+    color: #999;
+  }
+
+  .bottom {
+    margin-top: 13px;
+    line-height: 12px;
+  }
+
+  .button {
+    padding: 0;
+    float: right;
+  }
+
+  .image {
+    width: 100%;
+    display: block;
+  }
+
+  .clearfix:before,
+  .clearfix:after {
+    display: table;
+    content: "";
+  }
+
+  .clearfix:after {
+    clear: both
+  }
+
+  .back-width {
+    background-color: #CBD1D1; /*#2F79F6*/
+    position: fixed;
+    margin: auto;
+    left: 0;
+    right: 0;
+    top: 130px;
+    width: 100%;
+    height: 550px;
+    margin-bottom: 40px;
+  }
+
+  .login-body {
+
+    background: url("../assets/img/gflogin.jpg") no-repeat left 50%;
+    font-family: 'Open Sans', sans-serif;
+    background-color: #2469E8;
+    background-size: cover;
+
+    /*background-size: cover;
+    -webkit-background-size: cover;
+    -moz-background-size: cover;
+    -o-background-size: cover;*/
+    /*min-height: 1050px;*/
+
+    position: absolute;
+
+    margin: auto;
+    left: -400px;
+    right: 0;
+    bottom: 0;
+    width: 800px;
+    height: 550px;
+    /*
+    top: 0;
+    right: 0;
+    bottom: 0;
+    left: 0;*/
+  }
+
+  .login {
+    /*flex: 1;
+    width: 100%;*/
+    position: relative;
+    max-width: 22rem;
+    top: 60px;
+    left: 850px;
+    font-size: 0.875rem;
+    opacity: 0.9;
+
+    &-header {
+      margin-bottom: 1rem;
+
+      .brand {
+        margin: 4.5rem 0 3.5rem;
+        text-align: center;
+        letter-spacing: 0.125rem;
+
+        a {
+          margin: 0;
+          color: $brand-color;
+          font: 300 3rem sans-serif;
+
+          &:hover {
+            color: $brand-hover-color;
+            text-shadow: 0 0 1rem $brand-hover-color;
+          }
+        }
+      }
+    }
+
+    &-form {
+      /*margin-bottom: 2.5rem;
+      padding: 1.875rem 1.25rem;
+      background: $login-form-background;*/
+      color: $login-form-color;
+
+      /*.heading {
+        margin: 0 0 1rem;
+        font-weight: 400;
+        font-size: 1.5rem;
+      }*/
+
+      .el-button {
+        margin-top: 0.5rem;
+        width: 100%;
+      }
+    }
+
+
+  }
+</style>
+

+ 1 - 1
src/dashoo.cn/frontend_web/src/pages/signup.vue

@@ -102,7 +102,7 @@
                 </el-col>
                 <el-col :span="12">              
                   <el-form-item label="密码" label-width="150px" style="width: 100%" prop="UserPass" >
-                    <el-input type="password" v-model="formData.UserPass"  auto-complete="off" placeholder="请输入密码"></el-input>
+                    <el-input type="password" v-model="formData.UserPass"  auto-complete="off" placeholder="请输入密码(8-20位,字母数字组合)"></el-input>
                   </el-form-item>
                 </el-col>
                 <el-col :span="12">