Skip to content

Commit

Permalink
update source code about iOS Client
Browse files Browse the repository at this point in the history
  • Loading branch information
lizelu committed Dec 6, 2016
1 parent 5827d6f commit ede2142
Show file tree
Hide file tree
Showing 14 changed files with 286 additions and 22 deletions.
24 changes: 24 additions & 0 deletions iOSClientForPerfect/iOSClientForPerfect.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
F48676401DF2F01700078859 /* UserInfoRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = F486763F1DF2F01700078859 /* UserInfoRequest.swift */; };
F48676421DF2F82E00078859 /* RequestPathDefine.swift in Sources */ = {isa = PBXBuildFile; fileRef = F48676411DF2F82E00078859 /* RequestPathDefine.swift */; };
F48676451DF2F8F000078859 /* UserModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F48676441DF2F8F000078859 /* UserModel.swift */; };
F4CC9FF41DF6A8DE00A90E8C /* MainPageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4CC9FF31DF6A8DE00A90E8C /* MainPageCell.swift */; };
F4CC9FF61DF6A8FE00A90E8C /* AccountManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4CC9FF51DF6A8FE00A90E8C /* AccountManager.swift */; };
F4CC9FF81DF6ABD900A90E8C /* ContentModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4CC9FF71DF6ABD900A90E8C /* ContentModel.swift */; };
F4CC9FFA1DF6AD0E00A90E8C /* ContentReqest.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4CC9FF91DF6AD0E00A90E8C /* ContentReqest.swift */; };
F4E7C20E1DEEC880009CD13C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4E7C20D1DEEC880009CD13C /* AppDelegate.swift */; };
F4E7C2131DEEC880009CD13C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F4E7C2111DEEC880009CD13C /* Main.storyboard */; };
F4E7C2151DEEC880009CD13C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F4E7C2141DEEC880009CD13C /* Assets.xcassets */; };
Expand All @@ -32,6 +36,10 @@
F486763F1DF2F01700078859 /* UserInfoRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserInfoRequest.swift; sourceTree = "<group>"; };
F48676411DF2F82E00078859 /* RequestPathDefine.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RequestPathDefine.swift; sourceTree = "<group>"; };
F48676441DF2F8F000078859 /* UserModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserModel.swift; sourceTree = "<group>"; };
F4CC9FF31DF6A8DE00A90E8C /* MainPageCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainPageCell.swift; sourceTree = "<group>"; };
F4CC9FF51DF6A8FE00A90E8C /* AccountManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountManager.swift; sourceTree = "<group>"; };
F4CC9FF71DF6ABD900A90E8C /* ContentModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentModel.swift; sourceTree = "<group>"; };
F4CC9FF91DF6AD0E00A90E8C /* ContentReqest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentReqest.swift; sourceTree = "<group>"; };
F4E7C20A1DEEC880009CD13C /* iOSClientForPerfect.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iOSClientForPerfect.app; sourceTree = BUILT_PRODUCTS_DIR; };
F4E7C20D1DEEC880009CD13C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
F4E7C2121DEEC880009CD13C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
Expand Down Expand Up @@ -68,6 +76,7 @@
F48676411DF2F82E00078859 /* RequestPathDefine.swift */,
F486763D1DF2D38400078859 /* Reqeust.swift */,
F486763F1DF2F01700078859 /* UserInfoRequest.swift */,
F4CC9FF91DF6AD0E00A90E8C /* ContentReqest.swift */,
);
path = NewWorking;
sourceTree = "<group>";
Expand All @@ -76,6 +85,7 @@
isa = PBXGroup;
children = (
F486763B1DF2D14D00078859 /* Tools.swift */,
F4CC9FF51DF6A8FE00A90E8C /* AccountManager.swift */,
);
path = Tools;
sourceTree = "<group>";
Expand All @@ -84,10 +94,19 @@
isa = PBXGroup;
children = (
F48676441DF2F8F000078859 /* UserModel.swift */,
F4CC9FF71DF6ABD900A90E8C /* ContentModel.swift */,
);
path = Model;
sourceTree = "<group>";
};
F4CC9FF01DF6A7C100A90E8C /* View */ = {
isa = PBXGroup;
children = (
F4CC9FF31DF6A8DE00A90E8C /* MainPageCell.swift */,
);
path = View;
sourceTree = "<group>";
};
F4E7C2011DEEC880009CD13C = {
isa = PBXGroup;
children = (
Expand All @@ -111,6 +130,7 @@
F486763A1DF2D13600078859 /* Tools */,
F48676351DF2CE0800078859 /* NewWorking */,
F48676341DF2CDDA00078859 /* ViewController */,
F4CC9FF01DF6A7C100A90E8C /* View */,
F4E7C20D1DEEC880009CD13C /* AppDelegate.swift */,
F4E7C2111DEEC880009CD13C /* Main.storyboard */,
F4E7C2141DEEC880009CD13C /* Assets.xcassets */,
Expand Down Expand Up @@ -197,12 +217,16 @@
F48676391DF2D11A00078859 /* ViewController.swift in Sources */,
F48676451DF2F8F000078859 /* UserModel.swift in Sources */,
F42CFDB81DF544CE00EA8BCF /* LoginOrRegisterViewController.swift in Sources */,
F4CC9FF81DF6ABD900A90E8C /* ContentModel.swift in Sources */,
F48676421DF2F82E00078859 /* RequestPathDefine.swift in Sources */,
F486763E1DF2D38400078859 /* Reqeust.swift in Sources */,
F4CC9FF41DF6A8DE00A90E8C /* MainPageCell.swift in Sources */,
F48676371DF2CE3800078859 /* InputUserNameController.swift in Sources */,
F4E7C20E1DEEC880009CD13C /* AppDelegate.swift in Sources */,
F42CFDBA1DF5451600EA8BCF /* MainTableViewController.swift in Sources */,
F486763C1DF2D14D00078859 /* Tools.swift in Sources */,
F4CC9FF61DF6A8FE00A90E8C /* AccountManager.swift in Sources */,
F4CC9FFA1DF6AD0E00A90E8C /* ContentReqest.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "book_icon.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 61 additions & 7 deletions iOSClientForPerfect/iOSClientForPerfect/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -238,18 +238,69 @@
<scene sceneID="Q7A-8K-4be">
<objects>
<tableViewController storyboardIdentifier="MainTableViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="fDL-DA-Mb4" customClass="MainTableViewController" customModule="iOSClientForPerfect" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="vSx-a2-2NC">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="57" sectionHeaderHeight="28" sectionFooterHeight="28" id="vSx-a2-2NC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="0.83499743439915797" green="0.93010875338413679" blue="0.73842527529668145" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="AEa-fX-q6a">
<rect key="frame" x="0.0" y="28" width="375" height="44"/>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" accessoryType="detailDisclosureButton" indentationWidth="10" reuseIdentifier="MainPageCell" rowHeight="57" id="AEa-fX-q6a" customClass="MainPageCell" customModule="iOSClientForPerfect" customModuleProvider="target">
<rect key="frame" x="0.0" y="28" width="375" height="57"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="AEa-fX-q6a" id="HdF-15-fk0">
<rect key="frame" x="0.0" y="0.0" width="375" height="43"/>
<rect key="frame" x="0.0" y="0.0" width="308" height="57"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="book_icon" translatesAutoresizingMaskIntoConstraints="NO" id="cVm-TR-Wq8">
<rect key="frame" x="20" y="13" width="30" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="7Xp-l5-6MV"/>
<constraint firstAttribute="width" constant="30" id="8Q5-36-QHV"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FR4-MQ-dIg">
<rect key="frame" x="58" y="14" width="250" height="16"/>
<constraints>
<constraint firstAttribute="height" constant="16" id="moQ-Gu-2LA"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="time" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="a3b-1A-jn7">
<rect key="frame" x="58" y="32" width="250" height="13"/>
<constraints>
<constraint firstAttribute="height" constant="13" id="wav-Qb-ivs"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="sk4-Fo-gsa">
<rect key="frame" x="13" y="56" width="347" height="1"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="Bf7-nc-9f6"/>
</constraints>
</view>
</subviews>
<constraints>
<constraint firstItem="sk4-Fo-gsa" firstAttribute="leading" secondItem="HdF-15-fk0" secondAttribute="leading" constant="13" id="6WK-cM-pXf"/>
<constraint firstItem="FR4-MQ-dIg" firstAttribute="leading" secondItem="cVm-TR-Wq8" secondAttribute="trailing" constant="8" id="GbB-7G-pav"/>
<constraint firstAttribute="bottom" secondItem="sk4-Fo-gsa" secondAttribute="bottom" id="Gfg-gn-rmP"/>
<constraint firstItem="cVm-TR-Wq8" firstAttribute="centerY" secondItem="HdF-15-fk0" secondAttribute="centerY" id="Xdf-dZ-hDg"/>
<constraint firstAttribute="trailing" secondItem="FR4-MQ-dIg" secondAttribute="trailing" id="dGA-3Z-JX1"/>
<constraint firstItem="a3b-1A-jn7" firstAttribute="leading" secondItem="cVm-TR-Wq8" secondAttribute="trailing" constant="8" id="h4l-59-1o3"/>
<constraint firstItem="cVm-TR-Wq8" firstAttribute="leading" secondItem="HdF-15-fk0" secondAttribute="leadingMargin" constant="12" id="lS5-JS-KBV"/>
<constraint firstAttribute="trailing" secondItem="a3b-1A-jn7" secondAttribute="trailing" id="rN8-1D-tU2"/>
<constraint firstItem="FR4-MQ-dIg" firstAttribute="top" secondItem="HdF-15-fk0" secondAttribute="top" constant="14" id="wiy-8Y-25F"/>
<constraint firstItem="a3b-1A-jn7" firstAttribute="top" secondItem="FR4-MQ-dIg" secondAttribute="bottom" constant="2" id="z1n-gg-TaK"/>
<constraint firstAttribute="trailing" secondItem="sk4-Fo-gsa" secondAttribute="trailing" constant="-52" id="zAo-GG-46K"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="timeLable" destination="a3b-1A-jn7" id="eel-hZ-XEm"/>
<outlet property="titleLabel" destination="FR4-MQ-dIg" id="0NY-Ku-MbK"/>
</connections>
</tableViewCell>
</prototypes>
<connections>
Expand All @@ -267,7 +318,7 @@
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="QYS-Q8-65f" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="3382" y="79"/>
<point key="canvasLocation" x="3381.5999999999999" y="78.710644677661179"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="uvo-J6-quU">
Expand Down Expand Up @@ -303,7 +354,10 @@
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="8cd-eJ-9CE" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2543.1999999999998" y="77.811094452773617"/>
<point key="canvasLocation" x="2730" y="80"/>
</scene>
</scenes>
<resources>
<image name="book_icon" width="140" height="140"/>
</resources>
</document>
14 changes: 14 additions & 0 deletions iOSClientForPerfect/iOSClientForPerfect/Model/ContentModel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// ContentModel.swift
// iOSClientForPerfect
//
// Created by Mr.LuDashi on 2016/12/6.
// Copyright © 2016年 ZeluLi. All rights reserved.
//

import Foundation
class ContentModel {
var title = ""
var content = ""
var createTime = ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import Foundation
class UserModel {
public var userId: String = ""
public var userName: String = ""
public var password: String = ""
public var password: String = "" //先当Token,正常是不能存储密码的
public var regestTime: String = ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
//
// ContentReqest.swift
// iOSClientForPerfect
//
// Created by Mr.LuDashi on 2016/12/6.
// Copyright © 2016年 ZeluLi. All rights reserved.
//

import Foundation
class ContentRequest: BaseRequest {
func fetchContentList(userId: String){
let requestPath = "\(RequestHome)\(RequestContentList)"
let request = Request(start: {
self.start()
}, success: { (json) in
guard let list = json as? [String: Any] else {
return
}


var contents: Array<ContentModel> = []

if list["list"] != nil {
guard let contentList = list["list"]! as? [[String:String]] else {
return
}

for item in contentList {
let contentModels = ContentModel()
guard let title = item["title"] else {
continue
}
contentModels.title = title

guard let time = item["time"] else {
continue
}
contentModels.createTime = time

contents.append(contentModels)
}
}

self.success(contents)

}) { (errorMessage) in
self.faile(errorMessage)
}
let params: [String:String] = ["userId": userId]
request.postRequest(path: "\(requestPath)", parameters: params)
}

func fetchContentDetail(contentId: String){
let requestPath = "\(RequestHome)\(RequestContentDetail)"
let request = Request(start: {
self.start()
}, success: { (json) in
guard let contentDetail = json as? [String: Any] else {
return
}

let contentModel = ContentModel()

if contentDetail["list"] != nil {
guard let content = contentDetail["list"]! as? [String:String] else {
return
}

contentModel.title = content["title"] ?? ""
contentModel.content = content["content"] ?? ""
contentModel.createTime = content["createTime"] ?? ""

}

self.success(contentModel)

}) { (errorMessage) in
self.faile(errorMessage)
}

let params: [String:String] = ["contentId": contentId]
request.postRequest(path: "\(requestPath)", parameters: params)
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ let RequestHome = "http://127.0.0.1:8181"
let RequestUserInfoPath = "/queryUserInfoByUserName"
let RequestUserLogin = "/login"
let RequestUserRegister = "/register"
let RequestContentList = "/contentList"
let RequestContentDetail = "/contentDetail"


Loading

0 comments on commit ede2142

Please sign in to comment.