zhuliu 9 tháng trước cách đây
mục cha
commit
d347ce8e0c

+ 28 - 7
src/api/registerAndLogin.js

@@ -42,8 +42,8 @@ export default {
      * @param {String} data.phoneCode - 验证码
      * @returns 
      */
-    loginByPhone(data){
-        return axios.post('/permission/qiaoBi/admin/loginByPhone',data)
+    backPhoneLogin(data){
+        return axios.post('/permission/qiaoBi/qiaoBiPerson/backPhoneLogin',data)
     },
     /**
      * 账号密码登录
@@ -52,14 +52,35 @@ export default {
      * @param {String} data.password - 密码
      * @returns 
      */
-    login(data) {
-        return axios.post('/permission/qiaoBi/admin/login', data)
-    },
     backAccountLogin(data){
         return axios.post('/permission/qiaoBi/qiaoBiPerson/backAccountLogin',data)
     },
-    backPhoneLogin(data){
-        return axios.post('/permission/qiaoBi/qiaoBiPerson/backPhoneLogin',data)
+
+    /**
+     * 退出登录
+     */
+    logout() {
+        return axios.post('/permission/qiaoBi/admin/logout')
     },
     
+
+    /**
+     * 根据付费码发送手机验证码
+     */
+    sendPhoneCodeByPaidCode(data) {
+        return axios.post('/permission/qiaoBi/paidCode/sendPhoneCode',data)
+    },
+    /**
+     * 根据付费码发送手机验证码
+     */
+    checkPhoneCodeByPaidCode(data) {
+        return axios.post('/permission/qiaoBi/paidCode/checkPhoneCode',data)
+    },
+
+    /**
+     * 企业注册
+     */
+    companySignUp(data) {
+        return axios.post('/permission/qiaoBi/qiaoBiPerson/companySignUp',data)
+    },
 }

+ 10 - 1
src/router/index.js

@@ -100,7 +100,7 @@ export const defaultBackStageManageRouterItem = [
         path: 'editTenant',
         name: 'Administrator_editTenant',
         component: () => import('@/views/backStageManage/organization/tenant/editTenant.vue'),
-        meta: {title: '编辑企业信息',icon: '企业'},
+        meta: {title: '编辑企业信息',icon: '企业',keepAlive:true},
         hidden:true
       },
       {
@@ -310,6 +310,15 @@ export const backStageManage = [
         },
         component: () => import('@/views/backStageManage/login/index.vue'),
       },
+      {
+        path: 'register',
+        name: 'Administrator_register',
+        meta: {
+          title: '后台管理-企业注册',
+          notLogin:true
+        },
+        component: () => import('@/views/backStageManage/login/component/register.vue'),
+      },
       ...backStageManageRouterItem
     ]
   }

+ 4 - 0
src/store/modules/history.js

