zhuliu 11 ماه پیش
والد
کامیت
b4c5ef27df

+ 3 - 1
src/api/index.js

@@ -1,8 +1,10 @@
 
 
 import permission from "./permission";
+import registerAndLogin from './registerAndLogin'
 
 export default {
 
-  ...permission
+  ...permission,
+  ...registerAndLogin
 }

+ 38 - 0
src/api/registerAndLogin.js

@@ -0,0 +1,38 @@
+import axios from '@/utils/axios'
+
+export default {
+    /**
+     * 获取手机验证码
+     * @param {*} data 
+     * @param {String} data.phoneNum - 手机号(不可为空)
+     * @returns 
+     */
+    getPhoneCode(data){
+        return axios.post('/permission/api/admin/getPhoneCode',data)
+    },
+    /**
+     * 个人用户注册
+     * @param {*} data
+     * @param {String} data.phoneNum - 手机号码(不可为空)
+     * @param {String} data.phoneCode - 验证码(不可为空)
+     * @param {int} data.vipType - 版本类型(不可为空)
+     * @param {String} data.name - 姓名(可为空)
+     * @param {String} data.email - 邮箱(可为空)
+     * @param {String} data.username - 账号(可为空)
+     * @param {String} data.password - 密码(可为空)
+     * @param {String} data.inviteCode - 验证码(可为空)
+     * @return {*} 
+     */
+    personnelSignUp(data){
+        return axios.post('/permission/api/qiaoBiPerson/personnelSignUp',data)
+    },
+    /**
+     * 查询会员版本
+     * @param {*} data 
+     * @param {String} data.vipTypeName - 版本名称(可为空)
+     * @returns 
+     */
+    queryQiaoBiVipType(data){
+        return axios.post('/permission/api/vipType/queryQiaoBiVipType',data)
+    },
+}

BIN
src/assets/image/register_background.png


+ 72 - 3
src/icons/iconfont/demo_index.html

@@ -55,6 +55,24 @@
           <ul class="icon_lists dib-box">
           
             <li class="dib">
+              <span class="icon iconfont">&#xe655;</span>
+                <div class="name">添加账号</div>
+                <div class="code-name">&amp;#xe655;</div>
+              </li>
+          
+            <li class="dib">
+              <span class="icon iconfont">&#xe62d;</span>
+                <div class="name">邮箱</div>
+                <div class="code-name">&amp;#xe62d;</div>
+              </li>
+          
+            <li class="dib">
+              <span class="icon iconfont">&#xe609;</span>
+                <div class="name">验证码</div>
+                <div class="code-name">&amp;#xe609;</div>
+              </li>
+          
+            <li class="dib">
               <span class="icon iconfont">&#xe62c;</span>
                 <div class="name">密码</div>
                 <div class="code-name">&amp;#xe62c;</div>
@@ -84,9 +102,9 @@
 <pre><code class="language-css"
 >@font-face {
   font-family: 'iconfont';
-  src: url('iconfont.woff2?t=1726826444037') format('woff2'),
-       url('iconfont.woff?t=1726826444037') format('woff'),
-       url('iconfont.ttf?t=1726826444037') format('truetype');
+  src: url('iconfont.woff2?t=1730442227258') format('woff2'),
+       url('iconfont.woff?t=1730442227258') format('woff'),
+       url('iconfont.ttf?t=1730442227258') format('truetype');
 }
 </code></pre>
           <h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
@@ -113,6 +131,33 @@
         <ul class="icon_lists dib-box">
           
           <li class="dib">
+            <span class="icon iconfont icon-tianjiazhanghao"></span>
+            <div class="name">
+              添加账号
+            </div>
+            <div class="code-name">.icon-tianjiazhanghao
+            </div>
+          </li>
+          
+          <li class="dib">
+            <span class="icon iconfont icon-youxiang"></span>
+            <div class="name">
+              邮箱
+            </div>
+            <div class="code-name">.icon-youxiang
+            </div>
+          </li>
+          
+          <li class="dib">
+            <span class="icon iconfont icon-yanzhengma"></span>
+            <div class="name">
+              验证码
+            </div>
+            <div class="code-name">.icon-yanzhengma
+            </div>
+          </li>
+          
+          <li class="dib">
             <span class="icon iconfont icon-mima"></span>
             <div class="name">
               密码
@@ -159,6 +204,30 @@
           
             <li class="dib">
                 <svg class="icon svg-icon" aria-hidden="true">
