Browse Source

【轻会员】注册成功后跳转订阅逻辑补充

lizhe 1 year ago
parent
commit
53fae53da2

+ 11 - 0
PDF Office/PDF Master/Class/KMLightMember/Controller/Login&Register/KMLoginWindowController.swift

@@ -152,6 +152,17 @@ class KMLoginWindowController: NSWindowController {
             print("注册成功")
         }
         
+        self.registerSuccessView.subscribeAction = { [unowned self] view in
+            loginMainWindow?.endSheet(view.window!)
+            view.window!.close()
+            
+            KMComparativeTableViewController.show(window: loginMainWindow ?? NSWindow())
+            
+            loginWindowController = nil
+            loginMainWindow = nil
+            print("注册成功")
+        }
+        
         //MARK: - 验证码界面
         //验证码界面点击取消按钮
         self.verificationCodeView.cancelAction = { [unowned self] view in

+ 39 - 0
PDF Office/PDF Master/Class/KMLightMember/Controller/Login&Register/View/KMRegisterSuccessView.swift

@@ -8,15 +8,19 @@
 import Cocoa
 
 typealias KMRegisterSuccessViewDoneAction = (_ view: KMRegisterSuccessView) -> Void
+typealias KMRegisterSuccessViewSubscribeAction = (_ view: KMRegisterSuccessView) -> Void
 class KMRegisterSuccessView: KMBaseXibView {
 
     @IBOutlet weak var titleLabel: NSTextField!
     @IBOutlet weak var imageView: NSView!
     @IBOutlet weak var doneButton: NSButton!
+    @IBOutlet var textView: NSTextView!
     
     var doneButtonVC: KMDesignButton!
     
     var doneAction: KMRegisterSuccessViewDoneAction?
+    var subscribeAction: KMRegisterSuccessViewSubscribeAction?
+    
     override func draw(_ dirtyRect: NSRect) {
         super.draw(dirtyRect)
 
@@ -40,6 +44,11 @@ class KMRegisterSuccessView: KMBaseXibView {
         self.doneButtonVC.button.keyEquivalent = KMKeyEquivalent.enter
         self.doneButtonVC.stringValue = NSLocalizedString("Getting Started", comment: "")
         self.doneButtonVC.updateUI()
+        
+        self.textView.delegate = self
+        self.textView.isEditable = false
+        self.textView.frame = (self.textView.enclosingScrollView?.contentView.bounds)!
+        self.textView.autoresizingMask = [.width, .height]
     }
     
     override func reloadData() {
@@ -51,6 +60,24 @@ class KMRegisterSuccessView: KMBaseXibView {
         super.updateLanguage()
         self.titleLabel.stringValue = NSLocalizedString("Register Successfully", comment: "")
         self.doneButtonVC.stringValue = NSLocalizedString("Getting Started", comment: "")
+        
+        let string = NSLocalizedString("Want to save documents with unlimited conversion and no watermark?", comment: "") + "  " + NSLocalizedString("Subscription", comment: "")
+        let attributedString = NSMutableAttributedString.init(string: string)
+        let paragraphStyle = NSMutableParagraphStyle()
+        paragraphStyle.alignment = .center;
+        attributedString.addAttributes([NSAttributedString.Key.font : NSFont.SFProTextRegular(12.0),
+                                        NSAttributedString.Key.foregroundColor : NSColor(hex: "#252629"),
+                                        NSAttributedString.Key.paragraphStyle : paragraphStyle],
+                                    range: NSRange(location: 0, length: string.count))
+        
+        let range = string.range(of: NSLocalizedString("Subscription", comment: ""))
+        attributedString.setAttributes([NSAttributedString.Key.font : NSFont.SFProTextRegular(12.0),
+                                        NSAttributedString.Key.foregroundColor : NSColor(hex: "#1770F4"),
+                                        NSAttributedString.Key.underlineColor : NSColor.clear,
+                                        NSAttributedString.Key.link : "register://"],
+                                       range: string.nsRange(from: range!)!)
+        
+        self.textView.textStorage?.setAttributedString(attributedString)
     }
     
     @IBAction func doneButtonAction(_ sender: Any) {
@@ -59,3 +86,15 @@ class KMRegisterSuccessView: KMBaseXibView {
         callBack(self)
     }
 }
+
+extension KMRegisterSuccessView: NSTextViewDelegate {
+    func textView(_ textView: NSTextView, clickedOnLink link: Any, at charIndex: Int) -> Bool {
+        if link as! String == "register://" {
+            guard let callBack = self.subscribeAction else { return true }
+            
+            print("链接点击")
+            callBack(self)
+        }
+        return true
+    }
+}

+ 35 - 0
PDF Office/PDF Master/Class/KMLightMember/Controller/Login&Register/View/KMRegisterSuccessView.xib

@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
+        <deployment identifier="macosx"/>
         <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
@@ -9,6 +10,7 @@
             <connections>
                 <outlet property="doneButton" destination="BHA-OV-pZP" id="jf3-NX-5Ue"/>
                 <outlet property="imageView" destination="7K1-g6-KF8" id="AWD-Xz-DEM"/>
+                <outlet property="textView" destination="BmK-8g-l4S" id="NkQ-gQ-UJ7"/>
                 <outlet property="titleLabel" destination="4cO-4T-Pi4" id="ClA-UK-hvm"/>
             </connections>
         </customObject>
@@ -67,11 +69,44 @@ DQ
 </string>
                     </buttonCell>
                 </button>
+                <scrollView borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" translatesAutoresizingMaskIntoConstraints="NO" id="acP-iz-Hm7">
+                    <rect key="frame" x="32" y="76" width="262" height="40"/>
+                    <clipView key="contentView" drawsBackground="NO" id="fDR-s5-djl">
+                        <rect key="frame" x="0.0" y="0.0" width="262" height="40"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <textView wantsLayer="YES" editable="NO" drawsBackground="NO" importsGraphics="NO" richText="NO" verticallyResizable="YES" spellingCorrection="YES" smartInsertDelete="YES" id="BmK-8g-l4S">
+                                <rect key="frame" x="0.0" y="0.0" width="262" height="40"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <color key="backgroundColor" red="1" green="0.99843658089999998" blue="0.99619259260000004" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
+                                <size key="minSize" width="262" height="40"/>
+                                <size key="maxSize" width="279" height="10000000"/>
+                                <color key="insertionPointColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                            </textView>
+                        </subviews>
+                        <color key="backgroundColor" red="1" green="0.99843658089999998" blue="0.99619259260000004" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
+                    </clipView>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="40" id="FSj-LD-YRq"/>
+                    </constraints>
+                    <scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="Z2q-0v-7yV">
+                        <rect key="frame" x="-100" y="-100" width="225" height="15"/>
+                        <autoresizingMask key="autoresizingMask"/>
+                    </scroller>
+                    <scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="NO" id="3Xj-gn-5js">
+                        <rect key="frame" x="-100" y="-100" width="15" height="24"/>
+                        <autoresizingMask key="autoresizingMask"/>
+                    </scroller>
+                </scrollView>
             </subviews>
             <constraints>
                 <constraint firstItem="BHA-OV-pZP" firstAttribute="top" secondItem="NLK-Uq-H0v" secondAttribute="bottom" constant="48" id="DTn-v1-N3U"/>
+                <constraint firstAttribute="trailing" secondItem="acP-iz-Hm7" secondAttribute="trailing" constant="32" id="GnA-ws-mF0"/>
+                <constraint firstItem="acP-iz-Hm7" firstAttribute="leading" secondItem="c22-O7-iKe" secondAttribute="leading" constant="32" id="HJt-UG-l1d"/>
+                <constraint firstItem="acP-iz-Hm7" firstAttribute="centerX" secondItem="c22-O7-iKe" secondAttribute="centerX" id="Ki4-63-Ucg"/>
                 <constraint firstItem="NLK-Uq-H0v" firstAttribute="top" secondItem="c22-O7-iKe" secondAttribute="top" constant="82" id="R0u-Ba-L0G"/>
                 <constraint firstItem="BHA-OV-pZP" firstAttribute="centerX" secondItem="c22-O7-iKe" secondAttribute="centerX" id="S1z-ii-bIg"/>
+                <constraint firstItem="acP-iz-Hm7" firstAttribute="top" secondItem="BHA-OV-pZP" secondAttribute="bottom" constant="8" id="Slc-Px-AZS"/>
                 <constraint firstItem="NLK-Uq-H0v" firstAttribute="centerX" secondItem="c22-O7-iKe" secondAttribute="centerX" id="mwJ-eh-RLh"/>
             </constraints>
             <point key="canvasLocation" x="38" y="231.5"/>