Commit c32525ec authored by Sandy's avatar Sandy

文件上传类封装

parent e07121cd
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
8F4BFD071F2F3314003EA16B /* GalleryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F4BFD031F2F3314003EA16B /* GalleryViewController.m */; }; 8F4BFD071F2F3314003EA16B /* GalleryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F4BFD031F2F3314003EA16B /* GalleryViewController.m */; };
8F4BFD081F2F3314003EA16B /* SingleScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F4BFD051F2F3314003EA16B /* SingleScrollView.m */; }; 8F4BFD081F2F3314003EA16B /* SingleScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F4BFD051F2F3314003EA16B /* SingleScrollView.m */; };
8F4BFD0A1F2F3596003EA16B /* ZJPicture.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8F4BFD091F2F3596003EA16B /* ZJPicture.storyboard */; }; 8F4BFD0A1F2F3596003EA16B /* ZJPicture.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8F4BFD091F2F3596003EA16B /* ZJPicture.storyboard */; };
8F4BFD0D1F3019AC003EA16B /* SalesInputTotalVIew.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F4BFD0C1F3019AC003EA16B /* SalesInputTotalVIew.m */; };
8F6C92381F2ADF4F0060E983 /* HomeWeatherBoard.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F6C92371F2ADF4F0060E983 /* HomeWeatherBoard.m */; }; 8F6C92381F2ADF4F0060E983 /* HomeWeatherBoard.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F6C92371F2ADF4F0060E983 /* HomeWeatherBoard.m */; };
8F6C923B1F2ADFEC0060E983 /* WeatherModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F6C923A1F2ADFEC0060E983 /* WeatherModel.m */; }; 8F6C923B1F2ADFEC0060E983 /* WeatherModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F6C923A1F2ADFEC0060E983 /* WeatherModel.m */; };
8F6C923E1F2AE3430060E983 /* HomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F6C923D1F2AE3430060E983 /* HomeViewController.m */; }; 8F6C923E1F2AE3430060E983 /* HomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F6C923D1F2AE3430060E983 /* HomeViewController.m */; };
...@@ -229,6 +230,8 @@ ...@@ -229,6 +230,8 @@
8F4BFD041F2F3314003EA16B /* SingleScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SingleScrollView.h; sourceTree = "<group>"; }; 8F4BFD041F2F3314003EA16B /* SingleScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SingleScrollView.h; sourceTree = "<group>"; };
8F4BFD051F2F3314003EA16B /* SingleScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SingleScrollView.m; sourceTree = "<group>"; }; 8F4BFD051F2F3314003EA16B /* SingleScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SingleScrollView.m; sourceTree = "<group>"; };
8F4BFD091F2F3596003EA16B /* ZJPicture.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = ZJPicture.storyboard; sourceTree = "<group>"; }; 8F4BFD091F2F3596003EA16B /* ZJPicture.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = ZJPicture.storyboard; sourceTree = "<group>"; };
8F4BFD0B1F3019AC003EA16B /* SalesInputTotalVIew.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SalesInputTotalVIew.h; sourceTree = "<group>"; };
8F4BFD0C1F3019AC003EA16B /* SalesInputTotalVIew.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SalesInputTotalVIew.m; sourceTree = "<group>"; };
8F6C92361F2ADF4F0060E983 /* HomeWeatherBoard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomeWeatherBoard.h; sourceTree = "<group>"; }; 8F6C92361F2ADF4F0060E983 /* HomeWeatherBoard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomeWeatherBoard.h; sourceTree = "<group>"; };
8F6C92371F2ADF4F0060E983 /* HomeWeatherBoard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HomeWeatherBoard.m; sourceTree = "<group>"; }; 8F6C92371F2ADF4F0060E983 /* HomeWeatherBoard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HomeWeatherBoard.m; sourceTree = "<group>"; };
8F6C92391F2ADFEC0060E983 /* WeatherModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeatherModel.h; sourceTree = "<group>"; }; 8F6C92391F2ADFEC0060E983 /* WeatherModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeatherModel.h; sourceTree = "<group>"; };
...@@ -631,6 +634,8 @@ ...@@ -631,6 +634,8 @@
8F4BFCCE1F2EF508003EA16B /* Views */ = { 8F4BFCCE1F2EF508003EA16B /* Views */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
8F4BFD0B1F3019AC003EA16B /* SalesInputTotalVIew.h */,
8F4BFD0C1F3019AC003EA16B /* SalesInputTotalVIew.m */,
8F4BFCEC1F2F0F16003EA16B /* SaleInputAmountCollectionViewCell.h */, 8F4BFCEC1F2F0F16003EA16B /* SaleInputAmountCollectionViewCell.h */,
8F4BFCED1F2F0F16003EA16B /* SaleInputAmountCollectionViewCell.m */, 8F4BFCED1F2F0F16003EA16B /* SaleInputAmountCollectionViewCell.m */,
8F4BFCE01F2F02CB003EA16B /* SaleInputTopView.h */, 8F4BFCE01F2F02CB003EA16B /* SaleInputTopView.h */,
...@@ -1150,6 +1155,7 @@ ...@@ -1150,6 +1155,7 @@
8F973C1F1F21FD54003D3ADB /* ViewController.m in Sources */, 8F973C1F1F21FD54003D3ADB /* ViewController.m in Sources */,
8F4BFCC51F2EDCAF003EA16B /* BusinessFunctionModel.m in Sources */, 8F4BFCC51F2EDCAF003EA16B /* BusinessFunctionModel.m in Sources */,
8F250D451F297DA80031B4BC /* XWFilterAnimator+XWBarSwipe.m in Sources */, 8F250D451F297DA80031B4BC /* XWFilterAnimator+XWBarSwipe.m in Sources */,
8F4BFD0D1F3019AC003EA16B /* SalesInputTotalVIew.m in Sources */,
8F4BFCFA1F2F32D5003EA16B /* InspectRepairAddPicTableViewCell.m in Sources */, 8F4BFCFA1F2F32D5003EA16B /* InspectRepairAddPicTableViewCell.m in Sources */,
8F250D841F29C14F0031B4BC /* LoginViewModel.m in Sources */, 8F250D841F29C14F0031B4BC /* LoginViewModel.m in Sources */,
8FEF5E7E1F285E56001496E3 /* UIViewController+Additions.m in Sources */, 8FEF5E7E1F285E56001496E3 /* UIViewController+Additions.m in Sources */,
......
...@@ -414,6 +414,9 @@ ...@@ -414,6 +414,9 @@
</userDefinedRuntimeAttribute> </userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/> <userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
</userDefinedRuntimeAttributes> </userDefinedRuntimeAttributes>
<connections>
<action selector="actionSubmit:" destination="28i-0U-BU7" eventType="touchUpInside" id="zLk-6s-8al"/>
</connections>
</button> </button>
</subviews> </subviews>
<color key="backgroundColor" red="1" green="0.9999405146" blue="0.99998033050000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="1" green="0.9999405146" blue="0.99998033050000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
...@@ -427,9 +430,149 @@ ...@@ -427,9 +430,149 @@
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="54" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="ByU-Du-Lfu"> <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="54" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="ByU-Du-Lfu">
<rect key="frame" x="0.0" y="120" width="375" height="483"/> <rect key="frame" x="0.0" y="120" width="375" height="483"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<view key="tableHeaderView" contentMode="scaleToFill" id="53i-tk-Lrb" customClass="SalesInputTotalVIew">
<rect key="frame" x="0.0" y="0.0" width="375" height="140"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="QEw-E2-1OO">
<rect key="frame" x="0.0" y="0.0" width="375" height="100"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="本单合计(元)" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5gG-68-cw6">
<rect key="frame" x="0.0" y="13" width="183.5" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="erL-yW-0wJ"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="本单笔数(笔)" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="IWe-eM-ZBJ">
<rect key="frame" x="191.5" y="13" width="183.5" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="tDD-nm-uWD"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="x2a-xO-2MI">
<rect key="frame" x="73" y="46" width="38" height="42"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gal-KS-YYd">
<rect key="frame" x="10" y="4" width="18" height="34"/>
<fontDescription key="fontDescription" type="system" pointSize="28"/>
<color key="textColor" red="0.9859483242" green="0.0" blue="0.026950567960000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="42" id="6R9-gT-8fk"/>
<constraint firstItem="gal-KS-YYd" firstAttribute="leading" secondItem="x2a-xO-2MI" secondAttribute="leading" constant="10" id="Tam-lg-nTJ"/>
<constraint firstItem="gal-KS-YYd" firstAttribute="centerX" secondItem="x2a-xO-2MI" secondAttribute="centerX" id="hQb-Vk-qvk"/>
<constraint firstItem="gal-KS-YYd" firstAttribute="centerY" secondItem="x2a-xO-2MI" secondAttribute="centerY" id="ksH-oD-1tw"/>
<constraint firstAttribute="trailing" secondItem="gal-KS-YYd" secondAttribute="trailing" constant="10" id="lyZ-hx-tCM"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3ev-dH-Cco">
<rect key="frame" x="275" y="50" width="18" height="34"/>
<fontDescription key="fontDescription" type="system" pointSize="28"/>
<color key="textColor" red="0.8991458416" green="0.0" blue="0.1079747528" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="1" borderStyle="roundedRect" placeholder="请输入笔数" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="GHZ-Kt-wIe">
<rect key="frame" x="232" y="45" width="104" height="45"/>
<constraints>
<constraint firstAttribute="height" constant="45" id="DgZ-d4-v71"/>
<constraint firstAttribute="width" constant="104" id="M9U-Sm-sJP"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="45" id="iiI-Da-JgX"/>
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" keyboardType="numbersAndPunctuation"/>
</textField>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="uEI-Gb-BQv">
<rect key="frame" x="0.0" y="99" width="375" height="1"/>
<color key="backgroundColor" red="0.92144894600000005" green="0.92063152790000002" blue="0.94577074049999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="HFP-Xj-yOr"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="BRK-Kx-Jpi">
<rect key="frame" x="187" y="13" width="1" height="79"/>
<color key="backgroundColor" red="0.92144894600000005" green="0.92063152790000002" blue="0.94577074049999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="1" id="f5k-KZ-qNG"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="1" green="0.99997437" blue="0.99999129769999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="uEI-Gb-BQv" firstAttribute="leading" secondItem="QEw-E2-1OO" secondAttribute="leading" id="A34-Ed-EBA"/>
<constraint firstItem="BRK-Kx-Jpi" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="x2a-xO-2MI" secondAttribute="trailing" constant="4" id="Br1-xJ-r6z"/>
<constraint firstItem="BRK-Kx-Jpi" firstAttribute="centerX" secondItem="QEw-E2-1OO" secondAttribute="centerX" id="CL1-MI-gHs"/>
<constraint firstAttribute="bottom" secondItem="uEI-Gb-BQv" secondAttribute="bottom" id="HaG-er-7gg"/>
<constraint firstItem="BRK-Kx-Jpi" firstAttribute="top" secondItem="QEw-E2-1OO" secondAttribute="top" constant="13" id="J2t-HC-Ofj"/>
<constraint firstItem="x2a-xO-2MI" firstAttribute="top" secondItem="5gG-68-cw6" secondAttribute="bottom" constant="12" id="LCE-0e-kD8"/>
<constraint firstItem="5gG-68-cw6" firstAttribute="width" secondItem="IWe-eM-ZBJ" secondAttribute="width" id="NLo-6C-UEb"/>
<constraint firstItem="GHZ-Kt-wIe" firstAttribute="centerY" secondItem="gal-KS-YYd" secondAttribute="centerY" id="Nhc-Wc-E4m"/>
<constraint firstItem="uEI-Gb-BQv" firstAttribute="top" secondItem="BRK-Kx-Jpi" secondAttribute="bottom" constant="7" id="OAB-dr-SLO"/>
<constraint firstItem="IWe-eM-ZBJ" firstAttribute="top" secondItem="QEw-E2-1OO" secondAttribute="top" constant="13" id="V2E-Ss-FFw"/>
<constraint firstItem="3ev-dH-Cco" firstAttribute="centerX" secondItem="IWe-eM-ZBJ" secondAttribute="centerX" id="Voi-5b-5nk"/>
<constraint firstItem="IWe-eM-ZBJ" firstAttribute="leading" secondItem="5gG-68-cw6" secondAttribute="trailing" constant="8" id="W4B-Sg-8ju"/>
<constraint firstAttribute="trailing" secondItem="IWe-eM-ZBJ" secondAttribute="trailing" id="WU8-qp-UC3"/>
<constraint firstItem="x2a-xO-2MI" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="QEw-E2-1OO" secondAttribute="leading" constant="4" id="YD2-cu-c54"/>
<constraint firstItem="x2a-xO-2MI" firstAttribute="centerX" secondItem="5gG-68-cw6" secondAttribute="centerX" id="ZFi-8n-P7K"/>
<constraint firstItem="GHZ-Kt-wIe" firstAttribute="centerX" secondItem="IWe-eM-ZBJ" secondAttribute="centerX" id="ckR-5g-wD7"/>
<constraint firstItem="IWe-eM-ZBJ" firstAttribute="leading" secondItem="5gG-68-cw6" secondAttribute="trailing" constant="8" id="eGb-OE-QM7"/>
<constraint firstItem="5gG-68-cw6" firstAttribute="top" secondItem="QEw-E2-1OO" secondAttribute="top" constant="13" id="hKx-lk-MIc"/>
<constraint firstAttribute="trailing" secondItem="uEI-Gb-BQv" secondAttribute="trailing" id="kJ9-8q-FkL"/>
<constraint firstAttribute="height" constant="100" id="keS-1g-d2V"/>
<constraint firstItem="3ev-dH-Cco" firstAttribute="centerY" secondItem="gal-KS-YYd" secondAttribute="centerY" id="w7f-Pv-6fv"/>
<constraint firstItem="5gG-68-cw6" firstAttribute="leading" secondItem="QEw-E2-1OO" secondAttribute="leading" id="zAw-1m-y4x"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="PS2-L5-eAZ">
<rect key="frame" x="0.0" y="100" width="375" height="40"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="支付明细" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qhb-VO-I6a">
<rect key="frame" x="16" y="7" width="90" height="27"/>
<fontDescription key="fontDescription" type="system" pointSize="22"/>
<color key="textColor" red="0.93035113810000003" green="0.35202065110000003" blue="0.063138075170000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="0.994497776" green="0.97084438799999995" blue="0.94110399479999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="qhb-VO-I6a" firstAttribute="leading" secondItem="PS2-L5-eAZ" secondAttribute="leading" constant="16" id="daE-0E-s5P"/>
<constraint firstItem="qhb-VO-I6a" firstAttribute="centerY" secondItem="PS2-L5-eAZ" secondAttribute="centerY" id="pXV-aS-vl7"/>
<constraint firstAttribute="height" constant="40" id="wes-a3-HwI"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="1" green="0.99997437" blue="0.99999129769999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="PS2-L5-eAZ" secondAttribute="trailing" id="BkQ-S7-Y00"/>
<constraint firstItem="PS2-L5-eAZ" firstAttribute="top" secondItem="QEw-E2-1OO" secondAttribute="bottom" id="GbN-Dd-q8a"/>
<constraint firstItem="QEw-E2-1OO" firstAttribute="leading" secondItem="53i-tk-Lrb" secondAttribute="leading" id="LVk-YE-r1A"/>
<constraint firstItem="QEw-E2-1OO" firstAttribute="top" secondItem="53i-tk-Lrb" secondAttribute="top" id="LZU-77-o9T"/>
<constraint firstAttribute="trailing" secondItem="QEw-E2-1OO" secondAttribute="trailing" id="NNh-3j-SS4"/>
<constraint firstItem="PS2-L5-eAZ" firstAttribute="leading" secondItem="53i-tk-Lrb" secondAttribute="leading" id="qTl-AR-rIv"/>
<constraint firstAttribute="bottom" secondItem="PS2-L5-eAZ" secondAttribute="bottom" id="v7E-kP-uX1"/>
</constraints>
<variation key="default">
<mask key="constraints">
<exclude reference="v7E-kP-uX1"/>
</mask>
</variation>
<connections>
<outlet property="labelTotal" destination="gal-KS-YYd" id="g7E-rS-Gsp"/>
<outlet property="textFieldBillCount" destination="GHZ-Kt-wIe" id="jZ8-D6-Wv1"/>
<outlet property="viewRedBac" destination="x2a-xO-2MI" id="PUV-Yd-ETx"/>
</connections>
</view>
<prototypes> <prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="SaleInputAddAmountCell" rowHeight="50" id="Skf-PJ-7lK" customClass="SaleInputAddAmountCell"> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="SaleInputAddAmountCell" rowHeight="50" id="Skf-PJ-7lK" customClass="SaleInputAddAmountCell">
<rect key="frame" x="0.0" y="28" width="375" height="50"/> <rect key="frame" x="0.0" y="168" width="375" height="50"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Skf-PJ-7lK" id="I5Y-dB-SbA"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Skf-PJ-7lK" id="I5Y-dB-SbA">
<rect key="frame" x="0.0" y="0.0" width="375" height="50"/> <rect key="frame" x="0.0" y="0.0" width="375" height="50"/>
...@@ -475,7 +618,7 @@ ...@@ -475,7 +618,7 @@
</connections> </connections>
</tableViewCell> </tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="InspectRepairAddPicTableViewCell" rowHeight="114" id="bNB-BG-Z0y" customClass="InspectRepairAddPicTableViewCell"> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="InspectRepairAddPicTableViewCell" rowHeight="114" id="bNB-BG-Z0y" customClass="InspectRepairAddPicTableViewCell">
<rect key="frame" x="0.0" y="78" width="375" height="114"/> <rect key="frame" x="0.0" y="218" width="375" height="114"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="bNB-BG-Z0y" id="aER-Cm-gkK"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="bNB-BG-Z0y" id="aER-Cm-gkK">
<rect key="frame" x="0.0" y="0.0" width="375" height="114"/> <rect key="frame" x="0.0" y="0.0" width="375" height="114"/>
...@@ -536,8 +679,8 @@ ...@@ -536,8 +679,8 @@
<outlet property="layOut" destination="d5i-7I-fwZ" id="hYp-Dt-A8j"/> <outlet property="layOut" destination="d5i-7I-fwZ" id="hYp-Dt-A8j"/>
</connections> </connections>
</tableViewCell> </tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="b3J-hs-7Am"> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="header" id="b3J-hs-7Am">
<rect key="frame" x="0.0" y="192" width="375" height="54"/> <rect key="frame" x="0.0" y="332" width="375" height="54"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="b3J-hs-7Am" id="uuZ-Ph-fa6"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="b3J-hs-7Am" id="uuZ-Ph-fa6">
<rect key="frame" x="0.0" y="0.0" width="375" height="54"/> <rect key="frame" x="0.0" y="0.0" width="375" height="54"/>
...@@ -597,6 +740,7 @@ ...@@ -597,6 +740,7 @@
<connections> <connections>
<outlet property="btnBottom" destination="pGM-pq-sCr" id="Taa-zY-MVJ"/> <outlet property="btnBottom" destination="pGM-pq-sCr" id="Taa-zY-MVJ"/>
<outlet property="tableView" destination="ByU-Du-Lfu" id="EYl-ha-xkO"/> <outlet property="tableView" destination="ByU-Du-Lfu" id="EYl-ha-xkO"/>
<outlet property="totalView" destination="53i-tk-Lrb" id="Jgr-zL-cHb"/>
</connections> </connections>
</viewController> </viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="8BI-14-Fwd" userLabel="First Responder" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="8BI-14-Fwd" userLabel="First Responder" sceneMemberID="firstResponder"/>
......
...@@ -10,14 +10,16 @@ ...@@ -10,14 +10,16 @@
#import "SaleInputViewModel.h" #import "SaleInputViewModel.h"
#import "SaleInputAmountCollectionViewCell.h" #import "SaleInputAmountCollectionViewCell.h"
#import "SaleInputAddAmountCell.h" #import "SaleInputAddAmountCell.h"
#import "PicViewModel.h"
#import "InspectRepairAddPicTableViewCell.h" #import "InspectRepairAddPicTableViewCell.h"
#import "CalculateHelper.h"
#import "SalesInputTotalVIew.h"
@interface SaleInputAddViewController ()<UITableViewDelegate, UITableViewDataSource> @interface SaleInputAddViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *tableView; @property (weak, nonatomic) IBOutlet UITableView *tableView;
/** 计算本单合计、输入总笔数 */
@property (nonatomic, weak) IBOutlet SalesInputTotalVIew *totalView;
@property (weak, nonatomic) IBOutlet UIButton *btnBottom; @property (weak, nonatomic) IBOutlet UIButton *btnBottom;
@property (strong, nonatomic) SaleInputViewModel *viewModel; @property (strong, nonatomic) SaleInputViewModel *viewModel;
@property (strong, nonatomic) NSMutableArray *arrData; @property (strong, nonatomic) NSMutableArray *arrData;
@property (strong, nonatomic) PicViewModel *picVM;
@end @end
@implementation SaleInputAddViewController @implementation SaleInputAddViewController
...@@ -45,11 +47,24 @@ ...@@ -45,11 +47,24 @@
} }
} }
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
if (section == 0) {
return 0;
}else{
return 50;
}
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"header"];
return cell.contentView;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == 0) { if (indexPath.section == 0) {
return 50; return 50;
}else{ }else{
return self.picVM.cellHeight; return self.viewModel.picVM.cellHeight;
} }
} }
...@@ -59,31 +74,45 @@ ...@@ -59,31 +74,45 @@
SaleInputAddAmountCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SaleInputAddAmountCell" forIndexPath:indexPath]; SaleInputAddAmountCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SaleInputAddAmountCell" forIndexPath:indexPath];
cell.isEdit = self.viewModel.type != SaleInputTypeReadOnly; cell.isEdit = self.viewModel.type != SaleInputTypeReadOnly;
[cell configCellWithArray:self.arrData indexPath:indexPath]; [cell configCellWithArray:self.arrData indexPath:indexPath];
// WS(weakSelf); WS(weakSelf);
cell.blockNumberChanged = ^{ cell.blockNumberChanged = ^{
// [weakSelf allInputMoney]; [weakSelf allInputMoney];
}; };
return cell; return cell;
}else{ }else{
InspectRepairAddPicTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"InspectRepairAddPicTableViewCell" forIndexPath:indexPath]; InspectRepairAddPicTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"InspectRepairAddPicTableViewCell" forIndexPath:indexPath];
[cell configCellWithViewModel:self.picVM [cell configCellWithViewModel:self.viewModel.picVM
indexPath:indexPath indexPath:indexPath
target:self]; target:self];
WS(weakSelf); WS(weakSelf);
cell.blockReloadData = ^{ cell.blockReloadData = ^{
[weakSelf.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] [weakSelf.tableView reloadSections:[NSIndexSet indexSetWithIndex:1] withRowAnimation:UITableViewRowAnimationFade];
withRowAnimation:UITableViewRowAnimationAutomatic];
}; };
return cell; return cell;
} }
} }
- (void)allInputMoney {
NSDecimalNumber *allInputMoney = nil;
for (HMSaleInputDetail_payments *cellModel in self.arrData) {
allInputMoney = [CalculateHelper calculateNum1:allInputMoney num2:cellModel.total type:CalculateTypeAdd];
}
//本单合计
self.totalView.labelTotal.text = [CalculateHelper getMoneyStringFrom:allInputMoney];
}
- (void)httpPayments { - (void)httpPayments {
} }
#pragma mark - actions
- (IBAction)actionSubmit:(id)sender {
[self.viewModel httpUpload];
}
ZJLazy(SaleInputViewModel, viewModel); ZJLazy(SaleInputViewModel, viewModel);
ZJLazy(NSMutableArray, arrData); ZJLazy(NSMutableArray, arrData);
ZJLazy(PicViewModel, picVM);
@end @end
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
self.query.dateRange.beginDate = @"2016-07-12"; self.query.dateRange.beginDate = @"2016-07-12";
self.query.dateRange.endDate = @"2017-07-13"; self.query.dateRange.endDate = @"2017-07-13";
WS(weakSelf); WS(weakSelf);
[ZJHttpManager POST:@"hdmall/api/sale/getList" parameters:self.query.toDictionary complete:^(id responseObject, NSError *error) { [ZJHttpManager POST:@"hdmall/salesinput/query" parameters:self.query.toDictionary complete:^(id responseObject, NSError *error) {
if (kIsResponse) { if (kIsResponse) {
}else{ }else{
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "HMSaleInputDetail.h" #import "HMSaleInputDetail.h"
#import "PicViewModel.h"
typedef NS_ENUM(NSInteger, SaleInputType) { typedef NS_ENUM(NSInteger, SaleInputType) {
SaleInputTypeCreate, SaleInputTypeCreate,
SaleInputTypeEdit, SaleInputTypeEdit,
...@@ -15,6 +17,7 @@ typedef NS_ENUM(NSInteger, SaleInputType) { ...@@ -15,6 +17,7 @@ typedef NS_ENUM(NSInteger, SaleInputType) {
}; };
@interface SaleInputViewModel : NSObject @interface SaleInputViewModel : NSObject
@property (assign, nonatomic) SaleInputType type; @property (assign, nonatomic) SaleInputType type;
@property (strong, nonatomic) PicViewModel *picVM;
/** /**
获取全部支付方式 获取全部支付方式
...@@ -22,4 +25,6 @@ typedef NS_ENUM(NSInteger, SaleInputType) { ...@@ -22,4 +25,6 @@ typedef NS_ENUM(NSInteger, SaleInputType) {
@param callBack 获取到支付方式的回调(如果arrPayments = nil, 则代表请求失败) @param callBack 获取到支付方式的回调(如果arrPayments = nil, 则代表请求失败)
*/ */
- (void)httpAllPayments:(void (^)(NSMutableArray<HMSaleInputDetail_payments *> *arrPayments))callBack; - (void)httpAllPayments:(void (^)(NSMutableArray<HMSaleInputDetail_payments *> *arrPayments))callBack;
- (void)httpUpload;
@end @end
...@@ -34,4 +34,22 @@ ...@@ -34,4 +34,22 @@
} }
}]; }];
} }
- (void)httpUpload {
NSMutableArray *arrImage = [NSMutableArray array];
for (UIImage *img in self.picVM.arrPics) {
ZJBaseFileModel *file = [ZJBaseFileModel new];
file.data = [img imageDataForUpload];
file.name = [file.data md5String];
file.keyName = @"file";
file.mimeType = @"image/jpeg";
[arrImage addObject:file];
}
[ZJHttpManager upLoadFiles:arrImage params:nil commplete:^(NSMutableArray *attachments) {
}];
}
ZJLazy(PicViewModel, picVM);
@end @end
//
// SalesInputTotalVIew.h
// vanke
//
// Created by Z on 16/4/20.
// Copyright © 2016年 gomore. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SalesInputTotalVIew : UIView
@property (weak, nonatomic) IBOutlet UILabel *labelTotal;
@property (weak, nonatomic) IBOutlet UITextField *textFieldBillCount;
@end
//
// SalesInputTotalVIew.m
// vanke
//
// Created by Z on 16/4/20.
// Copyright © 2016年 gomore. All rights reserved.
//
#import "SalesInputTotalVIew.h"
@interface SalesInputTotalVIew ()<UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet UIView *viewRedBac;
@end
@implementation SalesInputTotalVIew
- (void)awakeFromNib {
[super awakeFromNib];
self.viewRedBac.layer.cornerRadius = 7;
self.textFieldBillCount.delegate = self;
}
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
NSArray *valideInput = @[@"0",@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"-",@""];
if ([valideInput containsObject:string]) {
if (textField.text.length > 0 && [string isEqualToString:@"-"]) {
return NO;
}
NSMutableString * futureString = [NSMutableString stringWithString:textField.text];
[futureString insertString:string atIndex:range.location];
if ([futureString hasPrefix:@"0."] ||
[futureString hasPrefix:@"00"] ||
[futureString hasPrefix:@"-0"] ||
futureString.length > 6) {
return NO;
}
NSInteger flag = 0;
NSInteger pointNum = 0;//用于标记-的数量,只能有一个-
const NSInteger limited = 20;//限制小数点后面的位数
for (int i = (int)futureString.length - 1; i>=0; i--) {
if ([futureString characterAtIndex:i] == '-') {
pointNum++;
if (pointNum == 2) {
return NO;
}
}
}
for (int i = (int)futureString.length - 1; i>=0; i--) {
if ([futureString characterAtIndex:i] == '-') {
if (flag > limited) {
return NO;
}
break;
}
flag++;
}
return YES;
}else{
return NO;
}
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
...@@ -27,10 +27,32 @@ ...@@ -27,10 +27,32 @@
<key>NSAllowsArbitraryLoads</key> <key>NSAllowsArbitraryLoads</key>
<true/> <true/>
</dict> </dict>
<key>NSLocationAlwaysUsageDescription</key> <key>NSAppleMusicUsageDescription</key>
<string>App需要您的同意,才能始终访问位置</string> <string>App需要您的同意,才能访问媒体资料库</string>
<key>NSLocationUsageDescription</key> <key>NSBluetoothPeripheralUsageDescription</key>
<string>App需要您的同意,才能访问位置</string> <string>App需要您的同意,才能访问蓝牙</string>
<key>NSCalendarsUsageDescription</key>
<string>App需要您的同意,才能访问日历</string>
<key>NSCameraUsageDescription</key>
<string>App需要您的同意,才能访问相机</string>
<key>NSHealthShareUsageDescription</key>
<string>App需要您的同意,才能访问健康分享</string>
<key>NSHealthUpdateUsageDescription</key>
<string>App需要您的同意,才能访问健康更新 </string>
<key>NSLocationAlwaysUsageDescription</key>
<string>App需要您的同意,才能始终访问位置</string>
<key>NSLocationUsageDescription</key>
<string>App需要您的同意,才能访问位置</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>App需要您的同意,才能在使用期间访问位置</string>
<key>NSMicrophoneUsageDescription</key>
<string>App需要您的同意,才能访问麦克风</string>
<key>NSMotionUsageDescription</key>
<string>App需要您的同意,才能访问运动与健身</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>App需要您的同意,才能访问相册</string>
<key>NSRemindersUsageDescription</key>
<string>App需要您的同意,才能访问提醒事项</string>
<key>UILaunchStoryboardName</key> <key>UILaunchStoryboardName</key>
<string>LaunchScreen</string> <string>LaunchScreen</string>
<key>UIMainStoryboardFile</key> <key>UIMainStoryboardFile</key>
...@@ -39,37 +61,9 @@ ...@@ -39,37 +61,9 @@
<array> <array>
<string>armv7</string> <string>armv7</string>
</array> </array>
<key>NSAppleMusicUsageDescription</key>
<string>App需要您的同意,才能访问媒体资料库</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>App需要您的同意,才能访问蓝牙</string>
<key>NSCalendarsUsageDescription</key>
<string>App需要您的同意,才能访问日历</string>
<key>NSCameraUsageDescription</key>
<string>App需要您的同意,才能访问相机</string>
<key>NSHealthShareUsageDescription</key>
<string>App需要您的同意,才能访问健康分享</string>
<key>NSHealthUpdateUsageDescription</key>
<string>App需要您的同意,才能访问健康更新 </string>
<key>NSLocationAlwaysUsageDescription</key>
<string>App需要您的同意,才能始终访问位置</string>
<key>NSLocationUsageDescription</key>
<string>App需要您的同意,才能访问位置</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>App需要您的同意,才能在使用期间访问位置</string>
<key>NSMicrophoneUsageDescription</key>
<string>App需要您的同意,才能访问麦克风</string>
<key>NSMotionUsageDescription</key>
<string>App需要您的同意,才能访问运动与健身</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>App需要您的同意,才能访问相册</string>
<key>NSRemindersUsageDescription</key>
<string>App需要您的同意,才能访问提醒事项</string>
<key>UISupportedInterfaceOrientations</key> <key>UISupportedInterfaceOrientations</key>
<array> <array>
<string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array> </array>
</dict> </dict>
</plist> </plist>
{
"images" : [
{
"idiom" : "universal",
"filename" : "list_nodata.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "list_nodata@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "list_nodata@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
//BaseClass //BaseClass
#import "BaseViewController.h" #import "BaseViewController.h"
#import "ZJBaseModel.h" #import "ZJBaseModel.h"
#import "ZJBaseFileModel.h"
#import "ZJBaseHttpManager.h" #import "ZJBaseHttpManager.h"
//third //third
...@@ -35,6 +36,7 @@ ...@@ -35,6 +36,7 @@
#import "NSNumber+Addtions.h" #import "NSNumber+Addtions.h"
#import "NSString+Additions.h" #import "NSString+Additions.h"
#import "NSDate+Additions.h" #import "NSDate+Additions.h"
#import "NSData+EncodeAdditions.h"
// Include any system framework and library headers here that should be included in all compilation units. // Include any system framework and library headers here that should be included in all compilation units.
// You will also need to set the Prefix Header build setting of one or more of your targets to reference this file. // You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
self.pageSize = 15; self.pageSize = 15;
self.tableView.delegate = self; self.tableView.delegate = self;
self.tableView.dataSource = self; self.tableView.dataSource = self;
self.tableView.estimatedRowHeight = 159; self.tableView.estimatedRowHeight = 159;
self.tableView.rowHeight = UITableViewAutomaticDimension; self.tableView.rowHeight = UITableViewAutomaticDimension;
if (!self.tableView.tableFooterView) { if (!self.tableView.tableFooterView) {
...@@ -66,7 +65,7 @@ ...@@ -66,7 +65,7 @@
- (void)paggingMode { - (void)paggingMode {
WS(weakSelf); WS(weakSelf);
self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
weakSelf.page = 0; weakSelf.page = 1;
[weakSelf.arrData removeAllObjects]; [weakSelf.arrData removeAllObjects];
/** /**
* 子类里面要重写httpRequest方法 * 子类里面要重写httpRequest方法
...@@ -108,6 +107,15 @@ ...@@ -108,6 +107,15 @@
- (void)emptyDataSet:(UIScrollView *)scrollView didTapView:(UIView *)view { - (void)emptyDataSet:(UIScrollView *)scrollView didTapView:(UIView *)view {
[self.tableView.mj_header beginRefreshing]; [self.tableView.mj_header beginRefreshing];
} }
- (BOOL)emptyDataSetShouldAllowScroll:(UIScrollView *)scrollView {
return YES;
}
- (void)emptyDataSetWillAppear:(UIScrollView *)scrollView {
scrollView.contentOffset = CGPointZero;
}
- (CAAnimation *)imageAnimationForEmptyDataSet:(UIScrollView *)scrollView { - (CAAnimation *)imageAnimationForEmptyDataSet:(UIScrollView *)scrollView {
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform"]; CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform"];
animation.fromValue = [NSValue valueWithCATransform3D:CATransform3DIdentity]; animation.fromValue = [NSValue valueWithCATransform3D:CATransform3DIdentity];
......
...@@ -15,12 +15,21 @@ ...@@ -15,12 +15,21 @@
@property (nonatomic, strong) NSString <Optional> * name; @property (nonatomic, strong) NSString <Optional> * name;
/** 文件上传时的文件类型 */
@property (nonatomic, strong) NSString <Ignore> * mimeType;
/** 文件上传时的key(与后台约定) */
@property (nonatomic, strong) NSString <Ignore> * keyName;
@property (nonatomic, strong) NSString <Ignore> * localPath; @property (nonatomic, strong) NSString <Ignore> * localPath;
@property (strong, nonatomic) UIImage <Ignore> * image; @property (strong, nonatomic) UIImage <Ignore> * image;
@property (strong, nonatomic) NSData <Ignore> * data;
- (instancetype)initWithDictionary:(NSDictionary *)dict; - (instancetype)initWithDictionary:(NSDictionary *)dict;
/** /**
* 显示附件的图片 * 显示附件的图片
* *
......
...@@ -56,4 +56,5 @@ ...@@ -56,4 +56,5 @@
} }
} }
@end @end
...@@ -41,7 +41,8 @@ ...@@ -41,7 +41,8 @@
* *
*/ */
- (UIImage *)scaledToWidth:(NSInteger)newWidth; - (UIImage *)scaledToWidth:(NSInteger)newWidth;
/** 获取用于图片上传的图片data */
- (NSData *)imageDataForUpload;
/** 计算图片大小 */ /** 计算图片大小 */
- (CGFloat)dataSize; - (CGFloat)dataSize;
@end @end
......
...@@ -135,6 +135,12 @@ ...@@ -135,6 +135,12 @@
return scaledImage; return scaledImage;
} }
- (NSData *)imageDataForUpload {
UIImage *imageScaled = [self scaledToWidth:400];
NSData *data = [imageScaled scaledToSpaceMaxSize:80];
return data;
}
/** 计算图片大小 */ /** 计算图片大小 */
- (CGFloat)dataSize { - (CGFloat)dataSize {
NSData *data = UIImageJPEGRepresentation(self, 1); NSData *data = UIImageJPEGRepresentation(self, 1);
......
...@@ -110,8 +110,8 @@ ...@@ -110,8 +110,8 @@
WS(weakSelf); WS(weakSelf);
[imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) { [imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) {
[weakSelf.viewModel.arrPics addObjectsFromArray:photos]; [weakSelf.viewModel.arrPics addObjectsFromArray:photos];
[weakSelf.collectionView reloadData];
weakSelf.blockReloadData(); weakSelf.blockReloadData();
// [weakSelf.collectionView reloadData];
}]; }];
[self.vc presentViewController:imagePickerVc animated:YES completion:nil]; [self.vc presentViewController:imagePickerVc animated:YES completion:nil];
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
// //
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
@class ZJBaseFileModel;
#define ZJHttpManager [ZJBaseHttpManager shareCilent] #define ZJHttpManager [ZJBaseHttpManager shareCilent]
@interface ZJBaseHttpManager : NSObject @interface ZJBaseHttpManager : NSObject
@property (assign, nonatomic) BOOL debugLogEnabled; @property (assign, nonatomic) BOOL debugLogEnabled;
...@@ -27,5 +28,8 @@ ...@@ -27,5 +28,8 @@
- (void)DELETE:(NSString *)URLString - (void)DELETE:(NSString *)URLString
parameters:(id)parameters parameters:(id)parameters
complete:(void (^)(id responseObject, NSError *error))complete; complete:(void (^)(id responseObject, NSError *error))complete;
/** 上传文件 */
- (void)upLoadFiles:(NSArray<ZJBaseFileModel *> *)files
params:(NSDictionary *)params
commplete:(void (^__nullable)(NSMutableArray *attachments))complete;
@end @end
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#import "AFNetworking.h" #import "AFNetworking.h"
#import "ZJShowLogView.h" #import "ZJShowLogView.h"
#import "JSONKit.h" #import "JSONKit.h"
#import "ZJBaseFileModel.h"
@interface ZJBaseHttpManager () @interface ZJBaseHttpManager ()
@property (nonatomic, strong) AFHTTPSessionManager *manager; @property (nonatomic, strong) AFHTTPSessionManager *manager;
...@@ -144,6 +145,41 @@ ...@@ -144,6 +145,41 @@
}]; }];
} }
/** 上传文件 */
- (void)upLoadFiles:(NSArray<ZJBaseFileModel *> *)files
params:(NSDictionary *)params
commplete:(void (^__nullable)(NSMutableArray *attachments))complete{
if (files.count == 0) {
complete(nil);
return;
}
WS(weakSelf);
[self.manager POST:@"hdmall/media/upload" parameters:params constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
for (ZJBaseFileModel *file in files) {
[formData appendPartWithFileData:file.data //data
name:file.keyName //接口key值
fileName:file.name //文件名称,必须有后缀
mimeType:file.mimeType]; //文件类型,后台接受使用
}
} progress:^(NSProgress * _Nonnull uploadProgress) {
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
if (kIsResponse) {
} else {
kFalseHttpTips;
}
[weakSelf logWithUrl:@"hdmall/media/upload" Method:@"UPLOAD" param:params respones:responseObject];
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
[MBProgressHUD j_error:@"上传失败" complete:nil];
[weakSelf logWithUrl:@"hdmall/media/upload" Method:@"UPLOAD" param:params respones:error];
}];
}
/** /**
打印网络请求的详情 打印网络请求的详情
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment