Commit 10be386de81729622529ca58f4087761614a1f0e
1 parent
c53c1179
update...
Showing
3 changed files
with
101 additions
and
4 deletions
src/main/resources/static/real_control_v2/js/safe_driv/call_phone.js
0 → 100644
| 1 | +var gb_call_phone = function () { | |
| 2 | + | |
| 3 | + var basePath = "http://180.168.57.114:4244"; | |
| 4 | + var wsUri = "ws://180.168.57.114:21892/"; | |
| 5 | + | |
| 6 | + var nbbm2tel = { | |
| 7 | + | |
| 8 | + }; | |
| 9 | + | |
| 10 | + var locData = window.localStorage.getItem('test_nbbm2tel_json'); | |
| 11 | + if(locData){ | |
| 12 | + nbbm2tel = JSON.parse(locData); | |
| 13 | + } | |
| 14 | + | |
| 15 | + var login = function (cb) { | |
| 16 | + var agentID = '1002'; | |
| 17 | + var dn = '6006'; | |
| 18 | + | |
| 19 | + var options = { | |
| 20 | + AgentID: agentID, | |
| 21 | + DN: dn, | |
| 22 | + wsUri: wsUri, | |
| 23 | + setbtnStatus: function (stateName) { | |
| 24 | + //setState(stateName); | |
| 25 | + console.log('stateName', stateName); | |
| 26 | + | |
| 27 | + cb && cb(stateName) | |
| 28 | + } | |
| 29 | + }; | |
| 30 | + $.CallCenterInit(options); | |
| 31 | + }; | |
| 32 | + | |
| 33 | + var call = function (nbbm, loginSucc, loginFailed, callSucc) { | |
| 34 | + var telNumber = nbbm2tel[nbbm]; | |
| 35 | + if(!telNumber){ | |
| 36 | + alert('没有该车辆的对照表..'); | |
| 37 | + loginFailed && loginFailed(); | |
| 38 | + return; | |
| 39 | + } | |
| 40 | + login(function (sname) { | |
| 41 | + if(sname=='login'){ | |
| 42 | + loginSucc && loginSucc(); | |
| 43 | + | |
| 44 | + $.CallCenterPublicFun.Dialing(telNumber); | |
| 45 | + setTimeout(function () { | |
| 46 | + callSucc && callSucc(); | |
| 47 | + }, 1000); | |
| 48 | + } | |
| 49 | + else{ | |
| 50 | + loginFailed && loginFailed(); | |
| 51 | + } | |
| 52 | + }); | |
| 53 | + }; | |
| 54 | + | |
| 55 | + var hangup = function () { | |
| 56 | + console.log('hangup...'); | |
| 57 | + $.CallCenterPublicFun.Hangup(); | |
| 58 | + }; | |
| 59 | + | |
| 60 | + return { | |
| 61 | + call: call, | |
| 62 | + hangup: hangup, | |
| 63 | + setNbbm2tel: function (json) { | |
| 64 | + nbbm2tel = json; | |
| 65 | + | |
| 66 | + window.localStorage.setItem('test_nbbm2tel_json', JSON.stringify(nbbm2tel)); | |
| 67 | + }, | |
| 68 | + getNbbm2tel: function () { | |
| 69 | + return nbbm2tel; | |
| 70 | + } | |
| 71 | + } | |
| 72 | +}(); | |
| 0 | 73 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/js/safe_driv/safeDriv.js
| ... | ... | @@ -60,7 +60,7 @@ var gb_safe_driv = (function () { |
| 60 | 60 | '</div>'; |
| 61 | 61 | |
| 62 | 62 | $wrap.on('click', '.safe_driv_pop', function () { |
| 63 | - var title = $(this).data('title') + ' <button class="uk-button uk-button-mini uk-button-primary" id="openPhoneModalBtn" type="button">打电话</button>'; | |
| 63 | + var title = $(this).data('title') + ' <button data-nbbm="'+$(this).data('nbbm')+'" class="uk-button uk-button-mini uk-button-primary" id="openPhoneModalBtn" type="button">打电话</button>'; | |
| 64 | 64 | var url = $(this).data('url'); |
| 65 | 65 | $(this).remove(); |
| 66 | 66 | var lightbox = UIkit.lightbox.create([ |
| ... | ... | @@ -119,7 +119,28 @@ var gb_safe_driv = (function () { |
| 119 | 119 | }; |
| 120 | 120 | |
| 121 | 121 | $(document).on('click', '#openPhoneModalBtn', function () { |
| 122 | - showCallPhoneModal(); | |
| 122 | + var t = $(this).text(); | |
| 123 | + if(t == '挂断!'){ | |
| 124 | + gb_call_phone.hangup(); | |
| 125 | + $(this).text('打电话').removeClass('uk-button-danger'); | |
| 126 | + return; | |
| 127 | + } | |
| 128 | + else if(t == '打电话'){ | |
| 129 | + var nbbm = $(this).data('nbbm'); | |
| 130 | + var btn = this; | |
| 131 | + | |
| 132 | + $(btn).text('登录坐席..'); | |
| 133 | + gb_call_phone.call(nbbm, function () { | |
| 134 | + $(btn).text('拨号中..'); | |
| 135 | + }, function () { | |
| 136 | + $(btn).text('登录坐席失败'); | |
| 137 | + setTimeout(function () { | |
| 138 | + $(btn).text('打电话'); | |
| 139 | + }, 1200); | |
| 140 | + }, function () { | |
| 141 | + $(btn).text('挂断!').addClass('uk-button-danger'); | |
| 142 | + }); | |
| 143 | + } | |
| 123 | 144 | }); |
| 124 | 145 | |
| 125 | 146 | ... | ... |
src/main/resources/static/real_control_v2/main.html
| ... | ... | @@ -117,7 +117,7 @@ |
| 117 | 117 | <!-- 高德 --> |
| 118 | 118 | <script src="http://webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda"></script> |
| 119 | 119 | <!-- jquery --> |
| 120 | -<script src="/real_control_v2/assets/js/jquery.min.js"></script> | |
| 120 | +<script src="http://180.168.57.114:4244/Scripts/jquery-3.2.1.min.js"></script> | |
| 121 | 121 | <!-- jquery actual --> |
| 122 | 122 | <script src="/real_control_v2/assets/js/jquery.actual.min.js" merge="plugins"></script> |
| 123 | 123 | <!-- jquery.serializejson JSON序列化插件 --> |
| ... | ... | @@ -224,7 +224,7 @@ |
| 224 | 224 | <!-- #### 安全驾驶 start ### --> |
| 225 | 225 | <div class="safe_driv_pop_wrap" ></div> |
| 226 | 226 | <script id="safe_driv_item-temp" type="text/html"> |
| 227 | - <div class="safe_driv_pop uk-animation-slide-bottom" data-type="{{yczltype}}" data-title="{{clzbh}} {{timeStr}} {{ycztText}}" data-url="{{url}}"> | |
| 227 | + <div class="safe_driv_pop uk-animation-slide-bottom" data-nbbm="{{clzbh}}" data-type="{{yczltype}}" data-title="{{clzbh}} {{timeStr}} {{ycztText}}" data-url="{{url}}"> | |
| 228 | 228 | <div> |
| 229 | 229 | <span class="title">异常 {{clzbh}}</span> |
| 230 | 230 | <span class="text"> {{timeStr}} 出现违规驾驶({{ycztText}})</span> |
| ... | ... | @@ -235,6 +235,10 @@ |
| 235 | 235 | |
| 236 | 236 | <script src="/real_control_v2/js/safe_driv/safeDriv.js" merge="custom_js"></script> |
| 237 | 237 | <!-- #### 安全驾驶 end ### --> |
| 238 | + | |
| 239 | +<!-- 打电话 --> | |
| 240 | +<script src="http://180.168.57.114:4244/Scripts/CallCenter.js" ></script> | |
| 241 | +<script src="/real_control_v2/js/safe_driv/call_phone.js" ></script> | |
| 238 | 242 | </body> |
| 239 | 243 | |
| 240 | 244 | </html> | ... | ... |