mirror of
https://github.com/wahyd4/libr-ios.git
synced 2026-08-09 05:06:46 +10:00
注册用户,以及ui调整
This commit is contained in:
@@ -5,7 +5,6 @@ use_frameworks!
|
||||
target 'librx' do
|
||||
pod 'RESideMenu', '~> 4.0.7'
|
||||
pod 'Alamofire', '~> 2.0'
|
||||
# pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git', :branch => 'xcode7.1'
|
||||
pod 'SwiftyJSON', '~> 2.3.1'
|
||||
pod 'Spring', :git => 'https://github.com/MengTo/Spring.git', :branch => 'swift2'
|
||||
pod 'JSONWebToken', '~> 1.4.0'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9052" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9040"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
|
||||
@@ -1108,31 +1108,26 @@
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" verticalHuggingPriority="252" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="用户名" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Y2X-jo-oLB">
|
||||
<rect key="frame" x="173" y="94" width="255" height="30"/>
|
||||
<animations/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="255" id="YUJ-Ht-0DL"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
</textField>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" verticalHuggingPriority="252" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="密码" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="cpu-Tk-fUU">
|
||||
<rect key="frame" x="173" y="132" width="255" height="30"/>
|
||||
<rect key="frame" x="173" y="338" width="255" height="30"/>
|
||||
<animations/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="255" id="Ymy-Ux-w68"/>
|
||||
<constraint firstAttribute="width" constant="255" id="e8y-Dj-khI"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
</textField>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="HB2-uZ-jZA">
|
||||
<rect key="frame" x="173" y="170" width="255" height="32"/>
|
||||
<rect key="frame" x="173" y="376" width="255" height="32"/>
|
||||
<animations/>
|
||||
<color key="backgroundColor" red="0.1529411765" green="0.61176470589999998" blue="0.92156862750000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="255" id="Vp7-LO-FuI"/>
|
||||
<constraint firstAttribute="height" constant="32" id="rId-j3-5o2"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" name="AvenirNext-Regular" family="Avenir Next" pointSize="14"/>
|
||||
<state key="normal" title="登录">
|
||||
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<color key="titleColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<color key="titleShadowColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
@@ -1140,8 +1135,12 @@
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="sWV-hY-NHv">
|
||||
<rect key="frame" x="173" y="210" width="255" height="32"/>
|
||||
<rect key="frame" x="173" y="416" width="255" height="32"/>
|
||||
<animations/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="255" id="OUc-61-eJ9"/>
|
||||
<constraint firstAttribute="height" constant="32" id="UA6-h1-Tip"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" name="AvenirNext-Regular" family="Avenir Next" pointSize="14"/>
|
||||
<state key="normal" title="新浪微博登录">
|
||||
<color key="titleColor" red="0.97647064920000004" green="0.34901961679999999" blue="0.1294117719" alpha="1" colorSpace="deviceRGB"/>
|
||||
@@ -1151,45 +1150,87 @@
|
||||
<action selector="signupWithWeibo:" destination="rEs-RQ-eVA" eventType="touchUpInside" id="4H9-mS-c79"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Ddt-50-5SH">
|
||||
<rect key="frame" x="279" y="536" width="44" height="44"/>
|
||||
<animations/>
|
||||
<color key="backgroundColor" red="0.97647064920000004" green="0.34901961679999999" blue="0.1294117719" alpha="1" colorSpace="deviceRGB"/>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Logo_Max" translatesAutoresizingMaskIntoConstraints="NO" id="MSA-uv-1uF">
|
||||
<rect key="frame" x="225" y="100" width="150" height="150"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="44" id="PdF-SC-SHY"/>
|
||||
<constraint firstAttribute="height" constant="44" id="VLh-9w-rt0"/>
|
||||
<constraint firstAttribute="width" constant="150" id="BHT-kj-yqP"/>
|
||||
<constraint firstAttribute="height" constant="150" id="pyz-wd-ECJ"/>
|
||||
</constraints>
|
||||
<color key="tintColor" red="0.18039215689999999" green="0.56470588239999997" blue="0.92549019610000005" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<state key="normal" image="icon-close">
|
||||
<color key="titleColor" red="0.18039215689999999" green="0.56470588239999997" blue="0.92549019610000005" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="titleShadowColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
</imageView>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="邮箱地址" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="LuJ-4O-IoB">
|
||||
<rect key="frame" x="173" y="300" width="255" height="30"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="255" id="1NX-lg-Z3z"/>
|
||||
<constraint firstAttribute="width" constant="225" id="51z-35-rw6"/>
|
||||
<constraint firstAttribute="width" constant="255" id="7o8-Lo-3uE"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="255" id="bTc-A1-Rft"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
<exclude reference="1NX-lg-Z3z"/>
|
||||
<exclude reference="51z-35-rw6"/>
|
||||
<exclude reference="bTc-A1-Rft"/>
|
||||
</mask>
|
||||
</variation>
|
||||
</textField>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6ZB-oh-mVA">
|
||||
<rect key="frame" x="349" y="453" width="79" height="24"/>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="10"/>
|
||||
<state key="normal" title="返回"/>
|
||||
<connections>
|
||||
<segue destination="GHF-5j-X2W" kind="unwind" unwindAction="unwindToHome:" id="7Jb-Fp-VWi"/>
|
||||
<segue destination="GHF-5j-X2W" kind="unwind" unwindAction="unwindToHome:" id="UlG-oi-4Lp"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="0Xa-9Y-Cal">
|
||||
<rect key="frame" x="216" y="453" width="113" height="24"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="113" id="24a-Cq-J0H"/>
|
||||
<constraint firstAttribute="width" constant="255" id="jS6-Dx-aTs"/>
|
||||
<constraint firstAttribute="height" constant="24" id="xRY-eM-1Um"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="10"/>
|
||||
<state key="normal" title="还没有账号?注册一个"/>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
<exclude reference="jS6-Dx-aTs"/>
|
||||
</mask>
|
||||
</variation>
|
||||
<connections>
|
||||
<segue destination="j4i-y0-BY9" kind="show" id="6Bx-a2-yQY"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<animations/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstItem="Y2X-jo-oLB" firstAttribute="centerX" secondItem="HLZ-lg-Qw6" secondAttribute="centerX" id="1fy-ae-GHg"/>
|
||||
<constraint firstItem="cpu-Tk-fUU" firstAttribute="top" secondItem="Y2X-jo-oLB" secondAttribute="bottom" constant="8" id="1k5-uO-DJm"/>
|
||||
<constraint firstItem="HB2-uZ-jZA" firstAttribute="top" secondItem="cpu-Tk-fUU" secondAttribute="bottom" constant="8" id="G2h-gN-UXZ"/>
|
||||
<constraint firstAttribute="centerX" secondItem="sWV-hY-NHv" secondAttribute="centerX" id="JTs-Wr-Bjf"/>
|
||||
<constraint firstAttribute="centerX" secondItem="Ddt-50-5SH" secondAttribute="centerX" constant="-1" id="KB4-4q-0pZ"/>
|
||||
<constraint firstItem="HB2-uZ-jZA" firstAttribute="width" secondItem="cpu-Tk-fUU" secondAttribute="width" id="QmH-Mb-PfG"/>
|
||||
<constraint firstItem="HB2-uZ-jZA" firstAttribute="width" secondItem="sWV-hY-NHv" secondAttribute="width" id="T9Q-t2-YTX"/>
|
||||
<constraint firstItem="sWV-hY-NHv" firstAttribute="top" secondItem="HB2-uZ-jZA" secondAttribute="bottom" constant="8" id="eOx-9K-itB"/>
|
||||
<constraint firstItem="F6i-0U-9Hk" firstAttribute="top" secondItem="Ddt-50-5SH" secondAttribute="bottom" constant="20" id="i8z-X2-JNW"/>
|
||||
<constraint firstAttribute="centerX" secondItem="cpu-Tk-fUU" secondAttribute="centerX" id="mEx-3U-K4a"/>
|
||||
<constraint firstItem="Y2X-jo-oLB" firstAttribute="width" secondItem="cpu-Tk-fUU" secondAttribute="width" id="nEX-Fd-GFM"/>
|
||||
<constraint firstItem="Y2X-jo-oLB" firstAttribute="top" secondItem="NKw-zF-9q3" secondAttribute="bottom" constant="74" id="wL1-Bi-TXE"/>
|
||||
<constraint firstAttribute="centerX" secondItem="HB2-uZ-jZA" secondAttribute="centerX" id="xCd-Lf-Jnx"/>
|
||||
<constraint firstItem="0Xa-9Y-Cal" firstAttribute="centerX" secondItem="HLZ-lg-Qw6" secondAttribute="centerX" id="4TE-KT-zPR"/>
|
||||
<constraint firstItem="MSA-uv-1uF" firstAttribute="top" secondItem="NKw-zF-9q3" secondAttribute="bottom" constant="80" id="7pC-g9-YZB"/>
|
||||
<constraint firstItem="cpu-Tk-fUU" firstAttribute="centerX" secondItem="HLZ-lg-Qw6" secondAttribute="centerX" id="D7h-3U-SKu"/>
|
||||
<constraint firstItem="6ZB-oh-mVA" firstAttribute="trailing" secondItem="HB2-uZ-jZA" secondAttribute="trailing" id="Utj-X3-cBO"/>
|
||||
<constraint firstItem="MSA-uv-1uF" firstAttribute="centerX" secondItem="HLZ-lg-Qw6" secondAttribute="centerX" id="XyQ-X5-Tfg"/>
|
||||
<constraint firstItem="sWV-hY-NHv" firstAttribute="top" secondItem="HB2-uZ-jZA" secondAttribute="bottom" constant="8" id="YiN-uy-TxC"/>
|
||||
<constraint firstItem="6ZB-oh-mVA" firstAttribute="top" secondItem="sWV-hY-NHv" secondAttribute="bottom" constant="5" id="bh9-F7-jXr"/>
|
||||
<constraint firstItem="LuJ-4O-IoB" firstAttribute="centerX" secondItem="HLZ-lg-Qw6" secondAttribute="centerX" id="clt-s8-bdV"/>
|
||||
<constraint firstItem="0Xa-9Y-Cal" firstAttribute="top" secondItem="sWV-hY-NHv" secondAttribute="bottom" constant="5" id="gG2-bE-plR"/>
|
||||
<constraint firstItem="0Xa-9Y-Cal" firstAttribute="centerX" secondItem="HLZ-lg-Qw6" secondAttribute="centerX" constant="-27.5" id="hPv-7A-vyN"/>
|
||||
<constraint firstItem="sWV-hY-NHv" firstAttribute="centerX" secondItem="HLZ-lg-Qw6" secondAttribute="centerX" id="kiF-07-yYa"/>
|
||||
<constraint firstItem="HB2-uZ-jZA" firstAttribute="centerX" secondItem="HLZ-lg-Qw6" secondAttribute="centerX" id="prt-NB-EOe"/>
|
||||
<constraint firstItem="cpu-Tk-fUU" firstAttribute="top" secondItem="LuJ-4O-IoB" secondAttribute="bottom" constant="8" symbolic="YES" id="swz-Ro-Jec"/>
|
||||
<constraint firstItem="HB2-uZ-jZA" firstAttribute="top" secondItem="cpu-Tk-fUU" secondAttribute="bottom" constant="8" id="tOF-bv-WXo"/>
|
||||
<constraint firstItem="6ZB-oh-mVA" firstAttribute="leading" secondItem="0Xa-9Y-Cal" secondAttribute="trailing" constant="20" id="vc3-Jj-aMB"/>
|
||||
<constraint firstItem="LuJ-4O-IoB" firstAttribute="top" secondItem="MSA-uv-1uF" secondAttribute="bottom" constant="50" id="wEt-Jr-ClQ"/>
|
||||
</constraints>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
<exclude reference="4TE-KT-zPR"/>
|
||||
</mask>
|
||||
</variation>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="closeButton" destination="Ddt-50-5SH" id="0RJ-zi-3DF"/>
|
||||
<outlet property="emailTextField" destination="Y2X-jo-oLB" id="UNi-Qb-Dic"/>
|
||||
<outlet property="emailTextField" destination="LuJ-4O-IoB" id="9Vh-0m-eVR"/>
|
||||
<outlet property="loginButton" destination="HB2-uZ-jZA" id="2Ol-rR-iDj"/>
|
||||
<outlet property="passwordTextField" destination="cpu-Tk-fUU" id="vLI-ZW-Vs9"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
@@ -1198,6 +1239,104 @@
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-3903" y="5044"/>
|
||||
</scene>
|
||||
<!--注册-->
|
||||
<scene sceneID="TWu-Fa-urh">
|
||||
<objects>
|
||||
<viewController title="注册" id="j4i-y0-BY9" customClass="LogupViewController" customModule="librx" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="lOO-na-YYo"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="DqC-vn-Xo0"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="G5V-Dp-TVN">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" verticalHuggingPriority="252" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="邮箱地址" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="iIB-9r-imp">
|
||||
<rect key="frame" x="173" y="300" width="255" height="30"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="255" id="eGm-o4-qD5"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
</textField>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" verticalHuggingPriority="252" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="密码" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="N24-6p-UIN">
|
||||
<rect key="frame" x="173" y="338" width="255" height="30"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="255" id="LaL-Xd-xh9"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
</textField>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Jg8-5r-KsY">
|
||||
<rect key="frame" x="173" y="376" width="255" height="32"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="255" id="ogc-7k-siZ"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" name="AvenirNext-Regular" family="Avenir Next" pointSize="14"/>
|
||||
<state key="normal" title="注册">
|
||||
<color key="titleShadowColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="signupButtonPressed:" destination="rEs-RQ-eVA" eventType="touchDown" id="3wu-rD-a6A"/>
|
||||
<action selector="sigupBtnPressed:" destination="j4i-y0-BY9" eventType="touchUpInside" id="i79-dI-t7p"/>
|
||||
</connections>
|
||||
</button>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Logo_Max" translatesAutoresizingMaskIntoConstraints="NO" id="w6U-wb-Wim">
|
||||
<rect key="frame" x="225" y="100" width="150" height="150"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="150" id="fzJ-D9-kXt"/>
|
||||
<constraint firstAttribute="width" constant="150" id="u2y-Wk-bsY"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5Qs-7r-0jb">
|
||||
<rect key="frame" x="173" y="416" width="255" height="26"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="255" id="gm0-7S-nuO"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" name="AvenirNext-Regular" family="Avenir Next" pointSize="10"/>
|
||||
<state key="normal" title="返回">
|
||||
<color key="titleShadowColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="signupButtonPressed:" destination="rEs-RQ-eVA" eventType="touchDown" id="yIA-rh-KZT"/>
|
||||
<segue destination="f8E-VA-Fy3" kind="unwind" unwindAction="unwindToViewController:" id="uLs-bK-eRt"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstItem="N24-6p-UIN" firstAttribute="centerX" secondItem="G5V-Dp-TVN" secondAttribute="centerX" id="4Vf-TU-WXS"/>
|
||||
<constraint firstItem="Jg8-5r-KsY" firstAttribute="top" secondItem="N24-6p-UIN" secondAttribute="bottom" constant="8" id="7j2-XY-C3p"/>
|
||||
<constraint firstItem="iIB-9r-imp" firstAttribute="top" secondItem="w6U-wb-Wim" secondAttribute="bottom" constant="50" id="Nmq-j2-9Ec"/>
|
||||
<constraint firstItem="iIB-9r-imp" firstAttribute="centerX" secondItem="G5V-Dp-TVN" secondAttribute="centerX" id="RWa-X8-c11"/>
|
||||
<constraint firstItem="w6U-wb-Wim" firstAttribute="centerX" secondItem="G5V-Dp-TVN" secondAttribute="centerX" constant="-25" id="SlQ-b3-1hg"/>
|
||||
<constraint firstItem="5Qs-7r-0jb" firstAttribute="top" secondItem="Jg8-5r-KsY" secondAttribute="bottom" constant="8" id="cbT-gl-Hh4"/>
|
||||
<constraint firstItem="w6U-wb-Wim" firstAttribute="centerX" secondItem="G5V-Dp-TVN" secondAttribute="centerX" id="fJa-cC-lXo"/>
|
||||
<constraint firstItem="Jg8-5r-KsY" firstAttribute="centerX" secondItem="G5V-Dp-TVN" secondAttribute="centerX" id="kx7-fo-fvL"/>
|
||||
<constraint firstItem="N24-6p-UIN" firstAttribute="top" secondItem="iIB-9r-imp" secondAttribute="bottom" constant="8" id="pkY-Fm-WN0"/>
|
||||
<constraint firstItem="5Qs-7r-0jb" firstAttribute="centerX" secondItem="G5V-Dp-TVN" secondAttribute="centerX" id="uJN-SD-ph5"/>
|
||||
<constraint firstItem="w6U-wb-Wim" firstAttribute="top" secondItem="lOO-na-YYo" secondAttribute="bottom" constant="80" id="w8g-Y4-fxP"/>
|
||||
</constraints>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
<exclude reference="SlQ-b3-1hg"/>
|
||||
</mask>
|
||||
</variation>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="backButton" destination="5Qs-7r-0jb" id="Xty-kZ-VKL"/>
|
||||
<outlet property="passwordTextField" destination="N24-6p-UIN" id="pnS-MJ-Jrm"/>
|
||||
<outlet property="signupButton" destination="Jg8-5r-KsY" id="NUu-RG-vRe"/>
|
||||
<outlet property="usernameTextField" destination="iIB-9r-imp" id="2pL-13-9cP"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="kXj-0k-afy" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
<exit id="f8E-VA-Fy3" userLabel="Exit" sceneMemberID="exit"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-3101" y="5044"/>
|
||||
</scene>
|
||||
<!--创建分享-->
|
||||
<scene sceneID="pp1-zy-mbC">
|
||||
<objects>
|
||||
@@ -1583,6 +1722,7 @@
|
||||
<image name="Lightning" width="32" height="32"/>
|
||||
<image name="Like" width="32" height="32"/>
|
||||
<image name="LikeEmpty" width="32" height="32"/>
|
||||
<image name="Logo_Max" width="200" height="200"/>
|
||||
<image name="Plus" width="25" height="25"/>
|
||||
<image name="Python" width="32" height="32"/>
|
||||
<image name="Settings" width="25" height="25"/>
|
||||
@@ -1592,7 +1732,6 @@
|
||||
<image name="action-share" width="19" height="27"/>
|
||||
<image name="background" width="600" height="310"/>
|
||||
<image name="default" width="62" height="62"/>
|
||||
<image name="icon-close" width="19" height="20"/>
|
||||
</resources>
|
||||
<inferredMetricsTieBreakers>
|
||||
<segue reference="dIc-VY-jD3"/>
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.1</string>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
|
||||
@@ -12,11 +12,17 @@ import SwiftyJSON
|
||||
struct JsonPaser{
|
||||
|
||||
private static let defaultThumail = "http://7pn5d3.com1.z0.glb.clouddn.com/9050353.png"
|
||||
private static let defaultAvatar = "http://7xlrny.com1.z0.glb.clouddn.com/avatars/files/12/test4.png"
|
||||
|
||||
static func parseProfile(json: JSON) -> Profile {
|
||||
|
||||
let id: Int = json["id"].int!
|
||||
let avatar: String = json["avatar"].string!
|
||||
|
||||
var avatar = defaultAvatar
|
||||
if let _avatar = json["avatar"].string {
|
||||
avatar = _avatar
|
||||
}
|
||||
|
||||
let name:String = json["name"].string!
|
||||
let email:String = json["email"].string!
|
||||
let followed:Bool = json["followed"].bool!
|
||||
|
||||
+39
-15
@@ -235,27 +235,51 @@ struct LibrxService {
|
||||
.response{(_,_, json, _) in
|
||||
|
||||
let data = JSON(data: json!)
|
||||
let jwt = data["user"]["token"].stringValue
|
||||
handleUserInfo(data, response: response)
|
||||
|
||||
let name = data["user"]["name"].stringValue
|
||||
let email = data["user"]["email"].stringValue
|
||||
let id = data["user"]["id"].intValue
|
||||
|
||||
do {
|
||||
|
||||
let payload = try JWT.decode(jwt, algorithm: .HS256(email))
|
||||
let token: String = payload["token"]! as! String
|
||||
let user = User(id: id, name: name, email: email, token: token)
|
||||
|
||||
response(user: user)
|
||||
} catch{
|
||||
response(user: nil)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static func signUp(email: String, password: String, response: (user:User?) ->()) {
|
||||
|
||||
let urlString = baseURL + ResourcePath.SignUp.description
|
||||
let parameters = [
|
||||
"user[email]": email,
|
||||
"user[password]": password,
|
||||
"user[password_confirmation]": password
|
||||
]
|
||||
|
||||
Alamofire.request(.POST, urlString, parameters: parameters).response { (req, res, data, error) -> Void in
|
||||
|
||||
let json = JSON(data: data!)
|
||||
print(json)
|
||||
handleUserInfo(json, response: response)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static func handleUserInfo(data: JSON, response: (user:User?) ->()) {
|
||||
|
||||
let jwt = data["user"]["token"].stringValue
|
||||
|
||||
let name = data["user"]["name"].stringValue
|
||||
let email = data["user"]["email"].stringValue
|
||||
let id = data["user"]["id"].intValue
|
||||
|
||||
do {
|
||||
let payload = try JWT.decode(jwt, algorithm: .HS256(email))
|
||||
let token: String = payload["token"]! as! String
|
||||
let user = User(id: id, name: name, email: email, token: token)
|
||||
response(user: user)
|
||||
} catch{
|
||||
response(user: nil)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
static func postDetails(postId: Int, response: (Post) -> ()){
|
||||
|
||||
let urlString = baseURL + ResourcePath.Post(postId: postId).description
|
||||
|
||||
@@ -16,32 +16,26 @@ class LoginViewController: UIViewController {
|
||||
|
||||
@IBOutlet weak var emailTextField: UITextField!
|
||||
@IBOutlet weak var passwordTextField: UITextField!
|
||||
@IBOutlet weak var closeButton: UIButton!
|
||||
@IBOutlet weak var loginButton: UIButton!
|
||||
|
||||
weak var delegate: LoginViewControllerDelegate?
|
||||
|
||||
override func viewDidLoad() {
|
||||
|
||||
super.viewDidLoad()
|
||||
|
||||
let translation = CGAffineTransformMakeTranslation(0, 100)
|
||||
let scale = CGAffineTransformMakeScale(0.0, 0.0)
|
||||
|
||||
self.closeButton.transform = CGAffineTransformConcat(translation, scale)
|
||||
passwordTextField.secureTextEntry = true
|
||||
self.loginButton.layer.borderWidth = 1
|
||||
self.loginButton.layer.borderColor = UIColor.lightGrayColor().CGColor
|
||||
|
||||
}
|
||||
|
||||
override func viewDidAppear(animated: Bool) {
|
||||
|
||||
UIView.animateWithDuration(0.214, delay: 0.0, options: UIViewAnimationOptions.CurveEaseIn, animations: {
|
||||
|
||||
let translation = CGAffineTransformMakeTranslation(0, 0)
|
||||
let scale = CGAffineTransformMakeScale(1, 1)
|
||||
|
||||
self.closeButton.transform = CGAffineTransformConcat(translation, scale)
|
||||
|
||||
}, completion: nil)
|
||||
if let _ = LocalStore.accessToken() {
|
||||
self.delegate?.loginViewControllerDidLogin(self)
|
||||
self.dismissViewControllerAnimated(true, completion: nil)
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -64,7 +58,6 @@ class LoginViewController: UIViewController {
|
||||
UMSocialDataService.defaultDataService().requestSnsInformation(UMShareToSina, completion: {(res:UMSocialResponseEntity!) ->Void in
|
||||
let data = res.data
|
||||
print(data)
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// LogupViewController.swift
|
||||
// librx
|
||||
//
|
||||
// Created by Yunlong Zheng on 15/10/27.
|
||||
// Copyright © 2015年 librx. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class LogupViewController: UIViewController {
|
||||
|
||||
@IBOutlet weak var usernameTextField: UITextField!
|
||||
@IBOutlet weak var passwordTextField: UITextField!
|
||||
@IBOutlet weak var signupButton: UIButton!
|
||||
@IBOutlet weak var backButton: UIButton!
|
||||
|
||||
func alert(message: String) {
|
||||
let alc = UIAlertController(title: message, message: nil, preferredStyle: UIAlertControllerStyle.Alert)
|
||||
alc.addAction(UIAlertAction(title: "确定", style: UIAlertActionStyle.Cancel, handler: nil))
|
||||
self.presentViewController(alc, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
self.passwordTextField.secureTextEntry = true
|
||||
self.signupButton.layer.borderWidth = 1
|
||||
self.signupButton.layer.borderColor = UIColor.lightGrayColor().CGColor
|
||||
|
||||
}
|
||||
|
||||
|
||||
@IBAction func sigupBtnPressed(sender: AnyObject) {
|
||||
|
||||
let username: String = usernameTextField.text!
|
||||
let password: String = passwordTextField.text!
|
||||
|
||||
print("\(username):\(password)")
|
||||
|
||||
LibrxService.signUp(username, password: password) { (user) -> () in
|
||||
|
||||
if let _user = user {
|
||||
LocalStore.setAccessToken(_user.token)
|
||||
LocalStore.setAccessUserId(_user.id)
|
||||
self.dismissViewControllerAnimated(true, completion: nil)
|
||||
}else {
|
||||
self.alert(NSLocalizedString("username or password error", comment:"for login error"))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user