+                  <use xlink:href="#icon-tianjiazhanghao"></use>
+                </svg>
+                <div class="name">添加账号</div>
+                <div class="code-name">#icon-tianjiazhanghao</div>
+            </li>
+          
+            <li class="dib">
+                <svg class="icon svg-icon" aria-hidden="true">
+                  <use xlink:href="#icon-youxiang"></use>
+                </svg>
+                <div class="name">邮箱</div>
+                <div class="code-name">#icon-youxiang</div>
+            </li>
+          
+            <li class="dib">
+                <svg class="icon svg-icon" aria-hidden="true">
+                  <use xlink:href="#icon-yanzhengma"></use>
+                </svg>
+                <div class="name">验证码</div>
+                <div class="code-name">#icon-yanzhengma</div>
+            </li>
+          
+            <li class="dib">
+                <svg class="icon svg-icon" aria-hidden="true">
                   <use xlink:href="#icon-mima"></use>
                 </svg>
                 <div class="name">密码</div>

+ 15 - 3
src/icons/iconfont/iconfont.css

@@ -1,8 +1,8 @@
 @font-face {
   font-family: "iconfont"; /* Project id 4690301 */
-  src: url('iconfont.woff2?t=1726826444037') format('woff2'),
-       url('iconfont.woff?t=1726826444037') format('woff'),
-       url('iconfont.ttf?t=1726826444037') format('truetype');
+  src: url('iconfont.woff2?t=1730442227258') format('woff2'),
+       url('iconfont.woff?t=1730442227258') format('woff'),
+       url('iconfont.ttf?t=1730442227258') format('truetype');
 }
 
 .iconfont {
@@ -13,6 +13,18 @@
   -moz-osx-font-smoothing: grayscale;
 }
 
+.icon-tianjiazhanghao:before {
+  content: "\e655";
+}
+
+.icon-youxiang:before {
+  content: "\e62d";
+}
+
+.icon-yanzhengma:before {
+  content: "\e609";
+}
+
 .icon-mima:before {
   content: "\e62c";
 }

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1 - 1
src/icons/iconfont/iconfont.js


+ 21 - 0
src/icons/iconfont/iconfont.json

