fancy 5 年 前
コミット
98e7fa741c

+ 16 - 0
o2ios/O2Platform.xcodeproj/project.pbxproj

@@ -119,6 +119,10 @@
 		B13A0120236935BC00025F3B /* O2CloudFileInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = B13A011F236935BC00025F3B /* O2CloudFileInfo.swift */; };
 		B142B081230FB56400E7D127 /* MimeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B142B080230FB56400E7D127 /* MimeType.swift */; };
 		B142B083230FB58B00E7D127 /* Swime.swift in Sources */ = {isa = PBXBuildFile; fileRef = B142B082230FB58B00E7D127 /* Swime.swift */; };
+		B1489B1C248E0F4D009EE9FD /* IMChatViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1489B1A248E0F4D009EE9FD /* IMChatViewController.swift */; };
+		B1489B1D248E0F4D009EE9FD /* IMChatViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = B1489B1B248E0F4D009EE9FD /* IMChatViewController.xib */; };
+		B1489B51248E192D009EE9FD /* IMChatMessageViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1489B4F248E192D009EE9FD /* IMChatMessageViewCell.swift */; };
+		B1489B52248E192D009EE9FD /* IMChatMessageViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = B1489B50248E192D009EE9FD /* IMChatMessageViewCell.xib */; };
 		B14B339F2356EB1500442968 /* CloudFileViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B14B339E2356EB1500442968 /* CloudFileViewModel.swift */; };
 		B14E07532301137F00AE85A0 /* ContactPickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B14E07522301137F00AE85A0 /* ContactPickerViewController.swift */; };
 		B14E07862301418400AE85A0 /* ContactUnitPickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B14E07852301418400AE85A0 /* ContactUnitPickerViewController.swift */; };
@@ -1433,6 +1437,10 @@
 		B13A011F236935BC00025F3B /* O2CloudFileInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = O2CloudFileInfo.swift; sourceTree = "<group>"; };
 		B142B080230FB56400E7D127 /* MimeType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MimeType.swift; sourceTree = "<group>"; };
 		B142B082230FB58B00E7D127 /* Swime.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Swime.swift; sourceTree = "<group>"; };
+		B1489B1A248E0F4D009EE9FD /* IMChatViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IMChatViewController.swift; sourceTree = "<group>"; };
+		B1489B1B248E0F4D009EE9FD /* IMChatViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = IMChatViewController.xib; sourceTree = "<group>"; };
+		B1489B4F248E192D009EE9FD /* IMChatMessageViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IMChatMessageViewCell.swift; sourceTree = "<group>"; };
+		B1489B50248E192D009EE9FD /* IMChatMessageViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = IMChatMessageViewCell.xib; sourceTree = "<group>"; };
 		B14B339E2356EB1500442968 /* CloudFileViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CloudFileViewModel.swift; sourceTree = "<group>"; };
 		B14E07522301137F00AE85A0 /* ContactPickerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactPickerViewController.swift; sourceTree = "<group>"; };
 		B14E07852301418400AE85A0 /* ContactUnitPickerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactUnitPickerViewController.swift; sourceTree = "<group>"; };
@@ -2558,6 +2566,8 @@
 				B1173A5A2488C546005075F0 /* IMConversationListViewController.swift */,
 				B1173A5F2488C82F005075F0 /* IMViewModel.swift */,
 				B1173A692488D4AD005075F0 /* O2IM.swift */,
+				B1489B1A248E0F4D009EE9FD /* IMChatViewController.swift */,
+				B1489B1B248E0F4D009EE9FD /* IMChatViewController.xib */,
 			);
 			path = "IM-聊天";
 			sourceTree = "<group>";
@@ -2583,6 +2593,8 @@
 			children = (
 				B1173A652488CD5B005075F0 /* IMConversationItemCell.swift */,
 				B1173A662488CD5B005075F0 /* IMConversationItemCell.xib */,
+				B1489B4F248E192D009EE9FD /* IMChatMessageViewCell.swift */,
+				B1489B50248E192D009EE9FD /* IMChatMessageViewCell.xib */,
 			);
 			path = View;
 			sourceTree = "<group>";
@@ -5458,6 +5470,7 @@
 				E4C24B4920844F3C00E426B0 /* JCMessageImageCollectionViewCell.xib in Resources */,
 				E4C24C1820844F5200E426B0 /* yh_image_picked@2x.png in Resources */,
 				E45755A61E0BA72E00EC44F4 /* qrcode_scan_part_net.png in Resources */,
