No Description

superviseMan.js 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. loginSuper()
  39. }
  40. function loginSuper(){
  41. $(".registStatus").show()
  42. superviseMan = true;
  43. if (!extenNum) {
  44. $(".registStatus").html('请输入账号');
  45. } else if((extenNum>2067||extenNum<2001)&&(extenNum<1005||extenNum>1010)){
  46. $(".registStatus").html('账号不正确');
  47. }else{
  48. var signcode ="api/addrelation+"+formatDateTime()
  49. console.log(signcode)
  50. var telPhone = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
  51. if (!telPhone.test($("#telephone").val())) {
  52. $(".registStatus").text("手机号格式不正确");
  53. } else {
  54. $.ajax({
  55. type: "get",
  56. url: "https://12345sp.jbdu.cn:9002/Api/AddRelation",
  57. dataType: "json",
  58. async: true,
  59. data: {
  60. ext:$("#account").val(),
  61. telephone: $("#telephone").val(),
  62. signcode: $.md5(signcode).toUpperCase()
  63. },
  64. success: function(data) {
  65. if (data.state =="success") {
  66. $(".registStatus").text("登录成功");
  67. $(".loginbtn").hide()
  68. $(".superviseVideoCall").show()
  69. $(".superviseVideoMeetCall").show()
  70. sip_uri_ = "sip:"+$("#account").val()+"@"+huayi.config.socket_ip;
  71. sip_password_ = "1234";
  72. ws_uri_ = huayi.config.ws_uri_; //wss://sip.800100.com.cn:7443 218.29.229.185:8011
  73. contact_uri = huayi.config.contact_uri
  74. testStart();
  75. }else{
  76. $(".registStatus").text("关联失败");
  77. }
  78. }
  79. })
  80. }
  81. }
  82. }
  83. $(".loginbtn").click(function(){
  84. extenNum = $("#account").val();
  85. loginSuper()
  86. // setTimeout(function(){
  87. // window.location.href="superviseMan.html?extenNum="+$("#account").val()+"&telephone="+$("#telephone").val()
  88. // },2000)
  89. })