Authored by 李奇

粘贴发送优化

@@ -4,10 +4,9 @@ @@ -4,10 +4,9 @@
4 * @date: 2017/03/09 4 * @date: 2017/03/09
5 */ 5 */
6 6
7 -/* global gDomains injected from client.hbs*/ 7 +/* global gDomains injected from client.hbs*/ // eslint-disable-line
8 var $ = require('yoho-jquery'); 8 var $ = require('yoho-jquery');
9 var Handlebars = require('yoho-handlebars'); 9 var Handlebars = require('yoho-handlebars');
10 -var config = require('../../../config/common');  
11 10
12 // dialog html 11 // dialog html
13 var $view = '<div class="mask-dialog preview-dialog">' + 12 var $view = '<div class="mask-dialog preview-dialog">' +
@@ -35,7 +34,9 @@ var $viewHbs = Handlebars.compile($view); @@ -35,7 +34,9 @@ var $viewHbs = Handlebars.compile($view);
35 * @param cb 上传成功的回调 34 * @param cb 上传成功的回调
36 */ 35 */
37 function Paste(sl, cb) { 36 function Paste(sl, cb) {
38 - if (typeof sl !== 'string') { return; } 37 + if (typeof sl !== 'string') {
  38 + return;
  39 + }
39 this.$el = document.querySelector(sl); 40 this.$el = document.querySelector(sl);
40 this.formData = null; 41 this.formData = null;
41 this.uploadCb = cb; 42 this.uploadCb = cb;
@@ -143,7 +144,12 @@ Paste.prototype = { @@ -143,7 +144,12 @@ Paste.prototype = {
143 }, 144 },
144 145
145 open: function() { 146 open: function() {
  147 + var dh, vh = $(window).height();
  148 + var $main = $('.preview-dialog .dialog-main');
  149 +
146 this.$preview.show(); 150 this.$preview.show();
  151 + dh = $main.height();
  152 + $main.css('top', (vh - dh - 40) / 2);
147 }, 153 },
148 154
149 close: function() { 155 close: function() {
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 top: 0; 5 top: 0;
6 width: 100%; 6 width: 100%;
7 height: 100%; 7 height: 100%;
8 - 8 +
9 .dialog-mask { 9 .dialog-mask {
10 position: fixed; 10 position: fixed;
11 top: 0; 11 top: 0;
@@ -15,13 +15,12 @@ @@ -15,13 +15,12 @@
15 z-index: 1070; 15 z-index: 1070;
16 background-color: #000; 16 background-color: #000;
17 filter: alpha(opacity=50); 17 filter: alpha(opacity=50);
18 - opacity: .4; 18 + opacity: 0.4;
19 -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; 19 -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
20 } 20 }
21 21
22 .dialog-main { 22 .dialog-main {
23 position: relative; 23 position: relative;
24 - top: 50px;  
25 width: 600px; 24 width: 600px;
26 padding: 20px; 25 padding: 20px;
27 z-index: 1100; 26 z-index: 1100;
@@ -55,7 +54,6 @@ @@ -55,7 +54,6 @@
55 max-height: 400px; 54 max-height: 400px;
56 border: 1px solid #eee; 55 border: 1px solid #eee;
57 } 56 }
58 -  
59 } 57 }
60 58
61 .foot-part { 59 .foot-part {
@@ -82,7 +80,6 @@ @@ -82,7 +80,6 @@
82 .cancel-btn { 80 .cancel-btn {
83 color: #000; 81 color: #000;
84 } 82 }
85 -  
86 } 83 }
87 } 84 }
88 } 85 }