+				B1489B52248E192D009EE9FD /* IMChatMessageViewCell.xib in Resources */,
 				E46E6C721DD41F5D00AB7561 /* ZSSfonts@2x.png in Resources */,
 				E46E6C6E1DD41F5D00AB7561 /* ZSScenterjustify@2x.png in Resources */,
 				B1298E822366B2E7006E9236 /* CFImageViewCell.xib in Resources */,
@@ -5479,6 +5492,7 @@
 				E4C24B6120844F3C00E426B0 /* addressCode in Resources */,
 				E4B697D920764A2D0062F6E8 /* myshareEditorByPerson.json in Resources */,
 				E457559D1E0BA72E00EC44F4 /* qrcode_scan_btn_flash_down@2x.png in Resources */,
+				B1489B1D248E0F4D009EE9FD /* IMChatViewController.xib in Resources */,
 				E4C24C1A20844F5200E426B0 /* emoticons.bundle in Resources */,
 				E4B888E11D9D48F1002E1A46 /* contacts.storyboard in Resources */,
 				E45755A51E0BA72E00EC44F4 /* qrcode_scan_light_green@2x.png in Resources */,
@@ -5985,6 +5999,7 @@
 				E4C24B5320844F3C00E426B0 /* SAIInputView.swift in Sources */,
 				E40E24CF20B7DA3C009F8BE7 /* OOFormDateItemView.swift in Sources */,
 				B1FBA01D230A3AB500A90722 /* O2JsApiBizUtil.swift in Sources */,
+				B1489B51248E192D009EE9FD /* IMChatMessageViewCell.swift in Sources */,
 				E4B69776207630240062F6E8 /* UIView+Extension.swift in Sources */,
 				E4C24BB420844F3C00E426B0 /* JCMessageContentViewType.swift in Sources */,
 				E4C24B9420844F3C00E426B0 /* JCGroupSettingCell.swift in Sources */,
@@ -6365,6 +6380,7 @@
 				E4B888A41D9D48F1002E1A46 /* MJRefreshBackNormalFooter.m in Sources */,
 				E4B2320F20B2A9F60082F30A /* OOAttandanceWorkPlaceController.swift in Sources */,
 				E46E6CB91DD41F5D00AB7561 /* CYRTextView.m in Sources */,
+				B1489B1C248E0F4D009EE9FD /* IMChatViewController.swift in Sources */,
 				B175007C233C6908003DA7B9 /* BlockTap.swift in Sources */,
 				E4C24B5020844F3C00E426B0 /* SAIInputAccessoryViewLayout.swift in Sources */,
 				E4AA17151EE158E70030D9AB /* LogListViewController.swift in Sources */,

+ 126 - 0
o2ios/O2Platform/App/IM-聊天/IMChatViewController.swift

