| | |
| | | WXApi.send(req) |
| | | } |
| | | |
| | | /// 分享图片 |
| | | static func sharePic(_ img:UIImage,thumb:UIImage,text:String,scale:CGFloat = 0.6,scene:WXScene = WXSceneTimeline){ |
| | | |
| | | let imageObject = WXImageObject() |
| | | imageObject.imageData = img.pngData()! |
| | | |
| | | let mediaMessage = WXMediaMessage() |
| | | // mediaMessage.thumbData = thumb.pngData()! |
| | | mediaMessage.mediaObject = imageObject |
| | | mediaMessage.title = text |
| | | |
| | | let req = SendMessageToWXReq() |
| | | req.bText = false |
| | | req.message = mediaMessage |
| | | req.scene = Int32(scene.rawValue) |
| | | WXApi.send(req) |
| | | } |
| | | |
| | | /// 分享音乐 |
| | | static func shareMusic(_ musicUrl:String,musicLowBandUrl:String,title:String,desc:String,thumb:UIImage,scene:WXScene = WXSceneSession){ |
| | | let musicObject = WXMusicObject() |
| | |
| | | alert(msg: "请阅读并同意《隐私协议》《用户协议》");return |
| | | } |
| | | |
| | | view.endEditing(true) |
| | | Services.login(phone: tf_phone.text!, code: tf_authCode.text!).subscribe(onNext: {result in |
| | | if var token = result.data?.token{ |
| | | token.request_time = Int(Date().timeIntervalSince1970) |
| | |
| | | </userDefinedRuntimeAttributes> |
| | | </view> |
| | | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="OJ6-0b-fVC"> |
| | | <rect key="frame" x="0.0" y="68" width="597" height="432"/> |
| | | <rect key="frame" x="0.0" y="62" width="597" height="438"/> |
| | | <subviews> |
| | | <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="XW5-ds-CXG"> |
| | | <rect key="frame" x="5" y="5" width="587" height="422"/> |
| | | <rect key="frame" x="5" y="5" width="587" height="428"/> |
| | | <color key="backgroundColor" red="0.94509803920000002" green="0.94509803920000002" blue="0.94509803920000002" alpha="0.84999999999999998" colorSpace="custom" customColorSpace="sRGB"/> |
| | | </imageView> |
| | | <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_success" translatesAutoresizingMaskIntoConstraints="NO" id="eyJ-Qy-E0w"> |
| | | <rect key="frame" x="258.5" y="175.5" width="80" height="81"/> |
| | | <rect key="frame" x="258.5" y="178.5" width="80" height="81"/> |
| | | </imageView> |
| | | </subviews> |
| | | <color key="backgroundColor" systemColor="systemBackgroundColor"/> |
| | |
| | | <constraint firstItem="Xjz-V8-keG" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="5Iq-AY-uUK"/> |
| | | <constraint firstItem="OJ6-0b-fVC" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="6p8-30-BD6"/> |
| | | <constraint firstAttribute="trailing" secondItem="OJ6-0b-fVC" secondAttribute="trailing" id="EAu-4C-peY"/> |
| | | <constraint firstItem="OJ6-0b-fVC" firstAttribute="top" secondItem="Xjz-V8-keG" secondAttribute="bottom" constant="16" id="YpO-u8-Uyg"/> |
| | | <constraint firstItem="OJ6-0b-fVC" firstAttribute="top" secondItem="Xjz-V8-keG" secondAttribute="bottom" constant="10" id="YpO-u8-Uyg"/> |
| | | <constraint firstAttribute="bottom" secondItem="OJ6-0b-fVC" secondAttribute="bottom" constant="10" id="m6e-nJ-ukf"/> |
| | | </constraints> |
| | | <size key="customSize" width="597" height="510"/> |
| | |
| | | super.viewDidLoad() |
| | | |
| | | yy_popBlock = {[weak self] in |
| | | self?.quitAction() |
| | | self?.quitAction(isPop: true) |
| | | } |
| | | |
| | | btn_exit.addTarget(self, action: #selector(quitAction), for: .touchUpInside) |
| | |
| | | } |
| | | case .story1,.story2: |
| | | if let dict = noti.object as? Dictionary<String,Any>{ |
| | | let type = weakSelf.viewModel.listenType.value == .story1 ? 1:0 |
| | | let type = weakSelf.viewModel.listenType.value == .story1 ? 1:2 |
| | | let accracy = Int(Double(weakSelf.viewModel.correctNum) / Double(weakSelf.viewModel.correctNum + weakSelf.viewModel.errorNum) * 100) |
| | | weakSelf.storyComplete(storyId: dict["storyId"] as! Int, accuracy: accracy, studyTime: weakSelf.viewModel.times, type: type, integral: dict["storyIntegral"] as! Int) |
| | | } |
| | |
| | | |
| | | toalIntegral = floor(Double(toalIntegral) * (Double(accracy) / 100.0)).int |
| | | |
| | | let vc = HomeStudyCompleteVC(correctNum: viewModel.correctNum, errorNum: viewModel.errorNum, totalCoin: toalIntegral, listenType: viewModel.listenType.value) |
| | | let vc = HomeStudyCompleteVC(totalCoin: toalIntegral,viewModel: viewModel,studyScheduleModel: studyScheduleModel!) |
| | | vc.title = viewModel.listenType.value.rawTitle |
| | | vc.viewModel = viewModel |
| | | push(vc: vc) |
| | | } |
| | | |
| | |
| | | name = "超级记忆" |
| | | let v = viewModel.answerItems.first?.value as! Listen1Model |
| | | totalNum = Double(v.photoList.count) |
| | | if totalNum > 0{ |
| | | if totalNum > 0 && viewModel.correctNum > 0 && viewModel.errorNum > 0{ |
| | | accuracy = Int(Double(viewModel.correctNum) / Double(viewModel.correctNum + viewModel.errorNum) * 100) |
| | | } |
| | | toalIntegral = floor(Double(integral) * (Double(accuracy) / 100.0)).int |
| | |
| | | |
| | | timer.invalidate() |
| | | |
| | | let vc = HomeStudyCompleteVC(correctNum: viewModel.correctNum, errorNum: viewModel.errorNum, totalCoin: toalIntegral, listenType: viewModel.listenType.value,totalNum:totalNum.int) |
| | | let vc = HomeStudyCompleteVC(totalCoin: toalIntegral,totalNum:totalNum.int,viewModel: viewModel,studyScheduleModel: studyScheduleModel!) |
| | | vc.title = viewModel.listenType.value.rawTitle |
| | | vc.viewModel = viewModel |
| | | push(vc: vc) |
| | | } |
| | | |
| | |
| | | NotificationCenter.default.post(name: Refresh_ListenSchedule_Noti, object: nil) |
| | | }).disposed(by: disposeBag) |
| | | |
| | | let vc = HomeStudyCompleteVC(correctNum: viewModel.correctNum, errorNum: viewModel.errorNum, totalCoin: integral, listenType: viewModel.listenType.value) |
| | | let vc = HomeStudyCompleteVC(totalCoin: integral,viewModel: viewModel,studyScheduleModel: studyScheduleModel!) |
| | | vc.title = viewModel.listenType.value.rawTitle |
| | | vc.viewModel = viewModel |
| | | push(vc: vc) |
| | | } |
| | | |
| | |
| | | timer.invalidate() |
| | | } |
| | | |
| | | @objc func quitAction(){ |
| | | @objc func quitAction(isPop:Bool = false){ |
| | | if btn_exit.titleLabel?.text == "完成"{ |
| | | if viewModel.listenType.value == .story2{ |
| | | |
| | | if isPop{ |
| | | self.navigationController?.popViewController();return |
| | | } |
| | | |
| | | guard (pageVC.currentController as! HomeListenStory_2_VC).isPlayEnd else { |
| | | alert(msg: "请听完");return |
| | | } |
| | | |
| | | let v = data as! Listen1Model |
| | | let accuracy = 100 |
| | | storyComplete(storyId: v.data!.id, accuracy: accuracy, studyTime: viewModel.times, type: 1, integral: v.data!.lookIntegral) |
| | | storyComplete(storyId: v.data!.id, accuracy: accuracy, studyTime: viewModel.times, type: viewModel.listenType.value == .story1 ? 1:2, integral: v.data!.integral) |
| | | } |
| | | }else{ |
| | | CommonAlertView.show(content: "未完成全部答题,确认退出吗?") {[weak self] () in |
| | |
| | | case .lesson1,.lesson2,.lesson3,.lesson4,.lesson5: |
| | | if temIds.count > 0 && topicIds.count > 0{ |
| | | let totalNum = weakSelf.viewModel.correctNum + weakSelf.viewModel.errorNum |
| | | Services.exitLearning(type:weakSelf.viewModel.listenType.value.rawValue,week: weakSelf.viewModel.week.value!, day: weakSelf.viewModel.day.value!, teamIds: temIds, topicIds: topicIds,answerNumber: totalNum,correctNumber:weakSelf.viewModel.correctNum,studyTime:weakSelf.viewModel.times,schedule: schedule).subscribe(onNext: { data in |
| | | Services.exitLearning(type:weakSelf.viewModel.listenType.value.rawValue,quarter: weakSelf.viewModel.quarter.value!,week: weakSelf.viewModel.week.value!, day: weakSelf.viewModel.day.value!, teamIds: temIds, topicIds: topicIds,answerNumber: totalNum,correctNumber:weakSelf.viewModel.correctNum,studyTime:weakSelf.viewModel.times,schedule: schedule).subscribe(onNext: { data in |
| | | |
| | | NotificationCenter.default.post(name: MeUserInfoUpdate_Noti, object: nil) |
| | | |
| | | }).disposed(by: weakSelf.disposeBag) |
| | | } |
| | | default:break |
| | | case .game1,.game2,.story1,.story2: |
| | | Services.exitGameOrStory(studyTime: weakSelf.viewModel.times).subscribe(onNext: { _ in |
| | | |
| | | }).disposed(by: weakSelf.disposeBag) |
| | | } |
| | | weakSelf.navigationController?.popViewController(animated: true) |
| | | for vc in weakSelf.navigationController?.viewControllers ?? []{ |
| | | if vc.isKind(of: HomeListenMenuVC.self){ |
| | | weakSelf.navigationController?.popToViewController(vc, animated: true);break |
| | | } |
| | | |
| | | if vc.isKind(of: HomeListenVC.self){ |
| | | weakSelf.navigationController?.popToViewController(vc, animated: true);break |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | @objc func nextAction(){ |
| | | listenFightLine = .next |
| | | if viewModel.listenType.value == .story2{ |
| | | |
| | | guard (pageVC.currentController as! HomeListenStory_2_VC).isPlayEnd else { |
| | | alert(msg: "请听完");return |
| | | } |
| | | |
| | | let v = data as! Listen1Model |
| | | var dict = Dictionary<String,Any>() |
| | | dict["storyId"] = v.data?.id ?? 0 |
| | |
| | | @objc private func runloopTime(){ |
| | | print("进入。。。") |
| | | times -= 1 |
| | | label_hint.text = "请在\(times)s内选择答案!" |
| | | label_hint.text = "请在\(max(times,1))s内选择答案!" |
| | | |
| | | if times == 0{ |
| | | timer?.fireDate = .distantFuture |
| | |
| | | let y = abs(newRect.origin.y) + 99 + 5 |
| | | let layout = self.collectionView.collectionViewLayout as! UICollectionViewFlowLayout |
| | | let copyView = view_studyHandleView.copyView() |
| | | copyView.playBtn.isEnabled = false |
| | | view.addSubview(copyView) |
| | | |
| | | UIView.animate(withDuration: 0.5) { |
| | |
| | | for v in listen1Model.voiceList{ |
| | | v.type = 2 // 音频标识 |
| | | } |
| | | times = listen1Model.data?.answerTime ?? 120 |
| | | times = (listen1Model.data?.answerTime ?? 120) + 1 |
| | | |
| | | datas.append(contentsOf: listen1Model.photoList) |
| | | datas.append(contentsOf: listen1Model.voiceList) |
| | |
| | | |
| | | @objc private func runloopTime(){ |
| | | times -= 1 |
| | | label_time.text = "\(times)s" |
| | | label_time.text = "\(max(1,times))s" |
| | | |
| | | if times == 0{ |
| | | timer?.fireDate = .distantFuture |
| | |
| | | |
| | | class HomeListenStory_2_VC: BaseVC { |
| | | |
| | | var rootViewModel:HomeListenFightViewModel! |
| | | |
| | | private var viewModel = FightAnswerViewModel() |
| | | private var listen1Model:Listen1Model! |
| | | private var page:Int! |
| | | var rootViewModel:HomeListenFightViewModel! |
| | | |
| | | private var voicePlayer = VoicePlayer.share() |
| | | |
| | | private(set) var isPlayEnd = false |
| | | private lazy var stackView:UIStackView = { |
| | | let stackView = UIStackView() |
| | | stackView.spacing = 78 |
| | |
| | | } |
| | | } |
| | | |
| | | extension HomeListenStory_2_VC:UICollectionViewDelegate{ |
| | | extension HomeListenStory_2_VC:UICollectionViewDelegate{} |
| | | |
| | | } |
| | | |
| | | extension HomeListenStory_2_VC:UICollectionViewDelegateFlowLayout{ |
| | | |
| | | } |
| | | extension HomeListenStory_2_VC:UICollectionViewDelegateFlowLayout{} |
| | | |
| | | extension HomeListenStory_2_VC:UICollectionViewDataSource{ |
| | | func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { |
| | |
| | | |
| | | extension HomeListenStory_2_VC:VoicePlayerDelegate{ |
| | | func playComplete() { |
| | | isPlayEnd = true |
| | | view.isUserInteractionEnabled = true |
| | | } |
| | | |
| | | func playing() { |
| | | view.isUserInteractionEnabled = false |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | override func setRx() { |
| | | // NotificationCenter.default.rx.notification(Refresh_ListenSchedule_Noti).take(until: self.rx.deallocated).subscribe(onNext: {_ in |
| | | // self.getData() |
| | | // }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | private func getData(force:Bool = false){ |
| | | |
| | | // if studyScheduleModel == nil || force{ |
| | | // Services.studySchedule(week: week).subscribe(onNext: {data in |
| | | // self.studyScheduleModel = data.data |
| | | // self.tableView.reloadData() |
| | | // }).disposed(by: disposeBag) |
| | | // } |
| | | |
| | | } |
| | | |
| | | func jumpAt(listenType:ListenType){ |
| | | let row = listenType.rawValue - 1 |
| | | let jumpIndex:IndexPath = IndexPath(row: row, section: 1) |
| | |
| | | var time:Int = 5 |
| | | levelView.timer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { timer in |
| | | time -= 1 |
| | | levelView.label_time.text = "\(time)" |
| | | levelView.label_time.text = "\(max(time,1))" |
| | | levelView.animation() |
| | | if time <= 0{ |
| | | if time < 1{ |
| | | timer.invalidate() |
| | | UIView.animate(withDuration: 0.4) { |
| | | levelView.transform = .init(scaleX: 0.1, y: 0.1) |
| | |
| | | @IBOutlet weak var btn_next: UIButton! |
| | | @IBOutlet weak var stackView: UIStackView! |
| | | @IBOutlet weak var btn_back: UIButton! |
| | | |
| | | private var correctNum:Int = 0 |
| | | private var errorNum:Int = 0 |
| | | |
| | | private var totalCoin:Int = 0 |
| | | private var listenType:ListenType! |
| | | private var totalNum:Int? //总题目数量 |
| | | |
| | | required init(correctNum:Int,errorNum:Int,totalCoin:Int,listenType:ListenType,totalNum:Int? = nil){ |
| | | var viewModel:HomeListenFightViewModel! |
| | | var studyScheduleModel:StudyScheduleModel! |
| | | |
| | | required init(totalCoin:Int,totalNum:Int? = nil,viewModel:HomeListenFightViewModel,studyScheduleModel:StudyScheduleModel){ |
| | | super.init(nibName: nil, bundle: nil) |
| | | self.correctNum = correctNum |
| | | self.errorNum = errorNum |
| | | self.totalCoin = totalCoin |
| | | self.listenType = listenType |
| | | self.totalNum = totalNum |
| | | self.viewModel = viewModel |
| | | self.studyScheduleModel = studyScheduleModel |
| | | } |
| | | |
| | | |
| | | required init?(coder: NSCoder) { |
| | | fatalError("init(coder:) has not been implemented") |
| | | } |
| | | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | |
| | | yy_popBlock = {[weak self] () in |
| | | self?.backAction() |
| | | } |
| | | |
| | | label_coin.text = "恭喜你,已完成全部答题!获得\(totalCoin)积分!" |
| | | label_correctNum.text = "\(correctNum)次" |
| | | label_errorNum.text = "\(errorNum)次" |
| | | label_totalNum.text = "\(correctNum + errorNum)次" |
| | | label_ratioNum.text = String(format: "正确率:%.0lf%%", Double(correctNum) / Double(correctNum + errorNum) * 100) |
| | | label_coin.text = "恭喜您,已完成全部答题!获得\(totalCoin)积分!" |
| | | label_correctNum.text = "\(viewModel.correctNum)次" |
| | | label_errorNum.text = "\(viewModel.errorNum)次" |
| | | label_totalNum.text = "\(viewModel.correctNum + viewModel.errorNum)次" |
| | | label_ratioNum.text = String(format: "正确率:%.0lf%%", Double(viewModel.correctNum) / Double(viewModel.correctNum + viewModel.errorNum) * 100) |
| | | |
| | | if totalNum != nil{ |
| | | if totalNum != nil && viewModel.listenType.value == .game2{ |
| | | label_title_totalNum.text = "总题目:" |
| | | label_title_correctNum.text = "正确题目:" |
| | | label_title_errorNum.text = "错误题目:" |
| | | label_coin.text = "恭喜你,已完成游戏!获得\(totalCoin)积分!" |
| | | label_coin.text = "恭喜您,已完成游戏!获得\(totalCoin)积分!" |
| | | |
| | | label_totalNum.text = "\(totalNum!)" |
| | | label_correctNum.text = "\(correctNum)" |
| | | label_errorNum.text = "\(errorNum)" |
| | | label_correctNum.text = "\(viewModel.correctNum)" |
| | | label_errorNum.text = "\(viewModel.errorNum)" |
| | | } |
| | | |
| | | |
| | | btn_next.isHidden = listenType.rawValue >= 5 |
| | | btn_next.isHidden = viewModel.listenType.value == .lesson5 |
| | | |
| | | stackView.isHidden = listenType == .story2 |
| | | label_ratioNum.isHidden = listenType == .story2 |
| | | |
| | | // NotificationCenter.default.post(name: Refresh_ListenSchedule_Noti, object: nil) |
| | | } |
| | | stackView.isHidden = viewModel.listenType.value == .story2 |
| | | label_ratioNum.isHidden = viewModel.listenType.value == .story2 |
| | | |
| | | NotificationCenter.default.post(name: MeUserInfoUpdate_Noti, object: nil) |
| | | } |
| | | |
| | | override func setUI() { |
| | | super.setUI() |
| | |
| | | if toVC == nil{ |
| | | self.navigationController?.popToRootViewController(animated: true) |
| | | }else{ |
| | | self.navigationController?.popToViewController(toVC!, animated: true) |
| | | let nextType = ListenType(rawValue: listenType.rawValue + 1) |
| | | NotificationCenter.default.post(name: StudyCompleteNextLession_Noti, object: nextType) |
| | | let nextType = ListenType(rawValue: viewModel.listenType.value.rawValue + 1)! |
| | | |
| | | switch nextType { |
| | | case .lesson2: |
| | | Services.pictureSelectVoice(day:viewModel.day.value!, quarter: viewModel.quarter.value!, week: viewModel.week.value!).subscribe(onNext: {[weak self] result in |
| | | guard let weakSelf = self else { return } |
| | | if let data = result.data{ |
| | | let fightVC = HomeListenFightVC(listenType: .lesson2,quarter:weakSelf.viewModel.quarter.value!,week: weakSelf.viewModel.week.value!,day:weakSelf.viewModel.day.value!) |
| | | fightVC.title = ListenType.lesson2.rawTitle |
| | | fightVC.data = data |
| | | fightVC.studyScheduleModel = weakSelf.studyScheduleModel |
| | | weakSelf.push(vc: fightVC) |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | |
| | | |
| | | case .lesson3: |
| | | Services.induceExclude(day: viewModel.day.value!, quarter: viewModel.quarter.value!, week: viewModel.week.value!).subscribe(onNext: {[weak self] result in |
| | | guard let weakSelf = self else { return } |
| | | if let data = result.data{ |
| | | let fightVC = HomeListenFightVC(listenType: .lesson3,quarter:weakSelf.viewModel.quarter.value!,week: weakSelf.viewModel.week.value!,day:weakSelf.viewModel.day.value!) |
| | | fightVC.title = ListenType.lesson3.rawTitle |
| | | fightVC.data = data |
| | | fightVC.studyScheduleModel = weakSelf.studyScheduleModel |
| | | weakSelf.push(vc: fightVC) |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | |
| | | case .lesson4: |
| | | Services.questionsAndAnswers(day: viewModel.day.value!, quarter: viewModel.quarter.value!, week: viewModel.week.value!).subscribe(onNext: {[weak self] result in |
| | | guard let weakSelf = self else { return } |
| | | if let data = result.data{ |
| | | let fightVC = HomeListenFightVC(listenType: .lesson4,quarter:weakSelf.viewModel.quarter.value!,week: weakSelf.viewModel.week.value!,day:weakSelf.viewModel.day.value!) |
| | | fightVC.title = ListenType.lesson4.rawTitle |
| | | fightVC.data = data |
| | | fightVC.studyScheduleModel = weakSelf.studyScheduleModel |
| | | weakSelf.push(vc: fightVC) |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | |
| | | case .lesson5: |
| | | Services.pictureMateVoice(day: viewModel.day.value!, quarter: viewModel.quarter.value!, week: viewModel.week.value!).subscribe(onNext: {[weak self] result in |
| | | guard let weakSelf = self else { return } |
| | | if let data = result.data{ |
| | | let fightVC = HomeListenFightVC(listenType: .lesson4,quarter:weakSelf.viewModel.quarter.value!,week: weakSelf.viewModel.week.value!,day:weakSelf.viewModel.day.value!) |
| | | fightVC.title = ListenType.lesson5.rawTitle |
| | | fightVC.data = data |
| | | fightVC.studyScheduleModel = weakSelf.studyScheduleModel |
| | | weakSelf.push(vc: fightVC) |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | |
| | | default:break |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | @IBOutlet weak var label_needCoin: UILabel! |
| | | @IBOutlet weak var label_orderNum: UILabel! |
| | | @IBOutlet weak var label_footNeedCoin: UILabel! |
| | | @IBOutlet weak var btn_exchange: UIButton! |
| | | |
| | | private var viewModel = MarketContentViewModel() |
| | | private var recipientId:Int? // 地址ID |
| | |
| | | Services.redeemNow(goodId: viewModel.detailModel.value!.good!.id).subscribe(onNext: {result in |
| | | self.label_orderNum.text = result.data?.orderNumber ?? "" |
| | | self.viewModel.detailModel.accept(result.data) |
| | | }).disposed(by: disposeBag) |
| | | }) { error in |
| | | self.btn_exchange.backgroundColor = .gray.withAlphaComponent(0.5) |
| | | self.btn_exchange.isEnabled = false |
| | | }.disposed(by: disposeBag) |
| | | |
| | | Services.addressList().subscribe(onNext: {[weak self]result in |
| | | self?.viewModel.address.accept(result.data ?? []) |
| | |
| | | <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MarketExchangeVC" customModule="DolphinEnglishLearnStudent" customModuleProvider="target"> |
| | | <connections> |
| | | <outlet property="btn_add" destination="wqg-IO-Jti" id="tqa-wd-rR2"/> |
| | | <outlet property="btn_exchange" destination="N4Y-Qi-AD2" id="XNW-YA-Bjy"/> |
| | | <outlet property="btn_reduce" destination="H9G-ck-ezM" id="uPJ-2M-QEo"/> |
| | | <outlet property="cons_footerHei" destination="71z-Eh-Ya8" id="V0f-Rh-ggi"/> |
| | | <outlet property="field_number" destination="1nG-XY-fwB" id="xye-yR-VBc"/> |
| | |
| | | import UIKit |
| | | import QMUIKit |
| | | |
| | | let MeUserInfoUpdate_Noti = Notification.Name.init("MeUserInfoUpdate_Noti") |
| | | |
| | | class MeVC: BaseVC { |
| | | @IBOutlet weak var btn_address: QMUIButton! |
| | | @IBOutlet weak var btn_coinRecord: QMUIButton! |
| | |
| | | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | |
| | | Services.userInfo().subscribe(onNext: {result in |
| | | var items = Array<String>() |
| | | |
| | | if let model = result.data?.user{ |
| | | self.imge_cover.sd_setImage(with: URL(string: model.headImg)) |
| | | self.label_name.text = model.name |
| | | items.append("剩余积分:\(model.integral)") |
| | | } |
| | | |
| | | if let model = result.data?.userStudy{ |
| | | items.append("学习进度:周目\(model.week.jq_cn)") |
| | | items.append("学习总时长:\(model.totalStudy)小时") |
| | | } |
| | | self.label_info.text = items.joined(separator: "|") |
| | | |
| | | }).disposed(by: disposeBag) |
| | | getData() |
| | | } |
| | | |
| | | |
| | | override func setUI() { |
| | | super.setUI() |
| | |
| | | |
| | | } |
| | | |
| | | override func setRx() { |
| | | NotificationCenter.default.rx.notification(MeUserInfoUpdate_Noti).take(until: self.rx.deallocated).subscribe(onNext: {[weak self] _ in |
| | | self?.getData() |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | private func getData(){ |
| | | Services.userInfo().subscribe(onNext: {result in |
| | | var items = Array<String>() |
| | | |
| | | if let model = result.data?.user{ |
| | | self.imge_cover.sd_setImage(with: URL(string: model.headImg)) |
| | | self.label_name.text = model.name |
| | | items.append("剩余积分:\(model.integral)") |
| | | } |
| | | |
| | | if let model = result.data?.userStudy{ |
| | | items.append("学习进度:周目\(model.week.jq_cn)") |
| | | items.append("学习总时长:\(model.totalStudy)小时") |
| | | } |
| | | self.label_info.text = items.joined(separator: "|") |
| | | |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | /// 地址管理 |
| | | @IBAction func addressManageAction(_ sender: QMUIButton) { |
| | | let vc = AddressManageVC(type: .handle) |
| | |
| | | tableView.delegate = self |
| | | tableView.dataSource = self |
| | | tableView.backgroundColor = .clear |
| | | tableView.showsVerticalScrollIndicator = false |
| | | tableView.showsHorizontalScrollIndicator = false |
| | | tableView.separatorStyle = .none |
| | | tableView.register(UINib(nibName: "AddressManageTCell", bundle: nil), forCellReuseIdentifier: "_AddressManageTCell") |
| | | tableView.jq_addShadows(shadowColor: UIColor(hexStr: "#D9D9D9"), corner: 0, radius: 20, offset: CGSize(width: 0, height: 2), opacity: 1) |
| | |
| | | super.setUI() |
| | | tableView.delegate = self |
| | | tableView.dataSource = self |
| | | tableView.showsVerticalScrollIndicator = false |
| | | tableView.showsHorizontalScrollIndicator = false |
| | | tableView.register(UINib(nibName: "Home_1_TCell", bundle: nil), forCellReuseIdentifier: "_Home_1_TCell") |
| | | tableView.separatorStyle = .none |
| | | |
| | |
| | | import JQTools |
| | | import QMUIKit |
| | | import RxSwift |
| | | import SDWebImage |
| | | |
| | | class ShareView: UIView,JQNibView{ |
| | | |
| | |
| | | |
| | | |
| | | @IBAction func shareAction(_ sender: QMUIButton) { |
| | | guard let m = shareModel else {alertError(msg: "分享失败");return} |
| | | guard shareModel != nil else {alertError(msg: "数据获取失败");return} |
| | | var scene:WXScene! |
| | | if sender.tag == 10{ |
| | | scene = WXSceneSession |
| | | }else{ |
| | | scene = WXSceneTimeline |
| | | } |
| | | |
| | | WeChatTools.shareText("12312") |
| | | // WeChatTools.sharePic(img_cover.image!, thumb: UIImage(named: "logo")!, scale: 1.0, scene: scene) |
| | | showHUD() |
| | | SDWebImageDownloader.shared.downloadImage(with: URL(string: shareModel!.img)) { iamge, data, error, state in |
| | | hiddenHUD() |
| | | guard error == nil else {alert(msg: "图片获取失败");return} |
| | | WeChatTools.shareUrl("https://dollearn.com/", title: "海豚智能教育平台", desc: self.shareModel!.title, thumb: iamge!, scene: scene) |
| | | } |
| | | } |
| | | } |
| | |
| | | <constraint firstAttribute="width" secondItem="FYo-U3-DCE" secondAttribute="height" multiplier="1:0.1972" id="hji-FF-fZU"/> |
| | | </constraints> |
| | | </view> |
| | | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="9NU-dC-vCn"> |
| | | <view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="9NU-dC-vCn"> |
| | | <rect key="frame" x="350.5" y="160.5" width="479" height="377"/> |
| | | <subviews> |
| | | <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="bg_login" translatesAutoresizingMaskIntoConstraints="NO" id="QBd-oU-bQt"> |
| | |
| | | return btn |
| | | }() |
| | | |
| | | let playBtn = UIButton(type: .custom) |
| | | |
| | | var playUrl:String? |
| | | var listenType:ListenType? |
| | | private var playAtClouse:((Int)->Void)? |
| | |
| | | make.height.equalTo(32) |
| | | } |
| | | |
| | | let playBtn = UIButton(type: .custom) |
| | | playBtn.addTarget(self, action: #selector(playingAction), for: .touchUpInside) |
| | | addSubview(playBtn) |
| | | playBtn.snp.makeConstraints { make in |
| | |
| | | } |
| | | |
| | | func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) { |
| | | |
| | | if URLContexts.first!.url.host == "resendContextReqByScheme"{ |
| | | WXApi.handleOpen(URLContexts.first!.url, delegate: self) |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | UserDefaults.standard.synchronize() |
| | | }).disposed(by: weakSelf.disposeBag) |
| | | } |
| | | }else{ |
| | | UserDefaults.standard.set(Date().timeIntervalSince1970, forKey: "scheduledTimer") |
| | | UserDefaults.standard.synchronize() |
| | | } |
| | | } |
| | | timer?.fire() |
| | |
| | | func suspendTimer(){ |
| | | timer?.fireDate = .distantFuture |
| | | timer = nil |
| | | UserDefaults.standard.set(nil, forKey: "scheduledTimer") |
| | | UserDefaults.standard.synchronize() |
| | | } |
| | | } |
| | | |
| | |
| | | case 200:ob.onNext(next) |
| | | case 506: |
| | | ob.onError(NetRequestError.Other(next.code,next.msg)) |
| | | case 503,502: //登录被冻结 |
| | | case 502: //登录被冻结 |
| | | CommonAlertView.show(isSinple: true, content: next.msg) |
| | | // case 501: |
| | | // CommonAlertView.show(title: "提示", content: next.msg,isSingle: true) { _ in |
| | | // |
| | | // } |
| | | // ob.onError(NetRequestError.InvaildSession) |
| | | case 401,505,600: |
| | | if !ignoreAlert{ |
| | | alertError(msg: "登录失效,请重新登录");ob.onError(NetRequestError.InvaildSession) |
| | | } |
| | | sceneDelegate?.needLogin() |
| | | default: |
| | | //503是手机验证码错误 |
| | | if !ignoreAlert{ |
| | | DispatchQueue.main.async { |
| | | alertError(msg: "\(next.msg)") |
| | |
| | | |
| | | class func parentPage()->Observable<BaseResponse<String>>{ |
| | | let params = ParamsAppender.build(url: All_Url) |
| | | params.interface(url: "/study/base/user/parentPage") |
| | | params.interface(url: "/study/base/user/studyPage") |
| | | return NetworkRequest.request(params: params, method: .post, progress: false) |
| | | } |
| | | |
| | |
| | | .append(key: "orderNumber", value: orderNumber) |
| | | .append(key: "recipientId", value: recipientId) |
| | | .append(key: "remark", value: remark) |
| | | return NetworkRequest.request(params: params, method: .post,encoding: JSONEncoding.default, progress: true) |
| | | return NetworkRequest.request(params: params, method: .post,encoding: JSONEncoding.default, progress: true,ignoreAlert: true) |
| | | } |
| | | |
| | | class func userInfo()->Observable<BaseResponse<UserInfoModel>>{ |
| | |
| | | return NetworkRequest.request(params: params, method: .post,encoding: JSONEncoding.default, progress: true) |
| | | } |
| | | |
| | | class func exitLearning(type:Int,week:Int,day:Int,teamIds:[String],topicIds:[String],answerNumber:Int,correctNumber:Int,studyTime:Int,schedule:Int)->Observable<BaseResponse<SimpleModel>>{ |
| | | class func exitLearning(type:Int,quarter:Int,week:Int,day:Int,teamIds:[String],topicIds:[String],answerNumber:Int,correctNumber:Int,studyTime:Int,schedule:Int)->Observable<BaseResponse<SimpleModel>>{ |
| | | let params = ParamsAppender.build(url: All_Url) |
| | | params.interface(url: "/study/base/study/exitLearning") |
| | | .append(key: "week", value: week) |
| | |
| | | .append(key: "correctNumber", value: correctNumber) |
| | | .append(key: "studyTime", value: studyTime) |
| | | .append(key: "schedule", value: schedule) |
| | | .append(key: "quarter", value: quarter) |
| | | return NetworkRequest.request(params: params, method: .post,encoding: JSONEncoding.default, progress: true) |
| | | } |
| | | |
| | | class func exitGameOrStory(studyTime:Int)->Observable<BaseResponse<SimpleModel>>{ |
| | | let params = ParamsAppender.build(url: All_Url) |
| | | params.interface(url: "/study/base/study/exitGameOrStory") |
| | | .append(key: "studyTime", value: studyTime) |
| | | return NetworkRequest.request(params: params, method: .get,encoding: JSONEncoding.default, progress: false) |
| | | } |
| | | |
| | | class func updateOrderAddress(orderId:Int,recipientId:Int)->Observable<BaseResponse<SimpleModel>>{ |
| | | let params = ParamsAppender.build(url: All_Url) |
| | | params.interface(url: "/goods/base/goods/updateOrderAddress") |