소스 검색

修改登录失败错误提示:用户名或密码错误

liuwei 4 년 전
부모
커밋
d23e2e5ba1
5개의 변경된 파일25개의 추가작업 그리고 15개의 파일을 삭제
  1. 6 1
      src/renderer/api/ajax.js
  2. 1 1
      src/renderer/api/index.js
  3. 1 1
      src/renderer/assets/less/splitscreen.less
  4. 16 11
      src/renderer/components/BigShow.vue
  5. 1 1
      src/renderer/components/Login.vue

+ 6 - 1
src/renderer/api/ajax.js

@@ -11,7 +11,7 @@ axios.interceptors.request.use(config => {
   return config
 })
 
-export default function ajax (url, data={}, type='GET') {
+export default function ajax (url, data={}, type='GET',reqName) {
 
   return new Promise(function (resolve, reject) {
     // 执行异步ajax请求
@@ -42,6 +42,11 @@ export default function ajax (url, data={}, type='GET') {
       // 成功了调用resolve()
       resolve(response.data)
     }).catch(function (error) {
+      // 如果是登录请求失败
+      if(reqName === 'login'){
+        alert(`用户名或密码错误!`)
+        return
+      }
       alert(`请求出错了 ${error}`)
     })
   })

+ 1 - 1
src/renderer/api/index.js

@@ -14,7 +14,7 @@ axios.get('static/EnitySystem.data').then(async res => {
 })
 
 // 登录
-export const reqLogin = (data) => ajax(BASE_URL+'/login',data,'POST')
+export const reqLogin = (data,reqName) => ajax(BASE_URL+'/login',data,'POST',reqName)
 
 // 退出登录
 export const reqLogout = (data) => ajax(BASE_URL+'/logout',data,'POST')

+ 1 - 1
src/renderer/assets/less/splitscreen.less

@@ -14,7 +14,7 @@
   .sitem {
     border: 1px solid #000000;
     color:#fff;
-    //background-color: #717171;
+    background-color: #717171;
     position: relative;
 
     // 关闭信号源开窗按钮

+ 16 - 11
src/renderer/components/BigShow.vue

@@ -30,12 +30,12 @@
             >
                 <div ref="signal">
                     <div class="closeBtn" @click.stop="closeSignal(itemV)">×</div>
-                    <video-player
+                    <!--<video-player
                             ref="videoPlayer"
                             :options="playerOptions"
                             :playsinline="true"
                     >
-                    </video-player>
+                    </video-player>-->
                 </div>
             </VueDragResize>
 
@@ -64,7 +64,7 @@
                 divArr:[],// 默认大屏中盒子的数组
                 streamWindows:[], // 传递出去的信号源位置信息
                 bigScreenJson:[],
-                playerOptions: {
+                playerOptions: { // rtmp视频流配置
                     sources: [],
                     techOrder: ['flash'],
                     autoplay: true,
@@ -116,7 +116,7 @@
                                 width:arr[index].width,
                                 height:arr[index].height,
                                 id:0,
-                                sourceId:arr[index] ? arr[index].sourceId : '',
+                                sourceId:arr[index].sourceId,
                                 widthScale:arr[index].width/(this.currentBigshow[0].Width*this.$store.state.bigScale),
                                 heightScale:arr[index].height/(this.currentBigshow[0].Height*this.$store.state.bigScale),
                                 orginRect:{}
@@ -145,14 +145,14 @@
                 const arr = this.$data.streamWindows
                 // 找出当前改动的信号源
                 const currentItem = arr.filter(item => item.sourceId === itemV.sourceId)
-                /*currentItem[0].widthScale = obj.width/currentItem[0].width
-                currentItem[0].heightScale = obj.height/currentItem[0].height*/
                 currentItem[0].width = obj.width
                 currentItem[0].height = obj.height
+                currentItem[0].widthScale = obj.width/(this.currentBigshow[0].Width*this.$store.state.bigScale)
+                currentItem[0].heightScale = obj.height/(this.currentBigshow[0].Height*this.$store.state.bigScale)
                 const otherItems = arr.filter(item => item.sourceId !== itemV.sourceId)
                 const newStreamWindows = [...currentItem,...otherItems]
                 this.streamWindows = newStreamWindows
-                this.reqRefreshBigScreen(newStreamWindows)
+                this.reqRefreshBigScreen(newStreamWindows,true)
             },
 
             // 关闭信号源
@@ -174,8 +174,10 @@
                     if(arr.length>0){
                         let index = arr.length-1
                         arr[index].splitScreenStatus = this.$store.state.splitScreenStatus+1
-                        arr[index].width = this.currentBigshow[0].Width*this.$store.state.bigScale/arr[index].splitScreenStatus,
-                        arr[index].height = this.currentBigshow[0].Height*this.$store.state.bigScale/arr[index].splitScreenStatus,
+                        arr[index].width = this.currentBigshow[0].Width*this.$store.state.bigScale/arr[index].splitScreenStatus
+                        arr[index].height = this.currentBigshow[0].Height*this.$store.state.bigScale/arr[index].splitScreenStatus
+                        arr[index].widthScale = arr[index].width/(this.currentBigshow[0].Width*this.$store.state.bigScale)
+                        arr[index].heightScale = arr[index].height/(this.currentBigshow[0].Height*this.$store.state.bigScale)
                         this.$store.dispatch('updateSignalPreList',arr)
                         return
                     }
@@ -220,8 +222,11 @@
                     this.$data.divArr.push(i+1)
                 }
 
-                const arr = this.$store.state.signalPreList
-                this.reqRefreshBigScreen(arr)
+                /*const arr = this.$store.state.signalPreList
+                this.reqRefreshBigScreen(arr)*/
+                // this.$store.dispatch('updateSignalPreList',this.$data.streamWindows)
+                // console.log(this.$data.streamWindows)
+                this.reqRefreshBigScreen(this.$data.streamWindows)
             }
         }
     }

+ 1 - 1
src/renderer/components/Login.vue

@@ -75,7 +75,7 @@
                 const userInfo = {name:username,password}
 
                 // 请求登录
-                const res = await reqLogin(userInfo)
+                const res = await reqLogin(userInfo,'login')
                 if(res.token){
                     // 将user保存到vuex的state,同时保存到本地
                     this.$store.dispatch('saveUser', userInfo)