@@ -4,9 +4,13 @@ export default {
     history:[],
     historyPath:[],
     currentPath:null,
+    destroyPath:null,
   },
 
   mutations: {
+    addDestroyPath(state,path){
+      state.destroyPath=path;
+    },
     addHistoryPath(state,path){
       let paths=state.historyPath.filter(item=>{
           return item!==path;

+ 20 - 2
src/views/backStageManage/layout/components/AppMain.vue

@@ -2,7 +2,7 @@
   <section class="app-main">
     <transition name="fade" mode="out-in">
       <keep-alive>
-          <router-view :key="$route.fullPath" v-if="$route.meta.keepAlive"></router-view>
+          <router-view :key="getKey()" v-if="$route.meta.keepAlive"></router-view>
       </keep-alive>
     </transition>
       <transition name="fade" mode="out-in">
@@ -26,9 +26,14 @@ export default {
     currentPath(){
       return this.$store.state.history.currentPath;
     },
+    destroyPath(){
+      return this.$store.state.history.destroyPath
+    }
   },
   watch:{
-
+    // destroyPath(){
+    //   this.destroyComponent()
+    // }
   },
   data() {
     return {
@@ -38,8 +43,21 @@ export default {
     // if(this.userId){
     //   this.connectWebSocket(this.userId)
     // }
+    this.destroyComponent()
   },
   methods: {
+    getKey(){
+      return this.$route.fullPath
+    },
+    destroyComponent(){
+      if(this.destroyPath){
+        var dom = this.$refs[this.destroyPath]
+        console.log(dom)
+        if(dom){
+          dom.$history()
+        }
+      }
+    },
   },
 }
 </script>

+ 10 - 4
src/views/backStageManage/layout/components/Navbar.vue

@@ -80,11 +80,17 @@ export default {
       // this.$store.dispatch('LogOut').then(() => {
       //   location.reload() // 为了重新实例化vue-router对象 避免bug
       // })
-      this.$router.push(
-        {
-          path:'/administrator/login'
+      this.$api.logout().then(response=>{
+        if(response.code == 200){
+          this.$cookie.remove("token")
+          this.$router.push(
+            {
+              path:'/administrator/login'
+            }
+          )
         }
-      )
+      })
+     
     },
     personalMessage(){
       this.$router.push(

+ 1 - 0
src/views/backStageManage/layout/components/history.vue

@@ -41,6 +41,7 @@ export default {
       var sign = this.currentPath == path
       this.$store.commit('removeHistoryPath',path);
       this.$store.commit('removeHistory',path);
+      this.$store.commit('addDestroyPath',path);
       if(sign){
         this.tabClick(this.history[this.history.length-1])
       }

+ 421 - 0
src/views/backStageManage/login/component/register.vue

@@ -0,0 +1,421 @@
+<template>
+    <div class="register" :style="`background-image:url(${require('@/assets/image/register_background.png')})`">
+      <div class="content">
+        <div class="logo">
+          <el-image :src="require('@/assets/image/logo3.png')" class="img" fit="contain"></el-image>
+        </div>
+        <div class="body">
+          <div class="title">
+            <div>企业注册</div>
+          </div>
+          <div class="input">
+            <el-form ref="ruleForm" :model="form" :rules="rules" label-position="right" label-width="80px">
+                <template>
+                    <div>
+                        <div class="form_item_title">
+                            <div>付费码信息<span style="color:red;font-size:12px;">(请先检验付费码)</span>:</div>
+                            <el-button type="primary" size="small" @click="verification">校验</el-button>
+                        </div>
+                        <el-form-item prop="paidCode" label="付费码:">
+                            <el-input v-model="form.paidCode" placeholder="请输入付费码"></el-input>
+                        </el-form-item>
+                        <el-form-item prop="phoneCode1" label="验证码:">
+                            <el-input v-model="form.phoneCode1" placeholder="请输入验证码">
+                                <el-button slot="append" class="phoneCode" :disabled="phoneCodeText.indexOf('秒')!=-1" @click="sendPhoneCodeByPaidCode">{{phoneCodeText}}</el-button>
+                            </el-input>
+                        </el-form-item>
+                        <!-- <div class="verification">
+                            <el-button type="primary" size="small" @click="verification">校验</el-button>
+                        </div> -->
+                    </div>
+                </template>
+                <!-- <div class="form_item_title">注册信息:</div> -->
+                <p class="form_item_title">企业信息:</p>
+                <el-row :gutter="24">
+                    <el-col :span="12">
+						<el-form-item label="名称:" prop="tenantName">
+							<el-input
+								v-model="form.tenantName"
+								placeholder="请输入企业名称"
+							></el-input>
+						</el-form-item>
+					</el-col>
+                    <el-col :span="12">
+						<el-form-item label="类型:" prop="tenantType">
+                            <el-select v-model="form.tenantType" placeholder="请选择企业类型" style="width:100%">
+                                <el-option v-for="item in tenantType" :key="item.dictChildValue" :label="item.dictChildLabel" :value="Number(item.dictChildValue)"></el-option>
+                            </el-select>
+						</el-form-item>
+					</el-col>
+                    <el-col :span="24">
+						<el-form-item label="地址:" prop="tenantAddress">
+							<el-input
+								v-model="form.tenantAddress"
+								placeholder="请输入企业地址"
+							></el-input>
+						</el-form-item>
+					</el-col>
+                </el-row>
+                <p class="form_item_title">人员信息:</p>
+                <el-row :gutter="24">
+                    <el-col :span="12">
+						<el-form-item label="姓名:" prop="personnelName">
+							<el-input
+								v-model="form.personnelName"
+								placeholder="请输入姓名"
+							></el-input>
+						</el-form-item>
+					</el-col>
+                    <el-col :span="12">
+						<el-form-item label="邮箱:" prop="personnelEmail">
+							<el-input
+								v-model="form.personnelEmail"
+								placeholder="请输入邮箱"
+							></el-input>
+						</el-form-item>
+					</el-col>
+                    <el-col :span="12">
+						<el-form-item label="手机号:" prop="personnelPhone">
+							<el-input
+								v-model="form.personnelPhone"
+								placeholder="请输入手机号"
+                                maxlength="11"
+							></el-input>
+						</el-form-item>
+					</el-col>
+                    <el-col :span="12">
+						<el-form-item label="验证码:" prop="phoneCode">
+							<el-input v-model="form.phoneCode" placeholder="请输入验证码">
+                                <el-button slot="append" class="phoneCode" :disabled="phoneCodeText1.indexOf('秒')!=-1" @click="getPhoneCode">{{phoneCodeText1}}</el-button>
+                            </el-input>
+						</el-form-item>
+					</el-col>
+                    <el-col :span="12">
+						<el-form-item label="账号:" prop="personnelUserName">
+                            <el-input
+                                v-model="form.personnelUserName"
+                                placeholder="请输入账号"
+                            ></el-input>
+                        </el-form-item>
+					</el-col>
+                    <el-col :span="12">
+						<el-form-item label="密码:" prop="personnelPassword">
+                            <el-input
+                                v-model="form.personnelPassword"
+                                placeholder="请输入密码"
+                            ></el-input>
+                        </el-form-item> 
+					</el-col>
+                </el-row>
+            </el-form>
+          </div>
+          <div class="btn">
+            <el-button round style="width:100%;background:var(--color);color:white;height:50px;" :loading="btnLoading" @click="submit">注册</el-button>
+          </div>
+        </div>
+      </div>
+      <div class="copyright">
+        copyright©灵智信息服务(深圳)有限公司
+      </div>
+    </div>
+</template>
+  
+<script>
+  import Storage from '@/utils/storage';
+  export default {
+    components: {},
+    props: {},
+    data() {
+      return {
+        btnLoading:false,
+        form:{
+        },
+        phoneCodeText:'获取验证码',
+        phoneCodeText1:'获取验证码',
+        rules:{
+            personnelPhone: [
+                { 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"}
+            ],
+            tenantType:[
+                {required: true, message: "请选择类型", trigger: "change"}
+            ],
+        },
+        tenantType:[]
+      };
+    },
+    watch: {},
+    computed: {},
+    created() {},
+    mounted() {
+        this.getTenantType()
+    },
+    methods: {
+        getTenantType(){
+            var params = {
+                type:'TENANT_TYPE'
+            }
+            this.$api.getSysDictByType(params).then(response => {
+                this.tenantType = response.data.TENANT_TYPE
+            })
+        },
+      //获取验证码
+      sendPhoneCodeByPaidCode(){
+        if(!this.form.paidCode){
+          this.$message.warning('请输入手机号')
+          return
+        }
+        if(this.phoneCodeText.indexOf('秒')!=-1){
+          return
+        }
+        var params = {
+            paidCode:this.form.paidCode
+        }
+        this.$api.sendPhoneCodeByPaidCode(params).then(response=>{
+          if(response.code == 200){
+            this.$message.success('验证码已发送到付费码预留的手机号')
+            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=>{
+  
+        })
+      },
+      //获取验证码
+        getPhoneCode(){
+            if(!this.form.personnelPhone){
+                this.$message.warning('请输入手机号')
+                return
+            }
+            if(this.phoneCodeText1.indexOf('秒')!=-1){
+                return
+            }
+            var params = {
+                phoneNum:this.form.personnelPhone
+            }
+            this.$api.getPhoneCode(params).then(response=>{
+                if(response.code == 200){
+                var num = 60
+                this.phoneCodeText1 = num + '秒'
+                var timer = setInterval(()=>{
+                    num -= 1
+                    this.phoneCodeText1 = num + '秒'
+                    if(num == 0){
+                        this.phoneCodeText1 = '再次获取验证码'
+                        clearInterval(timer)
+                    }
+                },1000)
+                }else{
+                    this.$message.error(response.message)
+                }
+            }).catch(error=>{
+
+            })
+        },
+      //检验验证码以及返回信息
+      verification(){
+        if(!this.form.paidCode){
+            this.$message.warning('请输入付费码')
+            return
+        }
+        if(!this.form.phoneCode1){
+            this.$message.warning('请输入验证')
+            return
+        }
+        var params = {
+            paidCode:this.form.paidCode,
+            phoneCode:this.form.phoneCode1
+        }
+        this.$api.checkPhoneCodeByPaidCode(params).then(response=>{
+            if(response.code == 200 && response.data.token){
+                this.$message.success('检验通过')
+                var form = {
+                    ...response.data,
+                    ...this.form
+                }
+                this.form = form
+            }
+        })
+      },
+      //提交信息
+      submit(){
+        if(!this.form.token){
+            this.$message.warning('请先校验付费码')
+            return
+        }
+        this.$refs.ruleForm.validate((valid) => {
+          if (valid) {
+            var api = 'companySignUp'
+            this.btnLoading = true
+            this.$api[api](this.form).then(response=>{
+              if(response.code == 200){
+                this.btnLoading = false
+                // this.$cookie.set('token',response.data.token)
+                Storage.setStr('username', this.form.personnelUserName)
+                Storage.setStr('password', this.form.personnelPassword)
+                Storage.setStr('phoneNum', this.form.personnelPhone)
+                this.$message.success('注册成功')
+                this.$router.replace(
+                  {
+                    path:'/administrator/login',
+                  }
+                )
+              }
+            }).catch(error=>{
+              this.btnLoading = false
+            })
+  
+          }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;
+      }
+      .el-input__prefix{
+        line-height: 35px !important;
+      }
+      .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;
+    background-attachment: fixed;
+  }
+  .form_item_title{
+        padding: 5px 0;
+        font-weight: bold;
+        font-size: 16px;
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+    }
+    .verification{
+        display: flex;
+        justify-content: flex-end;
+        padding: 5px 0;
+    }
+  
+  
+  .content{
+    width: 1000px;
+    height: fit-content;
+    background: rgba($color: white, $alpha: 0.6);
+    position: absolute;
+    inset: 0;
+    margin: auto;
+    z-index: 999;
+    padding: 20px;
+    .img{
+      height: 50px;
+    }
+  }
+  .body{
+    width:750px;
+    padding: 0px 0 35px 0;
+    margin: auto;
+    .title{
+      text-align: center;
+      font-size: 28px;
+      // color: var(--color);
+      color: black;
+      font-weight: bold;
+      &>div{
+        margin-bottom: 10px;
+      }
+    }
+    .input{
+      margin:20px 0;
+      &>div{
+        margin-bottom: 10px;
+      }
+    }
+  }
+  .forget{
+    display: flex;
+    justify-content: space-between;
+    // text-align: center;
+    font-size: 14px;
+    .forget_btn{
+      color: var(--color);
+      cursor: pointer;
+    }
+  }
+  .btn{
+    margin-top:20px;
+  }
+  .copyright{
+    position: absolute;
+    right: 0;
+    left: 0;
+    bottom: 35px;
+    margin: auto;
+    text-align: center;
+    color: black;
+    z-index: 9999;
+  }
+  </style>

+ 23 - 1
src/views/backStageManage/login/index.vue

@@ -50,12 +50,16 @@
           </el-form>
         </div>
         <div class="forget">
-          <span class="forget_btn" @click="forget">忘记密码了?</span>
+          <span class="forget_btn" @click="forget" v-if="loginType == 2">忘记密码了?</span>
+          <span class="forget_btn" v-else></span>
           <span class="forget_btn" @click="changeLoginType">切换{{loginType==1?'账号密码':'手机号'}}登录</span>
         </div>
         <div class="btn">
           <el-button round style="width:100%;background:var(--color);color:white;height:50px;" :loading="btnLoading" @click="submit">登录</el-button>
         </div>
+        <div class="register">
+          <span class="forget_btn" @click="register">企业注册</span>
+        </div>
       </div>
     </div>
     <div class="copyright">
@@ -185,6 +189,13 @@ export default {
       })
       
     },
+    register(){
+      this.$router.push(
+        {
+          path:'/administrator/register'
+        }
+      )
+    },
   },
 };
 </script>
@@ -234,6 +245,17 @@ export default {
 }
 </style>
 <style lang="scss" scoped>
+.register{
+  display: flex;
+  justify-content:flex-end;
+  font-size: 14px;
+  font-weight:bold;
+  padding-top: 10px;
+  .forget_btn{
+    color: var(--color);
+    cursor: pointer;
+  }
+}
 .login{
   width: 100vw;
   height: 100vh;

+ 1 - 1
src/views/backStageManage/organization/tenant/components/tenant.vue

@@ -24,7 +24,7 @@
                 <el-table-column prop="address" label="联系人地址" align="center" show-overflow-tooltip></el-table-column>
                 <el-table-column prop="type" label="类型" align="center" show-overflow-tooltip>
                     <template slot-scope="scope">
-                        <div>{{ getTenantName(scope.row.tenantType) }}</div>
+                        <div>{{ getTenantName(scope.row.type) }}</div>
                     </template>
                 </el-table-column>
                 <el-table-column prop="vipTypes" label="购买会员信息">