説明なし

security.js 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. //注册信息
  2. mui.ready(function() {
  3. /*定义全局变量*/
  4. var bdPhone = document.getElementById("bdPhone");
  5. var bdEmail = document.getElementById("bdEmail");
  6. var changePass = document.getElementById("changepass");
  7. var phoneName = document.getElementById("phonename");
  8. var emailName = document.getElementById("emailname");
  9. var verified = document.getElementById("verified");
  10. var phoneCookie = "";
  11. var emailCookie = "";
  12. mui.plusReady(function() {
  13. isAuthentication();
  14. lookup();
  15. /*退出绑定手机页面*/
  16. window.addEventListener('securityPage',function(event){
  17. phoneName = event.detail.id;
  18. ifPhoneAmdEmail(phoneCookie)
  19. })
  20. bdEmail.addEventListener('tap', function() {
  21. mui.openWindow({
  22. url: '../html/bindmail.html',
  23. id: '../html/bindmail.html',
  24. show: {
  25. aniShow: "slide-in-right"
  26. }
  27. });
  28. })
  29. bdPhone.addEventListener('tap', function() {
  30. mui.openWindow({
  31. url: '../html/bindphone.html',
  32. id: '../html/bindphone.html',
  33. show: {
  34. aniShow: "slide-in-right"
  35. }
  36. });
  37. })
  38. changePass.addEventListener('tap', function() {
  39. mui.openWindow({
  40. url: '../html/changepass.html',
  41. id: '../html/changepass.html',
  42. show: {
  43. aniShow: "slide-in-right"
  44. }
  45. });
  46. })
  47. function ifPhoneAmdEmail(){
  48. /*判断是否绑定了手机号*/
  49. if(phoneCookie != "" && phoneCookie != null && phoneCookie != "null") {
  50. /*phoneName.innerText = (phoneCookie.substring(0, 3) + "****" + phoneCookie.substring(7, 11));*/
  51. phoneName.innerText = (phoneCookie);
  52. } else {
  53. phoneName.innerText = ("请绑定手机号");
  54. }
  55. /*判断是否绑定了邮箱*/
  56. if(emailCookie != "" && emailCookie != null && emailCookie != "null") {
  57. emailName.innerText = (emailCookie);
  58. } else {
  59. emailName.innerText = ("请绑定邮箱");
  60. }
  61. }
  62. function isAuthentication() {
  63. var userId = plus.storage.getItem('userid');
  64. mui.ajax(baseUrl + "/ajax/professor/editBaseInfo/" + userId, {
  65. dataType: 'json', //数据格式类型
  66. type: 'GET', //http请求类型
  67. timeout: 10000, //超时设置
  68. async: false,
  69. success: function(data) {
  70. var $info = data.data || {}
  71. if(data.success && data.data) {
  72. if($info.authentication){
  73. verified.innerText="已认证";
  74. }else{
  75. verified.innerText="为认证";
  76. }
  77. }
  78. },
  79. error: function() {
  80. plus.nativeUI.toast("服务器链接超时", toastStyle);
  81. return;
  82. }
  83. });
  84. }
  85. function lookup() {
  86. var userId = plus.storage.getItem('userid');
  87. mui.ajax(baseUrl + "/ajax/qaUser" , {
  88. data:{
  89. id:userId
  90. },
  91. dataType: 'json', //数据格式类型
  92. type: 'GET', //http请求类型
  93. timeout: 10000, //超时设置
  94. async: false,
  95. success: function(data) {
  96. var $info = data.data || {}
  97. if(data.success && $info) {
  98. emailCookie = $info.email;
  99. phoneCookie = $info.mobilePhone;
  100. ifPhoneAmdEmail(phoneCookie,emailCookie)
  101. }
  102. },
  103. error: function() {
  104. plus.nativeUI.toast("服务器链接超时", toastStyle);
  105. return;
  106. }
  107. });
  108. }
  109. })
  110. });