Преглед на файлове

优化页面,完善加入企业功能

jinsy преди 7 години
родител
ревизия
5bb0a92e38

+ 36 - 27
frontend/saas-portal-web/src/components/conenter/addenterprise.vue

@@ -8,7 +8,7 @@
             <div class="gs-worp qy-worp tj-up">
                 <div class="qy-title" style="position: relative;">
                     <ul class="over">
-                        <li class="left xs" v-for="(d, i) in tab" :key="i" :class= "{qyactive:nowindex == i}" @click="tabwith(i)">{{d.name}}</li>
+                        <li class="left xs" v-for="(d, i) in tab" :key="i" :class= "{qyactive:nowindex == i}" @click="tabwatch(i)">{{d.name}}</li>
                     </ul>
                 </div>
                 <div class="qy-conent" :class= "{showqiye:nowindex == 0}" style="padding-top: 60px;">
@@ -120,7 +120,7 @@ import { setTimeout } from 'timers';
                 // area:'',//区
                 qymingzi: false,//企业名是否注册
                 Email: '',
-                mytoken: JSON.parse(localStorage.getItem('app-state-session')),//本地储存的用户信息
+                mytoken: Session.get(),//本地储存的用户信息
                 reg: new RegExp(/[\@\#\$\%\&\*!\¥]/),//非法字符
                 regname:new RegExp(/[\@\#\$\%\&\*!\¥0-9]/),//非法字符加数字
                 isaddress: false,//公司地址验证
@@ -142,6 +142,7 @@ import { setTimeout } from 'timers';
                 isTestingname:false,
                 isregname:false,
                 companyId:null,
+                admin:null,
                 arr:[]
             }
         },
@@ -153,7 +154,7 @@ import { setTimeout } from 'timers';
             this.$refs.email.value = this.mytoken.account.email;
         },
         methods: {
-            tabwith(i){
+            tabwatch(i){
                 this.nowindex = i;
             },
             //取消添加企业
@@ -219,8 +220,11 @@ import { setTimeout } from 'timers';
                             this.islookup = true;   
                         } else if (res.data.success == false && res.data.message == '公司不存在') {
                             this.$refs.warningqyname.innerHTML = '<img style="width:14px" src="/static/img/warning.png" alt=""> 该企业不存在';
+                            this.islookup = false; 
                         } else {
                             this.$message.error('请求失败,请重试');
+                            this.islookup = false; 
+                            this.$refs.warningqyname.innerHTML = '<img style="width:14px" src="/static/img/warning.png" alt="">'
                         }
                     })
                 }
@@ -260,6 +264,7 @@ import { setTimeout } from 'timers';
             // 选择要加入的企业
             qylist(i){
                 this.companyId = this.arr[i].id,
+                this.admin = this.arr[i].admin,
                 this.newindex = i
             },
             //加入企业提交按钮
@@ -273,30 +278,34 @@ import { setTimeout } from 'timers';
                 } else if (!this.isregname) {
                     this.$message.error('姓名不能包含符号、数字等非法字符');
                 } else if (this.companyId){
-                    this.$ajax({
-                        url: this.$url.api+'/api/account/accountCenter/company/join',
-                        method:'POST',
-                        data:{
-                            username:username,
-                            accountId:this.mytoken.account.id,
-                            companyId:this.companyId,
-                        },
-                        headers:{
-                            "Authorization":token,
-                        }
-                    })
-                    .then(res=>{
-                        if (res.data.success) {
-                            this.$message.success('提交成功,待管理员批准加入');
-                            this.$store.state.ishongdian = true;//显示红点
-                            setTimeout(()=>{
-                                this.$router.push({name:'company'});
-                                document.documentElement.scrollTop = 0;
-                            },3000)
-                        } else {
-                            this.$message.error(res.data.message);
-                        }
-                    })
+                    if (this.admin == this.mytoken.account.realname) {
+                        this.$message.error('账号已在企业服务中,不能重复加入');
+                    } else {
+                        this.$ajax({
+                            url: this.$url.api+'/api/account/accountCenter/company/join',
+                            method:'POST',
+                            data:{
+                                username:username,
+                                accountId:this.mytoken.account.id,
+                                companyId:this.companyId,
+                            },
+                            headers:{
+                                "Authorization":token,
+                            }
+                        })
+                        .then(res=>{
+                            if (res.data.success) {
+                                this.$message.success('提交成功,待管理员批准加入');
+                                this.$store.state.ishongdian = true;//显示红点
+                                setTimeout(()=>{
+                                    this.$router.push({name:'company'});
+                                    document.documentElement.scrollTop = 0;
+                                },3000)
+                            } else {
+                                this.$message.error(res.data.message);
+                            }
+                        })
+                    }
                 } else {
                     this.$message.error('请选择要加入的企业');
                 }

