瀏覽代碼

上传修改cdn域名

Steven 1 年之前
父節點
當前提交
a2418d1805

+ 6 - 0
KulexiuForTeacher/KulexiuForTeacher.xcodeproj/project.pbxproj

@@ -874,6 +874,7 @@
 		BC8418462AC2D9FB00D8F90E /* PasswordCheckBodyView.m in Sources */ = {isa = PBXBuildFile; fileRef = BC8418442AC2D9FB00D8F90E /* PasswordCheckBodyView.m */; };
 		BC86CB172AC2E72000450EED /* KSNewConfirmAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = BC86CB162AC2E72000450EED /* KSNewConfirmAlertView.m */; };
 		BC86CB192AC2E72500450EED /* KSNewConfirmAlertView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BC86CB182AC2E72500450EED /* KSNewConfirmAlertView.xib */; };
+		BC86CB1C2AC2F22200450EED /* UIImageView+DisplayImage.m in Sources */ = {isa = PBXBuildFile; fileRef = BC86CB1A2AC2F22100450EED /* UIImageView+DisplayImage.m */; };
 		BC8831002873D26000C702A0 /* LiveVideoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = BC8830FE2873D25F00C702A0 /* LiveVideoModel.m */; };
 		BC8831042873D67C00C702A0 /* LiveVideoCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = BC8831022873D67C00C702A0 /* LiveVideoCollectionViewCell.m */; };
 		BC8831052873D67C00C702A0 /* LiveVideoCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = BC8831032873D67C00C702A0 /* LiveVideoCollectionViewCell.xib */; };
@@ -2724,6 +2725,8 @@
 		BC86CB152AC2E72000450EED /* KSNewConfirmAlertView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KSNewConfirmAlertView.h; sourceTree = "<group>"; };
 		BC86CB162AC2E72000450EED /* KSNewConfirmAlertView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KSNewConfirmAlertView.m; sourceTree = "<group>"; };
 		BC86CB182AC2E72500450EED /* KSNewConfirmAlertView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KSNewConfirmAlertView.xib; sourceTree = "<group>"; };
+		BC86CB1A2AC2F22100450EED /* UIImageView+DisplayImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImageView+DisplayImage.m"; sourceTree = "<group>"; };
+		BC86CB1B2AC2F22100450EED /* UIImageView+DisplayImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImageView+DisplayImage.h"; sourceTree = "<group>"; };
 		BC8830FE2873D25F00C702A0 /* LiveVideoModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LiveVideoModel.m; sourceTree = "<group>"; };
 		BC8830FF2873D25F00C702A0 /* LiveVideoModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LiveVideoModel.h; sourceTree = "<group>"; };
 		BC8831012873D67B00C702A0 /* LiveVideoCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LiveVideoCollectionViewCell.h; sourceTree = "<group>"; };
@@ -3856,6 +3859,8 @@
 		277930C527E30FBD0010E277 /* Category */ = {
 			isa = PBXGroup;
 			children = (
+				BC86CB1B2AC2F22100450EED /* UIImageView+DisplayImage.h */,
+				BC86CB1A2AC2F22100450EED /* UIImageView+DisplayImage.m */,
 				BC0D951F2AC2870300E54D3F /* UIViewController+KSExtension.h */,
 				BC0D95202AC2870400E54D3F /* UIViewController+KSExtension.m */,
 				BCDB092F280583C000D0BDAD /* NSObject+KSDateFormatter.h */,
@@ -8742,6 +8747,7 @@
 				27BC3B1827F2B0D200D81E30 /* kSJXCollectionView.m in Sources */,
 				BCB6340927F6A35700ACFDCF /* LiveroomTimeManager.m in Sources */,
 				27F9030627E86CBD00C08A19 /* DeviceCheckView.m in Sources */,
+				BC86CB1C2AC2F22200450EED /* UIImageView+DisplayImage.m in Sources */,
 				275B16EF27EAF9B20081FDEF /* ChatNavView.m in Sources */,
 				BCA353E92859A6FB00377661 /* MusicRoomHomeworkCell.m in Sources */,
 				BCEA752028190CEB00886A86 /* CardBandResultViewController.m in Sources */,

+ 19 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/Tools/Category/UIImageView+DisplayImage.h

@@ -0,0 +1,19 @@
+//
+//  UIImageView+DisplayImage.h
+//  KulexiuForStudent
+//
+//  Created by 王智 on 2023/9/26.
+//
+
+#import <UIKit/UIKit.h>
+
+typedef void(^KSCacheImageCallback)(UIImage * _Nonnull image);
+NS_ASSUME_NONNULL_BEGIN
+
+@interface UIImageView (DisplayImage)
+
+- (void)displayImageWithUrl:(NSURL *)imageUrl placeholder:(UIImage *)placeholderImage defaultImage:(UIImage *)defaultImage callback:(KSCacheImageCallback)callback;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 27 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/Tools/Category/UIImageView+DisplayImage.m

@@ -0,0 +1,27 @@
+//
+//  UIImageView+DisplayImage.m
+//  KulexiuForStudent
+//
+//  Created by 王智 on 2023/9/26.
+//
+
+#import "UIImageView+DisplayImage.h"
+
+@implementation UIImageView (DisplayImage)
+
+- (void)displayImageWithUrl:(NSURL *)imageUrl placeholder:(UIImage *)placeholderImage defaultImage:(UIImage *)defaultImage callback:(KSCacheImageCallback)callback {
+    [self sd_setImageWithURL:imageUrl placeholderImage:placeholderImage completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
+        if (error) {
+            if (callback) {
+                callback(defaultImage);
+            }
+        }
+        else {
+            if (callback) {
+                callback(image);
+            }
+        }
+    }];
+}
+
+@end

+ 2 - 1
KulexiuForTeacher/KulexiuForTeacher/Common/Tools/KSUploadManager.m

@@ -54,7 +54,7 @@
 
 - (void)configTXCloud {
     QCloudServiceConfiguration *configuration = [QCloudServiceConfiguration new];
-    QCloudCOSXMLEndPoint *endpoint = [[QCloudCOSXMLEndPoint alloc] init];
+    QCloudCOSXMLEndPoint *endpoint = [[QCloudCOSXMLEndPoint alloc] initWithLiteralURL:[NSURL URLWithString:@"oss.dayaedu.com"]];
     endpoint.regionName = @"ap-nanjing";
     // 适使用HTTPS
     endpoint.useHTTPS = YES;
@@ -263,6 +263,7 @@
         }
     }
 }
