123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- var prevImage;
- var lastId = 0;
- var sessionId = "";
- var sessionName = "";
- mui.plusReady(function() {
- plus.nativeUI.showWaiting();
- self = plus.webview.currentWebview();
- teamInfo = self.info;
- sessionId = self.sessionId;
- sessionName = self.sessionName;
- getMineInfo();//初始化个人信息
- if(sessionName){
- $("#title").html(sessionName)
- }
- //刷新消息页
- var opener = self.opener();
- if(opener.id=="jumingim.html" || opener.id=="yishengim.html"){
- mui.back = backToWebviewById(opener.id,false,function() {
- var mainWebview = plus.webview.getWebviewById(opener.id);
- mui.fire(mainWebview,"xiaoxiUpdate");
- self.close();
- });
- } else {
- backToParent();
- }
- //backxiaoxi();
- prevImage = mui.previewImage();
- initPage();
- try {
- plus.push.clear();
- } catch(e) {
-
- }
- });
- function initPage(){
-
- if(teamInfo&&teamInfo.teamCode) {
- sendGet("/doctor/admin-teams/"+ teamInfo.teamCode +"/members", {}, null, function(res){
- if(res.status == 200){
- members = {};
- $.each(res.data, function(i, v) {
- members[v.code] = v;
- });
- createSession(3, getMembers);
- } else
- mui.toast("获取成员列表失败!");
- })
- } else if(sessionId){
- imClient.Sessions.getParticipants(sessionId,function(res) {
- members = {};
- $.each(res, function(i, v) {
- members[v.id] = v;
- });
- createSession(3, getMembers);
- },function(res) {
- mui.toast("获取成员列表失败!");
- })
- }
-
- }
-
- /**
- * 获取聊天图片列表
- */
- function getImgMsgList(handle){
- im.getGroupMsg(getUserId(), teamInfo.code, lastId, pageSize, function(data) {
- console.log("imgs:" + JSON.stringify(data));
- chatCache.imgs = data.records.reverse();
- appendPrevImgs(chatCache.imgs);
- if(handle) handle(data);
- }, 2);
- }
-
- /**
- * 发送消息
- */
- function uploadMsg(type, content, locSrc, isNotSend, callBack) {
- uploadMsgBase(type, content, locSrc, isNotSend, callBack);
- }
-
- function setTitle(teamName){
- document.querySelector("h1").innerText = teamName;
- }
-
- document.getElementById("qun_detail").addEventListener('tap', function() {
- mui.openWindow({
- url: "../../tuandui/html/tuanduishezhi.html",
- id: "tuanduishezhi.html",
- extras: teamInfo || {
- teamCode: sessionId,
- teamName: sessionName
- }
- })
- });
-
- window.addEventListener('updateTeamName', function(e) {
- setTitle(e.detail.teamName)
- });
-
|