9cf2eae0 by 任超

style:图片上传

1 parent b5c3267e
...@@ -61,6 +61,10 @@ $(document).on("click", ".area_list li", function (e) { ...@@ -61,6 +61,10 @@ $(document).on("click", ".area_list li", function (e) {
61 _getGuideBusinessInWssq($(this).attr("data-id")) 61 _getGuideBusinessInWssq($(this).attr("data-id"))
62 _getGuideBusinessInReserve($(this).attr("data-id")) 62 _getGuideBusinessInReserve($(this).attr("data-id"))
63 }) 63 })
64 // 办事指南在线办理
65 $(document).on("click", ".onlineProcessing", function () {
66 console.log($(this).attr('data-id'))
67 })
64 68
65 layui.use(['form', 'common'], function () { 69 layui.use(['form', 'common'], function () {
66 var common = layui.common, 70 var common = layui.common,
...@@ -126,7 +130,7 @@ function _getGuideBusinessInWssq(id) { ...@@ -126,7 +130,7 @@ function _getGuideBusinessInWssq(id) {
126 li = '<li class="layui-this" lay-id="0">全部</li>' 130 li = '<li class="layui-this" lay-id="0">全部</li>'
127 itemList_tab.append(li) 131 itemList_tab.append(li)
128 for (var i = 0; i < result.data.length; i++) { 132 for (var i = 0; i < result.data.length; i++) {
129 li = '<li lay-id="'+(i+1)+'">'+result.data[i].businessShortName+'</li>' 133 li = '<li lay-id="'+(i+1)+'">'+result.data[i].bsznFlmc+'</li>'
130 itemList_tab.append(li) 134 itemList_tab.append(li)
131 } 135 }
132 } 136 }
...@@ -159,14 +163,27 @@ function _getGuideBusinessInReserve(id) { ...@@ -159,14 +163,27 @@ function _getGuideBusinessInReserve(id) {
159 li = '<li class="layui-this" lay-id="0">全部</li>' 163 li = '<li class="layui-this" lay-id="0">全部</li>'
160 itemList_tab1.append(li) 164 itemList_tab1.append(li)
161 for (var i = 0; i < result.data.length; i++) { 165 for (var i = 0; i < result.data.length; i++) {
162 li = '<li lay-id="'+(i+1)+'">'+result.data[i].businessShortName+'</li>' 166 li = '<li lay-id="'+(i+1)+'">'+result.data[i].bsznFlmc+'</li>'
163 itemList_tab1.append(li) 167 itemList_tab1.append(li)
164 } 168 }
165 } 169 }
166 } 170 }
167 }); 171 });
168 } 172 }
173 // GET /portal/MhGuide/listBusinessIdsByBsznId 通过办事指南ID获取对应的业务ID列表
169 174
175 function _getGuideBusinessInReserve(id) {
176 $.ajax({
177 type: "get", //提交方式
178 url: portal.api_url + "/portal/MhGuide/listBusinessIdsByBsznId?bsznId="+id,//路径
179 dataType: "json",
180 //数据,这里使用的是Json格式进行传输
181 success: function (result) {//返回数据根据结果进行相应的处理
182 if (result.code == 200 && result.data != null) {
183 }
184 }
185 });
186 }
170 var data = { //数据 187 var data = { //数据
171 "list": [], 188 "list": [],
172 "onlineList": [] 189 "onlineList": []
......
...@@ -13,7 +13,7 @@ function SetServicesPath() { ...@@ -13,7 +13,7 @@ function SetServicesPath() {
13 //设置全局參數 13 //设置全局參數
14 var portal = 14 var portal =
15 { 15 {
16 'api_url': "http://192.168.2.59:8000", //属性名用引号括起来,属性间由逗号隔开 16 'api_url': "http://192.168.2.108:8000", //属性名用引号括起来,属性间由逗号隔开
17 'name': 'myName', 17 'name': 'myName',
18 "rootPath": GetRootPath() 18 "rootPath": GetRootPath()
19 }; 19 };
......
...@@ -4,29 +4,29 @@ $(function () { ...@@ -4,29 +4,29 @@ $(function () {
4 var index = $(this).parent().index(); 4 var index = $(this).parent().index();
5 flieList.splice(index, 1) 5 flieList.splice(index, 1)
6 sizeObj.splice(index, 1) 6 sizeObj.splice(index, 1)
7 if(flieList.length==1) { 7 if (flieList.length == 1) {
8 $(this).parent().parent().parent('.fileSpan').find('.update').attr('src','../../staticImages/update.png'); 8 $(this).parent().parent().parent('.fileSpan').find('.update').attr('src', '../../staticImages/update.png');
9 $(this).parent().parent().parent('.fileSpan').find('.updatetext').text('点击文件上传') 9 $(this).parent().parent().parent('.fileSpan').find('.updatetext').text('点击文件上传')
10 } 10 }
11 $(this).parent().remove() 11 $(this).parent().remove()
12 }) 12 })
13 }) 13 })
14 // 存放每个文件大小的数组,用来比较去重
15 var sizeObj = []; 14 var sizeObj = [];
16 15 var flieList = [];
17 16 function handleUpdate(e, $input) {
18 function handleUpdate(e,$input) { 17 let inputList = []
19 if(flieList.length>=2) { 18 inputList.push($input)
19 if (flieList.length >= 2) {
20 layer.msg('已经完成上传最大限度', { icon: 5 }); 20 layer.msg('已经完成上传最大限度', { icon: 5 });
21 return false 21 return false
22 }else { 22 } else {
23 let file = []; 23 let file = [];
24 file.push(e.files[0]) 24 file.push(e.files[0])
25 analysisList(file, document.getElementById("#"+$input), $input); 25 analysisList(file, document.getElementById("#" + $input), $input);
26 } 26 }
27 } 27 }
28 //解析列表函数 28 //解析列表函数
29 function analysisList(obj, inputName, $input) { 29 function analysisList(obj, inputName, $input) {
30 //如果没有文件 30 //如果没有文件
31 if (obj.length < 1) { 31 if (obj.length < 1) {
32 return false; 32 return false;
...@@ -48,29 +48,41 @@ function handleUpdate(e,$input) { ...@@ -48,29 +48,41 @@ function handleUpdate(e,$input) {
48 //给json对象添加内容,得到选择的文件的数据 48 //给json对象添加内容,得到选择的文件的数据
49 var itemArr = [fileObj, name, size]; //文件,文件名,文件大小,文件类型 49 var itemArr = [fileObj, name, size]; //文件,文件名,文件大小,文件类型
50 flieList.push(itemArr); 50 flieList.push(itemArr);
51 if (flieList.length==2){ 51 if (flieList.length == 2) {
52 inputName.parent().find('.update').attr('src','../../staticImages/Yes.png'); 52 $("#" + $input).parent().find('.update').attr('src', '../../staticImages/Yes.png');
53 inputName.parent().find('.updatetext').text('') 53 $("#" + $input).parent().find('.updatetext').text('')
54 } 54 }
55 //把这个文件的大小放进数组中 55 //把这个文件的大小放进数组中
56 sizeObj.push(size); 56 sizeObj.push(size);
57 } 57 }
58 createList(); //生成列表 58 createList($input); //生成列表
59 document.querySelector("#"+$input).value = null 59 document.querySelector("#" + $input).value = null
60 }; 60 };
61 61
62 //生成列表 62 //生成列表
63 function createList() { 63 function createList($input) {
64 $('.fileListName').empty() 64 $("#" + $input).parent().find('.fileListName').empty()
65 console.log(flieList, 98898989)
66 for (var i = 0; i < flieList.length; i++) { 65 for (var i = 0; i < flieList.length; i++) {
67 var fileData = flieList[i]; 66 var fileData = flieList[i];
68 var name = fileData[1] 67 var name = fileData[1]
69 $('.fileListName').append( 68 $("#" + $input).parent().find('.fileListName').append(
70 '<li class="fileName">'+ 69 '<li class="fileName">' +
71 '<span title="' + name + '">' + name + '</span>' + 70 '<span title="' + name + '">' + name + '</span>' +
72 '<img class="operation" src="../../staticImages/chacha.png">'+ 71 '<img class="operation" src="../../staticImages/chacha.png">' +
73 '</li>' 72 '</li>'
74 ); 73 );
75 } 74 }
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;
76 } 88 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -92,7 +92,6 @@ $('.add_form').click(function () { ...@@ -92,7 +92,6 @@ $('.add_form').click(function () {
92 $('.record').click(function (event) { 92 $('.record').click(function (event) {
93 event.stopPropagation(); 93 event.stopPropagation();
94 }) 94 })
95 var flieList = []; // 登记证书列表
96 var flieList1 = []; // 房屋所有权证书列表 95 var flieList1 = []; // 房屋所有权证书列表
97 var flieList3 = []; // 询问笔录 96 var flieList3 = []; // 询问笔录
98 // 省市区 97 // 省市区
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
83 <svg class="icon svg-icon" aria-hidden="true"> 83 <svg class="icon svg-icon" aria-hidden="true">
84 <use xlink:href="#icontudi"></use> 84 <use xlink:href="#icontudi"></use>
85 </svg> 85 </svg>
86 {{item.businessShortName}} 86 {{item.bsznFlmc}}
87 </h2> 87 </h2>
88 </div> 88 </div>
89 <ul class="online_list"> 89 <ul class="online_list">
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
95 <button type="button" 95 <button type="button"
96 class="layui-btn layui-btn-sm">查看详情</button> 96 class="layui-btn layui-btn-sm">查看详情</button>
97 </a> 97 </a>
98 <a> 98 <a class="onlineProcessing" data-id={{item.bsznListVOS[i].bsmBszn}}>
99 <button type="button" class="layui-btn layui-btn-sm layui-btn-normal">在线办理</button> 99 <button type="button" class="layui-btn layui-btn-sm layui-btn-normal">在线办理</button>
100 </a> 100 </a>
101 </div> 101 </div>
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
115 <svg class="icon svg-icon" aria-hidden="true"> 115 <svg class="icon svg-icon" aria-hidden="true">
116 <use xlink:href="#icontudi"></use> 116 <use xlink:href="#icontudi"></use>
117 </svg> 117 </svg>
118 {{item.businessShortName}} 118 {{item.bsznFlmc}}
119 </h2> 119 </h2>
120 </div> 120 </div>
121 <ul class="online_list"> 121 <ul class="online_list">
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
126 <a href='./businessGuideDeatil.html?id={{item.bsznListVOS[i].bsmBszn}}' target="_blank"> 126 <a href='./businessGuideDeatil.html?id={{item.bsznListVOS[i].bsmBszn}}' target="_blank">
127 <button type="button" class="layui-btn layui-btn-sm">查看详情</button> 127 <button type="button" class="layui-btn layui-btn-sm">查看详情</button>
128 </a> 128 </a>
129 <a> 129 <a class="onlineProcessing" data-id={{item.bsznListVOS[i].bsmBszn}}>
130 <button type="button" class="layui-btn layui-btn-sm layui-btn-normal">在线办理</button> 130 <button type="button" class="layui-btn layui-btn-sm layui-btn-normal">在线办理</button>
131 </a> 131 </a>
132 </div> 132 </div>
......
...@@ -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" onclick="" onchange="handleUpdate(this,'fileInput')"/> 119 <input type="file" multiple id="fileInput" 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>
...@@ -130,12 +130,12 @@ ...@@ -130,12 +130,12 @@
130 <div class="img_update"> 130 <div class="img_update">
131 <div class="fileBox"> 131 <div class="fileBox">
132 <div class="fileSpan vm"> 132 <div class="fileSpan vm">
133 <input type="file" multiple id="fileInput1" /> 133 <input type="file" multiple id="fileInput1" onclick="" onchange="handleUpdate(this,'fileInput1')"/>
134 <div class="file_name"> 134 <div class="file_name">
135 <img class="update" src="../../staticImages/update.png"> 135 <img class="update" src="../../staticImages/update.png">
136 <p class="updatetext">点击文件上传</p> 136 <p class="updatetext">点击文件上传</p>
137 </div> 137 </div>
138 <div class="fileListName1"></div> 138 <div class="fileListName"></div>
139 </div> 139 </div>
140 <div class="certificate">房屋所有权证书(2份)</div> 140 <div class="certificate">房屋所有权证书(2份)</div>
141 </div> 141 </div>
......