No Description

superviseMan.js 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. var formatDateTime = function (date) {
  2. var date = new Date();
  3. var y = date.getFullYear().toString();
  4. var m = date.getMonth() + 1;
  5. m = m < 10 ? ('0' + m) : m;
  6. var d = date.getDate();
  7. d = d < 10 ? ('0' + d) : d;
  8. return y + m + d
  9. // +' '+h+':'+minute+':'+second;
  10. };
  11. var extenNum = helper.request.queryString("extenNum");
  12. var telephone = helper.request.queryString("telephone");
  13. var acceptExtenNum = helper.request.queryString("fjh");
  14. $(function(){
  15. if($(".superviseBtn").text()=="我是市民"){
  16. $(".registStatus").html('点击下方登录按钮');
  17. $(".loginbtn").show();
  18. $(".videoCall").hide();
  19. }
  20. if(acceptExtenNum){
  21. $(".registStatus").html('点击下方登录按钮');
  22. $("#account").val(acceptExtenNum)
  23. $("#account").attr("disabled",true)
  24. $(".superviseBtn").hide()
  25. }
  26. })
  27. $(".superviseVideoCall").click(function(){
  28. dbCallVideoState =true;
  29. $(".videoMy").show();
  30. $(".leftText").html("连接中");
  31. videoSize();
  32. captureLocalMediaVideo();
  33. localMediaStream();
  34. })
  35. if(extenNum){
  36. $("#account").val(extenNum)
  37. $("#telephone").val(telephone)
  38. setTimeout(function(){
  39. loginSuper()
  40. },2000)
  41. }
  42. function loginSuper(){
  43. $(".registStatus").show()
  44. superviseMan = true;
  45. if (!extenNum) {
  46. $(".registStatus").html('请输入账号');
  47. } else if((extenNum>2067||extenNum<2001)&&(extenNum<1005||extenNum>1010)){
  48. $(".registStatus").html('账号不正确');
  49. }else{
  50. var signcode = "index/addrelation+" + formatDateTime()
  51. console.log(signcode)
  52. var telPhone = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
  53. if (!telPhone.test($("#telephone").val())) {
  54. $(".registStatus").text("手机号格式不正确");
  55. } else {
  56. $.ajax({
  57. type: "get",
  58. url: huayi.config.callcenter_url +"index/addrelation",,
  59. dataType: "json",
  60. async: true,
  61. data: {
  62. ext:$("#account").val(),
  63. telephone: $("#telephone").val(),
  64. signcode: $.md5(signcode).toUpperCase()
  65. },
  66. success: function(data) {
  67. if (data.state =="success") {
  68. $(".registStatus").text("登录成功");
  69. $(".loginbtn").hide()
  70. $(".superviseVideoCall").show()
  71. $(".superviseVideoMeetCall").show()
  72. sip_uri_ = "sip:"+$("#account").val()+"@"+huayi.config.socket_ip;
  73. sip_password_ = huayi.config.sip_password_;
  74. ws_uri_ = huayi.config.ws_uri_; //wss://sip.800100.com.cn:7443 218.29.229.185:8011
  75. contact_uri = huayi.config.contact_uri
  76. testStart();
  77. }else{
  78. $(".registStatus").text("关联失败");
  79. }
  80. }
  81. })
  82. }
  83. }
  84. }
  85. $(".loginbtn").click(function(){
  86. extenNum = $("#account").val();
  87. loginSuper()
  88. // setTimeout(function(){
  89. // window.location.href="superviseMan.html?extenNum="+$("#account").val()+"&telephone="+$("#telephone").val()
  90. // },2000)
  91. })