@@ -0,0 +1,126 @@
+//
+//  IMChatViewController.swift
+//  O2Platform
+//
+//  Created by FancyLou on 2020/6/8.
+//  Copyright © 2020 zoneland. All rights reserved.
+//
+
+import UIKit
+import CocoaLumberjack
+
+class IMChatViewController: UIViewController {
+
+    // MARK: - IBOutlet
+    //消息列表
+    @IBOutlet weak var tableView: UITableView!
+    //消息输入框
+    @IBOutlet weak var messageInputView: UITextField!
+    //底部工具栏的高度约束
+    @IBOutlet weak var bottomBarHeightConstraint: NSLayoutConstraint!
+    //底部工具栏
+    @IBOutlet weak var bottomBar: UIView!
+
+    private lazy var viewModel: IMViewModel = {
+        return IMViewModel()
+    }()
+
+    // MARK: - properties
+    var conversation: IMConversationInfo? = nil
+    private var chatMessageList: [IMMessageInfo] = []
+    private var page = 1
+    private var isShowEmoji = false
+    private var bottomBarHeight = 64
+
+
+    // MARK: - functions
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        self.tableView.delegate = self
+        self.tableView.dataSource = self
+        self.tableView.register(UINib(nibName: "IMChatMessageViewCell", bundle: nil), forCellReuseIdentifier: "IMChatMessageViewCell")
+        self.tableView.separatorStyle = .none
+        self.messageInputView.delegate = self
+
+        //底部安全距离 老机型没有
+        self.bottomBarHeight = Int(iPhoneX ? 64 + IPHONEX_BOTTOM_SAFE_HEIGHT: 64)
+        self.bottomBarHeightConstraint.constant = self.bottomBarHeight.toCGFloat
+        self.bottomBar.topBorder(width: 1, borderColor: base_gray_color.alpha(0.5))
+        self.messageInputView.backgroundColor = base_gray_color
+
+
+        self.loadMsgList(page: page)
+    }
+
+    //获取消息
+    private func loadMsgList(page: Int) {
+        if let c = self.conversation, let id = c.id {
+            self.viewModel.myMsgPageList(page: page, conversationId: id).then { (list) in
+                self.chatMessageList = list
+                DispatchQueue.main.async {
+                    self.tableView.reloadData()
+                }
+            }
+        } else {
+            self.showError(title: "参数错误!!!")
+        }
+    }
+
+
+    // MARK: - IBAction
+    //点击表情按钮
+    @IBAction func clickEmojiBtn(_ sender: UIButton) {
+        self.isShowEmoji.toggle()
+        self.view.endEditing(true)
+        if self.isShowEmoji {
+            self.bottomBarHeightConstraint.constant = self.bottomBarHeight.toCGFloat + 128
+        } else {
+            self.bottomBarHeightConstraint.constant = self.bottomBarHeight.toCGFloat
+
+        }
+        self.view.layoutIfNeeded()
+    }
+
+
+
+}
+// MARK: - tableview delegate
+extension IMChatViewController: UITableViewDelegate, UITableViewDataSource {
+
+    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+        return self.chatMessageList.count
+    }
+
+    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+        return tableView.dequeueReusableCell(withIdentifier: "IMChatMessageViewCell", for: indexPath)
+    }
+    func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
+        guard let c = cell as? IMChatMessageViewCell else {
+            return
+        }
+        //todo
+        c.setContent(item: self.chatMessageList[indexPath.row])
+    }
+
+
+}
+
+// MARK: - textField delegate
+extension IMChatViewController: UITextFieldDelegate {
+    func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
+        DDLogDebug("准备开始输入......")
+        closeEmoji()
+        return true
+    }
+
+    private func closeEmoji() {
+        self.isShowEmoji = false
+        self.bottomBarHeightConstraint.constant = 64
+        self.view.layoutIfNeeded()
+    }
+
+    func textFieldShouldReturn(_ textField: UITextField) -> Bool {
+        DDLogDebug("回车。。。。")
+        return true
+    }
+}

+ 81 - 0
o2ios/O2Platform/App/IM-聊天/IMChatViewController.xib

