You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

217 rivejä
6.3 KiB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Hello MUI</title>
  6. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7. <meta name="apple-mobile-web-app-capable" content="yes">
  8. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  9. <link rel="stylesheet" href="css/mui.min.css">
  10. <style>
  11. html,
  12. body {
  13. background-color: #efeff4;
  14. }
  15. .mui-content>.mui-table-view:first-child {
  16. margin-top: 0px;
  17. }
  18. .title {
  19. margin: 20px 15px 10px;
  20. color: #6d6d72;
  21. font-size: 15px;
  22. }
  23. .oa-contact-cell.mui-table .mui-table-cell {
  24. padding: 11px 0;
  25. vertical-align: middle;
  26. }
  27. .oa-contact-cell {
  28. position: relative;
  29. margin: -11px 0;
  30. }
  31. .oa-contact-avatar {
  32. width: 75px;
  33. }
  34. .oa-contact-avatar img {
  35. border-radius: 50%;
  36. }
  37. .oa-contact-content {
  38. width: 100%;
  39. }
  40. .oa-contact-name {
  41. margin-right: 20px;
  42. }
  43. .oa-contact-name,
  44. oa-contact-position {
  45. float: left;
  46. }
  47. .tit {
  48. padding: 10px 8px;
  49. font-size: 16px;
  50. font-family: "微软雅黑";
  51. }
  52. </style>
  53. </head>
  54. <body>
  55. <div class="mui-content">
  56. <div class="tit">咨询老师</div>
  57. <ul class="mui-table-view mui-table-view-striped mui-table-view-condensed" id="table">
  58. </ul>
  59. <div class="tit">关联老师</div>
  60. <ul class="mui-table-view mui-table-view-striped mui-table-view-condensed" id="tableguanlian">
  61. </ul>
  62. </div>
  63. </body>
  64. <script src="js/mui.min.js"></script>
  65. <script src="js/serverurl.js"></script>
  66. <script src="js/tools.js"></script>
  67. <script src="js/userinfos.js"></script>
  68. <script type="text/javascript" charset="utf-8">
  69. function RefreshContactTeacher() {
  70. CheckLogin();
  71. if(users.teaID != undefined && users.teaID != null && users.teaID != '' && users.teaID != 0 && users.teaID != '0') {
  72. //关联老师
  73. var table = document.getElementById("tableguanlian");
  74. var li = document.createElement("li");
  75. li.innerHTML = '<li class="mui-table-view-cell" onclick="OpenChat(\'' + users.teaID + '\');" id="' + users.teaID + '">' +
  76. '<div class="mui-slider-cell">' +
  77. '<div class="oa-contact-cell mui-table">' +
  78. '<div class="oa-contact-avatar mui-table-cell">' +
  79. '<img src="images/geren.png" />' +
  80. '</div>' +
  81. '<div class="oa-contact-content mui-table-cell">' +
  82. '<div class="mui-clearfix">' +
  83. '<h4 class="oa-contact-name">' + (users.teaName != undefined && users.teaName != null ? users.teaName : users.teaID) + '</h4>' +
  84. '<span class="oa-contact-position mui-h6" style="float: right;"></span>' +
  85. '</div>' +
  86. '<p class="oa-contact-email mui-h6">' +
  87. '聊天记录' +
  88. '</p>' +
  89. '</div>' +
  90. '</div>' +
  91. '</div>' +
  92. '</li>';
  93. table.appendChild(li, table.firstChild);
  94. }
  95. }
  96. (function($, doc) {
  97. mui.plusReady(function() {
  98. if(CheckLogin()) {
  99. var B = window.plus.bridge;
  100. var Yuntx = {
  101. ReadOffLineMessage: function(uln, unickname, successCallback, errorCallback) {
  102. var success = typeof successCallback !== 'function' ? null : function(args) {
  103. successCallback(args);
  104. },
  105. fail = typeof errorCallback !== 'function' ? null : function(code) {
  106. errorCallback(code);
  107. },
  108. callbackID = B.callbackId(success, fail);
  109. return B.exec("Yuntx", "ReadOffLineMessage", [callbackID, uln, unickname]);
  110. },
  111. OpenChat: function(uln, tln, successCallback, errorCallback) {
  112. var success = typeof successCallback !== 'function' ? null : function(args) {
  113. successCallback(args);
  114. },
  115. fail = typeof errorCallback !== 'function' ? null : function(code) {
  116. errorCallback(code);
  117. },
  118. callbackID = B.callbackId(success, fail);
  119. return B.exec("Yuntx", "OpenChat", [callbackID, uln, tln]);
  120. }
  121. };
  122. window.plus.Yuntx = Yuntx;
  123. var list = JSON.parse(localStorage.getItem('taigangteacherMsgList') || '[]');
  124. LoadList(list);
  125. GetMessage();
  126. RefreshContactTeacher();
  127. }
  128. });
  129. }(mui, document));
  130. function GetMessage() {
  131. plus.Yuntx.ReadOffLineMessage(users.ID, users.username,
  132. function(contact) { //成功
  133. },
  134. function(status) { //失败
  135. plus.nativeUI.toast("获取消息失败!");
  136. }
  137. );
  138. }
  139. function OpenChat(id) {
  140. plus.Yuntx.OpenChat(users.ID, id,
  141. function(contact) { //成功
  142. plus.nativeUI.closeWaiting();
  143. },
  144. function(status) { //失败
  145. plus.nativeUI.closeWaiting();
  146. });
  147. }
  148. function LoadList() {
  149. var table = document.getElementById("table");
  150. table.innerHTML = "";
  151. var xhr = new plus.net.XMLHttpRequest();
  152. xhr.responseType = "json";
  153. xhr.onreadystatechange = function() {
  154. switch(xhr.readyState) {
  155. case 4:
  156. if(xhr.status == 200) {
  157. if(xhr.response.result == "ok") {
  158. if(xhr.response.msg != null && xhr.response.msg.length > 0) {
  159. for(var i in xhr.response.msg) {
  160. var dataobject = xhr.response.msg[i];
  161. var li = document.createElement("li");
  162. li.setAttribute("userid", "" + dataobject.userID + "");
  163. li.innerHTML = '<li class="mui-table-view-cell" onclick="OpenChat(\'' + dataobject.userID + '\');" id="' + dataobject.userID + '">' +
  164. '<div class="mui-slider-cell">' +
  165. '<div class="oa-contact-cell mui-table">' +
  166. '<div class="oa-contact-avatar mui-table-cell">' +
  167. '<img src="images/geren.png" />' +
  168. '</div>' +
  169. '<div class="oa-contact-content mui-table-cell">' +
  170. '<div class="mui-clearfix">' +
  171. '<h4 class="oa-contact-name">' + dataobject.schoolName + '-' + dataobject.teacherName + '</h4>' +
  172. '<span class="oa-contact-position mui-h6" style="float: right;"></span>' +
  173. '</div>' +
  174. '<p class="oa-contact-email mui-h6">' +
  175. '咨询老师' +
  176. '</p>' +
  177. '</div>' +
  178. '</div>' +
  179. '</div>' +
  180. '</li>';
  181. table.appendChild(li, table.firstChild);
  182. }
  183. }
  184. } else {}
  185. } else {
  186. plus.nativeUI.toast('世界上最遥远的距离就是没有网络。');
  187. }
  188. break;
  189. default:
  190. break;
  191. }
  192. }
  193. xhr.open("GET", encodeURI(serverdomain + "/WebService/UserService.ashx?Action=getTeacherInfo"));
  194. xhr.send();
  195. }
  196. </script>
  197. </html>