From fb5d6874fb74ba9983fd68108c57eef44071041c Mon Sep 17 00:00:00 2001 From: hdw <496960745@qq.com> Date: 星期二, 04 十二月 2018 11:37:41 +0800 Subject: [PATCH] 添加版本验证 --- gx_tieta/WebRoot/batt-station-update1.jsp | 65 +++++++++++++++++++++++++++----- gx_tieta/WebRoot/bts-comm-task.jsp | 2 2 files changed, 55 insertions(+), 12 deletions(-) diff --git a/gx_tieta/WebRoot/batt-station-update1.jsp b/gx_tieta/WebRoot/batt-station-update1.jsp index bbc58ad..0f48d91 100644 --- a/gx_tieta/WebRoot/batt-station-update1.jsp +++ b/gx_tieta/WebRoot/batt-station-update1.jsp @@ -153,12 +153,19 @@ var element = layui.element; // 鑾峰彇鍏冪礌鎿嶄綔妯″潡 // 璁剧疆妫�娴嬫枃浠跺悕寮瑰嚭妗嗙殑content - var cFilenameContent = '<div style="width:300px; height: 50px;"><div style="margin-top: 20px;margin-left: 8px; margin-right: 8px; text-algin: center;">'+ + var cFilenameContent = '<div style="width:300px; height: 80px;"><div style="margin-top: 20px;margin-left: 8px; margin-right: 8px; text-algin: center;">'+ '<span>閫夋嫨鏂囦欢鍚嶏細</span>'+ '<select id="equipeTypeSel" style="width: 200px;height: 26px; border: 1px solid #ccc">'+ '<option value="avr_dfu.uc3">avr_dfu.uc3</option>'+ '<option value="E51_DFU.SM5">E51_DFU.SM5</option>'+ - '</select>'+ + '</select><br><br>'+ + '<span>杈撳叆鐗堟湰鍙凤細</span>'+ + '<input type="text" id="newestVer" style="width: 200px;height: 24px; border: 1px solid #ccc">'+ + '</div></div>'; + + var cVerContent = '<div style="width:300px; height: 50px;"><div style="margin-top: 20px;margin-left: 8px; margin-right: 8px; text-algin: center;">'+ + '<span>杈撳叆鐗堟湰鍙凤細</span>'+ + '<input type="text" id="newestVer" style="width: 200px;height: 24px; border: 1px solid #ccc">'+ '</div></div>'; var isNewLoad = true; @@ -426,15 +433,17 @@ // 鎵撳紑闈㈡澘璁剧疆鍗囩骇璁惧埆鐨勭被鍨� layer.open({ type: 1 - ,title: '鍗囩骇鏂囦欢鍚�' + ,title: '鍗囩骇鏂囦欢鍚�/鐗堟湰鍙�' ,content: cFilenameContent ,fixed: true ,resize: false ,btn:['璁剧疆', '鍙栨秷'] ,yes: function(index) { var filename = $('#equipeTypeSel').val(); + var newestVer = $('#newestVer').val(); + // 鏍¢獙瑕佹洿鏂扮殑璁惧 - checkStationState(updateList, data, filename); + checkStationState(updateList, data, filename, newestVer); layer.close(index); } }); @@ -462,8 +471,24 @@ var updateList = [data.fbsid]; var allData = [data]; - // 鏍¢獙瑕佹洿鏂扮殑璁惧 - checkStationState(updateList, allData, data.filename); + // 鎵撳紑闈㈡澘璁剧疆鍗囩骇璁惧埆鐨勭被鍨� + layer.open({ + type: 1 + ,title: '鍗囩骇鏂囦欢鍚�/鐗堟湰鍙�' + ,content: cFilenameContent + ,fixed: true + ,resize: false + ,btn:['璁剧疆', '鍙栨秷'] + ,yes: function(index) { + var newestVer = $('#newestVer').val(); + + // 鏍¢獙瑕佹洿鏂扮殑璁惧 + checkStationState(updateList, allData, data.filename, newestVer); + layer.close(index); + } + }); + + } // 鐐瑰嚮娣诲姞鐢熸垚琛ㄦ牸 @@ -728,7 +753,7 @@ // 楠岃瘉璁惧鏄惁鍏佽璁惧杩涜杩滅▼鍗囩骇 - function checkStationState(temp, all, filename){ + function checkStationState(temp, all, filename, newestVer){ $.ajax({ type: "post", url: "Fbs9100s_dfu_stateAction_action_judgeStation", @@ -740,7 +765,7 @@ //console.log(rs); if(rs.code == 1) { var data = rs.data; - var updateData = checkUpdating(data, all, filename); + var updateData = checkUpdating(data, all, filename, newestVer); $('#updateIframeData').data('update', updateData.good); // 鍙洿鏂扮殑璁惧淇℃伅 $('#updateIframeData').data('errorUpdate', updateData.bad); // 鏃犳硶鏇存柊鐨勮澶囦俊鎭� @@ -810,7 +835,7 @@ } // 鏍煎紡璇濆崌绾х殑璁惧 - function checkUpdating(rsData, all, filename) { + function checkUpdating(rsData, all, filename, newestVer) { var rs = { good: [] ,bad: [] @@ -825,7 +850,11 @@ // 鍒ゆ柇褰撳墠璁惧鏄惁姝e湪鍗囩骇 if(_all.updatestatusnum != 1) { if(_all.fbsid == _rsData.FBSDeviceId && _all.filename == filename) { - isError = false; + // 妫�娴嬪綋鍓嶇増鏈彿鏄惁涓烘渶鏂� + var isNewstVer = checkNewestVer(newestVer, _all.version); + if(!isNewstVer) { + isError = false; + } } } } @@ -939,7 +968,7 @@ return rs; } //console.log(getFnameByVer('D:8,V2.53.40')); - // 鏇村叿鐗堟湰鍙疯幏鍙栨枃浠剁殑鍚嶇О + // 鏍规嵁鐗堟湰鍙疯幏鍙栨枃浠剁殑鍚嶇О function getFnameByVer(version) { var fileList = [ { @@ -963,6 +992,20 @@ return filename; } + + console.log(checkNewestVer('42', 'D:8,V2.53.44')); + // 楠岃瘉鐗堟湰 + function checkNewestVer(ver ,version) { + var pattern = '^.*\\.[0-9]*\\.([0-9]*)$'; + var reg = new RegExp(pattern); + reg.test(version); + // 鍒ゆ柇褰撳墠鐗堟湰鏄惁涓烘渶鏂扮増鏈� + var isNewest = false; + if(ver == RegExp.$1) { + isNewest = true; + } + return isNewest; + } }); </script> </body> diff --git a/gx_tieta/WebRoot/bts-comm-task.jsp b/gx_tieta/WebRoot/bts-comm-task.jsp index 94769cb..26993fb 100644 --- a/gx_tieta/WebRoot/bts-comm-task.jsp +++ b/gx_tieta/WebRoot/bts-comm-task.jsp @@ -41,7 +41,7 @@ <div class="layui-page-container"> <!-- 鏉′欢绛涢�� --> <div class="layui-page-filter"> - <div class="page-filter-header layui-page-filter-fweight">鏈烘埧绔欑偣鍗囩骇鍔熻兘</div> + <div class="page-filter-header layui-page-filter-fweight">璁惧杩炴帴淇℃伅</div> <div class="page-filter-content"> <table> <tr class="layui-page-filter-tbl-header layui-page-filter-fweight"> -- Gitblit v1.9.1