+ 7 - 7
frontend/saas-portal-web/src/components/conenter/company.vue

@@ -100,7 +100,7 @@
                 </div>
             </div>
         </div>
-      </div>
+    </div>
 </template>
 
 <script>
@@ -118,7 +118,7 @@
                 ktsass: true,//开通saas
                 isDefault: true,//开通默认
                 isAutoLogin: this.$store.state.isAutoLogin,
-                mytoken: JSON.parse(localStorage.getItem('app-state-session')),//本地储存的用户信息
+                mytoken: Session.get(),//本地储存的用户信息
                 list: [],//企业列表信息
                 isheigh:false,//是否添加默认高度
                 admin: '',
@@ -138,7 +138,7 @@
             }
         },
         created(){
-            let mytoken = JSON.parse(localStorage.getItem('app-state-session'));
+            let mytoken = Session.get();
             let token = String(mytoken.token);
             //企业列表
             this.$ajax({
@@ -167,7 +167,7 @@
                                 enterprise.push(addenterprise)
                             }
                         };
-                        let session = JSON.parse(window.localStorage.getItem('app-state-session'));
+                        let session = Session.get();
                         if (enterprise.length != session.account.companies.length) {
                             session.account.companies = enterprise;
                             Session.set(session);
@@ -177,7 +177,7 @@
                         let token = res.data.data.token.token;
                         if (this.isAutoLogin) {
                             if (hasCompany) {
-                                let session=JSON.parse(localStorage.getItem('app-state-session'));
+                                let session = Session.get();
                                 session.account.companyId=companyId;
                                 session.span = session.timestamp - new Date().getTime();
                                 session.token=token;
@@ -260,7 +260,7 @@
                 })
                 .then(res=>{
                     let mytoken = res.data.data.token;
-                    let session=JSON.parse(localStorage.getItem('app-state-session'));
+                    let session = Session.get();
                     session.account.companyId=id;
                     session.span = session.timestamp - new Date().getTime();
                     session.token=mytoken;
@@ -346,8 +346,8 @@
             //查看企业详情
             getEnterpriseInfo(d){
                 document.documentElement.scrollTop = 0;
-                this.$router.push({path:'/details'});
                 window.sessionStorage.setItem('content',JSON.stringify(d))
+                this.$router.push({path:'/details'});
             },
              //添加企业
             addEnterprise(){

+ 5 - 2
frontend/saas-portal-web/src/components/conenter/details.vue

@@ -97,14 +97,14 @@
 </template>
 
 <script>
-
+import Session from '@/utils/session'
     export default {
         data(){
             return {
                 modify:true,
                 content: JSON.parse(window.sessionStorage.getItem("content")),
                 Email: '',
-                mytoken: JSON.parse(localStorage.getItem('app-state-session')),//本地储存的用户信息
+                mytoken: Session.get(),//本地储存的用户信息
                 isId: false,
                 isemail: true,//正则邮箱
                 ismodifyId: false
@@ -187,6 +187,9 @@
                         if (res.data.success) {
                             document.documentElement.scrollTop = 0;
                             this.modify = true;
+                            let session = Session.get();
+                            session.account.email = email;
+                            Session.set(session);
                             this.content.type = qyindustry;
                             this.content.adminEmail = email
                         };

+ 23 - 19
frontend/saas-portal-web/src/components/conenter/enterprise.vue

@@ -44,8 +44,9 @@
                 <div :class= "{gsqiye:nowindex == 0}"> 
                     
     <!-- 企业列表展示-------添加企业-------------企业详细信息展示 ---------------------------- -->
+                <!-- <keep-alive> -->
                     <router-view></router-view>
-
+                <!-- </keep-alive> -->
                 </div>
     <!-- 个人信息------------------------------------------------------------------- -->
                 <div :class= "{gsqiye:nowindex == 1}">
@@ -150,9 +151,10 @@
                         <div v-if="isnews" class="my-pagination">
                             <el-pagination
                                 background
+                                :page-size=size
                                 @current-change="handleCurrentChange"
                                 layout="prev, pager, next"
-                                :total= list>
+                                :total= listtotal>
                             </el-pagination>
                         </div>
                     </div>
@@ -170,7 +172,7 @@ import { setTimeout } from 'timers';
             return{
                 nowindex: 0,//tab切换
                 tianjiaqiye: true,//添加企业切换
-                mytoken: JSON.parse(localStorage.getItem('app-state-session')).account,//本地储存的用户信息
+                mytoken: Session.get().account,//本地储存的用户信息
                 mobile: null,
                 ismodifyname:true,
                 isname:true,//姓名验证
@@ -184,7 +186,8 @@ import { setTimeout } from 'timers';
                     {name: '消息'},
                 ],
                 arr: [],
-                list:1
+                listtotal:1,
+                size:10,//每页显示数量
             }
         },
         mounted(){
@@ -211,15 +214,15 @@ import { setTimeout } from 'timers';
         methods: {
             // tab切换
             tabswitch(index){
+                this.mytoken = Session.get().account;
                 if (index == 3) {
                     this.nowindex = 3;
-                    let mytoken = Session.get();
-                    let id = mytoken.account.id;
+                    let id = this.mytoken.id;
                     let param = {
                         type:'condition',
                         value:'creatorId='+id+''
                     }
-                    // tab切换到消息的时候执行
+                    // tab切换到消息的时候获取申请列表
                     this.$ajax({
                         url: this.$url.api+'/api/commons/remind/apply/list',
                         method:'GET',
@@ -227,18 +230,18 @@ import { setTimeout } from 'timers';
                         params: {
                             condition:JSON.stringify(param),
                             number:1,
-                            size:10
+                            size:this.size
                         },
                         headers:{
                             'Access-Control-Allow-Origin':'*',
-                            "Authorization":mytoken.token,
+                            "Authorization":Session.getToken(),
                             'Content-Type':'application/json;charset=UTF-8'
                         }
                     })
                     .then(res=>{
                         if (res.data.success) {
                             this.arr = res.data.data.list;
-                            this.list = res.data.data.total;
+                            this.listtotal = res.data.data.total;
                             this.$store.state.ishongdian = false;
                         }
                     })
@@ -247,9 +250,6 @@ import { setTimeout } from 'timers';
                 }
                 
             },
-            setTurnHome(){
-                this.$parent.turnHome = true
-            },
             //重新加入
             Rejoin(i){
                 this.$ajax({
@@ -268,13 +268,14 @@ import { setTimeout } from 'timers';
                     if (res.data.success) {
                         this.$message.success('提交成功,待管理员批准');
                         this.tabswitch(3);//本页面刷新
+                    } else {
+                        this.$message.error(res.data.message);
                     }
                 })
             },
             // 分页
              handleCurrentChange(val) {
-                let mytoken = Session.get();
-                let id = mytoken.account.id;
+                let id = this.mytoken.id;
                 let param = {
                     type:'condition',
                     value:'creatorId='+id+''
@@ -286,11 +287,11 @@ import { setTimeout } from 'timers';
                     params: {
                         condition:JSON.stringify(param),
                         number:val,
-                        size:10
+                        size:this.size
                     },
                     headers:{
                         'Access-Control-Allow-Origin':'*',
-                        "Authorization":mytoken.token,
+                        "Authorization":Session.getToken(),
                         'Content-Type':'application/json;charset=UTF-8'
                     }
                 })
@@ -300,6 +301,9 @@ import { setTimeout } from 'timers';
                     }
                 })
             },
+            setTurnHome(){
+                this.$parent.turnHome = true
+            },
             //退出
             loginout(){
                 const frame = window.frames[window.frames.length - 1]
@@ -369,10 +373,10 @@ import { setTimeout } from 'timers';
                     })
                 }
             },
-            //没有内容也要有一定的高度
+            //内容不足500固定高度
             boxheight(){
                 let H = this.$refs.qiyebox.offsetHeight;
-                if (H <= 500) {
+                if (H < 500) {
                     this.isheigh = true
                 } else {
                     this.isheigh = false

+ 1 - 3
frontend/saas-portal-web/src/components/conenter/home.vue

@@ -264,8 +264,7 @@
       };
       let token;
       if(localStorage.getItem('app-state-session')){
-        let mytoken = JSON.parse(localStorage.getItem('app-state-session'));
-        token = String(mytoken.token);
+        token = Session.getToken();
       }
       this.$ajax({
         url: this.$url.api+'/api/auth/info',
@@ -424,7 +423,6 @@
                 const frame = window.frames[window.frames.length - 1]
                 frame.postMessage(JSON.stringify(session), '*')
                 window.location.href = me.$url.web
-                // console.log("请求成功",res)
                 phone = ''
             })
             .catch(err=>{

+ 1 - 1
frontend/saas-portal-web/src/pages/index/index.vue

@@ -13,7 +13,7 @@ export default {
   name: 'App',
   data(){
     return {
-
+      
     }
   },
   components: {