Skip to content

Commit

Permalink
launch page
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent authored and vincent committed Feb 13, 2016
1 parent a3eab68 commit f6b50f3
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 48 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
19 changes: 19 additions & 0 deletions FeelingClient/Base.lproj/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<scenes>
<!--View Controller-->
Expand All @@ -16,7 +17,25 @@
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Find Memorise" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qkj-93-U9F">
<rect key="frame" x="198" y="278" width="205" height="43"/>
<fontDescription key="fontDescription" name="ChalkboardSE-Bold" family="Chalkboard SE" pointSize="30"/>
<color key="textColor" red="0.0" green="0.50196081400000003" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="qkj-93-U9F" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="3Mf-d2-1PW"/>
<constraint firstItem="qkj-93-U9F" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="WzD-By-SAq"/>
<constraint firstAttribute="leadingMargin" secondItem="qkj-93-U9F" secondAttribute="leading" id="yVa-pb-DSH"/>
</constraints>
<variation key="default">
<mask key="constraints">
<exclude reference="yVa-pb-DSH"/>
</mask>
</variation>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
Expand Down
51 changes: 29 additions & 22 deletions FeelingClient/ImageUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,35 +25,42 @@ func getAssetThumbnail(asset: PHAsset) -> UIImage {
}

extension UIViewController {

/**
* Called when 'return' key pressed. return NO to ignore.
*/
/**
* Called when 'return' key pressed. return NO to ignore.
*/
func textFieldShouldReturn(textField: UITextField) -> Bool {
textField.resignFirstResponder()
return true
}


/**
* Called when the user click on the view (outside the UITextField).
*/
/**
* Called when the user click on the view (outside the UITextField).
*/
override public func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
self.view.endEditing(true)
}




}

protocol MyAlertMsg{
func alertMsg(str: String ,view: LoginViewController, second: NSTimeInterval)



}
//
//
//
//class LoginViewController: UIViewController, MyAlertMsg {
//

extension MyAlertMsg{
func alertMsg(str: String, view: LoginViewController, second: NSTimeInterval) {
let waveToast = SAWaveToast(text: str, font: .systemFontOfSize(16), fontColor: .darkGrayColor(), waveColor: .cyanColor(), duration: second)
view.presentViewController(waveToast, animated: false, completion: nil)
}
}
// self.alertMsg("帐号或密码为空",view: self, second: 2)
//
//protocol MyAlertMsg{
// func alertMsg(str: String ,view: LoginViewController, second: NSTimeInterval)
//}
//
//extension MyAlertMsg{
// func alertMsg(str: String, view: LoginViewController, second: NSTimeInterval) {
// let waveToast = SAWaveToast(text: str, font: .systemFontOfSize(16), fontColor: .darkGrayColor(), waveColor: .cyanColor(), duration: second)
// view.presentViewController(waveToast, animated: false, completion: nil)
// }
//}
38 changes: 38 additions & 0 deletions FeelingClient/MVC/LaunchViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// LaunchViewController.swift
// FeelingClient
//
// Created by vincent on 13/2/16.
// Copyright © 2016 xecoder. All rights reserved.
//

import UIKit

class LaunchViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

let image = UIImage(named: "horse")
let blurredImage = image!.imageByApplyingBlurWithRadius(3)
self.view.layer.contents = blurredImage.CGImage
// Do any additional setup after loading the view.
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}


/*
// MARK: - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/

}
38 changes: 13 additions & 25 deletions FeelingClient/MVC/LoginViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import IBAnimatable
import SwiftyJSON
import Alamofire

class LoginViewController: UIViewController, MyAlertMsg {
class LoginViewController: UIViewController{

@IBOutlet var username: AnimatableTextField!
@IBOutlet var password: AnimatableTextField!
Expand All @@ -25,43 +25,31 @@ class LoginViewController: UIViewController, MyAlertMsg {
super.viewDidLoad()

let image = UIImage(named: "lonely-children")

let blurredImage = image!.imageByApplyingBlurWithRadius(3)

self.view.layer.contents = blurredImage.CGImage


let register = ActionButtonItem(title: "注册帐号", image: UIImage(named: "new")!)
register.action = { item in }

let forget = ActionButtonItem(title: "忘记密码", image: UIImage(named: "new")!)
forget.action = { item in }

let wechatLogin = ActionButtonItem(title: "微信登录", image: UIImage(named: "wechat")!)
wechatLogin.action = { item in }

let qqLogin = ActionButtonItem(title: "QQ登录", image: UIImage(named: "qq")!)
qqLogin.action = { item in }


let weiboLogin = ActionButtonItem(title: "微博登录", image: UIImage(named: "weibo")!)
weiboLogin.action = { item in }


let taobaoLogin = ActionButtonItem(title: "淘宝登录", image: UIImage(named: "taobao")!)
taobaoLogin.action = { item in
// self.showWalkthrough()
// self.showWalkthrough()
}


actionButton = ActionButton(attachedToView: self.view, items: [register, forget, wechatLogin, qqLogin, weiboLogin, taobaoLogin])
actionButton.action = { button in button.toggleMenu() }
actionButton.setImage(UIImage(named: "new"), forState: .Normal)
actionButton.backgroundColor = UIColor.lightGrayColor()


}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
Expand All @@ -80,8 +68,8 @@ class LoginViewController: UIViewController, MyAlertMsg {
if let json = responseObject {
let myJosn = JSON(json)
let code:Int = Int(myJosn["status"].stringValue)!
if code == 400 {
self.alertMsg(myJosn.dictionary!["detail"]!.stringValue,view: self, second: 2)
if code != 200 {
self.view.makeToast(myJosn.dictionary!["detail"]!.stringValue, duration: 2, position: .Top)
}
else{
self.jwt.token = myJosn.dictionary!["token"]!.stringValue
Expand All @@ -94,19 +82,19 @@ class LoginViewController: UIViewController, MyAlertMsg {
}
else
{
self.alertMsg("帐号或密码为空",view: self, second: 2)
self.view.makeToast("帐号或密码为空", duration: 2, position: .Top)
}

}


/*
// MARK: - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/

Expand All @@ -124,5 +112,5 @@ class LoginViewController: UIViewController, MyAlertMsg {
override func preferredStatusBarStyle() -> UIStatusBarStyle {
return UIStatusBarStyle.LightContent
}

}
5 changes: 4 additions & 1 deletion FeelingClient/common/NetApiAlamofire.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import Alamofire

public class NetApi{

var apiUrl = "http://192.168.137.1:80/"
// var apiUrl = "http://192.168.137.1:80/"
var apiUrl = "http://192.168.1.105/"



func getResult(method: Alamofire.Method,params: [String: AnyObject]?, completionHandler: (NSDictionary?, NSError?) -> ()) {
makeCall(method, section: "login",params: params, completionHandler: completionHandler)
Expand Down

0 comments on commit f6b50f3

Please sign in to comment.