@@ -6,6 +6,27 @@
   "description": "",
   "glyphs": [
     {
+      "icon_id": "40332010",
+      "name": "添加账号",
+      "font_class": "tianjiazhanghao",
+      "unicode": "e655",
+      "unicode_decimal": 58965
+    },
+    {
+      "icon_id": "1235223",
+      "name": "邮箱",
+      "font_class": "youxiang",
+      "unicode": "e62d",
+      "unicode_decimal": 58925
+    },
+    {
+      "icon_id": "12704884",
+      "name": "验证码",
+      "font_class": "yanzhengma",
+      "unicode": "e609",
+      "unicode_decimal": 58889
+    },
+    {
       "icon_id": "5532892",
       "name": "密码",
       "font_class": "mima",

BIN
src/icons/iconfont/iconfont.ttf


BIN
src/icons/iconfont/iconfont.woff


BIN
src/icons/iconfont/iconfont.woff2


+ 8 - 8
src/router/index.js

@@ -13,14 +13,14 @@ const routes = [
     component: () => import('@/views/index'),
   },
 
-  // {
-  //   path:'/login',
-  //   name:'Login',
-  //   meta: {
-  //     title: '系统登录'
-  //   },
-  //   component: () => import("@/views/login/index.vue")
-  // },
+  {
+    path:'/register',
+    name:'Register',
+    meta: {
+      title: '注册'
+    },
+    component: () => import("@/views/register/index.vue")
+  },
   {
     path: "",
     component: () => import('@/views/layout/index.vue'),

+ 8 - 6
src/utils/axios.js

@@ -4,7 +4,7 @@ import Vue from 'vue';
 import axios from "axios";
 import constants from "@/utils/constants";
 import storage from "@/utils/storage";
-import { Notification, Loading } from 'element-ui'
+import { Notification, Loading ,Message} from 'element-ui'
 import Store from '@/store'
 import Api from '@/api'
 import Config from '@/config'
@@ -60,27 +60,27 @@ _axios.interceptors.response.use(
       isRefreshing = false
       return response.data
     }
-    if (code === 401) {
+    else if (code === 401) {
       Router.push({
         path: `${Store.getters.prefix}/login`
       }).then(r => {})
       return Promise.reject(response.data)
     }
-    if (code === 402) {
+    else if (code === 402) {
       Notification.error({
         title: '权限不足',
         message: message
       })
       return Promise.reject(response.data)
     }
-    if(code == 806){
+    else if(code == 806){
       Notification.error({
         title: '账号未启用',
         message: message
       })
       return Promise.reject(response.data)
     }
-    if (code === 500) {
+    else if (code === 500) {
       // TODO
       return Promise.reject(response.data)
     } else if (code === 0) {
@@ -90,7 +90,9 @@ _axios.interceptors.response.use(
         message: message
       })
       return Promise.reject(response.data)
-    } else if (code !== 401) {
+    } else{
+      isRefreshing = false
+      return response.data 
     }
     // Do something with response data
     // return response;

+ 318 - 0
src/views/register/index.vue

@@ -0,0 +1,318 @@
+<template>
+  <div class="register" :style="`background-image:url(${require('@/assets/image/register_background.png')})`">
+    <div class="logo">
+        <el-image :src="require('@/assets/image/logo3.png')" class="img" fit="contain"></el-image>
+    </div>
+    <div class="content">
+        <div class="content_title">用户注册</div>
+        <div class="content_form">
+          <el-form ref="ruleForm" :model="form" :rules="rules" label-position="right" label-width="15px">
+            <el-form-item prop="phoneNum" label=" ">
+              <el-input v-model="form.phoneNum" placeholder="请输入手机号(必填)">
+                <i slot="prefix" class="el-icon-phone icon"></i>
+              </el-input>
+            </el-form-item>
+            <el-form-item prop="phoneCode" label=" ">
+              <el-input v-model="form.phoneCode" placeholder="请输入验证码(必填)">
+                <i slot="prefix" class="iconfont icon-yanzhengma icon"></i>
+                <el-button slot="append" class="phoneCode" :disabled="phoneCodeText.indexOf('秒')!=-1" @click="getPhoneCode">{{phoneCodeText}}</el-button>
+              </el-input>
+            </el-form-item>
+            <el-form-item prop="password" >
+              <el-input v-model="form.password" placeholder="请输入密码(非必填)">
+                <i slot="prefix" class="iconfont icon-mima icon"></i>
+              </el-input>
+            </el-form-item>
+            <el-form-item prop="username" >
+              <el-input v-model="form.username" placeholder="请输入账号(非必填)">
+                <i slot="prefix" class="iconfont icon-tianjiazhanghao icon"></i>
+              </el-input>
+            </el-form-item>
+            <el-form-item prop="email" >
+              <el-input v-model="form.email" placeholder="请输入邮箱(非必填)">
+                <i slot="prefix" class="iconfont icon-youxiang icon"></i>
+              </el-input>
+            </el-form-item>
+            <el-form-item prop="name" >
+              <el-input v-model="form.name" placeholder="请输入姓名(非必填)">
+                <i slot="prefix" class="el-icon-user-solid icon"></i>
+              </el-input>
+            </el-form-item>
+            <el-form-item prop="vipType" label=" ">
+              <el-select v-model="form.vipType" filterable style="width:100%" placeholder="请选择版本(必选)">
+                <el-option
+                  v-for="item in qiaoBiVipType"
+                  :key="item.vipTypeId"
+                  :label="item.vipTypeName"
+                  :value="item.vipTypeId">
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-form>
+        </div>
+        <div class="content_btn">
+          <el-button type="primary" size="small" @click="submit">注册</el-button>
+        </div>
+    </div>
+    <div class="copyright">
+      copyright©灵智信息服务(深圳)有限公司
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  components: {},
+  props: {},
+  data() {
+    return {
+      qiaoBiVipType:[],
+      form:{},
+      phoneCodeText:'获取验证码',
+      rules:{
+        phoneNum: [
+          { required: true, message: "请输入手机号码", trigger: "blur" },
+          {
+            pattern:
+              /(^((\+86)|(86))?(1[3-9])\d{9}$)|(^(0\d{2,3})-?(\d{7,8})$)/,
+            message: "请输入正确的手机号码",
+            trigger: "blur",
+          },
+        ],
+        phoneCode:[
+          {required: true, message: "请输入验证码", trigger: "blur"}
+        ],
+        email: [
+          { required: false, message: "请输入邮箱", trigger: "blur" },
+          {
+            pattern:
+              /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9_\.\-])+\.)+([a-zA-Z0-9]{2,4})+$/,
+            message: "请输入正确的邮箱格式",
+            trigger: "blur",
+          },
+        ],
+        vipType:[
+          {required: true, message: "请选择版本", trigger: "change"}
+        ]
+      }
+    };
+  },
+  watch: {},
+  computed: {
+    invitationCode(){
+      return this.$route.query.invitationCode
+    }
+  },
+  created() {},
+  mounted() {
+    this.init()
+  },
+  methods: {
+    //初始化
+    init(){
+      //获取会员版本信息
+      this.getQiaoBiVipType()
+    },
+    //获取会员版本信息
+    getQiaoBiVipType(name=''){
+      var params = {
+        vipTypeName:name
+      }
+      this.$api.queryQiaoBiVipType(params).then(response=>{
+        if(response.code == 200){
+          if(response.data && response.data.length>0){
+            this.qiaoBiVipType = response.data
+            this.$set(this.form,'vipType',this.qiaoBiVipType[0].vipTypeId)
+          }
+          
+        }
+      })
+    },
+    //获取验证码
+    getPhoneCode(){
+      if(!this.form.phoneNum){
+        this.$message.warning('请输入手机号')
+        return
+      }
+      const regex =  /(^((\+86)|(86))?(1[3-9])\d{9}$)|(^(0\d{2,3})-?(\d{7,8})$)/
+      if(!regex.test(this.form.phoneNum)){
+        this.$message.warning('请输入正确的手机号码')
+        return false
+      }
+      if(this.phoneCodeText.indexOf('秒')!=-1){
+        return
+      }
+      var params = {
+        phoneNum:this.form.phoneNum
+      }
+      this.$api.getPhoneCode(params).then(response=>{
+        if(response.code == 200){
+          var num = 60
+          this.phoneCodeText = num + '秒'
+          var timer = setInterval(()=>{
+            num -= 1
+            this.phoneCodeText = num + '秒'
+            if(num == 0){
+              this.phoneCodeText = '再次获取验证码'
+              clearInterval(timer)
+            }
+          },1000)
+        }else{
+          this.$message.error(response.message)
+        }
+      }).catch(error=>{
+
+      })
+    },
+    //提交信息
+    submit(){
+      this.$refs.ruleForm.validate((valid) => {
+        if (valid) {
+          if(this.invitationCode){
+            this.form.inviteCode = this.invitationCode
+          }
+          this.$api.personnelSignUp(this.form).then(response=>{
+            if(response.code == 200){
+              this.$message.success('注册成功')
+              this.$router.replace(
+                {
+                  path:'/home',
+                }
+              )
+            }else{
+              this.$message.error(response.message)
+            }
+          })
+          
+        }else {
+          return false;
+        }
+      })
+      
+    },
+  },
+};
+</script>
+<style lang="scss">
+.register{
+  .content{
+    .el-form-item{
+      margin-bottom: 10px;
+    }
+    
+    .el-input__inner{
+      // border-radius: 8px;
+      height: 35px;
+      border: 1px solid var(--color) ;
+      box-shadow: 2px 2px 2px 0 rgba($color: #494a9c, $alpha: 0.5);
+    }
+    .el-input-group__append{
+      border: 1px solid var(--color) ;
+      border-left: 0;
+      box-shadow: 2px 2px 2px 0 rgba($color: #494a9c, $alpha: 0.5);
+      background-color: var(--color);
+      color: white;
+    }
+    .is-error{
+      margin-bottom: 20px;
+      .el-input__inner{
+        border: #F56C6C ;
+        box-shadow: 2px 2px 2px 0 rgba($color: #F56C6C, $alpha: 0.5);
+      }
+      .el-input-group__append{
+        border: #F56C6C ;
+        box-shadow: 2px 2px 2px 0 rgba($color: #F56C6C, $alpha: 0.5);
+      }
+    }
+    
+    .content_btn{
+      .el-button{
+        width: 100%;
+        background-color: var(--color);
+        border-color: var(--color);
+      }
+    }
+  }
+}
+</style>
+<style lang="scss" scoped>
+.register{
+  width: 100vw;
+  height: 100vh;
+  background-size: cover;
+  background-position: center;
+  position: relative;
+}
+// .register::after{
+//   content:'';
+//   width: 100%;
+//   height: 100%;
+//   position: absolute;
+//   inset: 0;
+//   background: var(--color);
+//   opacity: 0.5;
+// }
+.logo{
+    position: absolute;
+    top: 0;
+    left: 0;
+    height: 80px;
+    width: fit-content;
+    // z-index: 9999;
+    .img{
+        width: 100%;
+        height: 100%;
+    }
+}
+.content{
+    // height: 400px;
+    width: 250px;
+    min-height: 300px;
+    height:fit-content;
+    border-radius: 10px;
+    // z-index: 9999;
+    position: absolute;
+    inset: 0;
+    margin: auto;
+    padding: 0 10px;
+    background-color: rgba(255, 255, 255, 0.5);
+    padding: 20px 100px 60px 100px;
+    .content_title{
+      text-align: center;
+      color: var(--color);
+      font-weight: bold;
+      font-size: 22px;
+      padding: 10px;
+    }
+    .content_form{
+      margin-top: 10px;
+      margin-left:-15px;
+      .icon{
+        color: black !important;
+        font-weight: bold;
+        font-size: 20px;
+        line-height: 35px;
+      }
+      .phoneCode{
+        padding: 5px;
+        font-size: 12px;
+      }
+      .is-disabled:hover{
+        color: inherit;
+        cursor: not-allowed;
+        background-color: inherit;
+        border-color: var(--color);
+      }
+    }
+}
+.copyright{
+  position: absolute;
+  right: 0;
+  left: 0;
+  bottom: 35px;
+  margin: auto;
+  text-align: center;
+  color: black;
+  // z-index: 9999;
+}
+</style>