+
 - (void)request:(KS3Request *)request didReceiveResponse:(NSURLResponse *)response {
     NSInteger statusCode = ((NSHTTPURLResponse*) response).statusCode;
     if ( (statusCode>= 200 && statusCode <300) || statusCode == 304) {

+ 8 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/Setting/Controller/UserSettingViewController.m

@@ -22,6 +22,7 @@
 #import "UserInfoManager.h"
 #import <RSKImageCropper/RSKImageCropper.h>
 #import "KSSmallChoosePicker.h"
+#import "UIImageView+DisplayImage.h"
 
 @interface UserSettingViewController ()<RSKImageCropViewControllerDelegate>
 
@@ -35,6 +36,8 @@
 
 @property (nonatomic, assign) NSInteger lastChooseIndex;
 
+@property (nonatomic, strong) UIImage *preDisplayImage;
+
 @end
 
 @implementation UserSettingViewController
@@ -57,10 +60,14 @@
 
 - (void)configMessage {
     if (![NSString isEmptyString:self.mineInfo.heardUrl]) {
-        [self.bodyView.userAvatal sd_setImageWithURL:[NSURL URLWithString:[self.mineInfo.heardUrl getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:USERDEFAULT_LOGO]];
+        [self.bodyView.userAvatal displayImageWithUrl:[NSURL URLWithString:[self.mineInfo.heardUrl getUrlEndcodeString]] placeholder:self.preDisplayImage defaultImage:[UIImage imageNamed:USERDEFAULT_LOGO] callback:^(UIImage * _Nonnull image) {
+            self.preDisplayImage = image;
+        }];
     }
     else {
         [self.bodyView.userAvatal setImage:[UIImage imageNamed:USERDEFAULT_LOGO]];
+        self.preDisplayImage = [UIImage imageNamed:USERDEFAULT_LOGO];
+
     }
     self.bodyView.nickNameLabel.text = [NSString returnNoNullStringWithString:self.mineInfo.username];
     NSString *userSex = @"";

+ 5 - 22
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/Setting/View/ModifyNameBodyView.xib

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
     <device id="retina6_1" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -16,32 +16,18 @@
                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2Nv-ef-xne">
                     <rect key="frame" x="0.0" y="20" width="414" height="56"/>
                     <subviews>
-                        <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入昵称" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="OMl-cn-8aR">
-                            <rect key="frame" x="14" y="0.0" width="350" height="56"/>
+                        <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入昵称" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="OMl-cn-8aR">
+                            <rect key="frame" x="14" y="0.0" width="386" height="56"/>
                             <color key="textColor" red="0.1019607843" green="0.1019607843" blue="0.1019607843" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                             <fontDescription key="fontDescription" type="system" pointSize="16"/>
                             <textInputTraits key="textInputTraits"/>
                         </textField>
-                        <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="nwh-W6-YBV">
-                            <rect key="frame" x="374" y="8" width="40" height="40"/>
-                            <constraints>
-                                <constraint firstAttribute="width" constant="40" id="8LK-BQ-Wtw"/>
-                                <constraint firstAttribute="height" constant="40" id="gKf-pk-YfV"/>
-                            </constraints>
-                            <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
-                            <state key="normal" image="modify_cancel"/>
-                            <connections>
-                                <action selector="clearAction:" destination="iN0-l3-epB" eventType="touchUpInside" id="unc-PQ-L5I"/>
-                            </connections>
-                        </button>
                     </subviews>
                     <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                     <constraints>
                         <constraint firstAttribute="height" constant="56" id="7R5-BM-RP3"/>
-                        <constraint firstItem="nwh-W6-YBV" firstAttribute="leading" secondItem="OMl-cn-8aR" secondAttribute="trailing" constant="10" id="Nir-ds-2sG"/>
-                        <constraint firstAttribute="trailing" secondItem="nwh-W6-YBV" secondAttribute="trailing" id="RUk-xL-fwg"/>
+                        <constraint firstAttribute="trailing" secondItem="OMl-cn-8aR" secondAttribute="trailing" constant="14" id="Ajo-9G-cxC"/>
                         <constraint firstAttribute="bottom" secondItem="OMl-cn-8aR" secondAttribute="bottom" id="gQC-pB-6Mz"/>
-                        <constraint firstItem="nwh-W6-YBV" firstAttribute="centerY" secondItem="2Nv-ef-xne" secondAttribute="centerY" id="hFY-ej-9Ab"/>
                         <constraint firstItem="OMl-cn-8aR" firstAttribute="top" secondItem="2Nv-ef-xne" secondAttribute="top" id="nNg-cL-rZs"/>
                         <constraint firstItem="OMl-cn-8aR" firstAttribute="leading" secondItem="2Nv-ef-xne" secondAttribute="leading" constant="14" id="tQ2-bG-4dt"/>
                     </constraints>
@@ -77,7 +63,4 @@
             <point key="canvasLocation" x="132" y="33"/>
         </view>
     </objects>
-    <resources>
-        <image name="modify_cancel" width="15" height="15"/>
-    </resources>
 </document>

+ 6 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/View/MineHeadView.m

@@ -7,6 +7,7 @@
 
 #import "MineHeadView.h"
 #import "KSStarView.h"
+#import "UIImageView+DisplayImage.h"
 
 @interface MineHeadView ()
 
@@ -33,6 +34,8 @@
 
 @property (weak, nonatomic) IBOutlet NSLayoutConstraint *secondImageWidth;
 
+@property (nonatomic, strong) UIImage *preDisplayImage;
+
 @end
 
 @implementation MineHeadView
@@ -109,7 +112,9 @@
     self.starView.rate = infoMessage.starGrade / 5.0f;
     
     if (![NSString isEmptyString:infoMessage.heardUrl]) {
-        [self.userAvatal sd_setImageWithURL:[NSURL URLWithString:[infoMessage.heardUrl getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:USERDEFAULT_LOGO]];
+        [self.userAvatal displayImageWithUrl:[NSURL URLWithString:[infoMessage.heardUrl getUrlEndcodeString]] placeholder:self.preDisplayImage defaultImage:[UIImage imageNamed:USERDEFAULT_LOGO] callback:^(UIImage * _Nonnull image) {
+            self.preDisplayImage = image;
+        }];
     }
     else {
         [self.userAvatal setImage:[UIImage imageNamed:USERDEFAULT_LOGO]];