Selaa lähdekoodia

修改弹窗样式 清除token

xueqin 3 vuotta sitten
vanhempi
commit
74cecf9e92
4 muutettua tiedostoa jossa 42 lisäystä ja 8 poistoa
  1. 21 1
      src/css/reset.less
  2. 2 2
      src/js/index.js
  3. 11 2
      src/js/modal.js
  4. 8 3
      src/js/utils.js

+ 21 - 1
src/css/reset.less

@@ -253,7 +253,7 @@ textarea {
     border-radius: 4px;
     overflow: hidden;
   }
-  .title {
+  .titlemodal {
     border-bottom: 1px solid #eee;
     line-height: 40px;
     height: 40px;
@@ -271,6 +271,17 @@ textarea {
     padding: 25px 15px 0 15px;
     font-size: 14px;
     text-align: center;
+    .warnimg {
+      width: 16px;
+      vertical-align: text-top;
+      margin-left: -18px;
+
+    }
+  }
+  .contentleft {
+    padding: 25px 30px 0 30px;
+    font-size: 14px;
+    text-align: left;
   }
   .btns {
     height: 36px;
@@ -299,6 +310,15 @@ textarea {
       margin-left: 30px;
       margin-right: 30px;
     }
+    .gobackbtn {
+      float: right;
+      background-color: #1E9FFF !important;
+      border-color: #1E9FFF !important;
+      color: #fff;
+      margin-right: 30px;
+
+
+    }
   }
 }
 .divModal {

+ 2 - 2
src/js/index.js

@@ -574,7 +574,7 @@ function bindMenu() {
 }
 
 window.addEventListener('message', e => {
-
+  localStorage.removeItem('accessToken')
   let data = e.data
   if (typeof data == 'string') {
     data = JSON.parse(data)
@@ -582,7 +582,7 @@ window.addEventListener('message', e => {
   if (data.iframemessage) {
 
     $.alerModal({
-      quiteBtn: true,
+      gobackBtn: true,
       title: "提示",
       type: "modal",
       width: '470',

+ 11 - 2
src/js/modal.js

@@ -4,16 +4,19 @@ const jQuery = require('jquery');
     let close = require("../images/icon_close_default.png")
     let suc = require("../images/success.png")
     let def = require("../images/default.png")
+    let warn = require("../images/warn.png")
     let loadingImg = require("../images/loading.gif")
     $.alerModal = function (options) {
         $('.divModal').remove()
         var dft = {
             sureBtn: true,
             quiteBtn: false,
+            gobackBtn: false,
             width: "400",
             title: "标题",
             sureText: "确定",
             cancalText: '取消',
+            gobackText: '我知道了',
             message: '<p class="tip">内容</p>',
             time: 1500,
             isFather: false,
@@ -26,13 +29,16 @@ const jQuery = require('jquery');
             <div class="alertModal">
                 <div class="modalBg"></div>
                 <div class="modalMain" style="width:${ops.width}px;margin-left:-${ops.width/2}px">
-                <p class="title">${ops.title} <img src="${close}" alt=""></p>
-                <div class="content">
+                <p class="titlemodal">${ops.title} <img src="${close}" alt=""></p>
+                <div class="content ${ops.gobackBtn?'contentleft':''}">
+
+                <img style='display:${ops.gobackBtn?'inlineBlock':'none'} ' class='warnimg' src="${warn}" />
                     ${ops.message}
                 </div>
                 <div class="btns clearfix">
                     <span class="quite" style="display:${ops.quiteBtn?'inlineBlock':'none'}">${ops.cancalText}</span>
                     <span class="sure sureChange" style="display:${ops.sureBtn?'inlineBlock':'none'}">${ops.sureText}</span>
+                    <span class="gobackbtn" style="display:${ops.gobackBtn?'inlineBlock':'none'}">${ops.gobackText}</span>
                 </div>
                 </div>
             </div>
@@ -94,6 +100,9 @@ const jQuery = require('jquery');
             $(document).on('click', ".alertModal .title img,.alertModal .quite", function () {
                 ops.callback();
             })
+             $(document).on('click', ".alertModal .title img,.alertModal .gobackbtn ", function () {
+                ops.callback();
+            })
         } else {
             $(document).on('click', ".alertModal .title img,.alertModal .quite", function () {
                 box.remove();

+ 8 - 3
src/js/utils.js

@@ -193,9 +193,9 @@ const post = function (url, data) {
 
         let dialogcode = jsonres.code === '10020011' || jsonres.code === '10020012'
         if (jsonres.code && dialogcode && (self == top)) {
-
+          localStorage.removeItem('accessToken')
           $.alerModal({
-            quiteBtn: true,
+            gobackBtn: true,
             title: "提示",
             type: "modal",
             width: '470',
@@ -213,6 +213,8 @@ const post = function (url, data) {
             }
           });
         } else if (jsonres.code && dialogcode && (self != top)) {
+          localStorage.removeItem('accessToken')
+
           const dialogmessage = {
             iframemessage: 1,
             data: jsonres.msg
@@ -237,9 +239,10 @@ const post = function (url, data) {
         let dialogcode2 = errorCode.code === '10020011' || errorCode.code === '10020012'
 
         if (errorCode.code && dialogcode2 && (self == top)) {
+          localStorage.removeItem('accessToken')
 
           $.alerModal({
-            quiteBtn: true,
+            gobackBtn: true,
             title: "提示",
             type: "modal",
             width: '470',
@@ -254,6 +257,8 @@ const post = function (url, data) {
           });
         } else {
           if (errorCode.code && dialogcode2 && (self != top)) {
+          localStorage.removeItem('accessToken')
+            
             const dialogmessage = {
               iframemessage: 1,
               data: errorCode.msg