style:图片上传
Showing
2 changed files
with
9 additions
and
25 deletions
... | @@ -14,19 +14,17 @@ $(function () { | ... | @@ -14,19 +14,17 @@ $(function () { |
14 | var sizeObj = []; | 14 | var sizeObj = []; |
15 | var flieList = []; | 15 | var flieList = []; |
16 | function handleUpdate(e, $input) { | 16 | function handleUpdate(e, $input) { |
17 | let inputList = [] | 17 | if (flieList.length >= $("#" + $input).attr('numList')) { |
18 | inputList.push($input) | ||
19 | if (flieList.length >= 2) { | ||
20 | layer.msg('已经完成上传最大限度', { icon: 5 }); | 18 | layer.msg('已经完成上传最大限度', { icon: 5 }); |
21 | return false | 19 | return false |
22 | } else { | 20 | } else { |
23 | let file = []; | 21 | let file = []; |
24 | file.push(e.files[0]) | 22 | file.push(e.files[0]) |
25 | analysisList(file, document.getElementById("#" + $input), $input); | 23 | analysisList(file, $input); |
26 | } | 24 | } |
27 | } | 25 | } |
28 | //解析列表函数 | 26 | //解析列表函数 |
29 | function analysisList(obj, inputName, $input) { | 27 | function analysisList(obj, $input) { |
30 | //如果没有文件 | 28 | //如果没有文件 |
31 | if (obj.length < 1) { | 29 | if (obj.length < 1) { |
32 | return false; | 30 | return false; |
... | @@ -48,9 +46,10 @@ function analysisList(obj, inputName, $input) { | ... | @@ -48,9 +46,10 @@ function analysisList(obj, inputName, $input) { |
48 | //给json对象添加内容,得到选择的文件的数据 | 46 | //给json对象添加内容,得到选择的文件的数据 |
49 | var itemArr = [fileObj, name, size]; //文件,文件名,文件大小,文件类型 | 47 | var itemArr = [fileObj, name, size]; //文件,文件名,文件大小,文件类型 |
50 | flieList.push(itemArr); | 48 | flieList.push(itemArr); |
51 | if (flieList.length == 2) { | 49 | if (flieList.length == $("#" + $input).attr('numList')) { |
50 | sizeObj = []; | ||
52 | $("#" + $input).parent().find('.update').attr('src', '../../staticImages/Yes.png'); | 51 | $("#" + $input).parent().find('.update').attr('src', '../../staticImages/Yes.png'); |
53 | $("#" + $input).parent().find('.updatetext').text('') | 52 | $("#" + $input).parent().find('.updatetext').text(''); |
54 | } | 53 | } |
55 | //把这个文件的大小放进数组中 | 54 | //把这个文件的大小放进数组中 |
56 | sizeObj.push(size); | 55 | sizeObj.push(size); |
... | @@ -72,17 +71,4 @@ function createList($input) { | ... | @@ -72,17 +71,4 @@ function createList($input) { |
72 | '</li>' | 71 | '</li>' |
73 | ); | 72 | ); |
74 | } | 73 | } |
75 | } | ||
76 | |||
77 | function isRepeat(arr) //不重复FALSE 重复true | ||
78 | { | ||
79 | var hash = {}; | ||
80 | for (var i in arr) { | ||
81 | if (hash[arr[i]]) { | ||
82 | return true; | ||
83 | } | ||
84 | // 不存在该元素,则赋值为true,可以赋任意值,相应的修改if判断条件即可 | ||
85 | hash[arr[i]] = true; | ||
86 | } | ||
87 | return false; | ||
88 | } | 74 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -116,7 +116,7 @@ | ... | @@ -116,7 +116,7 @@ |
116 | <div class="img_update"> | 116 | <div class="img_update"> |
117 | <div class="fileBox"> | 117 | <div class="fileBox"> |
118 | <div class="fileSpan vm"> | 118 | <div class="fileSpan vm"> |
119 | <input type="file" multiple id="fileInput" onchange="handleUpdate(this,'fileInput')"/> | 119 | <input type="file" multiple id="fileInput" numList="2" onchange="handleUpdate(this,'fileInput')"/> |
120 | <div class="file_name"> | 120 | <div class="file_name"> |
121 | <img class="update" src="../../staticImages/update.png"> | 121 | <img class="update" src="../../staticImages/update.png"> |
122 | <p class="updatetext">点击文件上传</p> | 122 | <p class="updatetext">点击文件上传</p> |
... | @@ -142,7 +142,7 @@ | ... | @@ -142,7 +142,7 @@ |
142 | </div> | 142 | </div> |
143 | 143 | ||
144 | <!-- 询问笔录 --> | 144 | <!-- 询问笔录 --> |
145 | <div class="img_update"> | 145 | <!-- <div class="img_update"> |
146 | <div class="fileBox"> | 146 | <div class="fileBox"> |
147 | <div class="fileSpan vm"> | 147 | <div class="fileSpan vm"> |
148 | <input type="file" multiple id="fileInput3" /> | 148 | <input type="file" multiple id="fileInput3" /> |
... | @@ -155,7 +155,7 @@ | ... | @@ -155,7 +155,7 @@ |
155 | </div> | 155 | </div> |
156 | <div class="certificate">询问笔录(1)份</div> | 156 | <div class="certificate">询问笔录(1)份</div> |
157 | </div> | 157 | </div> |
158 | </div> | 158 | </div> --> |
159 | </div> | 159 | </div> |
160 | <div class="next_button submitButton"> | 160 | <div class="next_button submitButton"> |
161 | <button type="button" class="layui-btn layui-btn-normal" onclick="skipClick()"> | 161 | <button type="button" class="layui-btn layui-btn-normal" onclick="skipClick()"> |
... | @@ -169,8 +169,6 @@ | ... | @@ -169,8 +169,6 @@ |
169 | <script type="text/javascript" src="../../staticJs/onlineApply/workFlow.js"></script> | 169 | <script type="text/javascript" src="../../staticJs/onlineApply/workFlow.js"></script> |
170 | <script type="text/javascript" src="../../staticJs/onlineApply/houseFill.js"></script> | 170 | <script type="text/javascript" src="../../staticJs/onlineApply/houseFill.js"></script> |
171 | <script type="text/javascript" src="../../staticJs/imageUpdate.js"></script> | 171 | <script type="text/javascript" src="../../staticJs/imageUpdate.js"></script> |
172 | <script type="text/javascript" src="../../staticJs/imageUpdate1.js"></script> | ||
173 | <script type="text/javascript" src="../../staticJs/imageUpdate3.js"></script> | ||
174 | <script type="text/javascript" src="../../staticJs/city-picker.js"></script> | 172 | <script type="text/javascript" src="../../staticJs/city-picker.js"></script> |
175 | <script type="text/javascript" src="../../staticJs/down.js"></script> | 173 | <script type="text/javascript" src="../../staticJs/down.js"></script> |
176 | <script type="text/html" id="barDemo"> | 174 | <script type="text/html" id="barDemo"> | ... | ... |
-
Please register or sign in to post a comment