@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+    <device id="retina6_1" orientation="portrait" appearance="light"/>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
+        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="IMChatViewController" customModule="O2Platform" customModuleProvider="target">
+            <connections>
+                <outlet property="bottomBar" destination="sDg-us-Ed9" id="J1d-XZ-5Rt"/>
+                <outlet property="bottomBarHeightConstraint" destination="qiu-7O-AwO" id="LWR-Ov-DMW"/>
+                <outlet property="messageInputView" destination="8BW-XG-rBx" id="A8J-9I-MjT"/>
+                <outlet property="tableView" destination="ZIb-3p-hnq" id="heR-v3-iUh"/>
+                <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
+            </connections>
+        </placeholder>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
+            <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="ZIb-3p-hnq">
+                    <rect key="frame" x="0.0" y="44" width="414" height="754"/>
+                    <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
+                    <color key="sectionIndexBackgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                </tableView>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="sDg-us-Ed9">
+                    <rect key="frame" x="0.0" y="798" width="414" height="98"/>
+                    <subviews>
+                        <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="请输入消息..." textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="8BW-XG-rBx">
+                            <rect key="frame" x="14" y="12" width="328" height="36"/>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="36" id="qe1-5v-UaD"/>
+                            </constraints>
+                            <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                            <textInputTraits key="textInputTraits" returnKeyType="send"/>
+                        </textField>
+                        <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="oTD-nU-xkE">
+                            <rect key="frame" x="366" y="12" width="36" height="36"/>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="36" id="AzT-Gm-fHl"/>
+                                <constraint firstAttribute="height" constant="36" id="PqN-1z-eCd"/>
+                            </constraints>
+                            <state key="normal" image="chat_emoji"/>
+                            <connections>
+                                <action selector="clickEmojiBtn:" destination="-1" eventType="touchUpInside" id="hZk-xk-g8t"/>
+                            </connections>
+                        </button>
+                    </subviews>
+                    <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                    <constraints>
+                        <constraint firstAttribute="trailing" secondItem="oTD-nU-xkE" secondAttribute="trailing" constant="12" id="BtK-YW-2fb"/>
+                        <constraint firstItem="oTD-nU-xkE" firstAttribute="top" secondItem="sDg-us-Ed9" secondAttribute="top" constant="12" id="JKE-h8-gll"/>
+                        <constraint firstItem="oTD-nU-xkE" firstAttribute="leading" secondItem="8BW-XG-rBx" secondAttribute="trailing" constant="24" id="Mzm-dM-gqy"/>
+                        <constraint firstItem="8BW-XG-rBx" firstAttribute="top" secondItem="sDg-us-Ed9" secondAttribute="top" constant="12" id="hnf-bY-DYH"/>
+                        <constraint firstItem="8BW-XG-rBx" firstAttribute="leading" secondItem="sDg-us-Ed9" secondAttribute="leading" constant="14" id="kAO-OU-1mN"/>
+                        <constraint firstAttribute="height" constant="98" id="qiu-7O-AwO"/>
+                    </constraints>
+                </view>
+            </subviews>
+            <color key="backgroundColor" systemColor="systemGray6Color" red="0.94901960780000005" green="0.94901960780000005" blue="0.96862745100000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+            <constraints>
+                <constraint firstItem="ZIb-3p-hnq" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" id="7kr-oh-NvU"/>
+                <constraint firstAttribute="trailing" secondItem="sDg-us-Ed9" secondAttribute="trailing" id="SXj-Vg-GIC"/>
+                <constraint firstAttribute="bottom" secondItem="sDg-us-Ed9" secondAttribute="bottom" id="ZjF-u3-yyV"/>
+                <constraint firstItem="ZIb-3p-hnq" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="d3C-Up-hv7"/>
+                <constraint firstItem="ZIb-3p-hnq" firstAttribute="trailing" secondItem="fnl-2z-Ty3" secondAttribute="trailing" id="igh-CL-C1S"/>
+                <constraint firstItem="sDg-us-Ed9" firstAttribute="top" secondItem="ZIb-3p-hnq" secondAttribute="bottom" id="rTN-Zh-8i6"/>
+                <constraint firstItem="sDg-us-Ed9" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="rqK-P9-wyk"/>
+            </constraints>
+            <viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>
+            <point key="canvasLocation" x="131.8840579710145" y="138.61607142857142"/>
+        </view>
+    </objects>
+    <resources>
+        <image name="chat_emoji" width="24" height="24"/>
+    </resources>
+</document>

+ 3 - 0
o2ios/O2Platform/App/IM-聊天/IMConversationListViewController.swift

@@ -124,6 +124,9 @@ extension IMConversationListViewController: UITableViewDelegate, UITableViewData
     }
     func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
         DDLogDebug("点击了 row \(indexPath.row)")
+        let chatView = IMChatViewController()
+        chatView.conversation = self.conversationList[indexPath.row]
+        self.navigationController?.pushViewController(chatView, animated: true)
     }
     //todo can edit
 

+ 18 - 1
o2ios/O2Platform/App/IM-聊天/IMViewModel.swift

@@ -19,7 +19,7 @@ class IMViewModel: NSObject {
 }
 
 extension IMViewModel {
-    
+    //查询会话列表
     func myConversationList() -> Promise<[IMConversationInfo]> {
         return Promise { fulfill, reject in
             self.communicateAPI.request(.myConversationList, completion: { result in
@@ -36,4 +36,21 @@ extension IMViewModel {
             })
         }
     }
+    //查询消息列表
+    func myMsgPageList(page: Int, conversationId: String) -> Promise<[IMMessageInfo]> {
+        return Promise { fulfill, reject in
+            self.communicateAPI.request(.msgListByPaging(page, 40, conversationId), completion: { result in
+                let response = OOResult<BaseModelClass<[IMMessageInfo]>>(result)
+                if response.isResultSuccess() {
+                    if let list = response.model?.data {
+                        fulfill(list)
+                    }else {
+                        reject(OOAppError.apiEmptyResultError)
+                    }
+                }else {
+                    reject(response.error!)
+                }
+            })
+        }
+    }
 }

+ 33 - 22
o2ios/O2Platform/App/IM-聊天/Model/IMConversationInfo.swift

@@ -15,23 +15,34 @@ class IMConversationInfo: NSObject, DataModel {
     @objc var personList: [String]?
     @objc var adminPerson: String?
     @objc var note: String?
-    
+
     @objc var lastMessageTime: String?
     @objc var createTime: String?
     @objc var updateTime: String?
     var unreadNumber: Int?
     var isTop: Bool?
-    
+
     @objc var lastMessage: IMMessageInfo?
-    
-    required override init(){}
-    
+
+    required override init() { }
+
     func mapping(mapper: HelpingMapper) {
-        
+
     }
 }
 
 
+class IMMessageRequestForm: NSObject, DataModel {
+
+    @objc var conversationId: String?
+
+    required override init() { }
+
+    func mapping(mapper: HelpingMapper) {
+
+    }
+}
+
 class IMMessageInfo: NSObject, DataModel {
     @objc var id: String?
     @objc var conversationId: String?
@@ -39,24 +50,24 @@ class IMMessageInfo: NSObject, DataModel {
     @objc var createPerson: String?
     @objc var createTime: String?
     @objc var updateTime: String?
-    
-     required override init(){}
-       
-       func mapping(mapper: HelpingMapper) {
-           
-       }
+
+    required override init() { }
+
+    func mapping(mapper: HelpingMapper) {
+
+    }
 }
 
 class IMMessageBodyInfo: NSObject, DataModel {
     @objc var id: String?
-   @objc var type: String?
-   @objc var body: String?
-    
-    
-    required override init(){}
-    
+    @objc var type: String?
+    @objc var body: String?
+
+
+    required override init() { }
+
     func mapping(mapper: HelpingMapper) {
-        
+
     }
 }
 
@@ -64,9 +75,9 @@ class IMMessageBodyInfo: NSObject, DataModel {
 class WsMessage: NSObject, DataModel {
     @objc var type: String? //im_create
     @objc var body: IMMessageInfo? //这个对象只有 type=im_create的时候才是这个对象
-    required override init(){}
-    
+    required override init() { }
+
     func mapping(mapper: HelpingMapper) {
-        
+
     }
 }

+ 29 - 0
o2ios/O2Platform/App/IM-聊天/View/IMChatMessageViewCell.swift

@@ -0,0 +1,29 @@
+//
+//  IMChatMessageViewCell.swift
+//  O2Platform
+//
+//  Created by FancyLou on 2020/6/8.
+//  Copyright © 2020 zoneland. All rights reserved.
+//
+
+import UIKit
+
+class IMChatMessageViewCell: UITableViewCell {
+
+    @IBOutlet weak var titleLabel: UILabel!
+    override func awakeFromNib() {
+        super.awakeFromNib()
+        // Initialization code
+    }
+
+    override func setSelected(_ selected: Bool, animated: Bool) {
+        super.setSelected(selected, animated: animated)
+
+        // Configure the view for the selected state
+    }
+    
+    func setContent(item: IMMessageInfo) {
+        self.titleLabel.text = item.createTime
+    }
+    
+}

+ 41 - 0
o2ios/O2Platform/App/IM-聊天/View/IMChatMessageViewCell.xib

@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+    <device id="retina6_1" orientation="portrait" appearance="light"/>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
+        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="IMChatMessageViewCell" customModule="O2Platform" customModuleProvider="target">
+            <rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+            <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
+                <rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
+                <autoresizingMask key="autoresizingMask"/>
+                <subviews>
+                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="111111" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2r2-Sl-HFm">
+                        <rect key="frame" x="12" y="8" width="296" height="28"/>
+                        <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                        <nil key="textColor"/>
+                        <nil key="highlightedColor"/>
+                    </label>
+                </subviews>
+                <constraints>
+                    <constraint firstItem="2r2-Sl-HFm" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="8" id="45B-z7-I5v"/>
+                    <constraint firstAttribute="trailing" secondItem="2r2-Sl-HFm" secondAttribute="trailing" constant="12" id="YSs-xr-qNs"/>
+                    <constraint firstItem="2r2-Sl-HFm" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="12" id="mnz-Is-W7S"/>
+                    <constraint firstAttribute="bottom" secondItem="2r2-Sl-HFm" secondAttribute="bottom" constant="8" id="p9k-7p-IA8"/>
+                </constraints>
+            </tableViewCellContentView>
+            <viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
+            <connections>
+                <outlet property="titleLabel" destination="2r2-Sl-HFm" id="kIP-0d-kYX"/>
+            </connections>
+            <point key="canvasLocation" x="132" y="139"/>
+        </tableViewCell>
+    </objects>
+</document>

+ 1 - 1
o2ios/O2Platform/App/O2MainController.swift

@@ -254,7 +254,7 @@ extension O2MainController: WebSocketDelegate {
                             }
                         }
                     }
-                } catch { }
+                } catch {  }
             }
             break
         case .connected(let headers):

+ 22 - 0
o2ios/O2Platform/Assets.xcassets/all/chat_emoji.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "chat_emoji@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "chat_emoji@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
o2ios/O2Platform/Assets.xcassets/all/chat_emoji.imageset/chat_emoji@2x.png


BIN
o2ios/O2Platform/Assets.xcassets/all/chat_emoji.imageset/chat_emoji@3x.png


+ 33 - 0
o2ios/O2Platform/Extension/UIView+Extension.swift

@@ -171,6 +171,39 @@ extension UIView {
         self.layer.cornerRadius = radius
         self.layer.masksToBounds = true
     }
+    
+    //画线
+    private func drawBorder(rect:CGRect,color:UIColor){
+        let line = UIBezierPath(rect: rect)
+        let lineShape = CAShapeLayer()
+        lineShape.path = line.cgPath
+        lineShape.fillColor = color.cgColor
+        self.layer.addSublayer(lineShape)
+    }
+    
+    //设置右边框
+    public func rightBorder(width:CGFloat,borderColor:UIColor){
+        let rect = CGRect(x: 0, y: self.frame.size.width - width, width: width, height: self.frame.size.height)
+        drawBorder(rect: rect, color: borderColor)
+    }
+    //设置左边框
+    public func leftBorder(width:CGFloat,borderColor:UIColor){
+        let rect = CGRect(x: 0, y: 0, width: width, height: self.frame.size.height)
+        drawBorder(rect: rect, color: borderColor)
+    }
+    //设置上边框
+    public func topBorder(width:CGFloat,borderColor:UIColor){
+        let rect = CGRect(x: 0, y: 0, width: self.frame.size.width, height: width)
+        drawBorder(rect: rect, color: borderColor)
+    }
+    //设置底边框
+    public func buttomBorder(width:CGFloat,borderColor:UIColor){
+        let rect = CGRect(x: 0, y: self.frame.size.height-width, width: self.frame.size.width, height: width)
+        drawBorder(rect: rect, color: borderColor)
+    }
+
+
+
 
 }
 

+ 9 - 2
o2ios/O2Platform/Framework/O2API/Communicate/CommunicateAPI.swift

@@ -13,6 +13,7 @@ import O2OA_Auth_SDK
 
 enum CommunicateAPI {
     case myConversationList
+    case msgListByPaging(Int, Int, String)
     
     
 }
@@ -42,7 +43,8 @@ extension CommunicateAPI: TargetType {
         switch self {
         case .myConversationList:
             return "/jaxrs/im/conversation/list/my"
-        
+        case .msgListByPaging(let page, let size, _):
+            return "/jaxrs/im/msg/list/\(page)/size/\(size)"
         }
     }
     
@@ -50,7 +52,8 @@ extension CommunicateAPI: TargetType {
         switch self {
         case .myConversationList:
             return .get
-         
+        case .msgListByPaging(_, _, _):
+            return .post
         }
     }
     
@@ -62,6 +65,10 @@ extension CommunicateAPI: TargetType {
         switch self {
         case .myConversationList:
             return .requestPlain
+        case .msgListByPaging(_, _, let conversationId):
+            let form = IMMessageRequestForm()
+            form.conversationId = conversationId
+            return .requestParameters(parameters: form.toJSON()!, encoding: JSONEncoding.default)
         }
     }
     

+ 2 - 1
o2ios/O2Platform/config/config.swift

@@ -81,7 +81,8 @@ var base_color: UIColor {
 }
 let base_blue_color = UIColor.init(hex: "#008be6")
 
-let base_gray_color = RGB(255.0, g: 255.0, b: 255.0)
+let base_gray_color = RGB(245.0, g: 245.0, b: 245.0)
+
 let base_gray_background_color = RGB(155.0,g:155.0,b:155.0)
 
 let toolbar_background_color = RGB(247,g:247,b:247)