Commit 48859467566b2bf44a256186a1e33cdf05cb814d

Authored by iOS-Xiaowen
1 parent adcec47d

no message

Showing 92 changed files with 4773 additions and 0 deletions

Too many changes to show.

To preserve performance only 92 of 118 files are displayed.

CNLiveBMineModule.podspec 0 → 100644
  1 +#
  2 +# Be sure to run `pod lib lint CNLiveBMineModule.podspec' to ensure this is a
  3 +# valid spec before submitting.
  4 +#
  5 +# Any lines starting with a # are optional, but their use is encouraged
  6 +# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
  7 +#
  8 +
  9 +Pod::Spec.new do |s|
  10 + s.name = 'CNLiveBMineModule'
  11 + s.version = '0.0.1'
  12 + s.summary = 'CNLiveBMineModule.'
  13 +
  14 +# This description is used to generate tags and improve search results.
  15 +# * Think: What does it do? Why did you write it? What is the focus?
  16 +# * Try to keep it short, snappy and to the point.
  17 +# * Write the description between the DESC delimiters below.
  18 +# * Finally, don't worry about the indent, CocoaPods strips it!
  19 +
  20 + s.description = <<-DESC
  21 +TODO: 网家家企业版-我的模块.
  22 + DESC
  23 +
  24 + s.homepage = 'http://bj.gitlab.cnlive.com/ios-team/CNLiveBMineModule'
  25 + # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
  26 + s.license = { :type => 'MIT', :file => 'LICENSE' }
  27 + s.author = { 'iOS-Xiaowen' => '153993236@qq.com' }
  28 + s.source = { :git => 'http://bj.gitlab.cnlive.com/ios-team/CNLiveBMineModule.git', :tag => s.version.to_s }
  29 + # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
  30 +
  31 + s.ios.deployment_target = '9.0'
  32 +
  33 + # s.source_files = 'CNLiveBMineModule/Classes/**/*'
  34 +
  35 + # Module
  36 + s.subspec 'Module' do |ss|
  37 + ss.source_files = 'CNLiveBMineModule/Classes/Module/*.{h,m}'
  38 + ss.dependency 'CNLiveBMineModule/Controller'
  39 + end
  40 +
  41 + # Controller
  42 + s.subspec 'Controller' do |ss|
  43 + ss.source_files = 'CNLiveBMineModule/Classes/Controller/*.{h,m}'
  44 + ss.dependency 'CNLiveBMineModule/UserInfo'
  45 + ss.dependency 'CNLiveBMineModule/View'
  46 + end
  47 +
  48 + # View
  49 + s.subspec 'View' do |ss|
  50 + ss.source_files = 'CNLiveBMineModule/Classes/View/*.{h,m}'
  51 + ss.dependency 'CNLiveBMineModule/Model'
  52 + ss.dependency 'CNLiveBMineModule/UserInfo'
  53 + end
  54 +
  55 + # Model
  56 + s.subspec 'Model' do |ss|
  57 + ss.source_files = 'CNLiveBMineModule/Classes/Model/*.{h,m}'
  58 + end
  59 +
  60 + # 用户信息/个人资料
  61 + s.subspec 'UserInfo' do |ss|
  62 + ss.source_files = 'CNLiveBMineModule/Classes/UserInfo/*.{h,m}'
  63 + end
  64 +
  65 + # 设置
  66 + s.subspec 'Setting' do |ss|
  67 + ss.source_files = 'CNLiveBMineModule/Classes/Setting/**/*.{h,m}'
  68 + end
  69 + s.resource_bundles = {
  70 + 'CNLiveBMineModule' => ['CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets']
  71 + }
  72 +
  73 + # s.public_header_files = 'Pod/Classes/**/*.h'
  74 + # s.frameworks = 'UIKit', 'MapKit'
  75 + # s.dependency 'AFNetworking', '~> 2.3'
  76 +
  77 + # pod
  78 + s.dependency 'CNLiveSDKs/CNLiveUserSystemSDK', '~> 0.3.2.0' #GitHub所以指定版本号
  79 + s.dependency 'CNLiveTripartiteManagement/QMUIKit'
  80 + s.dependency 'CNLiveTripartiteManagement/SDWebImage'
  81 + s.dependency 'CNLiveTripartiteManagement/Masonry'
  82 + s.dependency 'CNLiveTripartiteManagement/MJExtension'
  83 + s.dependency 'CNLiveTripartiteManagement/AFNetworking'
  84 +
  85 + # 服务层
  86 + s.dependency 'CNLiveServices'
  87 +
  88 + # 环境
  89 + s.dependency 'CNLiveEnvironment'
  90 +
  91 + # 基类
  92 + s.dependency 'CNLiveCommonClass'
  93 +
  94 + # IM
  95 + s.dependency 'CNLiveIMBaseSDK'
  96 +
  97 + # 类别
  98 + s.dependency 'CNLiveCategory'
  99 +
  100 + # 用户信息本地化
  101 + s.dependency 'CNLiveUserManagement'
  102 +
  103 + s.dependency 'CNLiveCommonCategory'
  104 + s.dependency 'CNLiveCustomControl'
  105 + s.dependency 'CNLiveManager'
  106 + s.dependency 'CNLiveImagePickerController'
  107 + s.dependency 'CNLiveAVCamera'
  108 + s.dependency 'CNLiveUserAgreementManager'
  109 + s.dependency 'CNLiveChooseCountry'
  110 +
  111 + s.static_framework = true
  112 +
  113 +end
... ...
CNLiveBMineModule/Assets/.gitkeep 0 → 100644
CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/Contents.json 0 → 100644
  1 +{
  2 + "info" : {
  3 + "version" : 1,
  4 + "author" : "xcode"
  5 + }
  6 +}
0 7 \ No newline at end of file
... ...
CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/default_avatar_f.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "filename" : "default_avatar_f.png",
  6 + "scale" : "1x"
  7 + },
  8 + {
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "idiom" : "universal",
  14 + "scale" : "3x"
  15 + }
  16 + ],
  17 + "info" : {
  18 + "version" : 1,
  19 + "author" : "xcode"
  20 + }
  21 +}
0 22 \ No newline at end of file
... ...
CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/default_avatar_f.imageset/default_avatar_f.png 0 → 100644

11.1 KB

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/default_avatar_y.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "filename" : "default_avatar_y.png",
  6 + "scale" : "1x"
  7 + },
  8 + {
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "idiom" : "universal",
  14 + "scale" : "3x"
  15 + }
  16 + ],
  17 + "info" : {
  18 + "version" : 1,
  19 + "author" : "xcode"
  20 + }
  21 +}
0 22 \ No newline at end of file
... ...
CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/default_avatar_y.imageset/default_avatar_y.png 0 → 100644

10.7 KB

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_bg.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "mine_bg@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "mine_bg@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
... ...
CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_bg.imageset/mine_bg@2x.png 0 → 100644

168 KB

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_bg.imageset/mine_bg@3x.png 0 → 100644

332 KB

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_cancellation_agree.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "mine_cancellation_agree@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "mine_cancellation_agree@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
... ...
CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_cancellation_agree.imageset/mine_cancellation_agree@2x.png 0 → 100644

331 Bytes

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_cancellation_agree.imageset/mine_cancellation_agree@3x.png 0 → 100644

650 Bytes

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_cancellation_agree_sel.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "mine_cancellation_agree_sel@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "mine_cancellation_agree_sel@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
... ...
CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_cancellation_agree_sel.imageset/mine_cancellation_agree_sel@2x.png 0 → 100644

733 Bytes

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_cancellation_agree_sel.imageset/mine_cancellation_agree_sel@3x.png 0 → 100644

1.33 KB

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_common.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "idiom" : "universal",
  9 + "filename" : "mine_common@2x.png",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "idiom" : "universal",
  14 + "filename" : "mine_common@3x.png",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "version" : 1,
  20 + "author" : "xcode"
  21 + }
  22 +}
0 23 \ No newline at end of file
... ...
CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_common.imageset/mine_common@2x.png 0 → 100644

2.14 KB

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_common.imageset/mine_common@3x.png 0 → 100644

4.11 KB

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_doyen.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "idiom" : "universal",
  9 + "filename" : "mine_doyen@2x.png",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "idiom" : "universal",
  14 + "filename" : "mine_doyen@3x.png",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "version" : 1,
  20 + "author" : "xcode"
  21 + }
  22 +}
0 23 \ No newline at end of file
... ...
CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_doyen.imageset/mine_doyen@2x.png 0 → 100644

1.79 KB

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_doyen.imageset/mine_doyen@3x.png 0 → 100644

3.32 KB

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_into.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "mine_into@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "mine_into@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
... ...
CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_into.imageset/mine_into@2x.png 0 → 100644

573 Bytes

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_into.imageset/mine_into@3x.png 0 → 100644

653 Bytes

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_location.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "idiom" : "universal",
  9 + "filename" : "mine_location@2x.png",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "idiom" : "universal",
  14 + "filename" : "mine_location@3x.png",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "version" : 1,
  20 + "author" : "xcode"
  21 + }
  22 +}
0 23 \ No newline at end of file
... ...
CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_location.imageset/mine_location@2x.png 0 → 100644

767 Bytes

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_location.imageset/mine_location@3x.png 0 → 100644

1.47 KB

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_logo.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "mine_logo@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "mine_logo@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
... ...
CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_logo.imageset/mine_logo@2x.png 0 → 100644

24.8 KB

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_logo.imageset/mine_logo@3x.png 0 → 100644

48.4 KB

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_overbadge.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "idiom" : "universal",
  9 + "filename" : "mine_overbadge@2x.png",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "idiom" : "universal",
  14 + "filename" : "mine_overbadge@3x.png",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "version" : 1,
  20 + "author" : "xcode"
  21 + }
  22 +}
0 23 \ No newline at end of file
... ...
CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_overbadge.imageset/mine_overbadge@2x.png 0 → 100644

1.91 KB

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_overbadge.imageset/mine_overbadge@3x.png 0 → 100644

3.61 KB

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_qb.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "mine_qb@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "mine_qb@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
... ...
CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_qb.imageset/mine_qb@2x.png 0 → 100644

2.75 KB

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_qb.imageset/mine_qb@3x.png 0 → 100644

5.12 KB

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_sz.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "mine_sz@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "mine_sz@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
... ...
CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_sz.imageset/mine_sz@2x.png 0 → 100644

2.67 KB

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_sz.imageset/mine_sz@3x.png 0 → 100644

4.59 KB

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_update_select.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "idiom" : "universal",
  9 + "filename" : "mine_update_select@2x.png",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "idiom" : "universal",
  14 + "filename" : "mine_update_select@3x.png",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "version" : 1,
  20 + "author" : "xcode"
  21 + }
  22 +}
0 23 \ No newline at end of file
... ...
CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_update_select.imageset/mine_update_select@2x.png 0 → 100644

330 Bytes

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_update_select.imageset/mine_update_select@3x.png 0 → 100644

700 Bytes

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_wjj_certification.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "idiom" : "universal",
  9 + "filename" : "mine_wjj_certification@2x.png",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "idiom" : "universal",
  14 + "filename" : "mine_wjj_certification@3x.png",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "version" : 1,
  20 + "author" : "xcode"
  21 + }
  22 +}
0 23 \ No newline at end of file
... ...
CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_wjj_certification.imageset/mine_wjj_certification@2x.png 0 → 100644

6.92 KB

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_wjj_certification.imageset/mine_wjj_certification@3x.png 0 → 100644

15.1 KB

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_zbzx.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "mine_zbzx@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "mine_zbzx@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
... ...
CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_zbzx.imageset/mine_zbzx@2x.png 0 → 100644

1.84 KB

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_zbzx.imageset/mine_zbzx@3x.png 0 → 100644

3.44 KB

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_zy.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "mine_zy@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "mine_zy@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
... ...
CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_zy.imageset/mine_zy@2x.png 0 → 100644

41.8 KB

CNLiveBMineModule/Assets/CNLiveBMineModule.xcassets/mine_zy.imageset/mine_zy@3x.png 0 → 100644

148 KB

CNLiveBMineModule/Classes/.gitkeep 0 → 100644
CNLiveBMineModule/Classes/Controller/CNLiveBMineController.h 0 → 100644
  1 +//
  2 +// CNLiveBMineController.h
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +/**
  10 + * 我的
  11 + */
  12 +
  13 +#import "CNCommonViewController.h"
  14 +
  15 +NS_ASSUME_NONNULL_BEGIN
  16 +
  17 +@interface CNLiveBMineController : CNCommonViewController
  18 +
  19 +@end
  20 +
  21 +NS_ASSUME_NONNULL_END
... ...
CNLiveBMineModule/Classes/Controller/CNLiveBMineController.m 0 → 100644
  1 +//
  2 +// CNLiveBMineController.m
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveBMineController.h"
  10 +
  11 +#import "MJExtension.h"
  12 +#import "QMUIKit.h"
  13 +
  14 +#import "CNLiveServices.h"
  15 +#import <CNLiveRequestBastKit/CNLiveNetworking.h>
  16 +#import "CNUserInfoManager.h"
  17 +//#import "CNLiveEnvironment.h"
  18 +#import "CNLiveCategory.h"
  19 +
  20 +#import "CNLiveBMineHeaderView.h"
  21 +#import "CNLiveBMineCell.h"
  22 +#import "CNLiveBMineModel.h"
  23 +#import "CNLiveBMineRequest.h"
  24 +
  25 +#import "CNLiveUserInfoController.h"
  26 +#import "CNLiveSettingController.h"
  27 +
  28 +@interface CNLiveBMineController()<UITableViewDelegate, UITableViewDataSource, CNLiveBMineHeaderViewDelegate, CNLiveBMineCellDelegate>
  29 +@property (nonatomic, strong) UITableView *tableView;
  30 +@property (nonatomic, weak) CNLiveBMineHeaderView *headerView;
  31 +@property (nonatomic, strong) NSMutableArray *data;
  32 +
  33 +@end
  34 +
  35 +@implementation CNLiveBMineController
  36 +static const NSInteger kHEIGHT = 253;
  37 +static const CGFloat timeValue = 1.5;
  38 +
  39 +#pragma mark - 加载数据
  40 +- (void)loadData {
  41 + NSArray *data = @[
  42 + @{
  43 + @"name":@"直播中心",
  44 + @"image":@"mine_zbzx",
  45 + },
  46 + @{
  47 + @"name":@"钱包",
  48 + @"image":@"mine_qb",
  49 + },
  50 + @{
  51 + @"name":@"设置",
  52 + @"image":@"mine_sz",
  53 + }
  54 + ];
  55 + for(NSDictionary *dic in data){
  56 + CNLiveBMineModel *model = [CNLiveBMineModel mj_objectWithKeyValues:dic];
  57 + [self.data addObject:model];
  58 + }
  59 + [self.tableView reloadData];
  60 +
  61 +}
  62 +
  63 +#pragma mark - 生命周期
  64 +- (void)viewWillAppear:(BOOL)animated{
  65 + [super viewWillAppear:animated];
  66 + self.navigationController.navigationBarHidden = YES;
  67 +
  68 + [self requestCertification];
  69 + if(self.headerView){
  70 + self.headerView.frame = CGRectMake(0, -kHEIGHT, SCREEN_WIDTH, kHEIGHT);
  71 + }
  72 + self.headerView.isRefresh = YES;
  73 + [self.tableView reloadData];
  74 +}
  75 +
  76 +- (void)viewDidLoad {
  77 + [super viewDidLoad];
  78 + self.view.backgroundColor = [UIColor whiteColor];
  79 + if (@available(iOS 11, *)) {
  80 + self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  81 + }
  82 + else {
  83 + self.automaticallyAdjustsScrollViewInsets = NO;
  84 + }
  85 + [self createSubViews];
  86 + [self loadData];
  87 +}
  88 +
  89 +- (void)createSubViews {
  90 + [self.view addSubview:self.tableView];
  91 + CNLiveBMineHeaderView *headerView = [[CNLiveBMineHeaderView alloc]initWithFrame:CGRectMake(0, -kHEIGHT, SCREEN_WIDTH, kHEIGHT)];
  92 + headerView.delegate = self;
  93 + headerView.tag = 666;
  94 + [self.tableView addSubview:headerView];
  95 + self.headerView = headerView;
  96 +}
  97 +
  98 +#pragma mark - UITableViewDelegate
  99 +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  100 + return 45;
  101 +}
  102 +
  103 +#pragma mark - UITableViewDataSource
  104 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  105 + return self.data.count;
  106 +}
  107 +
  108 +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  109 + CNLiveBMineCell *cell = [tableView dequeueReusableCellWithIdentifier:kCNLiveBMineCell];
  110 + cell.selectionStyle = UITableViewCellSelectionStyleNone;
  111 + cell.delegate = self;
  112 + cell.model = self.data[indexPath.row];
  113 + return cell;
  114 +}
  115 +
  116 +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  117 + CNLiveSettingController *vc = [[CNLiveSettingController alloc]init];
  118 + [self.navigationController pushViewController:vc animated:YES];
  119 +}
  120 +
  121 +#pragma mark - CNLiveBMineHeaderViewDelegate
  122 +- (void)headerView:(CNLiveBMineHeaderView *)headerView pushToController:(CNLiveBMineHeaderViewType)type{
  123 + switch (type) {
  124 + case CNLiveBMineHeaderViewTypeUerInfo:
  125 + {
  126 + CNLiveUserInfoController *vc = [[CNLiveUserInfoController alloc]init];
  127 + [self.navigationController pushViewController:vc animated:YES];
  128 + }
  129 + break;
  130 + case CNLiveBMineHeaderViewTypeWintess:
  131 + {
  132 +
  133 + }
  134 + break;
  135 + }
  136 +}
  137 +
  138 +#pragma mark - 请求方法
  139 +// 请求签到赚积分
  140 +- (void)requestSignIn{
  141 + self.headerView.interactionEnabled = NO;
  142 + [CNLiveBMineRequest signIn:^(BOOL isSuccess, NSDictionary * _Nonnull data, NSError * _Nonnull error) {
  143 + if (error.code == -1001 || error.code == -1009) {
  144 + [QMUITips showError:@"网络连接已断开" inView:self.view hideAfterDelay:timeValue];
  145 + return ;
  146 + }
  147 + if (isSuccess) {
  148 + id<CNLiveIntegralServiceProtocol> service = [[BeeHive shareInstance] createService:@protocol(CNLiveIntegralServiceProtocol)];
  149 + NSInteger status = [data[@"status"] integerValue];
  150 + if (status == 1) {
  151 + [service showGoldWhereaboutsViewWithDic:data];
  152 + }else{
  153 + [service showSignInViewWithDic:data];
  154 + }
  155 +
  156 + }else{
  157 + [QMUITips showError:@"签到失败" inView:self.view hideAfterDelay:timeValue];
  158 +
  159 + }
  160 + self.headerView.interactionEnabled = YES;
  161 + }];
  162 +}
  163 +
  164 +// 请求用户认证
  165 +- (void)requestCertification{
  166 + [CNLiveBMineRequest certification:^(BOOL isSuccess, NSDictionary * _Nonnull data, NSError * _Nonnull error) {
  167 + if (error.code == -1001 || error.code == -1009) {
  168 + [QMUITips showError:@"网络连接已断开" inView:self.view hideAfterDelay:timeValue];
  169 + return ;
  170 + }
  171 + if (isSuccess) {
  172 + NSString *darenIdentity = [NSString stringWithFormat:@"%@",[data objectForKey:@"darenIdentity"]];
  173 + if ([darenIdentity isEqualToString:@"1"]) { //普通用户
  174 + CNUserShareModel.isDaren = 0;
  175 + self.headerView.certificationImages = @[@"mine_wjj_certification",@"mine_common",@"mine_overbadge"];
  176 +
  177 + } else if ([darenIdentity isEqualToString:@"0"]) { //达人用户
  178 + CNUserShareModel.isDaren = 1;
  179 + self.headerView.certificationImages = @[@"mine_wjj_certification",@"mine_doyen", @"mine_overbadge"];
  180 +
  181 + }
  182 + }
  183 + }];
  184 +}
  185 +
  186 +#pragma mark - CNLiveBMineCellDelegate
  187 +- (void)cell:(CNLiveBMineCell *)cell didSelectItemAtItem:(NSInteger)item{
  188 +// switch (cell.model.type) {
  189 +// case CNLiveBMineCellTypeOrder:
  190 +// {
  191 +// if(item == 4){
  192 +// //售后
  193 +// id<CNLiveOrderServiceProtocol> service = [[BeeHive shareInstance] createService:@protocol(CNLiveOrderServiceProtocol)];
  194 +// [service pushToRefundViewController:0];
  195 +//
  196 +// }else{
  197 +// id<CNLiveOrderServiceProtocol> service = [[BeeHive shareInstance] createService:@protocol(CNLiveOrderServiceProtocol)];
  198 +// [service pushToOrderViewController:item];
  199 +// }
  200 +// }
  201 +// break;
  202 +// case CNLiveBMineCellTypeTool:
  203 +// {
  204 +// if(item == 0){
  205 +// // 收货地址
  206 +// id<CNLiveOrderServiceProtocol> service = [[BeeHive shareInstance] createService:@protocol(CNLiveOrderServiceProtocol)];
  207 +// [service pushToAddressViewController];
  208 +// }
  209 +// else if(item == 1){
  210 +// // 余额
  211 +// id<CNLiveBalanceServiceProtocol> service = [[BeeHive shareInstance] createService:@protocol(CNLiveBalanceServiceProtocol)];
  212 +// [service pushToBalanceViewControllerWithType:@"1" ID:CNUserShareModel.uid];
  213 +// }
  214 +// else if(item == 2){
  215 +// // 收藏
  216 +// id<CNLiveCollectionServiceProtocol> service = [[BeeHive shareInstance] createService:@protocol(CNLiveCollectionServiceProtocol)];
  217 +// [service pushToCollectionViewController];
  218 +// }
  219 +// else if(item == 3){
  220 +// // 发布记录
  221 +//// XWOrdersController *vc = [[XWOrdersController alloc]init];
  222 +//// [self.navigationController pushViewController:vc animated:YES];
  223 +// }
  224 +// else if(item == 4){
  225 +// // 邀请好友
  226 +//// XWOrdersController *vc = [[XWOrdersController alloc]init];
  227 +//// [self.navigationController pushViewController:vc animated:YES];
  228 +// }
  229 +// else if(item == 5){
  230 +// // 设置
  231 +// id<CNLiveSettingServiceProtocol> service = [[BeeHive shareInstance] createService:@protocol(CNLiveSettingServiceProtocol)];
  232 +// [service pushToSettingViewController];
  233 +// }
  234 +// else if(item == 6){
  235 +// // 小家音响
  236 +// NSLog(@"小家音响");
  237 +// }
  238 +// else if(item == 7){
  239 +// // 我的礼盒
  240 +// id<CNLiveOrderServiceProtocol> service = [[BeeHive shareInstance] createService:@protocol(CNLiveOrderServiceProtocol)];
  241 +// [service pushToGiftBoxViewController];
  242 +// }
  243 +// else if(item == 8){
  244 +// // 我的话题
  245 +// NSLog(@"我的话题");
  246 +// }
  247 +// else if(item == 9){
  248 +// // 路径工具
  249 +// NSLog(@"路径工具");
  250 +// }
  251 +//
  252 +// }
  253 +// break;
  254 +// case CNLiveBMineCellTypeGoods:
  255 +// {
  256 +//
  257 +// }
  258 +// break;
  259 +// case CNLiveBMineCellTypeSports:
  260 +// {
  261 +// if(item == 0){
  262 +// // 我的活动
  263 +// NSLog(@"我的活动");
  264 +// }
  265 +// else if(item == 1){
  266 +// // 我的记录
  267 +// NSLog(@"我的记录");
  268 +// }
  269 +// }
  270 +// break;
  271 +//
  272 +// default:
  273 +// break;
  274 +// }
  275 +
  276 +}
  277 +
  278 +#pragma mark - 状态栏
  279 +- (UIStatusBarStyle)preferredStatusBarStyle{
  280 + return UIStatusBarStyleLightContent;
  281 +
  282 +}
  283 +
  284 +#pragma mark - 响应方法
  285 +- (void)soccerDidClicked:(UIButton *)btn{
  286 + id<CNLiveIntegralServiceProtocol> service = [[BeeHive shareInstance] createService:@protocol(CNLiveIntegralServiceProtocol)];
  287 + [service pushToTaskListViewController];
  288 +}
  289 +
  290 +#pragma mark - 懒加载
  291 +- (NSMutableArray *)data {
  292 + if (!_data) {
  293 + _data = [NSMutableArray array];
  294 + }
  295 + return _data;
  296 +}
  297 +
  298 +- (UITableView *)tableView{
  299 + if(!_tableView){
  300 + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-TabBarHeight) style:UITableViewStylePlain];
  301 + _tableView.showsVerticalScrollIndicator = NO;
  302 + _tableView.delegate = self;
  303 + _tableView.dataSource = self;
  304 + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  305 + _tableView.backgroundColor = [UIColor whiteColor];
  306 + _tableView.estimatedRowHeight = 0;
  307 + _tableView.estimatedSectionHeaderHeight = 0;
  308 + _tableView.estimatedSectionFooterHeight = 0;
  309 + [_tableView registerClass:[CNLiveBMineCell class] forCellReuseIdentifier:kCNLiveBMineCell];
  310 + _tableView.contentInset = UIEdgeInsetsMake(kHEIGHT, 0, 0, 0);
  311 + }
  312 + return _tableView;
  313 +}
  314 +
  315 +@end
... ...
CNLiveBMineModule/Classes/Model/CNLiveBMineModel.h 0 → 100644
  1 +//
  2 +// CNLiveBMineModel.h
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright © 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +
  13 +@interface CNLiveBMineModel : NSObject
  14 +@property (nonatomic, copy) NSString *name;
  15 +@property (nonatomic, copy) NSString *image;
  16 +
  17 +@end
  18 +
  19 +NS_ASSUME_NONNULL_END
... ...
CNLiveBMineModule/Classes/Model/CNLiveBMineModel.m 0 → 100644
  1 +//
  2 +// CNLiveBMineModel.m
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright © 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveBMineModel.h"
  10 +
  11 +@implementation CNLiveBMineModel
  12 +
  13 +
  14 +@end
... ...
CNLiveBMineModule/Classes/Model/CNLiveBMineRequest.h 0 → 100644
  1 +//
  2 +// CNLiveBMineRequest.h
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright © 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +typedef void(^CertificationBlock)(BOOL isSuccess, NSDictionary *data, NSError *error);
  13 +typedef void(^SignInBlock)(BOOL isSuccess, NSDictionary *data, NSError *error);
  14 +
  15 +@interface CNLiveBMineRequest : NSObject
  16 +
  17 +// 请求用户认证
  18 ++ (void)certification:(CertificationBlock)block;
  19 +
  20 +
  21 +// 签到
  22 ++ (void)signIn:(SignInBlock)block;
  23 +
  24 +@end
  25 +
  26 +NS_ASSUME_NONNULL_END
... ...
CNLiveBMineModule/Classes/Model/CNLiveBMineRequest.m 0 → 100644
  1 +//
  2 +// CNLiveBMineRequest.m
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright © 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveBMineRequest.h"
  10 +#import "CNLiveCategory.h"
  11 +#import "CNLiveNetworking.h"
  12 +#import "CNLiveEnvironment.h"
  13 +#import "CNUserInfoManager.h"
  14 +
  15 +@implementation CNLiveBMineRequest
  16 +// 请求用户认证
  17 ++ (void)certification:(CertificationBlock)block {
  18 + NSDictionary *params = @{
  19 + @"witSid":CNUserShareModel.uid ? CNUserShareModel.uid : @""
  20 + };
  21 + [CNLiveNetworking setAllowRequestDefaultArgument:YES];
  22 + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNCheckWitnessUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) {
  23 + if (responseObject && [responseObject isKindOfClass:[NSDictionary class]] && responseObject[@"data"] && [responseObject[@"data"] isKindOfClass:[NSDictionary class]]) {
  24 + NSString *errorCode = [NSString stringWithFormat:@"%@", responseObject[@"errorCode"]];
  25 + NSDictionary *data = responseObject[@"data"];
  26 + block?block([errorCode isEqualToString:@"0"], data, error):@"";
  27 + }else{
  28 + block?block(NO, @{}, error):@"";
  29 +
  30 + }
  31 +
  32 + }];
  33 +
  34 +}
  35 +
  36 ++ (void)signIn:(SignInBlock)block {
  37 + NSDictionary *params = @{@"sid":CNUserShareModel.uid};
  38 + [CNLiveNetworking setAllowRequestDefaultArgument:YES];
  39 + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNIntegralSignInUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) {
  40 + if (responseObject && [responseObject isKindOfClass:[NSDictionary class]] && responseObject[@"data"] && [responseObject[@"data"] isKindOfClass:[NSDictionary class]]) {
  41 + NSString *errorCode = [NSString stringWithFormat:@"%@", responseObject[@"errorCode"]];
  42 + NSDictionary *data = responseObject[@"data"];
  43 + block?block([errorCode isEqualToString:@"0"], data, error):@"";
  44 + }else{
  45 + block?block(NO, @{}, error):@"";
  46 +
  47 + }
  48 +
  49 + }];
  50 +}
  51 +
  52 +@end
... ...
CNLiveBMineModule/Classes/Module/CNLiveBMineModule.h 0 → 100644
  1 +//
  2 +// CNLiveBMineModule.h
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +
  13 +@interface CNLiveBMineModule : NSObject
  14 +
  15 +@end
  16 +
  17 +NS_ASSUME_NONNULL_END
... ...
CNLiveBMineModule/Classes/Module/CNLiveBMineModule.m 0 → 100644
  1 +//
  2 +// CNLiveBMineModule.m
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveBMineModule.h"
  10 +#import "CNLiveServices.h"
  11 +
  12 +@BeeHiveMod(CNLiveBMineModule)
  13 +@interface CNLiveBMineModule()<BHModuleProtocol>
  14 +
  15 +@end
  16 +
  17 +@implementation CNLiveBMineModule
  18 +- (id)init {
  19 + if (self = [super init]) {
  20 +
  21 + }
  22 + return self;
  23 +
  24 +}
  25 +
  26 +- (NSUInteger)moduleLevel {
  27 + return 0;
  28 +
  29 +}
  30 +
  31 +- (void)modSetUp:(BHContext *)context {
  32 + switch (context.env) {
  33 + case BHEnvironmentDev:
  34 + //....初始化开发环境
  35 + break;
  36 + case BHEnvironmentProd:
  37 + //....初始化生产环境
  38 + default:
  39 + break;
  40 + }
  41 +
  42 +}
  43 +
  44 +- (void)modInit:(BHContext *)context {
  45 +
  46 +}
  47 +
  48 +@end
... ...
CNLiveBMineModule/Classes/Module/CNLiveBMineService.h 0 → 100644
  1 +//
  2 +// CNLiveBMineService.h
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +
  13 +@interface CNLiveBMineService : NSObject
  14 +
  15 +@end
  16 +
  17 +NS_ASSUME_NONNULL_END
... ...
CNLiveBMineModule/Classes/Module/CNLiveBMineService.m 0 → 100644
  1 +//
  2 +// CNLiveBMineService.m
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveBMineService.h"
  10 +#import "CNLiveServices.h"
  11 +#import "CNLivePageJumpManager.h"
  12 +
  13 +#import "CNLiveBMineController.h"
  14 +#import "CNLiveUserInfoController.h"
  15 +
  16 +//@BeeHiveService(CNLiveBMineServiceProtocol,CNLiveBMineService)
  17 +////@interface CNLiveBMineService ()<CNLiveBMineServiceProtocol>
  18 +//@interface CNLiveBMineService ()
  19 +//
  20 +//@end
  21 +
  22 +@implementation CNLiveBMineService
  23 +
  24 +// 我的
  25 +- (UIViewController *)getMineViewController {
  26 + return [CNLiveBMineController new];
  27 +}
  28 +
  29 +- (void)pushToMineViewController {
  30 + CNLiveBMineController *vc = [[CNLiveBMineController alloc]init];
  31 + [CNLivePageJumpManager pushViewController:vc];
  32 +}
  33 +
  34 +// 个人资料
  35 +- (UIViewController *)getUserInfoViewController {
  36 + return [CNLiveUserInfoController new];
  37 +}
  38 +
  39 +- (void)pushToUserInfoViewController {
  40 + CNLiveUserInfoController *vc = [[CNLiveUserInfoController alloc]init];
  41 + [CNLivePageJumpManager pushViewController:vc];
  42 +}
  43 +
  44 +@end
... ...
CNLiveBMineModule/Classes/Setting/AboutUs/CNLiveAboutUsController.h 0 → 100644
  1 +//
  2 +// CNLiveAboutUsController.h
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +/**
  10 + * 关于我们
  11 + */
  12 +
  13 +#import <UIKit/UIKit.h>
  14 +#import "CNCommonViewController.h"
  15 +
  16 +NS_ASSUME_NONNULL_BEGIN
  17 +
  18 +@interface CNLiveAboutUsController : CNCommonViewController
  19 +
  20 +@end
  21 +
  22 +NS_ASSUME_NONNULL_END
... ...
CNLiveBMineModule/Classes/Setting/AboutUs/CNLiveAboutUsController.m 0 → 100644
  1 +//
  2 +// CNLiveAboutUsController.m
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveAboutUsController.h"
  10 +#import "MJExtension.h"
  11 +#import "QMUIKit.h"
  12 +
  13 +#import "CNLiveServices.h"
  14 +#import "CNLiveUserAgreementManager.h"
  15 +#import "CNLiveEnvironment.h"
  16 +#import "CNLiveCategory.h"
  17 +#import "CNLiveBaseKit.h"
  18 +#import "CNLiveNavigationBar.h"
  19 +
  20 +#import "CNLiveSettingModel.h"
  21 +#import "CNLiveSettingCell.h"
  22 +
  23 +@interface CNLiveAboutUsController ()
  24 +<UITableViewDelegate, UITableViewDataSource>
  25 +@property (nonatomic, strong) CNLiveNavigationBar *navigationBar;
  26 +@property (nonatomic, strong) UITableView *tableView;
  27 +@property (nonatomic, strong) UIView *headerView;
  28 +@property (nonatomic, strong) UIView *footerView;
  29 +@property (nonatomic, strong) NSMutableArray *data;
  30 +
  31 +@end
  32 +
  33 +@implementation CNLiveAboutUsController
  34 +static const NSInteger timeValue = 1.5;
  35 +
  36 +#pragma mark - 加载数据
  37 +- (void)loadData {
  38 + // 版本
  39 + NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
  40 + NSString *shortVersion = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
  41 + NSString *appVersion = TestEnvironment?[NSString stringWithFormat:@"%@ beta",shortVersion]:shortVersion;
  42 +
  43 + NSArray *data = @[
  44 + @{
  45 + @"style":@"1",
  46 + @"title":@"给软件评分",
  47 + @"height":@"51",
  48 + @"lineHeight":@"1"
  49 + },
  50 + @{
  51 + @"style":@"1",
  52 + @"title":@"应用简介",
  53 + @"height":@"60",
  54 + @"lineHeight":@"10"
  55 + },
  56 + @{
  57 + @"style":@"1",
  58 + @"title":@"隐私政策协议",
  59 + @"height":@"51",
  60 + @"lineHeight":@"1"
  61 + },
  62 + @{
  63 + @"style":@"1",
  64 + @"title":@"软件许可及服务协议",
  65 + @"height":@"51",
  66 + @"lineHeight":@"1"
  67 + },
  68 + @{
  69 + @"style":@"1",
  70 + @"title":@"版权信息",
  71 + @"height":@"51",
  72 + @"lineHeight":@"1"
  73 + },
  74 + @{
  75 + @"style":@"1",
  76 + @"title":@"资质信息",
  77 + @"height":@"51",
  78 + @"lineHeight":@"1"
  79 + },
  80 + @{
  81 + @"style":@"4",
  82 + @"title":@"当前版本",
  83 + @"content":appVersion,
  84 + @"height":@"51",
  85 + @"lineHeight":@"1"
  86 + },
  87 + @{
  88 + @"style":@"1",
  89 + @"title":@"联系我们",
  90 + @"height":@"51",
  91 + @"lineHeight":@"1"
  92 + },
  93 + @{
  94 + @"style":@"1",
  95 + @"title":@"投诉",
  96 + @"height":@"51",
  97 + @"lineHeight":@"1"
  98 + }
  99 +
  100 + ];
  101 + for(NSDictionary *dic in data){
  102 + [self.data addObject:[CNLiveSettingModel mj_objectWithKeyValues:dic]];
  103 + }
  104 + [self.tableView reloadData];
  105 +
  106 +}
  107 +
  108 +#pragma mark - 生命周期
  109 +- (void)viewWillAppear:(BOOL)animated{
  110 + [super viewWillAppear:animated];
  111 + self.navigationController.navigationBarHidden = YES;
  112 +}
  113 +
  114 +- (void)viewDidLoad {
  115 + [super viewDidLoad];
  116 + self.view.backgroundColor = [UIColor whiteColor];
  117 + if (@available(iOS 11, *)) {
  118 + self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  119 + }
  120 + else {
  121 + self.automaticallyAdjustsScrollViewInsets = NO;
  122 + }
  123 +
  124 + [self createSubViews];
  125 + [self loadData];
  126 +
  127 +}
  128 +
  129 +- (void)dealloc {
  130 +
  131 +
  132 +}
  133 +
  134 +- (void)createSubViews {
  135 + [self.view addSubview:self.navigationBar];
  136 + [self.view addSubview:self.tableView];
  137 +}
  138 +
  139 +#pragma mark - UITableViewDelegate
  140 +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  141 + CNLiveSettingModel *model = self.data[indexPath.row];
  142 + return model.height;
  143 +}
  144 +
  145 +#pragma mark - UITableViewDataSource
  146 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  147 + return self.data.count;
  148 +}
  149 +
  150 +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  151 + CNLiveSettingCell *cell = [tableView dequeueReusableCellWithIdentifier:kCNLiveSettingCell];
  152 + cell.selectionStyle = UITableViewCellSelectionStyleNone;
  153 + CNLiveSettingModel *model = self.data[indexPath.row];
  154 + cell.model = model;
  155 + cell.lineColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
  156 + return cell;
  157 +}
  158 +
  159 +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  160 + if(indexPath.row == 0){ // 给软件评分
  161 + NSString *app = [NSString stringWithFormat:@"https://itunes.apple.com/app/apple-store/id%@?ct=web&mt=8",@"1337575478"];
  162 + if (@available(iOS 10.0, *)) {
  163 + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:app] options:@{} completionHandler:nil];
  164 + } else {
  165 + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:app]];
  166 + }
  167 +
  168 + }
  169 + else if(indexPath.row == 1){ // 应用简介
  170 + [CNLiveUserAgreementManager jumpToAgreementH5WithType:CNLiveUserAgreementIntroduction];
  171 +
  172 + }
  173 + else if(indexPath.row == 2){ // 隐私政策协议
  174 + [CNLiveUserAgreementManager jumpToAgreementH5WithType:CNLiveUserAgreementPrivacy];
  175 +
  176 + }
  177 + else if(indexPath.row == 3){ // 软件许可及服务协议
  178 + [CNLiveUserAgreementManager jumpToAgreementH5WithType:CNLiveUserAgreementPermission];
  179 + }
  180 + else if(indexPath.row == 4){ // 版权信息
  181 + [CNLiveUserAgreementManager jumpToAgreementH5WithType:CNLiveUserAgreementCopyright];
  182 +
  183 + }
  184 + else if(indexPath.row == 5){ // 资质信息
  185 + [CNLiveUserAgreementManager jumpToAgreementH5WithType:CNLiveUserAgreementEnterpriseQualification];
  186 + }
  187 + else if(indexPath.row == 6){ // 当前版本
  188 +
  189 + }
  190 + else if(indexPath.row == 7){ // 联系我们
  191 + QMUIAlertAction *sure = [QMUIAlertAction actionWithTitle:@"确定" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  192 + NSMutableString *tel = [[NSMutableString alloc] initWithFormat:@"telprompt://%@",@"010-88824192"];
  193 + if (@available(iOS 10.0, *)) {
  194 + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:tel] options:@{} completionHandler:nil];
  195 + } else {
  196 + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:tel]];
  197 + }
  198 +
  199 + }];
  200 + QMUIAlertAction *cancel = [QMUIAlertAction actionWithTitle:@"取消" style:QMUIAlertActionStyleCancel handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  201 + }];
  202 +
  203 + QMUIAlertController *alertController = [QMUIAlertController alertControllerWithTitle:@"联系我们" message:@"您确定要拨打010-88824192吗?" preferredStyle:QMUIAlertControllerStyleAlert];
  204 + [alertController addAction:sure];
  205 + [alertController addAction:cancel];
  206 +
  207 + NSMutableDictionary *titleAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
  208 +
  209 + titleAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
  210 +
  211 + NSMutableDictionary *cancelAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
  212 + cancelAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0];
  213 +
  214 + sure.buttonAttributes = titleAttributs;
  215 + cancel.buttonAttributes = cancelAttributs;
  216 +
  217 + [alertController showWithAnimated:YES];
  218 +
  219 + }else if (indexPath.row == 8){ // 投诉
  220 +
  221 +
  222 + }
  223 +
  224 +}
  225 +
  226 +#pragma mark - 懒加载
  227 +- (NSMutableArray *)data {
  228 + if (!_data) {
  229 + _data = [NSMutableArray array];
  230 + }
  231 + return _data;
  232 +}
  233 +
  234 +- (CNLiveNavigationBar *)navigationBar {
  235 + if (!_navigationBar) {
  236 + _navigationBar = [CNLiveNavigationBar navigationBar];
  237 + _navigationBar.title.text = [NSString stringWithFormat:@"关于%@",DisplayName];
  238 + __weak typeof(self) weakSelf = self;
  239 + _navigationBar.onClickLeftButton = ^{
  240 + __strong typeof(weakSelf) strongSelf = weakSelf;
  241 + if(!strongSelf) return ;
  242 + [strongSelf goBack];
  243 + };
  244 + }
  245 + return _navigationBar;
  246 +}
  247 +
  248 +- (UITableView *)tableView{
  249 + if(!_tableView){
  250 + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop) style:UITableViewStylePlain];
  251 + _tableView.delegate = self;
  252 + _tableView.dataSource = self;
  253 + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  254 + _tableView.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
  255 + _tableView.estimatedRowHeight = 0;
  256 + _tableView.estimatedSectionHeaderHeight = 0;
  257 + _tableView.estimatedSectionFooterHeight = 0;
  258 + [_tableView registerClass:[CNLiveSettingCell class] forCellReuseIdentifier:kCNLiveSettingCell];
  259 + _tableView.tableHeaderView = self.headerView;
  260 + _tableView.tableFooterView = self.footerView;
  261 +
  262 + }
  263 + return _tableView;
  264 +}
  265 +
  266 +- (UIView *)headerView {
  267 + if (!_headerView) {
  268 + _headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 160)];
  269 + _headerView.clipsToBounds = YES;
  270 + _headerView.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
  271 + UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-80)/2.0, 30, 80, 105)];
  272 + UIImage *image = [self getImageWithImageName:@"mine_logo" bundleName:@"CNLiveBMineModule" targetClass:[self class]];
  273 + imageView.image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
  274 + imageView.contentMode = UIViewContentModeCenter;
  275 + [_headerView addSubview:imageView];
  276 +
  277 + }
  278 + return _headerView;
  279 +}
  280 +
  281 +- (UIView *)footerView {
  282 + if (!_footerView) {
  283 + _footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 100)];
  284 + _footerView.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
  285 + UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(0, 25, SCREEN_WIDTH, 25)];
  286 + title.textColor = [UIColor colorWithRed:40/255.0 green:40/255.0 blue:40/255.0 alpha:1.0];
  287 + title.font = UIFontCNMake(12.0);
  288 + title.text = @"版权信息";
  289 + title.textAlignment = NSTextAlignmentCenter;
  290 + [_footerView addSubview:title];
  291 + UILabel *subTitle = [[UILabel alloc] initWithFrame:CGRectMake(0, 50, SCREEN_WIDTH, 25)];
  292 + subTitle.textColor = [UIColor colorWithRed:40/255.0 green:40/255.0 blue:40/255.0 alpha:1.0];
  293 + subTitle.font = UIFontCNMake(12.0);
  294 + subTitle.text = @"北京中投视讯文化传媒股份有限公司版权所有";
  295 + subTitle.textAlignment = NSTextAlignmentCenter;
  296 + [_footerView addSubview:subTitle];
  297 + }
  298 + return _footerView;
  299 +}
  300 +
  301 +#pragma mark - 响应方法
  302 +- (void)goBack {
  303 + if (self.presentingViewController != nil) {
  304 + [self dismissViewControllerAnimated:YES completion:nil];
  305 + }
  306 + else {
  307 + [self.navigationController popViewControllerAnimated:YES];
  308 + }
  309 +}
  310 +
  311 +@end
... ...
CNLiveBMineModule/Classes/Setting/Cancellation/CNLiveCancellationController.h 0 → 100644
  1 +//
  2 +// CNLiveCancellationController.h
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/3/21.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +// 注销账号
  10 +
  11 +#import "CNCommonViewController.h"
  12 +
  13 +NS_ASSUME_NONNULL_BEGIN
  14 +
  15 +@interface CNLiveCancellationController : CNCommonViewController
  16 +
  17 +@end
  18 +
  19 +NS_ASSUME_NONNULL_END
... ...
CNLiveBMineModule/Classes/Setting/Cancellation/CNLiveCancellationController.m 0 → 100644
  1 +//
  2 +// CNLiveCancellationController.m
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/3/21.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveCancellationController.h"
  10 +#import <WebKit/WebKit.h>
  11 +#import <Masonry/Masonry.h>
  12 +#import "QMUIKit.h"
  13 +
  14 +#import "CNLiveNetworking.h"
  15 +#import "CNLiveEnvironment.h"
  16 +#import "CNUserInfoManager.h"
  17 +
  18 +#import "CNLiveNavigationBar.h"
  19 +#import "CNLiveCancellationView.h"
  20 +
  21 +#import "CNLiveUserAgreementManager.h"
  22 +
  23 +@interface CNLiveCancellationController ()<WKNavigationDelegate,WKUIDelegate,CNLiveCancellationViewDelegate>
  24 +@property (nonatomic, strong) CNLiveNavigationBar *navigationBar;
  25 +@property (nonatomic, weak) WKWebView *webView;
  26 +@property (nonatomic, weak) CNLiveCancellationView *cancellationView;
  27 +
  28 +@end
  29 +
  30 +@implementation CNLiveCancellationController
  31 +static const NSInteger timeValue = 1.5;
  32 +
  33 +#pragma mark - Data
  34 +- (void)setData {
  35 + [[CNLiveUserAgreementManager manager] getAgreementH5WithType:CNLiveUserAgreementReviewApply success:^(NSString * _Nonnull h5, NSString * _Nonnull title, BOOL isShow) {
  36 + [QMUITips showLoadingInView:self.view];
  37 + [_webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:h5]]];
  38 +
  39 + } failure:^(NSError * _Nonnull error) {
  40 + [self loadHTMLString];
  41 +
  42 + }];
  43 +}
  44 +
  45 +#pragma mark - 生命周期
  46 +- (void)viewWillAppear:(BOOL)animated{
  47 + [super viewWillAppear:animated];
  48 + self.navigationController.navigationBarHidden = YES;
  49 +}
  50 +
  51 +- (void)viewDidLoad {
  52 + [super viewDidLoad];
  53 + // Do any additional setup after loading the view.
  54 + self.view.backgroundColor = [UIColor whiteColor];
  55 + self.edgesForExtendedLayout = UIRectEdgeNone;//双击webview不上移
  56 +
  57 + [self createUI];
  58 + [self layoutUI];
  59 + [self setData];
  60 +
  61 +}
  62 +- (void)dealloc{
  63 +
  64 +}
  65 +#pragma mark - UI
  66 +- (void)createUI {
  67 + [self.view addSubview:self.navigationBar];
  68 +
  69 + WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc]init];
  70 + config.preferences = [WKPreferences new];
  71 + config.preferences.javaScriptEnabled = YES;
  72 + config.preferences.javaScriptCanOpenWindowsAutomatically = NO;
  73 + config.userContentController = [[WKUserContentController alloc]init];
  74 +
  75 + //下方代码,禁止缩放
  76 + WKUserContentController *userController = [WKUserContentController new];
  77 + NSString *js = @"var script = document.createElement('meta');"
  78 + "script.name = 'viewport';"
  79 + "script.content=\"width=device-width, initial-scale=1.0,maximum-scale=1.0, minimum-scale=1.0, user-scalable=no\";"
  80 + "document.getElementsByTagName('div')[0].appendChild(script);";
  81 + WKUserScript *script = [[WKUserScript alloc] initWithSource:js injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:NO];
  82 +
  83 + NSMutableString *javascript = [NSMutableString string];
  84 + [javascript appendString:@"document.documentElement.style.webkitTouchCallout='none';"];//禁止长按
  85 + [javascript appendString:@"document.documentElement.style.webkitUserSelect='none';"];//禁止选择
  86 + WKUserScript *noneSelectScript = [[WKUserScript alloc] initWithSource:javascript injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES];
  87 + [userController addUserScript:script];
  88 + [userController addUserScript:noneSelectScript];
  89 + config.userContentController = userController;
  90 +
  91 + WKWebView *webView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:config];
  92 + webView.navigationDelegate = self;
  93 + webView.UIDelegate = self;
  94 + webView.scrollView.bounces = NO;
  95 + webView.scrollView.showsVerticalScrollIndicator = NO;
  96 + webView.scrollView.showsHorizontalScrollIndicator = NO;
  97 + [self.view addSubview:webView];
  98 + _webView = webView;
  99 +
  100 + CNLiveCancellationView *cancellationView = [[CNLiveCancellationView alloc]init];
  101 + cancellationView.delegate = self;
  102 + [self.view addSubview:cancellationView];
  103 + _cancellationView = cancellationView;
  104 +
  105 +}
  106 +- (void)layoutUI{
  107 + [_cancellationView mas_makeConstraints:^(MASConstraintMaker *make) {
  108 + make.left.equalTo(self.view.mas_left).with.offset(0);
  109 + make.right.equalTo(self.view.mas_right).with.offset(-0);
  110 + make.bottom.equalTo(self.view.mas_bottom).with.offset(-SafeAreaInsetsConstantForDeviceWithNotch.bottom);
  111 + make.height.offset(120);
  112 + }];
  113 + [_webView mas_makeConstraints:^(MASConstraintMaker *make) {
  114 + make.top.equalTo(self.view.mas_top).with.offset(NavigationContentTop);
  115 + make.left.equalTo(self.view.mas_left).with.offset(0);
  116 + make.right.equalTo(self.view.mas_right).with.offset(-0);
  117 + make.bottom.equalTo(_cancellationView.mas_top).with.offset(-0);
  118 +
  119 + }];
  120 +
  121 +}
  122 +#pragma mark - WKNavigationDelegate
  123 +// 页面加载完成之后调用
  124 +- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
  125 + [QMUITips hideAllTipsInView:self.view];
  126 +
  127 +}
  128 +// 页面加载失败时调用
  129 +- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation{
  130 + [self loadHTMLString];
  131 + [QMUITips hideAllTipsInView:self.view];
  132 +
  133 +}
  134 +
  135 +#pragma mark - CNLiveCancellationViewDelegate
  136 +- (void)clickedProtocol:(CNLiveCancellationView *)view{
  137 + [CNLiveUserAgreementManager jumpToAgreementH5WithType:CNLiveUserAgreementCancellation];
  138 +}
  139 +
  140 +- (void)clickedCancellation:(CNLiveCancellationView *)view{
  141 + __weak typeof(self) weakSelf = self;
  142 + QMUIAlertAction *sure = [QMUIAlertAction actionWithTitle:@"是" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  143 + __strong typeof(weakSelf) strongSelf = weakSelf;
  144 + if(!strongSelf) return ;
  145 + [strongSelf sendCancellationRequest];
  146 +
  147 + }];
  148 + QMUIAlertAction *cancel = [QMUIAlertAction actionWithTitle:@"否" style:QMUIAlertActionStyleCancel handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  149 + __strong typeof(weakSelf) strongSelf = weakSelf;
  150 + if(!strongSelf) return ;
  151 + self.navigationBar.right.userInteractionEnabled = YES;
  152 +
  153 + }];
  154 +
  155 + QMUIAlertController *alertController = [QMUIAlertController alertControllerWithTitle:@"您确定要注销此账户吗,工作人员将在5个工作日内完成审核" message:@"" preferredStyle:QMUIAlertControllerStyleAlert];
  156 + [alertController addAction:sure];
  157 + [alertController addAction:cancel];
  158 +
  159 + NSMutableDictionary *titleAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
  160 +
  161 + titleAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
  162 +
  163 + NSMutableDictionary *cancelAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
  164 + cancelAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0];
  165 +
  166 + sure.buttonAttributes = titleAttributs;
  167 + cancel.buttonAttributes = cancelAttributs;
  168 +
  169 + [alertController showWithAnimated:YES];
  170 +
  171 +}
  172 +
  173 +#pragma mark - Private Methods
  174 +- (void)loadHTMLString{
  175 + NSString *htmlContent = [NSString stringWithFormat:@"<div style=\"padding:0 5px;\"><p style=\"font-size:1.0625em;\"><strong>%@</strong></p><hr style=\"background-color:#EEEEEE;height:1px;border:none;\"/><p style=\"font-size:1em;\">%@</p><hr style=\"background-color:#EEEEEE;height:1px;border:none;\"/><p style=\"font-size:1em;\">%@</p><hr style=\"background-color:#EEEEEE;height:1px;border:none;\"/><p style=\"font-size:1em;\">%@</p><hr style=\"background-color:#EEEEEE;height:1px;border:none;\"/><p style=\"font-size:1em;\">%@</p></div>",@"我们对你注销网家家账号的决定深表遗憾。如果你仍执意注销账号,你的账号需同时满足以下条件:",@"1.账号处于安全状态: 最近1个月内无绑定手机/修改手机号、无找回密码/修改密码等操作,账号为正常使用中且在1年内无任何账号被限制的记录。",@"2.账号财产已结清,没有未完成和/或存在争议的服务: 账号中没有资产、欠款、未结清的资金和虚拟权益;本账号及通过本账号接入的第三方中没有未完成和/或存在争议的服务。",@"3.账号权限解除: 账号已解除与其他产品、网站授权登录或绑定关系。",@"4.账号无任何纠纷,包括投诉举报或被投诉举报。"];
  176 + [_webView loadHTMLString:htmlContent baseURL:nil];
  177 +
  178 +}
  179 +//请求注销接口
  180 +- (void)sendCancellationRequest{
  181 + NSDictionary *params = @{@"loginSid":CNUserShareModel.uid};
  182 + [CNLiveNetworking setAllowRequestDefaultArgument:YES];
  183 + [CNLiveNetworking setupShowDataResult:NO];
  184 +
  185 + [QMUITips showLoadingInView:self.view];
  186 +
  187 + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNCancellationUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) {
  188 + [QMUITips hideAllTipsInView:self.view];
  189 + if ([responseObject isKindOfClass:[NSDictionary class]] && [responseObject[@"errorCode"] isEqualToString:@"0"]) {
  190 + //我知道了
  191 + [self showIKnow];
  192 +
  193 + }else if([responseObject[@"errorCode"] isEqualToString:@"455"]){
  194 + [QMUITips showError:@"账号已经在注销中,请等待" inView:self.view hideAfterDelay:timeValue];
  195 + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  196 + [self.navigationController popViewControllerAnimated:YES];
  197 +
  198 + });
  199 +
  200 + }else{
  201 + [QMUITips showError:@"注销失败" inView:self.view hideAfterDelay:timeValue];
  202 +
  203 + }
  204 +
  205 + }];
  206 +
  207 +}
  208 +
  209 +//我知道了
  210 +- (void)showIKnow{
  211 + __weak typeof(self) weakSelf = self;
  212 + QMUIAlertAction *sure = [QMUIAlertAction actionWithTitle:@"我知道了" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  213 + __strong typeof(weakSelf) strongSelf = weakSelf;
  214 + if(!strongSelf) return ;
  215 + [strongSelf.navigationController popViewControllerAnimated:YES];
  216 +
  217 + }];
  218 +
  219 + QMUIAlertController *alertController = [QMUIAlertController alertControllerWithTitle:@"您的注销申请已提交,我们将在5个工作日内完成审核" message:@"" preferredStyle:QMUIAlertControllerStyleAlert];
  220 + [alertController addAction:sure];
  221 +
  222 + NSMutableDictionary *titleAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
  223 +
  224 + titleAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
  225 +
  226 + NSMutableDictionary *cancelAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
  227 + cancelAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0];
  228 + sure.buttonAttributes = titleAttributs;
  229 + [alertController showWithAnimated:YES];
  230 +
  231 +}
  232 +
  233 +/*
  234 +#pragma mark - Navigation
  235 +
  236 +// In a storyboard-based application, you will often want to do a little preparation before navigation
  237 +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  238 + // Get the new view controller using [segue destinationViewController].
  239 + // Pass the selected object to the new view controller.
  240 +}
  241 +*/
  242 +
  243 +#pragma mark - 懒加载
  244 +- (CNLiveNavigationBar *)navigationBar {
  245 + if (!_navigationBar) {
  246 + _navigationBar = [CNLiveNavigationBar navigationBar];
  247 + _navigationBar.title.text = @"审核申请";
  248 + __weak typeof(self) weakSelf = self;
  249 + _navigationBar.onClickLeftButton = ^{
  250 + __strong typeof(weakSelf) strongSelf = weakSelf;
  251 + if(!strongSelf) return ;
  252 + [strongSelf goBack];
  253 + };
  254 + }
  255 + return _navigationBar;
  256 +}
  257 +
  258 +#pragma mark - 响应方法
  259 +- (void)goBack {
  260 + if (self.presentingViewController != nil) {
  261 + [self dismissViewControllerAnimated:YES completion:nil];
  262 + }
  263 + else {
  264 + [self.navigationController popViewControllerAnimated:YES];
  265 + }
  266 +}
  267 +
  268 +@end
... ...
CNLiveBMineModule/Classes/Setting/Cancellation/CNLiveCancellationView.h 0 → 100644
  1 +//
  2 +// CNLiveCancellationView.h
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/3/21.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +@class CNLiveCancellationView;
  13 +@protocol CNLiveCancellationViewDelegate <NSObject>
  14 +- (void)clickedCancellation:(CNLiveCancellationView *)view;
  15 +- (void)clickedProtocol:(CNLiveCancellationView *)view;
  16 +
  17 +@end
  18 +@interface CNLiveCancellationView : UIView
  19 +@property (nonatomic, weak) id<CNLiveCancellationViewDelegate> delegate;
  20 +
  21 +@end
  22 +
  23 +NS_ASSUME_NONNULL_END
... ...
CNLiveBMineModule/Classes/Setting/Cancellation/CNLiveCancellationView.m 0 → 100644
  1 +//
  2 +// CNLiveCancellationView.m
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/3/21.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveCancellationView.h"
  10 +#import "YYKit.h"
  11 +#import <Masonry/Masonry.h>
  12 +#import "CNLiveCategory.h"
  13 +
  14 +@interface CNLiveCancellationView()<UITextViewDelegate>
  15 +@property (nonatomic, strong) UIButton *agreeBtn;
  16 +@property (nonatomic, strong) YYLabel *protocol;
  17 +@property (nonatomic, strong) UIButton *cancellationBtn;
  18 +
  19 +@end
  20 +
  21 +@implementation CNLiveCancellationView
  22 +static const NSInteger margin = 15;
  23 +#pragma mark - Init
  24 +- (instancetype)initWithFrame:(CGRect)frame {
  25 + self = [super initWithFrame:frame];
  26 + if (self) {
  27 + self.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
  28 + [self setup];
  29 + }
  30 + return self;
  31 +}
  32 +- (void)dealloc{
  33 +
  34 +}
  35 +
  36 +#pragma mark - UI
  37 +- (void)setup {
  38 + [self addSubview:self.agreeBtn];
  39 + [self addSubview:self.protocol];
  40 + [self addSubview:self.cancellationBtn];
  41 +
  42 +}
  43 +- (void)layoutSubviews{
  44 + [super layoutSubviews];
  45 + [_agreeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  46 + make.left.equalTo(self.mas_left).with.offset(0);
  47 + make.top.equalTo(self.mas_top).with.offset(margin);
  48 + make.width.height.offset(30);
  49 +
  50 + }];
  51 + [_protocol mas_makeConstraints:^(MASConstraintMaker *make) {
  52 + make.left.equalTo(self->_agreeBtn.mas_right).with.offset(8);
  53 + make.right.equalTo(self.mas_right).with.offset(-margin);
  54 + make.top.equalTo(self->_agreeBtn.mas_top).with.offset(0);
  55 + make.height.offset(30);
  56 +
  57 + }];
  58 + [_cancellationBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  59 + make.left.equalTo(self.mas_left).with.offset(margin);
  60 + make.right.equalTo(self.mas_right).with.offset(-margin);
  61 + make.bottom.equalTo(self.mas_bottom).with.offset(-margin);
  62 + make.height.offset(40);
  63 +
  64 + }];
  65 +
  66 +}
  67 +
  68 +#pragma mark - Data
  69 +/*
  70 + // Only override drawRect: if you perform custom drawing.
  71 + // An empty implementation adversely affects performance during animation.
  72 + - (void)drawRect:(CGRect)rect {
  73 + // Drawing code
  74 + }
  75 + */
  76 +#pragma mark - Action
  77 +- (void)clickedAgreeButton:(UIButton *)btn{
  78 + btn.selected = !btn.selected;
  79 + if(btn.selected){
  80 + _cancellationBtn.backgroundColor = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
  81 +
  82 + }else{
  83 + _cancellationBtn.backgroundColor = [UIColor colorWithRed:146/255.0 green:227/255.0 blue:154/255.0 alpha:1.0];
  84 + }
  85 +}
  86 +- (void)cancellationDidClicked:(UIButton *)btn{
  87 + if (self.delegate && [self.delegate respondsToSelector:@selector(clickedCancellation:)] && _agreeBtn.selected) {
  88 + [self.delegate clickedCancellation:self];
  89 +
  90 + }
  91 +}
  92 +
  93 +#pragma mark - UITextViewDelegate
  94 +- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange {
  95 + if ([[URL scheme] isEqualToString:@"cancellation"]) {
  96 + if (self.delegate && [self.delegate respondsToSelector:@selector(clickedProtocol:)]) {
  97 + [self.delegate clickedProtocol:self];
  98 +
  99 + }
  100 + return NO;
  101 + }
  102 + return YES;
  103 +}
  104 +
  105 +#pragma mark - Lazy loading
  106 +- (UIButton *)agreeBtn{
  107 + if (!_agreeBtn) {
  108 + _agreeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  109 + UIImage *xw_image1 = [self getImageWithImageName:@"mine_cancellation_agree" bundleName:@"CNLiveBMineModule" targetClass:[CNLiveCancellationView class]];
  110 +
  111 + UIImage *xw_image2 = [self getImageWithImageName:@"mine_cancellation_agree_sel" bundleName:@"CNLiveBMineModule" targetClass:[CNLiveCancellationView class]];
  112 +
  113 + [_agreeBtn setImage:xw_image1 forState:UIControlStateNormal];
  114 + [_agreeBtn setImage:xw_image2 forState:UIControlStateSelected];
  115 + [_agreeBtn addTarget:self action:@selector(clickedAgreeButton:) forControlEvents:UIControlEventTouchUpInside];
  116 + _agreeBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;//居左显示
  117 +
  118 + }
  119 + return _agreeBtn;
  120 +}
  121 +
  122 +- (YYLabel *)protocol{
  123 + if (!_protocol) {
  124 + _protocol = [[YYLabel alloc] init];
  125 + NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:@"我已阅读并同意《注销协议》"];
  126 + text.font = [UIFont fontWithName:@"PingFangSC-Regular" size:16];
  127 + text.color = [UIColor colorWithRed:40/255.0 green:40/255.0 blue:40/255.0 alpha:1.0];
  128 +
  129 + __weak typeof(self) weakSelf = self;
  130 + [text setTextHighlightRange:NSMakeRange(7, 6) color:[UIColor colorWithRed:72/255.0 green:167/255.0 blue:249/255.0 alpha:1.0] backgroundColor:[UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
  131 + if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(clickedProtocol:)]) {
  132 + [weakSelf.delegate clickedProtocol:weakSelf];
  133 +
  134 + }
  135 +
  136 + }];
  137 +
  138 + _protocol.attributedText = text;
  139 +
  140 + }
  141 + return _protocol;
  142 +}
  143 +
  144 +- (UIButton *)cancellationBtn{
  145 + if (!_cancellationBtn) {
  146 + _cancellationBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  147 + [_cancellationBtn setTitle:@"确认注销" forState:UIControlStateNormal];
  148 + _cancellationBtn.backgroundColor = [UIColor colorWithRed:72/255.0 green:167/255.0 blue:249/255.0 alpha:1.0];
  149 + _cancellationBtn.titleLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:17];
  150 + _cancellationBtn.layer.cornerRadius = 20;
  151 + _cancellationBtn.layer.masksToBounds = YES;
  152 + [_cancellationBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  153 + [_cancellationBtn addTarget:self action:@selector(cancellationDidClicked:) forControlEvents:UIControlEventTouchUpInside];
  154 + }
  155 + return _cancellationBtn;
  156 +}
  157 +
  158 +@end
  159 +
... ...
CNLiveBMineModule/Classes/Setting/Controller/CNLiveSettingController.h 0 → 100644
  1 +//
  2 +// CNLiveSettingController.h
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +/**
  10 + * 设置
  11 + */
  12 +
  13 +#import <UIKit/UIKit.h>
  14 +#import "CNCommonViewController.h"
  15 +
  16 +NS_ASSUME_NONNULL_BEGIN
  17 +
  18 +@interface CNLiveSettingController : CNCommonViewController
  19 +
  20 +@end
  21 +
  22 +NS_ASSUME_NONNULL_END
... ...
CNLiveBMineModule/Classes/Setting/Controller/CNLiveSettingController.m 0 → 100644
  1 +//
  2 +// CNLiveSettingController.m
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveSettingController.h"
  10 +#import "MJExtension.h"
  11 +#import <SDWebImage/SDWebImage.h>
  12 +#import "QMUIKit.h"
  13 +
  14 +#import "CNLiveUserAgreementManager.h"
  15 +#import "CNUserInfoManager.h"
  16 +
  17 +#import "CNLiveSettingModel.h"
  18 +#import "CNLiveSettingCell.h"
  19 +#import "CNLiveServices.h"
  20 +#import "CNLiveNavigationBar.h"
  21 +
  22 +#import "CNLiveUpdateTelController.h"//修改手机号
  23 +#import "CNLiveCancellationController.h"//注销
  24 +#import "CNLiveAboutUsController.h"//关于我们
  25 +#import "CNLiveBaseKit.h"
  26 +
  27 +@interface CNLiveSettingController ()
  28 +<UITableViewDelegate, UITableViewDataSource>
  29 +@property (nonatomic, strong) CNLiveNavigationBar *navigationBar;
  30 +@property (nonatomic, strong) UITableView *tableView;
  31 +@property (nonatomic, strong) UIButton *logout;
  32 +@property (nonatomic, strong) NSMutableArray *data;
  33 +
  34 +@end
  35 +
  36 +@implementation CNLiveSettingController
  37 +static const NSInteger timeValue = 1.5;
  38 +#pragma mark - 加载数据
  39 +- (void)loadData {
  40 + NSArray *data = @[
  41 + @{
  42 + @"style":@"2",
  43 + @"title":@"更换手机号",
  44 + @"content":CNUserShareModel.mobile,
  45 + @"height":@"60",
  46 + @"lineHeight":@"10"
  47 + },
  48 + @{
  49 + @"style":@"2",
  50 + @"title":@"绑定管理",
  51 + @"content":@"",
  52 + @"height":@"60",
  53 + @"lineHeight":@"10"
  54 + },
  55 + @{
  56 + @"style":@"2",
  57 + @"title":@"帮助与反馈",
  58 + @"content":@"",
  59 + @"height":@"60",
  60 + @"lineHeight":@"10"
  61 + },
  62 + @{
  63 + @"style":@"2",
  64 + @"title":@"清除缓存",
  65 + @"content":@"30k",
  66 + @"height":@"51",
  67 + @"lineHeight":@"1"
  68 + },
  69 + @{
  70 + @"style":@"1",
  71 + @"title":@"关于我们",
  72 + @"height":@"51",
  73 + @"lineHeight":@"1"
  74 + },
  75 + @{
  76 + @"style":@"1",
  77 + @"title":@"注销账号",
  78 + @"height":@"51",
  79 + @"lineHeight":@"1"
  80 + }
  81 +
  82 + ];
  83 + for(NSDictionary *dic in data){
  84 + [self.data addObject:[CNLiveSettingModel mj_objectWithKeyValues:dic]];
  85 + }
  86 + [self getSDCacheSize];
  87 + [self.tableView reloadData];
  88 +
  89 +}
  90 +- (void)getSDCacheSize {
  91 + __weak typeof(self) weakSelf = self;
  92 + [[SDImageCache sharedImageCache] calculateSizeWithCompletionBlock:^(NSUInteger fileCount, NSUInteger totalSize) {
  93 + NSString *cacheString = @"";
  94 + if (totalSize/(1024.0*1024.0) >= 1.0) {
  95 + cacheString = [NSString stringWithFormat:@"%.1fMB",totalSize/(1024.0*1024)];
  96 + } else {
  97 + cacheString = [NSString stringWithFormat:@"%.1fKB",totalSize/1024.0];
  98 + }
  99 + for (CNLiveSettingModel *model in self.data) {
  100 + if([model.title isEqualToString:@"清除缓存"]){
  101 + model.content = cacheString;
  102 + }
  103 + }
  104 + [weakSelf.tableView reloadData];
  105 +
  106 + }];
  107 +}
  108 +
  109 +#pragma mark - 生命周期
  110 +- (void)viewWillAppear:(BOOL)animated{
  111 + [super viewWillAppear:animated];
  112 + self.navigationController.navigationBarHidden = YES;
  113 + [self.tableView reloadData];
  114 + self.logout.titleLabel.font = UIFontBoldCNMake(17.0);
  115 +
  116 +}
  117 +
  118 +- (void)viewDidLoad {
  119 + [super viewDidLoad];
  120 + self.view.backgroundColor = [UIColor whiteColor];
  121 + if (@available(iOS 11, *)) {
  122 + self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  123 + }
  124 + else {
  125 + self.automaticallyAdjustsScrollViewInsets = NO;
  126 + }
  127 +
  128 + [self createSubViews];
  129 + [self loadData];
  130 +
  131 +}
  132 +
  133 +- (void)dealloc {
  134 +
  135 +
  136 +}
  137 +
  138 +- (void)createSubViews {
  139 + [self.view addSubview:self.navigationBar];
  140 + [self.view addSubview:self.tableView];
  141 + [self.view addSubview:self.logout];
  142 +
  143 +}
  144 +#pragma mark - UITableViewDelegate
  145 +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  146 + CNLiveSettingModel *model = self.data[indexPath.row];
  147 + return model.height;
  148 +}
  149 +
  150 +#pragma mark - UITableViewDataSource
  151 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  152 + return self.data.count;
  153 +}
  154 +
  155 +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  156 + CNLiveSettingCell *cell = [tableView dequeueReusableCellWithIdentifier:kCNLiveSettingCell];
  157 + cell.selectionStyle = UITableViewCellSelectionStyleNone;
  158 + CNLiveSettingModel *model = self.data[indexPath.row];
  159 + cell.model = model;
  160 + return cell;
  161 +}
  162 +
  163 +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  164 + if(indexPath.row == 0){ // 更换手机号
  165 + CNLiveUpdateTelController *vc = [[CNLiveUpdateTelController alloc]init];
  166 + [self.navigationController pushViewController:vc animated:YES];
  167 +
  168 + }
  169 + else if(indexPath.row == 1){ //绑定管理
  170 +
  171 + }
  172 + else if(indexPath.row == 2){ //帮助手册
  173 + [CNLiveUserAgreementManager jumpToAgreementH5WithType:CNLiveUserAgreementHelp];
  174 +
  175 + }
  176 + else if(indexPath.row == 3){ // 清除缓存
  177 + __weak typeof(self) weakSelf = self;
  178 + QMUIAlertAction *sure = [QMUIAlertAction actionWithTitle:@"确定" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  179 + __strong typeof(weakSelf) strongSelf = weakSelf;
  180 + if(!strongSelf) return ;
  181 + [strongSelf cleanLocalCache];
  182 +
  183 + }];
  184 + QMUIAlertAction *cancel = [QMUIAlertAction actionWithTitle:@"取消" style:QMUIAlertActionStyleCancel handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  185 + __strong typeof(weakSelf) strongSelf = weakSelf;
  186 + if(!strongSelf) return ;
  187 + self.navigationBar.right.userInteractionEnabled = YES;
  188 +
  189 + }];
  190 +
  191 + QMUIAlertController *alertController = [QMUIAlertController alertControllerWithTitle:@"确定清除本地缓存吗?" message:@"" preferredStyle:QMUIAlertControllerStyleAlert];
  192 + [alertController addAction:sure];
  193 + [alertController addAction:cancel];
  194 +
  195 + NSMutableDictionary *titleAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
  196 +
  197 + titleAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
  198 +
  199 + NSMutableDictionary *cancelAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
  200 + cancelAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0];
  201 +
  202 + sure.buttonAttributes = titleAttributs;
  203 + cancel.buttonAttributes = cancelAttributs;
  204 +
  205 + [alertController showWithAnimated:YES];
  206 +
  207 + }else if (indexPath.row == 4){
  208 + CNLiveAboutUsController *vc = [[CNLiveAboutUsController alloc]init];
  209 + [self.navigationController pushViewController:vc animated:YES];
  210 + }
  211 + else if (indexPath.row == 5) {
  212 + CNLiveCancellationController *vc = [[CNLiveCancellationController alloc]init];
  213 + [self.navigationController pushViewController:vc animated:YES];
  214 + }
  215 +}
  216 +
  217 +#pragma mark - 懒加载
  218 +- (NSMutableArray *)data {
  219 + if (!_data) {
  220 + _data = [NSMutableArray array];
  221 + }
  222 + return _data;
  223 +}
  224 +
  225 +- (CNLiveNavigationBar *)navigationBar {
  226 + if (!_navigationBar) {
  227 + _navigationBar = [CNLiveNavigationBar navigationBar];
  228 + _navigationBar.title.text = @"设置";
  229 + __weak typeof(self) weakSelf = self;
  230 + _navigationBar.onClickLeftButton = ^{
  231 + [weakSelf goBack];
  232 + };
  233 + }
  234 + return _navigationBar;
  235 +}
  236 +
  237 +- (UITableView *)tableView{
  238 + if(!_tableView){
  239 + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop-50) style:UITableViewStylePlain];
  240 + _tableView.delegate = self;
  241 + _tableView.dataSource = self;
  242 + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  243 + _tableView.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
  244 + _tableView.estimatedRowHeight = 0;
  245 + _tableView.estimatedSectionHeaderHeight = 0;
  246 + _tableView.estimatedSectionFooterHeight = 0;
  247 + [_tableView registerClass:[CNLiveSettingCell class] forCellReuseIdentifier:kCNLiveSettingCell];
  248 + }
  249 + return _tableView;
  250 +}
  251 +
  252 +- (UIButton *)logout{
  253 + if(!_logout){
  254 + _logout = [UIButton buttonWithType:UIButtonTypeCustom];
  255 + _logout.frame = CGRectMake(0, SCREEN_HEIGHT-SafeAreaInsetsConstantForDeviceWithNotch.bottom-50, SCREEN_WIDTH, 50);
  256 + _logout.backgroundColor = [UIColor whiteColor];
  257 + _logout.titleLabel.font = UIFontBoldCNMake(17.0);
  258 + [_logout setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  259 + [_logout setTitle:@"退出登录" forState:UIControlStateNormal];
  260 + _logout.adjustsImageWhenHighlighted = NO;
  261 + [_logout addTarget:self action:@selector(logoutDidClicked:) forControlEvents:UIControlEventTouchUpInside];
  262 + }
  263 + return _logout;
  264 +}
  265 +
  266 +#pragma mark - 响应方法
  267 +- (void)goBack {
  268 + if (self.presentingViewController != nil) {
  269 + [self dismissViewControllerAnimated:YES completion:nil];
  270 + }
  271 + else {
  272 + [self.navigationController popViewControllerAnimated:YES];
  273 + }
  274 +}
  275 +
  276 +- (void)logoutDidClicked:(UIButton *)btn{
  277 + QMUIAlertAction *sure = [QMUIAlertAction actionWithTitle:@"退出登录" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  278 + [UIApplication sharedApplication].delegate.window.rootViewController = nil;
  279 + [self cleanLocalCache];
  280 + id<CNLiveLoginServiceProtocol> login = [[BeeHive shareInstance] createService:@protocol(CNLiveLoginServiceProtocol)];
  281 + UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:[login getLoginViewController]];
  282 + [UIApplication sharedApplication].delegate.window.rootViewController = nav;
  283 + }];
  284 +
  285 + QMUIAlertAction *cancel = [QMUIAlertAction actionWithTitle:@"取消" style:QMUIAlertActionStyleCancel handler:nil];
  286 +
  287 + QMUIAlertController *alertController = [QMUIAlertController alertControllerWithTitle:@"" message:@"" preferredStyle:QMUIAlertControllerStyleActionSheet];
  288 + [alertController addAction:sure];
  289 + [alertController addAction:cancel];
  290 +
  291 + NSMutableDictionary *titleAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
  292 +
  293 + titleAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
  294 +
  295 + NSMutableDictionary *cancelAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
  296 + cancelAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0];
  297 +
  298 + sure.buttonAttributes = titleAttributs;
  299 + cancel.buttonAttributes = cancelAttributs;
  300 +
  301 + [alertController showWithAnimated:YES];
  302 +
  303 +}
  304 +
  305 +#pragma mark - 私有方法
  306 +// 清除本地缓存
  307 +- (void)cleanLocalCache{
  308 +// [XWUserManager removeUserInfo];
  309 + [[SDImageCache sharedImageCache] clearMemory];
  310 + [[SDImageCache sharedImageCache] clearDiskOnCompletion:^{
  311 + [QMUITips showSucceed:@"清除成功" inView:self.view hideAfterDelay:timeValue];
  312 + [self getSDCacheSize];
  313 +
  314 + }];
  315 +}
  316 +
  317 +#pragma mark - 公共方法
  318 +// 清除本地缓存
  319 ++ (void)cleanLocalCache{
  320 +// [XWUserManager removeUserInfo];
  321 + [[SDImageCache sharedImageCache] clearMemory];
  322 + [[SDImageCache sharedImageCache] clearDiskOnCompletion:^{
  323 +
  324 + }];
  325 +}
  326 +
  327 +@end
... ...
CNLiveBMineModule/Classes/Setting/Model/CNLiveSettingModel.h 0 → 100644
  1 +//
  2 +// CNLiveSettingModel.h
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright © 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +typedef NS_ENUM(NSInteger, CNLiveSettingModelType) {
  13 + CNLiveSettingModelTypeDefault = 0,
  14 + CNLiveSettingModelTypeText = 1,
  15 + CNLiveSettingModelTypeTextFront = 2
  16 +};
  17 +
  18 +@interface CNLiveSettingModel : NSObject
  19 +@property (nonatomic, copy) NSString *title;
  20 +@property (nonatomic, copy) NSString *content;
  21 +@property (nonatomic, copy) NSString *style;
  22 +
  23 +@property (nonatomic, assign) CNLiveSettingModelType type;
  24 +@property (nonatomic, assign) CGFloat height;
  25 +@property (nonatomic, assign) CGFloat lineHeight;
  26 +
  27 +@end
  28 +
  29 +NS_ASSUME_NONNULL_END
... ...
CNLiveBMineModule/Classes/Setting/Model/CNLiveSettingModel.m 0 → 100644
  1 +//
  2 +// CNLiveSettingModel.m
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright © 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveSettingModel.h"
  10 +
  11 +@implementation CNLiveSettingModel
  12 +
  13 +- (CNLiveSettingModelType)type{
  14 + if([self.style isEqualToString:@"1"]){
  15 + return CNLiveSettingModelTypeDefault;
  16 + }
  17 + else if([self.style isEqualToString:@"2"]){
  18 + return CNLiveSettingModelTypeTextFront;
  19 +
  20 + }
  21 + else if([self.style isEqualToString:@"4"]){
  22 + return CNLiveSettingModelTypeText;
  23 +
  24 + }
  25 + return CNLiveSettingModelTypeDefault;
  26 +}
  27 +
  28 +@end
... ...
CNLiveBMineModule/Classes/Setting/Model/CNLiveSettingRequest.h 0 → 100644
  1 +//
  2 +// CNLiveSettingRequest.h
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright © 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +
  13 +@interface CNLiveSettingRequest : NSObject
  14 +
  15 +
  16 +@end
  17 +
  18 +NS_ASSUME_NONNULL_END
... ...
CNLiveBMineModule/Classes/Setting/Model/CNLiveSettingRequest.m 0 → 100644
  1 +//
  2 +// CNLiveSettingRequest.m
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright © 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveSettingRequest.h"
  10 +
  11 +@implementation CNLiveSettingRequest
  12 +
  13 +
  14 +@end
... ...
CNLiveBMineModule/Classes/Setting/UpdateTel/CNLiveUpdateTelController.h 0 → 100644
  1 +//
  2 +// CNLiveUpdateTelController.h
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNCommonViewController.h"
  10 +
  11 +@interface CNLiveUpdateTelController : CNCommonViewController
  12 +
  13 +@end
... ...
CNLiveBMineModule/Classes/Setting/UpdateTel/CNLiveUpdateTelController.m 0 → 100644
  1 +//
  2 +// CNLiveUpdateTelController.m
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveUpdateTelController.h"
  10 +#import "CNLiveChooseCountryController.h"
  11 +#import "YYKit.h"
  12 +#import <Masonry/Masonry.h>
  13 +#import "QMUIKit.h"
  14 +
  15 +#import <CNLiveUserSystemSDK/CNLiveUserSystemCenter.h>
  16 +#import "CNUserInfoManager.h"
  17 +#import "NSString+CNLiveExtension.h"
  18 +#import "CNLiveCategory.h"
  19 +#import "CNLiveBaseKit.h"
  20 +
  21 +#import "CNLiveNavigationBar.h"
  22 +#import "CNLiveUpdateTelView.h"
  23 +
  24 +@interface CNLiveUpdateTelController()<UITextFieldDelegate, CNLiveUpdateTelViewDelegate, ChooseCountriesDelegate>
  25 +
  26 +@property (nonatomic, strong) CNLiveNavigationBar *navigationBar;
  27 +@property (nonatomic, strong) CNLiveUpdateTelView *updateTel;//背景
  28 +@property (nonatomic, strong) YYLabel *connection;
  29 +
  30 +@end
  31 +
  32 +@implementation CNLiveUpdateTelController
  33 +static const NSInteger timeValue = 1.5;
  34 +
  35 +- (void)viewWillAppear:(BOOL)animated {
  36 + [super viewWillAppear:animated];
  37 + self.navigationController.navigationBarHidden = YES;
  38 +
  39 +}
  40 +
  41 +- (void)viewDidLoad {
  42 + [super viewDidLoad];
  43 + // Do any additional setup after loading the view.
  44 +
  45 + self.view.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
  46 +
  47 + [self createSubViews];
  48 + [self xw_layoutSubviews];
  49 +
  50 + __weak typeof(self) weakSelf = self;
  51 + QMUIAlertAction *sure = [QMUIAlertAction actionWithTitle:@"确定" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  52 +
  53 + }];
  54 + QMUIAlertAction *cancel = [QMUIAlertAction actionWithTitle:@"取消" style:QMUIAlertActionStyleCancel handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  55 + __strong typeof(weakSelf) strongSelf = weakSelf;
  56 + if(!strongSelf) return ;
  57 + [strongSelf.navigationController popViewControllerAnimated:YES];
  58 + }];
  59 +
  60 + QMUIAlertController *alertController = [QMUIAlertController alertControllerWithTitle:@"更换手机号将只能使用新绑定的手机号登录app,是否继续修改?" message:@"" preferredStyle:QMUIAlertControllerStyleAlert];
  61 + [alertController addAction:sure];
  62 + [alertController addAction:cancel];
  63 +
  64 + NSMutableDictionary *titleAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
  65 +
  66 + titleAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
  67 +
  68 + NSMutableDictionary *cancelAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
  69 + cancelAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0];
  70 +
  71 + sure.buttonAttributes = titleAttributs;
  72 + cancel.buttonAttributes = cancelAttributs;
  73 +
  74 + [alertController showWithAnimated:YES];
  75 +
  76 +}
  77 +
  78 +#pragma mark - UI
  79 +- (void)createSubViews{
  80 + [self.view addSubview:self.navigationBar];
  81 + [self.view addSubview:self.updateTel];
  82 + [self.view addSubview:self.connection];
  83 +}
  84 +
  85 +- (void)xw_layoutSubviews{
  86 + [self.updateTel mas_makeConstraints:^(MASConstraintMaker *make) {
  87 + make.left.right.equalTo(self.view);
  88 + make.top.equalTo(self.view).offset(NavigationContentTop);
  89 + make.height.mas_equalTo(220);
  90 + }];
  91 + [self.connection mas_makeConstraints:^(MASConstraintMaker *make) {
  92 + make.left.right.equalTo(self.view);
  93 + make.bottom.equalTo(self.view.mas_bottom).offset(-30);
  94 + }];
  95 +
  96 +}
  97 +
  98 +- (void)didReceiveMemoryWarning {
  99 + [super didReceiveMemoryWarning];
  100 + // Dispose of any resources that can be recreated.
  101 +}
  102 +
  103 +#pragma mark - ChooseCountriesDelegate
  104 +- (void)chooseViewController:(CNLiveChooseCountryController *)controller countryName:(NSString *)name countryCode:(NSString *)code{
  105 + _updateTel.countryName.text = name;
  106 + _updateTel.countryCode.text = [NSString stringWithFormat:@"+%@",code];
  107 + _updateTel.codeNum = code;
  108 +
  109 +}
  110 +
  111 +#pragma mark - CNLiveUpdateTelViewDelegate
  112 +- (void)selectCountry:(CNLiveUpdateTelView *)view{
  113 + CNLiveChooseCountryController *vc = [[CNLiveChooseCountryController alloc]init];
  114 + vc.modalPresentationStyle = UIModalPresentationFullScreen;
  115 + vc.delegate = self;
  116 + vc.hidesBottomBarWhenPushed = YES;
  117 + [self presentViewController:vc animated:YES completion:nil];
  118 +}
  119 +
  120 +- (void)bindingSuccess:(CNLiveUpdateTelView *)view{
  121 + [self.navigationController popViewControllerAnimated:YES];
  122 +}
  123 +
  124 +- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
  125 + [self.updateTel.telTF resignFirstResponder];
  126 +}
  127 +
  128 +#pragma mark - Lazy Loading
  129 +- (CNLiveNavigationBar *)navigationBar {
  130 + if (!_navigationBar) {
  131 + _navigationBar = [CNLiveNavigationBar navigationBar];
  132 + _navigationBar.title.text = @"更换手机号";
  133 + __weak typeof(self) weakSelf = self;
  134 + _navigationBar.onClickLeftButton = ^{
  135 + __strong typeof(weakSelf) strongSelf = weakSelf;
  136 + if(!strongSelf) return ;
  137 + [strongSelf.navigationController popViewControllerAnimated:YES];
  138 + };
  139 +
  140 + }
  141 + return _navigationBar;
  142 +}
  143 +
  144 +- (CNLiveUpdateTelView *)updateTel{
  145 + if (!_updateTel) {
  146 + _updateTel = [[CNLiveUpdateTelView alloc] init];
  147 + _updateTel.delegate = self;
  148 + _updateTel.codeNum = @"86";
  149 + }
  150 + return _updateTel;
  151 +}
  152 +
  153 +- (YYLabel *)connection {
  154 + if (!_connection) {
  155 + _connection = [[YYLabel alloc] init];
  156 + _connection.numberOfLines = 0;
  157 + NSString *str = @"若当前号码已不用或丢失,请点击联系客服";
  158 + NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:str];
  159 + text.color = [UIColor colorWithRed:34/255.0 green:34/255.0 blue:34/255.0 alpha:1.0];
  160 + text.font = UIFontCNMake(12.0);
  161 + [text setTextHighlightRange:NSMakeRange(text.length-4, 4) color:[UIColor colorWithRed:44/255.0 green:209/255.0 blue:201/255.0 alpha:1.0] backgroundColor:[UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
  162 +
  163 + NSString *phoneStr = @"010-65832485";
  164 +
  165 + QMUIAlertAction *sure = [QMUIAlertAction actionWithTitle:@"好" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  166 + if (@available(iOS 10.0, *)) {
  167 + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",phoneStr]] options:@{} completionHandler:nil];
  168 + } else {
  169 + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",phoneStr]]];
  170 + }
  171 +
  172 + }];
  173 + QMUIAlertAction *cancel = [QMUIAlertAction actionWithTitle:@"取消" style:QMUIAlertActionStyleCancel handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  174 + }];
  175 +
  176 + QMUIAlertController *alertController = [QMUIAlertController alertControllerWithTitle:@"联系客服" message:[NSString stringWithFormat:@"将给%@拨打电话",phoneStr] preferredStyle:QMUIAlertControllerStyleAlert];
  177 + [alertController addAction:sure];
  178 + [alertController addAction:cancel];
  179 +
  180 + NSMutableDictionary *titleAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
  181 +
  182 + titleAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
  183 +
  184 + NSMutableDictionary *cancelAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
  185 + cancelAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0];
  186 +
  187 + sure.buttonAttributes = titleAttributs;
  188 + cancel.buttonAttributes = cancelAttributs;
  189 +
  190 + [alertController showWithAnimated:YES];
  191 +
  192 + } ];
  193 + _connection.attributedText = text;
  194 + _connection.textAlignment = NSTextAlignmentCenter;
  195 +
  196 + }
  197 + return _connection;
  198 +}
  199 +
  200 +/*
  201 +#pragma mark - Navigation
  202 +
  203 +// In a storyboard-based application, you will often want to do a little preparation before navigation
  204 +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  205 + // Get the new view controller using [segue destinationViewController].
  206 + // Pass the selected object to the new view controller.
  207 +}
  208 +*/
  209 +
  210 +@end
... ...
CNLiveBMineModule/Classes/Setting/UpdateTel/CNLiveUpdateTelView.h 0 → 100644
  1 +//
  2 +// CNLiveUpdateTelView.h
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/3/21.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +@class CNLiveUpdateTelView;
  13 +@protocol CNLiveUpdateTelViewDelegate <NSObject>
  14 +- (void)selectCountry:(CNLiveUpdateTelView *)view;
  15 +- (void)bindingSuccess:(CNLiveUpdateTelView *)view;
  16 +
  17 +@end
  18 +@interface CNLiveUpdateTelView : UIView
  19 +@property (nonatomic, weak) id<CNLiveUpdateTelViewDelegate> delegate;
  20 +
  21 +@property (nonatomic, strong) UILabel *countryName;
  22 +@property (nonatomic, strong) UILabel *countryCode;
  23 +
  24 +@property (nonatomic, strong) UITextField *telTF;
  25 +@property (nonatomic, strong) UITextField *codeTF;
  26 +
  27 +@property (nonatomic, assign) BOOL gotVerificationCode;
  28 +@property (nonatomic, assign) BOOL gotVerificationCodeIng;
  29 +
  30 +@property (nonatomic, copy) NSString *codeNum;
  31 +
  32 +@end
  33 +
  34 +NS_ASSUME_NONNULL_END
... ...
CNLiveBMineModule/Classes/Setting/UpdateTel/CNLiveUpdateTelView.m 0 → 100644
  1 +//
  2 +// CNLiveUpdateTelView.m
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/3/21.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveUpdateTelView.h"
  10 +#import "YYKit.h"
  11 +#import <Masonry/Masonry.h>
  12 +#import "QMUIKit.h"
  13 +
  14 +#import <CNLiveUserSystemSDK/CNLiveUserSystemCenter.h>
  15 +#import "NSString+CNLiveExtension.h"
  16 +#import "CNUserInfoManager.h"
  17 +#import "CNLiveCategory.h"
  18 +#import "CNLiveBaseKit.h"
  19 +
  20 +#define TIMECOUNT 60;
  21 +
  22 +@interface CNLiveUpdateTelView()<UITextFieldDelegate>
  23 +
  24 +@property (nonatomic, strong) UIView *lineView;
  25 +@property (nonatomic, strong) UIImageView *countryImg;
  26 +@property (nonatomic, strong) UILabel *numberLabel;//手机号
  27 +@property (nonatomic, strong) UILabel *codeLabel;//验证码
  28 +@property (nonatomic, strong) UIButton *verification;//验证码按钮
  29 +
  30 +@property (nonatomic, strong) UIView *bindingView;//改变按钮
  31 +@property (nonatomic, strong) UIButton *binding;//改变按钮
  32 +
  33 +@end
  34 +
  35 +@implementation CNLiveUpdateTelView
  36 +static const NSInteger margin = 15;
  37 +static const NSInteger timeValue = 1.5;
  38 +
  39 +#pragma mark - Init
  40 +- (instancetype)initWithFrame:(CGRect)frame {
  41 + self = [super initWithFrame:frame];
  42 + if (self) {
  43 + self.backgroundColor = [UIColor whiteColor];
  44 + [self createSubViews];
  45 + }
  46 + return self;
  47 +}
  48 +
  49 +#pragma mark - Data
  50 +- (void)setCodeNum:(NSString *)codeNum{
  51 + _codeNum = codeNum;
  52 +}
  53 +
  54 +#pragma mark - UI
  55 +- (void)createSubViews {
  56 + [self addSubview:self.countryName];
  57 + [self addSubview:self.lineView];
  58 + [self addSubview:self.countryImg];
  59 + [self addSubview:self.countryCode];
  60 +
  61 + [self addSubview:self.numberLabel];
  62 + [self addSubview:self.telTF];
  63 +
  64 + [self addSubview:self.codeLabel];
  65 + [self addSubview:self.codeTF];
  66 +
  67 + [self addSubview:self.verification];
  68 +
  69 + [self addSubview:self.bindingView];
  70 + [self addSubview:self.binding];
  71 +
  72 +}
  73 +- (void)layoutSubviews{
  74 + [super layoutSubviews];
  75 +
  76 + [self.countryName mas_makeConstraints:^(MASConstraintMaker *make) {
  77 + make.top.equalTo(self).offset(0);
  78 + make.left.equalTo(self).offset(margin);
  79 + make.height.mas_equalTo(50);
  80 + }];
  81 + [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
  82 + make.top.equalTo(self.countryName.mas_bottom).offset(0);
  83 + make.left.right.equalTo(self).offset(0);
  84 + make.height.mas_equalTo(10);
  85 + }];
  86 + [self.countryImg mas_makeConstraints:^(MASConstraintMaker *make) {
  87 + make.top.equalTo(self).offset(0);
  88 + make.right.equalTo(self).offset(-margin);
  89 + make.height.mas_equalTo(50);
  90 + make.width.mas_equalTo(10);
  91 + }];
  92 + [self.countryCode mas_makeConstraints:^(MASConstraintMaker *make) {
  93 + make.top.equalTo(self).offset(0);
  94 + make.right.equalTo(self.countryImg.mas_left).offset(-5);
  95 + make.height.mas_equalTo(50);
  96 + }];
  97 + [self.numberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  98 + make.top.equalTo(self.lineView.mas_bottom).offset(0);
  99 + make.left.equalTo(self).offset(margin);
  100 + make.height.mas_equalTo(50);
  101 + }];
  102 + [self.verification mas_makeConstraints:^(MASConstraintMaker *make) {
  103 + make.centerY.equalTo(self.numberLabel);
  104 + make.right.equalTo(self).offset(-margin);
  105 + make.width.mas_equalTo(100);
  106 + make.height.mas_equalTo(30);
  107 + }];
  108 + [self.telTF mas_makeConstraints:^(MASConstraintMaker *make) {
  109 + make.centerY.equalTo(self.numberLabel);
  110 + make.left.equalTo(self.numberLabel.mas_right).offset(20);
  111 +// make.right.equalTo(self.verification.mas_left).offset(-10);
  112 + }];
  113 + [self.codeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  114 + make.top.equalTo(self.numberLabel.mas_bottom).offset(0);
  115 + make.left.equalTo(self.numberLabel);
  116 +// make.width.mas_equalTo(50);
  117 + make.height.mas_equalTo(50);
  118 +
  119 + }];
  120 + [self.codeTF mas_makeConstraints:^(MASConstraintMaker *make) {
  121 + make.centerY.equalTo(self.codeLabel);
  122 + make.left.equalTo(self.codeLabel.mas_right).offset(20);
  123 + make.width.equalTo(self.telTF);
  124 + }];
  125 +
  126 + [self.bindingView mas_makeConstraints:^(MASConstraintMaker *make) {
  127 + make.top.equalTo(self.codeTF.mas_bottom).offset(15);
  128 + make.left.equalTo(self).offset(0);
  129 + make.right.equalTo(self).offset(-0);
  130 + make.bottom.equalTo(self.mas_bottom).offset(-0);
  131 + }];
  132 +
  133 + [self.binding mas_makeConstraints:^(MASConstraintMaker *make) {
  134 + make.top.equalTo(self.codeTF.mas_bottom).offset(30);
  135 + make.left.equalTo(self).offset(60);
  136 + make.right.equalTo(self).offset(-60);
  137 + make.height.mas_equalTo(45);
  138 + }];
  139 +}
  140 +
  141 +/*
  142 + // Only override drawRect: if you perform custom drawing.
  143 + // An empty implementation adversely affects performance during animation.
  144 + - (void)drawRect:(CGRect)rect {
  145 + // Drawing code
  146 + }
  147 + */
  148 +
  149 +#pragma mark - UITextFieldDelegate
  150 +- (void)textFieldDidChange:(UITextField *)textField {
  151 + if (textField.tag == 10001) { //手机号
  152 + if (!self.gotVerificationCodeIng) {
  153 + [self setupTextFieldUI:textField];
  154 + }
  155 + }
  156 + else if (textField.tag == 10002) { //验证码
  157 +
  158 + }
  159 +
  160 +}
  161 +
  162 +- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
  163 + if([string length] != 0){
  164 + NSLog(@"增");
  165 + if (textField.tag == 10002) {
  166 + if (textField.text.length>=6) {
  167 + return NO;
  168 + }
  169 + }
  170 + if (textField.tag == 10001) {
  171 + if (textField.text.length>=11) {
  172 + return NO;
  173 + }
  174 + }
  175 + }
  176 + else {
  177 + NSLog(@"删");
  178 + return YES;
  179 + }
  180 + return YES;
  181 +}
  182 +
  183 +#pragma mark - 懒加载
  184 +- (UILabel *)countryName {
  185 + if (!_countryName) {
  186 + _countryName = [[UILabel alloc] init];
  187 + _countryName.textColor = [UIColor colorWithRed:26/255.0 green:26/255.0 blue:26/255.0 alpha:1.0];
  188 + _countryName.font = UIFontCNMake(14.0);
  189 + _countryName.text = @"中国大陆";
  190 + _countryName.textAlignment = NSTextAlignmentLeft;
  191 + }
  192 + return _countryName;
  193 +}
  194 +
  195 +- (UIView *)lineView {
  196 + if (!_lineView) {
  197 + _lineView = [[UIView alloc] init];
  198 + _lineView.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
  199 + }
  200 + return _lineView;
  201 +}
  202 +
  203 +- (UIImageView *)countryImg{
  204 + if (!_countryImg) {
  205 + _countryImg = [[UIImageView alloc] init];
  206 + _countryImg.userInteractionEnabled = YES;
  207 + UIImage *image = [self getImageWithImageName:@"mine_info_front" bundleName:@"CNLiveBMineModule" targetClass:[self class]];
  208 + _countryImg.image = image;
  209 + _countryImg.contentMode = UIViewContentModeCenter;
  210 + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(countryTap:)];
  211 + [_countryImg addGestureRecognizer:tap];
  212 + }
  213 + return _countryImg;
  214 +}
  215 +
  216 +- (UILabel *)countryCode {
  217 + if (!_countryCode) {
  218 + _countryCode = [[UILabel alloc] init];
  219 + _countryCode.textColor = [UIColor colorWithRed:26/255.0 green:26/255.0 blue:26/255.0 alpha:1.0];
  220 + _countryCode.font = UIFontCNMake(14.0);
  221 + _countryCode.text = @"+86";
  222 + _countryCode.textAlignment = NSTextAlignmentLeft;
  223 + _countryCode.userInteractionEnabled = YES;
  224 + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(countryTap:)];
  225 + [_countryCode addGestureRecognizer:tap];
  226 + }
  227 + return _countryCode;
  228 +}
  229 +
  230 +- (UILabel *)numberLabel {
  231 + if (!_numberLabel) {
  232 + _numberLabel = [[UILabel alloc] init];
  233 + _numberLabel.textColor = [UIColor colorWithRed:26/255.0 green:26/255.0 blue:26/255.0 alpha:1.0];
  234 + _numberLabel.font = UIFontCNMake(14.0);
  235 + _numberLabel.text = @"手机号";
  236 + _numberLabel.textAlignment = NSTextAlignmentLeft;
  237 + }
  238 + return _numberLabel;
  239 +}
  240 +
  241 +- (UILabel *)codeLabel {
  242 + if (!_codeLabel) {
  243 + _codeLabel = [[UILabel alloc] init];
  244 + _codeLabel.textColor = [UIColor colorWithRed:26/255.0 green:26/255.0 blue:26/255.0 alpha:1.0];
  245 + _codeLabel.font = UIFontCNMake(14.0);
  246 + _codeLabel.text = @"验证码";
  247 + _codeLabel.textAlignment = NSTextAlignmentLeft;
  248 + }
  249 + return _codeLabel;
  250 +}
  251 +
  252 +- (UITextField *)telTF {
  253 + if (!_telTF) {
  254 + _telTF = [[UITextField alloc] init];
  255 + _telTF.textColor = [UIColor colorWithRed:34/255.0 green:34/255.0 blue:34/255.0 alpha:1.0];
  256 + _telTF.font = UIFontCNMake(14.0);
  257 + _telTF.placeholder = @"请输入新手机号";
  258 + _telTF.delegate = self;
  259 + _telTF.keyboardType = UIKeyboardTypeNumberPad;
  260 + [_telTF addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
  261 + _telTF.tag = 10001;
  262 + }
  263 + return _telTF;
  264 +}
  265 +
  266 +- (UITextField *)codeTF {
  267 + if (!_codeTF) {
  268 + _codeTF = [[UITextField alloc] init];
  269 + _codeTF.textColor = [UIColor colorWithRed:34/255.0 green:34/255.0 blue:34/255.0 alpha:1.0];
  270 + _codeTF.font = UIFontCNMake(14.0);
  271 + _codeTF.placeholder = @"请输入验证码";
  272 + _codeTF.delegate = self;
  273 + _codeTF.keyboardType = UIKeyboardTypeNumberPad;
  274 + [_codeTF addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
  275 + _codeTF.tag = 10002;
  276 + }
  277 + return _codeTF;
  278 +}
  279 +
  280 +- (UIButton *)verification{
  281 + if (!_verification) {
  282 + _verification = [UIButton buttonWithType:UIButtonTypeCustom];
  283 + [_verification setTitle:@"获取验证码" forState:UIControlStateNormal];
  284 + [_verification setTitleColor:[UIColor colorWithRed:195/255.0 green:195/255.0 blue:195/255.0 alpha:1.0] forState:UIControlStateNormal];
  285 + _verification.titleLabel.font = [UIFont systemFontOfSize:14.0];
  286 + _verification.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
  287 + _verification.layer.cornerRadius = 15;
  288 + _verification.layer.masksToBounds = YES;
  289 + [_verification addTarget:self action:@selector(verificationDidClicked:) forControlEvents:UIControlEventTouchUpInside];
  290 + }
  291 + return _verification;
  292 +}
  293 +
  294 +- (UIView *)bindingView{
  295 + if (!_bindingView) {
  296 + _bindingView = [[UIView alloc]init];
  297 + _bindingView.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
  298 + }
  299 + return _bindingView;
  300 +}
  301 +
  302 +- (UIButton *)binding{
  303 + if (!_binding) {
  304 + _binding = [UIButton buttonWithType:UIButtonTypeCustom];
  305 + [_binding setTitle:@"验证后绑定新手机号" forState:UIControlStateNormal];
  306 + [_binding setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  307 + _binding.titleLabel.font = UIFontCNMake(15.0);
  308 + _binding.backgroundColor = [UIColor colorWithRed:0/255.0 green:194/255.0 blue:0/255.0 alpha:1.0];
  309 + _binding.layer.cornerRadius = 45/2.0;
  310 + _binding.layer.masksToBounds = YES;
  311 + [_binding addTarget:self action:@selector(bindingDidClicked:) forControlEvents:UIControlEventTouchUpInside];
  312 + }
  313 + return _binding;
  314 +
  315 +}
  316 +
  317 +#pragma mark - 私有方法
  318 +
  319 +#pragma mark - Action
  320 +- (void)countryTap:(UITapGestureRecognizer *)tap{
  321 + if (self.delegate && [self.delegate respondsToSelector:@selector(selectCountry:)]) {
  322 + [self.delegate selectCountry:self];
  323 + }
  324 +}
  325 +
  326 +- (void)verificationDidClicked:(UIButton *)sender {
  327 + if ([NSString isEmpty:self.telTF.text] || [self.telTF.text isWhitespaceAndNewlines]) {
  328 + QMUIAlertAction *sure = [QMUIAlertAction actionWithTitle:@"我知道了" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  329 + }];
  330 + QMUIAlertController *alertController = [QMUIAlertController alertControllerWithTitle:@"请输入正确的手机号码" message:@"" preferredStyle:QMUIAlertControllerStyleAlert];
  331 + [alertController addAction:sure];
  332 +
  333 + NSMutableDictionary *titleAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
  334 + titleAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
  335 + sure.buttonAttributes = titleAttributs;
  336 +
  337 + [alertController showWithAnimated:YES];
  338 + }
  339 + else if ([self.telTF.text isEqualToString:CNUserShareModel.mobile]) {
  340 + [QMUITips showWithText:@"您更新的手机号与旧手机号一致,请重新输入确认" inView:[UIApplication sharedApplication].delegate.window hideAfterDelay:timeValue];
  341 + }
  342 + else {
  343 + // 发送验证码
  344 + [self.telTF resignFirstResponder];
  345 + [self.codeTF becomeFirstResponder];
  346 +
  347 + self.verification.userInteractionEnabled = NO;
  348 + self.verification.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
  349 + [self.verification setTitleColor:[UIColor colorWithRed:195/255.0 green:195/255.0 blue:195/255.0 alpha:1.0] forState:UIControlStateNormal];
  350 + self.gotVerificationCodeIng = YES;
  351 +
  352 + [CNLiveUserSystemCenter verificationCodeType:VerificationCodeTypeRegister mobile:self.telTF.text countryCode:_codeNum success:^(id result) {
  353 +
  354 + [QMUITips showSucceed:@"短信发送成功" inView:[UIApplication sharedApplication].delegate.window hideAfterDelay:timeValue];
  355 + self.gotVerificationCode = YES;
  356 + [self countDown];
  357 +
  358 + } failure:^(NSDictionary *errorDic) {
  359 + NSString *errMsg;
  360 + if ([[NSString stringWithFormat:@"%@",errorDic[@"errorCode"]] isEqualToString:@"408"]) {
  361 + errMsg = @"请填写正确的手机号";
  362 + } else {
  363 + errMsg = errorDic[@"errorMessage"];
  364 + }
  365 + [QMUITips showError:errMsg inView:[UIApplication sharedApplication].delegate.window hideAfterDelay:timeValue];
  366 +
  367 + self.gotVerificationCode = NO;
  368 + self.verification.userInteractionEnabled = YES;
  369 + self.verification.backgroundColor = [UIColor colorWithRed:0/255.0 green:194/255.0 blue:0/255.0 alpha:1.0];
  370 + [self.verification setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  371 + self.gotVerificationCodeIng = NO;
  372 +
  373 + }];
  374 + }
  375 +
  376 +}
  377 +
  378 +- (void)bindingDidClicked:(UIButton *)sender {
  379 + if (self.gotVerificationCode) {
  380 + if (self.codeTF.text.length == 6) {
  381 + [QMUITips showLoadingInView:self];
  382 + [CNLiveUserSystemCenter updateMobileWithUid:CNUserShareModel.uid mobile:self.telTF.text countryCode:_codeNum verificationCode:self.codeTF.text success:^(id result) {
  383 + CNUserShareModel.mobile = self.telTF.text;
  384 + [CNUserInfoModel setLocalUserInfo:self.countryName.text withKey:@"countryname"];
  385 + [CNUserInfoModel setLocalUserInfo:self.countryCode.text withKey:@"countrycode"];
  386 + [QMUITips hideAllToastInView:self animated:YES];
  387 + if (self.delegate && [self.delegate respondsToSelector:@selector(bindingSuccess:)]) {
  388 + [self.delegate bindingSuccess:self];
  389 + }
  390 +
  391 + } failure:^(NSDictionary *errorDic) {
  392 + [QMUITips hideAllToastInView:self animated:YES];
  393 + [QMUITips showError:errorDic[@"errorMessage"] inView:[UIApplication sharedApplication].delegate.window hideAfterDelay:timeValue];
  394 +
  395 + }];
  396 +
  397 + } else {
  398 + QMUIAlertAction *sure = [QMUIAlertAction actionWithTitle:@"我知道了" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  399 + }];
  400 + QMUIAlertController *alertController = [QMUIAlertController alertControllerWithTitle:@"请输入正确的验证码" message:@"" preferredStyle:QMUIAlertControllerStyleAlert];
  401 + [alertController addAction:sure];
  402 +
  403 + NSMutableDictionary *titleAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
  404 + titleAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
  405 + sure.buttonAttributes = titleAttributs;
  406 +
  407 + [alertController showWithAnimated:YES];
  408 + }
  409 +
  410 + } else {
  411 + NSString *alertText = @"请先获取验证码";
  412 + if (self.telTF.text.length != 11) {
  413 + alertText = @"请先输入正确的手机号码";
  414 + } else {
  415 + alertText = @"请先获取验证码";
  416 + }
  417 +
  418 + QMUIAlertAction *sure = [QMUIAlertAction actionWithTitle:@"我知道了" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  419 + }];
  420 + QMUIAlertController *alertController = [QMUIAlertController alertControllerWithTitle:alertText message:@"" preferredStyle:QMUIAlertControllerStyleAlert];
  421 + [alertController addAction:sure];
  422 +
  423 + NSMutableDictionary *titleAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
  424 + titleAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
  425 + sure.buttonAttributes = titleAttributs;
  426 +
  427 + [alertController showWithAnimated:YES];
  428 +
  429 + }
  430 +
  431 +}
  432 +
  433 +- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
  434 + [self.telTF resignFirstResponder];
  435 +}
  436 +
  437 +#pragma mark - 倒计时
  438 +- (void)countDown {
  439 + __block NSInteger second = TIMECOUNT;
  440 + //(1)
  441 + dispatch_queue_t quene = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
  442 + //(2)
  443 + dispatch_source_t timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, quene);
  444 + //(3)
  445 + dispatch_source_set_timer(timer, DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC, 0 * NSEC_PER_SEC);
  446 + //(4)
  447 + dispatch_source_set_event_handler(timer, ^{
  448 + dispatch_async(dispatch_get_main_queue(), ^{
  449 + if (second == 0) {
  450 + [self setupTextFieldUI:self.telTF];
  451 + self.gotVerificationCodeIng = NO;
  452 + [self.verification setTitle:[NSString stringWithFormat:@"获取验证码"] forState:UIControlStateNormal];
  453 + second = TIMECOUNT;
  454 + dispatch_cancel(timer);
  455 + } else {
  456 + [self.verification setTitle:[NSString stringWithFormat:@"%lds",second] forState:UIControlStateNormal];
  457 + second--;
  458 + }
  459 + });
  460 + });
  461 + //(5)
  462 + dispatch_resume(timer);
  463 +}
  464 +
  465 +- (void)setupTextFieldUI:(UITextField *)textField{
  466 + if (textField.text.length > 0) {
  467 + _verification.userInteractionEnabled = YES;
  468 + _verification.backgroundColor = [UIColor colorWithRed:0/255.0 green:194/255.0 blue:0/255.0 alpha:1.0];
  469 + [_verification setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  470 + }
  471 + else {
  472 + _verification.userInteractionEnabled = NO;
  473 + _verification.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
  474 + [_verification setTitleColor:[UIColor colorWithRed:195/255.0 green:195/255.0 blue:195/255.0 alpha:1.0] forState:UIControlStateNormal];
  475 + }
  476 +}
  477 +
  478 +@end
  479 +
... ...
CNLiveBMineModule/Classes/Setting/View/CNLiveSettingCell.h 0 → 100644
  1 +//
  2 +// CNLiveSettingCell.h
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright © 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +@class CNLiveSettingModel;
  13 +static NSString * const kCNLiveSettingCell = @"CNLiveSettingCell";
  14 +
  15 +@interface CNLiveSettingCell : UITableViewCell
  16 +
  17 +@property (nonatomic, strong) CNLiveSettingModel *model;
  18 +@property (nonatomic, strong) UIColor *lineColor;
  19 +
  20 +@end
  21 +
  22 +NS_ASSUME_NONNULL_END
... ...
CNLiveBMineModule/Classes/Setting/View/CNLiveSettingCell.m 0 → 100644
  1 +//
  2 +// CNLiveSettingCell.m
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/9/6.
  6 +// Copyright © 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveSettingCell.h"
  10 +#import <Masonry/Masonry.h>
  11 +#import "CNLiveCategory.h"
  12 +#import "CNLiveBaseKit.h"
  13 +
  14 +#import "CNLiveSettingModel.h"
  15 +
  16 +@interface CNLiveSettingCell()
  17 +@property (nonatomic, strong) UIView *line;
  18 +@property (nonatomic, strong) UILabel *title;
  19 +@property (nonatomic, strong) UILabel *content;
  20 +@property (nonatomic, strong) UIImageView *front;
  21 +
  22 +@end
  23 +
  24 +@implementation CNLiveSettingCell
  25 +static const NSInteger margin = 12;
  26 +
  27 +- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  28 + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  29 + if (self) {
  30 + self.contentView.backgroundColor = [UIColor whiteColor];
  31 +
  32 + [self.contentView addSubview:self.line];
  33 + [self.contentView addSubview:self.title];
  34 + [self.contentView addSubview:self.content];
  35 + [self.contentView addSubview:self.front];
  36 +
  37 + }
  38 + return self;
  39 +}
  40 +- (void)setModel:(CNLiveSettingModel *)model{
  41 + _model = model;
  42 + _title.text = model.title;
  43 + _content.text = model.content;
  44 + [self xw_layoutSubviews];
  45 +}
  46 +
  47 +- (void)xw_layoutSubviews{
  48 + _title.font = UIFontCNMake(16.0);
  49 + _content.font = UIFontCNMake(14.0);
  50 +
  51 + [_line mas_updateConstraints:^(MASConstraintMaker *make) {
  52 + make.left.equalTo(self.contentView.mas_left).with.offset(0);
  53 + make.right.equalTo(self.contentView.mas_right).with.offset(0);
  54 + make.top.equalTo(self.contentView.mas_top).with.offset(0);
  55 + make.height.offset(self.model.lineHeight);
  56 +
  57 + }];
  58 +
  59 + [_title mas_updateConstraints:^(MASConstraintMaker *make) {
  60 + make.left.equalTo(self.line.mas_left).with.offset(margin);
  61 + make.top.equalTo(self.line.mas_bottom).with.offset(0);
  62 + make.height.offset(self.model.height-self.model.lineHeight);
  63 +
  64 + }];
  65 +
  66 + [_front mas_updateConstraints:^(MASConstraintMaker *make) {
  67 + make.right.equalTo(self.line.mas_right).with.offset(-margin);
  68 + make.top.equalTo(self.title.mas_top).with.offset(0);
  69 + make.width.with.offset(margin);
  70 + make.height.equalTo(self.title.mas_height);
  71 +
  72 + }];
  73 +
  74 + switch (self.model.type) {
  75 + case CNLiveSettingModelTypeTextFront:
  76 + {
  77 + _front.hidden = NO;
  78 + _content.hidden = NO;
  79 + [_content mas_updateConstraints:^(MASConstraintMaker *make) {
  80 + make.top.equalTo(self.title.mas_top).with.offset(0);
  81 + make.left.equalTo(self.title.mas_right).with.offset(0);
  82 + make.right.equalTo(self.front.mas_left).with.offset(-margin);
  83 + make.height.equalTo(self.title.mas_height);
  84 +
  85 + }];
  86 + }
  87 + break;
  88 + case CNLiveSettingModelTypeText:
  89 + {
  90 + _front.hidden = YES;
  91 + _content.hidden = NO;
  92 + [_content mas_updateConstraints:^(MASConstraintMaker *make) {
  93 + make.top.equalTo(self.title.mas_top).with.offset(0);
  94 + make.left.equalTo(self.title.mas_right).with.offset(0);
  95 + make.right.equalTo(self.mas_right).with.offset(-margin);
  96 + make.height.equalTo(self.title.mas_height);
  97 +
  98 + }];
  99 + }
  100 + break;
  101 +
  102 + default:
  103 + {
  104 + _front.hidden = NO;
  105 + _content.hidden = YES;
  106 +
  107 + }
  108 + break;
  109 + }
  110 +
  111 +}
  112 +- (void)setLineColor:(UIColor *)lineColor{
  113 + _lineColor = lineColor;
  114 + _line.backgroundColor = lineColor;
  115 +}
  116 +- (void)awakeFromNib {
  117 + [super awakeFromNib];
  118 + // Initialization code
  119 +}
  120 +
  121 +- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  122 + [super setSelected:selected animated:animated];
  123 +
  124 + // Configure the view for the selected state
  125 +}
  126 +
  127 +#pragma mark - 响应方法
  128 +
  129 +#pragma mark - 懒加载
  130 +- (UIView *)line {
  131 + if (!_line) {
  132 + _line = [[UIView alloc] init];
  133 + _line.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
  134 + }
  135 + return _line;
  136 +}
  137 +
  138 +- (UILabel *)title {
  139 + if (!_title) {
  140 + _title = [[UILabel alloc] init];
  141 + _title.numberOfLines = 1;
  142 + _title.textColor = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0];
  143 + _title.font = UIFontCNMake(16.0);
  144 + }
  145 + return _title;
  146 +}
  147 +
  148 +- (UILabel *)content {
  149 + if (!_content) {
  150 + _content = [[UILabel alloc] init];
  151 + _content.numberOfLines = 1;
  152 + _content.lineBreakMode = NSLineBreakByTruncatingTail;
  153 + _content.textColor = [UIColor colorWithRed:102/255.0 green:102/255.0 blue:102/255.0 alpha:1.0];
  154 + _content.font = UIFontCNMake(14.0);
  155 + }
  156 + return _content;
  157 +}
  158 +
  159 +- (UIImageView *)front {
  160 + if (!_front) {
  161 + _front = [[UIImageView alloc] init];
  162 + UIImage *xw_image = [self getImageWithImageName:@"mine_into" bundleName:@"CNLiveBMineModule" targetClass:[CNLiveSettingCell class]];
  163 + _front.image = xw_image;
  164 + _front.contentMode = UIViewContentModeCenter;
  165 + }
  166 + return _front;
  167 +}
  168 +
  169 +@end
  170 +
... ...
CNLiveBMineModule/Classes/UserInfo/CNLiveInfoUpdateCell.h 0 → 100644
  1 +//
  2 +// CNLiveInfoUpdateCell.m
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +static NSString * const kCNLiveInfoUpdateCell = @"CNLiveInfoUpdateCell";
  13 +
  14 +@interface CNLiveInfoUpdateCell : UITableViewCell
  15 +@property (nonatomic, copy) NSString *text;
  16 +@property (nonatomic, assign) BOOL isShow;
  17 +
  18 +@end
  19 +
  20 +NS_ASSUME_NONNULL_END
... ...
CNLiveBMineModule/Classes/UserInfo/CNLiveInfoUpdateCell.m 0 → 100644
  1 +//
  2 +// CNLiveInfoUpdateCell.m
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveInfoUpdateCell.h"
  10 +#import <Masonry/Masonry.h>
  11 +#import <SDWebImage/SDWebImage.h>
  12 +#import "CNLiveUserInfoModel.h"
  13 +#import "CNLiveCategory.h"
  14 +
  15 +@interface CNLiveInfoUpdateCell()
  16 +@property (nonatomic, strong) UIView *line;
  17 +@property (nonatomic, strong) UILabel *title;
  18 +
  19 +@property (nonatomic, strong) UIImageView *pic;
  20 +
  21 +@end
  22 +
  23 +@implementation CNLiveInfoUpdateCell
  24 +static const NSInteger margin = 12;
  25 +
  26 +- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  27 + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  28 + if (self) {
  29 + self.contentView.backgroundColor = [UIColor whiteColor];
  30 +
  31 + [self.contentView addSubview:self.title];
  32 + [self.contentView addSubview:self.pic];
  33 + [self.contentView addSubview:self.line];
  34 +
  35 + [self xw_layoutSubviews];
  36 +
  37 + }
  38 + return self;
  39 +}
  40 +
  41 +- (void)xw_layoutSubviews{
  42 +
  43 + [_title mas_updateConstraints:^(MASConstraintMaker *make) {
  44 + make.left.equalTo(self.contentView.mas_left).with.offset(margin);
  45 + make.top.equalTo(self.contentView.mas_top).with.offset(0);
  46 + make.bottom.equalTo(self.contentView.mas_bottom).with.offset(0);
  47 +
  48 + }];
  49 +
  50 + [_pic mas_updateConstraints:^(MASConstraintMaker *make) {
  51 + make.right.equalTo(self.contentView.mas_right).with.offset(-margin);
  52 + make.top.equalTo(self.contentView.mas_top).with.offset(0);
  53 + make.bottom.equalTo(self.contentView.mas_bottom).with.offset(0);
  54 +
  55 + }];
  56 +
  57 + [_line mas_updateConstraints:^(MASConstraintMaker *make) {
  58 + make.left.equalTo(self.contentView.mas_left).with.offset(0);
  59 + make.right.equalTo(self.contentView.mas_right).with.offset(-0);
  60 + make.bottom.equalTo(self.contentView.mas_bottom).with.offset(0);
  61 + make.height.offset(0.5);
  62 +
  63 + }];
  64 +
  65 +
  66 +}
  67 +
  68 +- (void)setText:(NSString *)text{
  69 + _text = text;
  70 + _title.text = text;
  71 +}
  72 +
  73 +- (void)setIsShow:(BOOL)isShow{
  74 + _isShow = isShow;
  75 + _pic.hidden = !isShow;
  76 +}
  77 +
  78 +- (void)awakeFromNib {
  79 + [super awakeFromNib];
  80 + // Initialization code
  81 +}
  82 +
  83 +- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  84 + [super setSelected:selected animated:animated];
  85 +
  86 + // Configure the view for the selected state
  87 +}
  88 +#pragma mark - 懒加载
  89 +- (UIView *)line {
  90 + if (!_line) {
  91 + _line = [[UIView alloc] init];
  92 + _line.backgroundColor = [UIColor colorWithRed:235/255.0 green:235/255.0 blue:235/255.0 alpha:1.0];
  93 + }
  94 + return _line;
  95 +}
  96 +
  97 +- (UILabel *)title {
  98 + if (!_title) {
  99 + _title = [[UILabel alloc] init];
  100 + _title.numberOfLines = 1;
  101 + _title.textColor = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0];
  102 + _title.font = [UIFont systemFontOfSize:16];
  103 + }
  104 + return _title;
  105 +}
  106 +
  107 +
  108 +- (UIImageView *)pic {
  109 + if (!_pic) {
  110 + _pic = [[UIImageView alloc] init];
  111 + UIImage *xw_image = [self getImageWithImageName:@"mine_update_select" bundleName:@"CNLiveBMineModule" targetClass:[self class]];
  112 + _pic.image = xw_image;
  113 + _pic.hidden = YES;
  114 + _pic.contentMode = UIViewContentModeCenter;
  115 +
  116 + }
  117 + return _pic;
  118 +}
  119 +
  120 +@end
... ...
CNLiveBMineModule/Classes/UserInfo/CNLiveInfoUpdateController.h 0 → 100644
  1 +//
  2 +// CNLiveBMineController.m
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNCommonViewController.h"
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +@class CNLiveUserInfoModel;
  13 +
  14 +@interface CNLiveInfoUpdateController : CNCommonViewController
  15 +
  16 +/**
  17 + * @abstract 对象方法 初始化方法
  18 + *
  19 + * @param model 模型
  20 + */
  21 +- (instancetype)initWithModel:(CNLiveUserInfoModel *)model;
  22 +
  23 +@end
  24 +
  25 +NS_ASSUME_NONNULL_END
... ...
CNLiveBMineModule/Classes/UserInfo/CNLiveInfoUpdateController.m 0 → 100644
  1 +//
  2 +// CNLiveBMineController.m
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveInfoUpdateController.h"
  10 +#import "QMUIKit.h"
  11 +#import <SDWebImage/SDWebImage.h>
  12 +#import <Masonry/Masonry.h>
  13 +
  14 +#import <AVFoundation/AVCaptureDevice.h>
  15 +#import <AVFoundation/AVMediaFormat.h>
  16 +#import "XFCameraController.h"
  17 +#import "TZImagePickerController.h"
  18 +#import "CNUserInfoManager.h"
  19 +#import <CNLiveUserSystemSDK/CNLiveUserSystemCenter.h>
  20 +#import <CNLiveUserSystemSDK/CNLiveUserSystemTypeDef.h>
  21 +#import "NSString+CNLiveExtension.h"
  22 +#import "NSDictionary+Safety.h"
  23 +#import "UIImage+Common.h"
  24 +#import "CNLiveManager.h"
  25 +#import "TIMAdapter.h"
  26 +#import "CommonLibrary.h"
  27 +
  28 +#import "CNLiveCategory.h"
  29 +#import "CNLiveNavigationBar.h"
  30 +
  31 +//#import "CNLiveUserInfoModel.h"
  32 +#import "CNLiveUserInfoNotification.h"
  33 +#import "CNLiveInfoUpdateCell.h"
  34 +
  35 +@interface CNLiveInfoUpdateController ()<UITextFieldDelegate,UITextViewDelegate,QMUIAlertControllerDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate,TZImagePickerControllerDelegate,UITableViewDelegate,UITableViewDataSource>{
  36 + UIImage *_image;
  37 +}
  38 +@property (nonatomic, strong) CNLiveNavigationBar *navigationBar;
  39 +@property (nonatomic, strong) CNLiveUserInfoModel *model;
  40 +
  41 +@property (nonatomic, strong) UIView *contentView;
  42 +
  43 +// 头像
  44 +@property (nonatomic, strong) UIImageView *imageView;
  45 +
  46 +// 昵称/地址
  47 +@property (nonatomic, strong) UITextField *textField;
  48 +
  49 +// 个性签名
  50 +@property (nonatomic, strong) UITextView *textView;
  51 +@property (nonatomic, strong) UILabel *textNum;
  52 +
  53 +// 性别
  54 +@property (nonatomic, strong) UITableView *tableView;
  55 +@property (nonatomic, strong) NSString *gender;
  56 +
  57 +@end
  58 +
  59 +@implementation CNLiveInfoUpdateController
  60 +
  61 +#define _locMaxLength 12
  62 +#define _nickMaxLength 20
  63 +#define MAX_LIMIT_NUMS 30
  64 +
  65 +static const NSInteger margin = 15;
  66 +static const CGFloat timeValue = 1.5;
  67 +
  68 +#pragma mark - 初始化方法
  69 +- (instancetype)initWithModel:(CNLiveUserInfoModel *)model{
  70 + self = [super init];
  71 + if (self) {
  72 + self.model = model;
  73 + self.gender = CNUserShareModel.gender;
  74 + }
  75 + return self;
  76 +}
  77 +
  78 +#pragma mark - 生命周期
  79 +- (void)viewWillAppear:(BOOL)animated{
  80 + [super viewWillAppear:animated];
  81 + self.navigationController.navigationBarHidden = YES;
  82 +}
  83 +
  84 +- (void)viewDidLoad {
  85 + [super viewDidLoad];
  86 + self.view.backgroundColor = [UIColor colorWithRed:244.0/255.0 green:244.0/255.0 blue:244.0/255.0 alpha:1.0];
  87 + if (@available(iOS 11, *)) {
  88 + }
  89 + else {
  90 + self.automaticallyAdjustsScrollViewInsets = NO;
  91 + }
  92 + [self.view addSubview:self.navigationBar];
  93 + [self.view addSubview:self.contentView];
  94 +}
  95 +
  96 +#pragma mark - UITextFieldDelegate
  97 +- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
  98 + self.navigationBar.right.userInteractionEnabled = YES;
  99 + self.navigationBar.right.backgroundColor = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
  100 + NSInteger maxLength = (self.model.dataType == CNLiveUserInfoDataTypeNickname) ? _nickMaxLength : _locMaxLength;
  101 + if (range.location >= maxLength) {
  102 + textField.text = [textField.text substringToIndex:maxLength];
  103 + return NO;
  104 + }
  105 + return YES;
  106 +}
  107 +
  108 +- (BOOL)textFieldShouldReturn:(UITextField *)textField {
  109 + switch (self.model.dataType) {
  110 + case CNLiveUserInfoDataTypeNickname:
  111 + {
  112 + [self requestUpdateUserNickname];
  113 + }
  114 + break;
  115 + case CNLiveUserInfoDataTypeAddress:
  116 + {
  117 + [self requestUpdateUserAddress];
  118 + }
  119 + break;
  120 +
  121 + default:
  122 + break;
  123 + }
  124 + return YES;
  125 +}
  126 +
  127 +#pragma mark - UITextViewDelegate
  128 +- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
  129 + self.navigationBar.right.userInteractionEnabled = YES;
  130 + self.navigationBar.right.backgroundColor = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
  131 +
  132 + if([text length] != 0) {
  133 + NSLog(@"增");
  134 + if ([[text removeNewLine] length] == 0) { //换行
  135 + return NO;
  136 + }
  137 + }
  138 + else {
  139 + NSLog(@"删");
  140 + return YES;
  141 + }
  142 + NSLog(@"%lu",(unsigned long)textView.text.length);
  143 +
  144 + UITextRange *selectedRange = [textView markedTextRange]; //获取高亮部分
  145 + UITextPosition *pos = [textView positionFromPosition:selectedRange.start offset:0];
  146 + NSString *selectedtext = [textView textInRange:selectedRange]; //获取高亮部分内容
  147 +
  148 + //如果有高亮且当前字数开始位置小于最大限制时允许输入
  149 + if (selectedRange && pos) {
  150 + NSInteger startOffset = [textView offsetFromPosition:textView.beginningOfDocument toPosition:selectedRange.start];
  151 + NSInteger endOffset = [textView offsetFromPosition:textView.beginningOfDocument toPosition:selectedRange.end];
  152 + NSRange offsetRange = NSMakeRange(startOffset, endOffset - startOffset);
  153 +
  154 + if (offsetRange.location < MAX_LIMIT_NUMS && offsetRange.location+selectedtext.length <= MAX_LIMIT_NUMS && offsetRange.location+text.length <= MAX_LIMIT_NUMS) {
  155 + return YES;
  156 + }
  157 + else {
  158 + return NO;
  159 + }
  160 + }
  161 +
  162 + NSString *comcatstr = [textView.text stringByReplacingCharactersInRange:range withString:text];//拼上
  163 + NSInteger caninputlen = MAX_LIMIT_NUMS - comcatstr.length;//最大减全拼上(拼后剩/超)
  164 + if (caninputlen >= 0) {
  165 + return YES;
  166 + }
  167 + else {
  168 + NSInteger len = text.length + caninputlen; //原本剩余的空间
  169 + //防止当text.length + caninputlen < 0时,使得rg.length为一个非法最大正数出错
  170 + NSRange rg = {0,MAX(len,0)};
  171 +
  172 + if (rg.length > 0) {
  173 + NSString *s = @"";//正确待拼text
  174 + //判断是否只普通的字符或asc码(对于中文和表情返回NO)
  175 + BOOL asc = [text canBeConvertedToEncoding:NSASCIIStringEncoding];
  176 + if (asc) {
  177 + s = [text substringWithRange:rg];//因为是ascii码直接取就可以了不会错
  178 + }
  179 + else {
  180 + __block NSInteger idx = 0;
  181 + __block NSString *trimString = @"";//截取出的字串
  182 + //使用字符串遍历,这个方法能准确知道每个emoji是占一个unicode还是两个
  183 + [text enumerateSubstringsInRange:NSMakeRange(0, [text length])
  184 + options:NSStringEnumerationByComposedCharacterSequences
  185 + usingBlock: ^(NSString* substring, NSRange substringRange, NSRange enclosingRange, BOOL* stop) {
  186 +
  187 + NSInteger steplen = substring.length;
  188 + if (steplen>rg.length) {
  189 + *stop = YES; //取出所需要就break,提高效率
  190 + return ;
  191 + }
  192 + if (idx >= rg.length) {
  193 + *stop = YES; //取出所需要就break,提高效率
  194 + return ;
  195 + }
  196 +
  197 + trimString = [trimString stringByAppendingString:substring];
  198 + idx = idx + steplen;//这里变化了,使用了字串占的长度来作为步长
  199 + }];
  200 +
  201 + s = trimString;
  202 + }
  203 + //rang是指从当前光标处进行替换处理(注意如果执行此句后面返回的是YES会触发didchange事件)
  204 + [textView setText:[textView.text stringByReplacingCharactersInRange:range withString:s]];
  205 + //既然是超出部分截取了,哪一定是最大限制了。
  206 + self.textNum.text = [NSString stringWithFormat:@"%d",0];
  207 + }
  208 + return NO;
  209 + }
  210 +
  211 +}
  212 +
  213 +- (void)textViewDidChange:(UITextView *)textView{
  214 + NSString *nsTextContent = textView.text; //总text
  215 + NSInteger existTextNum = nsTextContent.length; //总length
  216 +
  217 + if (existTextNum > MAX_LIMIT_NUMS) {
  218 + //截取到最大位置的字符(由于超出截部分在should时被处理了所在这里这了提高效率不再判断)
  219 + NSString *s = [nsTextContent substringToIndex:MAX_LIMIT_NUMS];
  220 + [textView setText:s];
  221 + }
  222 + //不让显示负数
  223 + self.textNum.text = [NSString stringWithFormat:@"%ld",MAX(0,MAX_LIMIT_NUMS - existTextNum)];
  224 +
  225 +}
  226 +
  227 +- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
  228 + [self.view endEditing:YES];
  229 +}
  230 +#pragma mark - UITableViewDataSource
  231 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  232 + return 2;
  233 +}
  234 +
  235 +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  236 + NSArray *data = @[@"男", @"女"];
  237 + CNLiveInfoUpdateCell *cell = [tableView dequeueReusableCellWithIdentifier:kCNLiveInfoUpdateCell forIndexPath:indexPath];
  238 + cell.text = data[indexPath.row];
  239 + if(indexPath.row == 0){
  240 + cell.isShow = [CNUserShareModel.gender isEqualToString:@"m"];
  241 + }else if (indexPath.row == 1){
  242 + cell.isShow = [CNUserShareModel.gender isEqualToString:@"f"];
  243 + }
  244 + return cell;
  245 +}
  246 +
  247 +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  248 + return 50.0;
  249 +}
  250 +
  251 +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  252 + [self.tableView qmui_clearsSelection];
  253 +
  254 + self.navigationBar.right.userInteractionEnabled = YES;
  255 + self.navigationBar.right.backgroundColor = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
  256 +
  257 + CNLiveInfoUpdateCell *cell = [tableView cellForRowAtIndexPath:indexPath];
  258 + NSArray *visibleCells = [self.tableView visibleCells];
  259 + for (CNLiveInfoUpdateCell *visibleCell in visibleCells) {
  260 + visibleCell.isShow = NO;
  261 + }
  262 + cell.isShow = YES;
  263 +
  264 + if(indexPath.row == 0){
  265 + self.gender = @"m";
  266 + }else if(indexPath.row == 1){
  267 + self.gender = @"f";
  268 + }
  269 +
  270 +}
  271 +
  272 +- (void)didHideAlertController:(QMUIAlertController *)alertController{
  273 + self.navigationBar.right.userInteractionEnabled = YES;
  274 +
  275 +}
  276 +
  277 +#pragma mark - 更新头像
  278 +// 修改头像
  279 +- (void)updateHeaderActionSheetView{
  280 + __weak typeof(self) weakSelf = self;
  281 + QMUIAlertAction *action1 = [QMUIAlertAction actionWithTitle:@"拍照" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  282 + __strong typeof(weakSelf) strongSelf = weakSelf;
  283 + if(!strongSelf) return ;
  284 + strongSelf.navigationBar.right.userInteractionEnabled = YES;
  285 + __strong typeof(strongSelf) weakSelf = strongSelf;
  286 + [CNLiveAuthorizationManager getAVAuthorizationStatus:^{
  287 + __strong typeof(weakSelf) strongSelf = weakSelf;
  288 + if(!strongSelf) return ;
  289 + XFCameraController *cameraController = [[XFCameraController alloc] init];
  290 + cameraController.isCanShootVideo = NO;
  291 + cameraController.modalPresentationStyle = UIModalPresentationFullScreen;
  292 + __weak XFCameraController *weakCameraController = cameraController;
  293 + __weak typeof(strongSelf) weakSelf = strongSelf;
  294 + cameraController.takePhotosCompletionBlock = ^(UIImage *image, NSError *error) {
  295 + __strong typeof(weakSelf) strongSelf = weakSelf;
  296 + if(!strongSelf) return ;
  297 + strongSelf->_image = image;
  298 + [strongSelf requestUpdateUserHeader:image];
  299 +
  300 + dispatch_async(dispatch_get_main_queue(), ^{
  301 + [weakCameraController dismissViewControllerAnimated:YES completion:nil];
  302 + });
  303 + };
  304 + [self presentViewController:cameraController animated:YES completion:nil];
  305 + }];
  306 +
  307 + }];
  308 + QMUIAlertAction *action2 = [QMUIAlertAction actionWithTitle:@"从手机相册中选择" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  309 + __strong typeof(weakSelf) strongSelf = weakSelf;
  310 + if(!strongSelf) return ;
  311 + strongSelf.navigationBar.right.userInteractionEnabled = YES;
  312 + __strong typeof(strongSelf) weakSelf = strongSelf;
  313 + [CNLiveAuthorizationManager getPHAuthorizationStatus:^{
  314 + __strong typeof(weakSelf) strongSelf = weakSelf;
  315 + if(!strongSelf) return ;
  316 + TZImagePickerController *picker = [[TZImagePickerController alloc] initWithMaxImagesCount:1 delegate:strongSelf];
  317 + picker.modalPresentationStyle = UIModalPresentationFullScreen;
  318 + picker.allowPickingVideo = NO;
  319 + picker.allowPreview = NO;
  320 + __weak typeof(strongSelf) weakSelf = strongSelf;
  321 + [picker setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) {
  322 + __strong typeof(weakSelf) strongSelf = weakSelf;
  323 + if(!strongSelf) return ;
  324 + strongSelf->_image = [photos firstObject];
  325 + [strongSelf requestUpdateUserHeader:[photos firstObject]];
  326 + }];
  327 + [strongSelf presentViewController:picker animated:YES completion:nil];
  328 + }];
  329 +
  330 + }];
  331 + QMUIAlertAction *action3 = [QMUIAlertAction actionWithTitle:@"保存图片" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  332 + __strong typeof(weakSelf) strongSelf = weakSelf;
  333 + if(!strongSelf) return ;
  334 + [CNLiveAuthorizationManager getPHAuthorizationStatus:^{
  335 + UIImage *image = [strongSelf generateImage:strongSelf.imageView];
  336 + [QMUITips showLoadingInView:strongSelf.view];
  337 + [strongSelf saveImage:image];
  338 + [QMUITips hideAllTipsInView:strongSelf.view];
  339 + }];
  340 + self.navigationBar.right.userInteractionEnabled = YES;
  341 +
  342 + }];
  343 + QMUIAlertAction *cancel = [QMUIAlertAction actionWithTitle:@"取消" style:QMUIAlertActionStyleCancel handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  344 + __strong typeof(weakSelf) strongSelf = weakSelf;
  345 + if(!strongSelf) return ;
  346 + self.navigationBar.right.userInteractionEnabled = YES;
  347 +
  348 + }];
  349 +
  350 + QMUIAlertController *alertController = [QMUIAlertController alertControllerWithTitle:@"" message:@"" preferredStyle:QMUIAlertControllerStyleActionSheet];
  351 + alertController.delegate = self;
  352 + [alertController addAction:action1];
  353 + [alertController addAction:action2];
  354 + [alertController addAction:action3];
  355 + [alertController addAction:cancel];
  356 +
  357 + NSMutableDictionary *titleAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
  358 +
  359 + titleAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
  360 +
  361 + NSMutableDictionary *cancelAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
  362 + cancelAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0];
  363 +
  364 + action1.buttonAttributes = titleAttributs;
  365 + action2.buttonAttributes = titleAttributs;
  366 + action3.buttonAttributes = titleAttributs;
  367 + cancel.buttonAttributes = cancelAttributs;
  368 +
  369 + [alertController showWithAnimated:YES];
  370 +}
  371 +
  372 +// 更新头像
  373 +- (void)requestUpdateUserHeader:(UIImage *)image{
  374 + // 固定方向
  375 + image = [image fixOrientation];
  376 + //压缩图片质量
  377 + image = [self reduceImage:image percent:0.5];
  378 + [QMUITips showLoading:@"修改中" inView:self.view];
  379 +
  380 + [CNLiveUserSystemCenter uploadIconWithUid:CNUserShareModel.uid icon:image compressionQuality:0.99 success:^(id result) {
  381 + CNUserShareModel.faceUrl = result[@"data"][@"faceUrl"];
  382 + CNUserShareModel.bigFaceUrl = result[@"data"][@"bigFaceUrl"];
  383 +
  384 + [self.imageView sd_setImageWithURL:[NSURL URLWithString:CNUserShareModel.bigFaceUrl] placeholderImage:image completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
  385 + }];
  386 +
  387 + [self showSucceed:CNUserShareModel.faceUrl];
  388 +
  389 + } failure:^(NSDictionary *errorDic) {
  390 + [self showError:errorDic[@"errorMessage"]];
  391 +
  392 + }];
  393 +
  394 +}
  395 +
  396 +// 压缩图片质量
  397 +- (UIImage *)reduceImage:(UIImage *)image percent:(float)percent {
  398 + NSData *imageData = UIImageJPEGRepresentation(image, percent);
  399 + UIImage *newImage = [UIImage imageWithData:imageData];
  400 + return newImage;
  401 +}
  402 +
  403 +// 保存图片
  404 +- (void)saveImage:(UIImage *)image{
  405 + if(!image){
  406 + [QMUITips showError:@"保存失败" inView:self.view hideAfterDelay:timeValue];
  407 + return;
  408 + }
  409 + [[PHPhotoLibrary sharedPhotoLibrary]performChanges:^{
  410 + [PHAssetChangeRequest creationRequestForAssetFromImage:image];
  411 +
  412 + } completionHandler:^(BOOL success, NSError * _Nullable error) {
  413 + dispatch_async(dispatch_get_main_queue(), ^{
  414 + if (success) {
  415 + [QMUITips showSucceed:@"保存成功" inView:self.view hideAfterDelay:timeValue];
  416 + } else {
  417 + [QMUITips showError:@"保存失败" inView:self.view hideAfterDelay:timeValue];
  418 + }
  419 + });
  420 +
  421 + }];
  422 +}
  423 +
  424 +// UIView转UIImage
  425 +- (UIImage *)generateImage:(UIView *)view{
  426 + // 1.开启上下文
  427 + UIGraphicsBeginImageContextWithOptions(view.frame.size, NO, 0.0);
  428 + // 2. 将控制器View的Layer渲染到上下文
  429 + [view.layer renderInContext:UIGraphicsGetCurrentContext()];
  430 + // 3.取出图片
  431 + UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
  432 + // 4.结束上下文
  433 + UIGraphicsEndImageContext();
  434 +
  435 + return newImage;
  436 +}
  437 +
  438 +#pragma mark - 更新昵称
  439 +- (void)requestUpdateUserNickname{
  440 + NSString *text = [self.textField.text trim];
  441 + if (text.length == 0) {
  442 + [QMUITips showError:@"没有输入名字,请重新填写" inView:self.view hideAfterDelay:timeValue];
  443 + self.navigationBar.right.userInteractionEnabled = YES;
  444 + return;
  445 + }
  446 + if ([text isEqualToString:CNUserShareModel.nickname]) {
  447 + self.navigationBar.right.userInteractionEnabled = YES;
  448 + [self goBack];
  449 + return;
  450 + }
  451 +
  452 + [QMUITips showLoading:@"修改中" inView:self.view];
  453 + [CNLiveUserSystemCenter modifyUserInfoType:UserInfoTypeNickName uid:CNUserShareModel.uid modifyInfo:text success:^(id result) {
  454 + CNUserShareModel.nickname = self.textField.text;
  455 + [self showSucceed:CNUserShareModel.nickname];
  456 +
  457 + } failure:^(NSDictionary *errorDic) {
  458 + [self showError:errorDic[@"errorMessage"]];
  459 +
  460 + }];
  461 +
  462 +}
  463 +
  464 +#pragma mark - 更新性别
  465 +- (void)requestUpdateUserGender{
  466 + if ([self.gender isEqualToString:CNUserShareModel.gender]) {
  467 + self.navigationBar.right.userInteractionEnabled = YES;
  468 + [self goBack];
  469 + return;
  470 + }
  471 + [QMUITips showLoading:@"修改中" inView:self.view];
  472 + [CNLiveUserSystemCenter modifyUserInfoType:UserInfoTypeGender uid:CNUserShareModel.uid modifyInfo:self.gender success:^(id result) {
  473 + CNUserShareModel.gender = self.gender;
  474 + [self showSucceed:CNUserShareModel.gender];
  475 +
  476 + } failure:^(NSDictionary *errorDic) {
  477 + [self showError:errorDic[@"errorMessage"]];
  478 +
  479 + }];
  480 +
  481 +}
  482 +
  483 +#pragma mark - 更新地区
  484 +- (void)requestUpdateUserAddress{
  485 + NSString *text = [self.textField.text trim];
  486 + if (text.length == 0) {
  487 + [QMUITips showError:@"请填写您的位置" inView:self.view hideAfterDelay:timeValue];
  488 + self.navigationBar.right.userInteractionEnabled = YES;
  489 + return;
  490 + }
  491 + if ([text isEqualToString:CNUserShareModel.location]) {
  492 + self.navigationBar.right.userInteractionEnabled = YES;
  493 + [self goBack];
  494 + return;
  495 + }
  496 +
  497 + [QMUITips showLoading:@"修改中" inView:self.view];
  498 + [CNLiveUserSystemCenter modifyUserInfoType:UserInfoTypeLocation uid:CNUserShareModel.uid modifyInfo:text success:^(id result) {
  499 + CNUserShareModel.location = self.textField.text;
  500 + [self showSucceed:CNUserShareModel.location];
  501 +
  502 + } failure:^(NSDictionary *errorDic) {
  503 + [self showError:errorDic[@"errorMessage"]];
  504 +
  505 + }];
  506 +
  507 +}
  508 +
  509 +#pragma mark - 更新个性签名
  510 +- (void)requestUpdateUserIntroduction {
  511 + BOOL isNil = [[self.textView.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]length] == 0;
  512 +
  513 + if ([self.textView.text isEqualToString:CNUserShareModel.signature]) {
  514 + self.navigationBar.right.userInteractionEnabled = YES;
  515 + [self goBack];
  516 + }
  517 +
  518 + // 签名不可以为空
  519 + NSString *signature;
  520 + if (isNil) {
  521 + signature = @"";
  522 + } else {
  523 + signature = [self.textView.text qmui_trim];
  524 + }
  525 +
  526 + NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:signature,@"userSign", nil];
  527 + NSString *updateSign = CNLiveNSDictionaryDicToJson(dic);
  528 +
  529 + [QMUITips showLoading:@"修改中" inView:self.view];
  530 + [CNLiveUserSystemCenter updateOtherInfoWithUid:CNUserShareModel.uid extInfo:updateSign success:^(id result) {
  531 + CNUserShareModel.signature = signature;
  532 + [self showSucceed:CNUserShareModel.signature];
  533 +
  534 + } failure:^(NSDictionary *errorDic) {
  535 + [self showError:errorDic[@"errorMessage"]];
  536 +
  537 + }];
  538 +
  539 +}
  540 +
  541 +#pragma mark - 更新提示
  542 +- (void)showSucceed:(NSString *)info{
  543 + [CNLiveUserInfoNotification postUserInfoUpdateNotificationType:self.model.dataType info:info];
  544 +
  545 + [[IMAPlatform sharedInstance].host asyncProfile];
  546 + [QMUITips hideAllToastInView:self.view animated:YES];
  547 + self.navigationBar.right.userInteractionEnabled = YES;
  548 + [QMUITips showSucceed:@"修改成功" inView:self.view];
  549 + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeValue * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  550 + [QMUITips hideAllToastInView:self.view animated:YES];
  551 + [self goBack];
  552 + });
  553 +
  554 +}
  555 +- (void)showError:(NSString *)text{
  556 + self.navigationBar.right.userInteractionEnabled = YES;
  557 + [QMUITips hideAllToastInView:self.view animated:YES];
  558 + [QMUITips showError:text inView:self.view hideAfterDelay:timeValue];
  559 +}
  560 +
  561 +#pragma mark - 懒加载
  562 +- (CNLiveNavigationBar *)navigationBar {
  563 + if (!_navigationBar) {
  564 + _navigationBar = [CNLiveNavigationBar navigationBar];
  565 + _navigationBar.title.text = @"个人资料";
  566 + switch (self.model.dataType) {
  567 + case CNLiveUserInfoDataTypeHeader:
  568 + {
  569 + UIImage *xw_image = [self getImageWithImageName:@"cnlive_black_more" bundleName:@"CNLiveCustomControl" targetClass:[CNLiveNavigationBar class]];
  570 + _navigationBar.rightImage = xw_image;
  571 + }
  572 + break;
  573 + default:
  574 + {
  575 + _navigationBar.rightTitle = @"完成";
  576 + _navigationBar.right.frame = CGRectMake(SCREEN_WIDTH-45-15, StatusBarHeight+10, 45, 24);
  577 + [_navigationBar.right setContentHorizontalAlignment:UIControlContentHorizontalAlignmentCenter];
  578 + _navigationBar.right.backgroundColor = [UIColor lightGrayColor];
  579 + _navigationBar.right.userInteractionEnabled = NO;
  580 + _navigationBar.right.titleLabel.font = [UIFont boldSystemFontOfSize:13];
  581 + [_navigationBar.right setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  582 + _navigationBar.right.adjustsImageWhenHighlighted = NO;
  583 + _navigationBar.right.layer.masksToBounds = YES;
  584 + _navigationBar.right.layer.cornerRadius = 5;
  585 +
  586 + }
  587 + break;
  588 + }
  589 +
  590 + __weak typeof(self) weakSelf = self;
  591 + _navigationBar.onClickLeftButton = ^{
  592 + [weakSelf goBack];
  593 + };
  594 + _navigationBar.onClickRightButton = ^{
  595 + [self.textField resignFirstResponder];
  596 + [self.textView resignFirstResponder];
  597 +
  598 + switch (self.model.dataType) {
  599 + case CNLiveUserInfoDataTypeHeader://头像
  600 + {
  601 + [self updateHeaderActionSheetView];
  602 + }
  603 + break;
  604 + case CNLiveUserInfoDataTypeNickname://昵称
  605 + {
  606 + [self requestUpdateUserNickname];
  607 + }
  608 + break;
  609 + case CNLiveUserInfoDataTypeGender://昵称
  610 + {
  611 + [self requestUpdateUserGender];
  612 + }
  613 + break;
  614 + case CNLiveUserInfoDataTypeAddress://地区
  615 + {
  616 + [self requestUpdateUserAddress];
  617 + }
  618 + break;
  619 + case CNLiveUserInfoDataTypeIntroduction://简介
  620 + {
  621 + [self requestUpdateUserIntroduction];
  622 + }
  623 + break;
  624 +
  625 + default:
  626 + break;
  627 + }
  628 +
  629 + };
  630 + }
  631 + return _navigationBar;
  632 +}
  633 +
  634 +- (UIView *)contentView{
  635 + if(!_contentView){
  636 + _contentView = [[UIView alloc] initWithFrame:CGRectMake(0, NavigationContentTop+margin, SCREEN_WIDTH, 50)];
  637 + _contentView.backgroundColor = [UIColor whiteColor];
  638 + switch (self.model.dataType) {
  639 + case CNLiveUserInfoDataTypeHeader:
  640 + {
  641 + self.view.backgroundColor = [UIColor blackColor];
  642 + _contentView.backgroundColor = [UIColor blackColor];
  643 +
  644 + self.navigationBar.title.text = @"个人头像";
  645 + [self.view addSubview:self.imageView];
  646 +
  647 + }
  648 + break;
  649 + case CNLiveUserInfoDataTypeNickname:
  650 + {
  651 + self.navigationBar.title.text = @"设置昵称";
  652 +
  653 + [_contentView addSubview:self.textField];
  654 + self.textField.placeholder = @"请输入昵称";
  655 +
  656 + self.textField.text = self.model.info;
  657 + }
  658 + break;
  659 + case CNLiveUserInfoDataTypeAddress:
  660 + {
  661 + self.navigationBar.title.text = @"设置地区";
  662 +
  663 + [_contentView addSubview:self.textField];
  664 + self.textField.placeholder = @"请输入你所在的地区";
  665 +
  666 + self.textField.text = self.model.info;
  667 + }
  668 + break;
  669 + case CNLiveUserInfoDataTypeGender:
  670 + {
  671 + self.navigationBar.title.text = @"设置性别";
  672 + [self.navigationBar.left setTitle:@"取消" forState:UIControlStateNormal];
  673 + [self.navigationBar.left setTitleColor:[UIColor colorWithRed:30/255.0 green:30/255.0 blue:30/255.0 alpha:1.0] forState:UIControlStateNormal];
  674 + [self.navigationBar.left setImage:nil forState:UIControlStateNormal];
  675 + _contentView.frame = CGRectMake(0, NavigationContentTop+margin, SCREEN_WIDTH, 100);
  676 + [_contentView addSubview:self.tableView];
  677 + }
  678 + break;
  679 + case CNLiveUserInfoDataTypeIntroduction:
  680 + {
  681 + self.navigationBar.title.text = @"设置个性签名";
  682 +
  683 + _contentView.frame = CGRectMake(0, NavigationContentTop+margin, SCREEN_WIDTH, 120);
  684 + [_contentView addSubview:self.textView];
  685 + self.textView.text = self.model.info;
  686 + self.textNum.text = [NSString stringWithFormat:@"%lu",MAX(0,MAX_LIMIT_NUMS - self.textView.text.length)];
  687 +
  688 + [_contentView addSubview:self.textNum];
  689 + [self.textNum mas_makeConstraints:^(MASConstraintMaker *make) {
  690 + make.right.equalTo(self.textView);
  691 + make.bottom.equalTo(self.textView).offset(-margin);
  692 + }];
  693 + }
  694 + break;
  695 + default:
  696 + {
  697 +
  698 + }
  699 + break;
  700 + }
  701 +
  702 + }
  703 + return _contentView;
  704 +
  705 +}
  706 +
  707 +- (UIImageView *)imageView{
  708 + if(!_imageView){
  709 + _imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_WIDTH)];
  710 + _imageView.center = self.view.center;
  711 + UIImage *xw_image = [self getImageWithImageName:@"default_avatar_f" bundleName:@"CNLiveBMineModule" targetClass:[CNLiveInfoUpdateController class]];
  712 + [_imageView sd_setImageWithURL:[NSURL URLWithString:CNUserShareModel.bigFaceUrl?CNUserShareModel.bigFaceUrl:CNUserShareModel.faceUrl] placeholderImage:xw_image];
  713 + }
  714 + return _imageView;
  715 +}
  716 +
  717 +- (UITextField *)textField{
  718 + if(!_textField){
  719 + _textField = [[UITextField alloc] initWithFrame:CGRectMake(margin, 0, SCREEN_WIDTH-2*margin, 50)];
  720 + _textField.delegate = self;
  721 + _textField.backgroundColor = [UIColor whiteColor];// 设置背景颜色
  722 + _textField.textColor = [UIColor blackColor]; // 设置文字的颜色
  723 + _textField.clearsOnBeginEditing = YES; // 当第二次输入的时候,清空上一次的内容
  724 + _textField.font = [UIFont systemFontOfSize:15.0f];
  725 + _textField.clearButtonMode = UITextFieldViewModeWhileEditing; // 编辑的时候会显示出删除全部的小X
  726 + _textField.clearButtonMode = UITextFieldViewModeAlways;
  727 + _textField.backgroundColor = [UIColor whiteColor];
  728 + //设置显示模式为永远显示(默认不显示)
  729 + _textField.leftViewMode = UITextFieldViewModeAlways;
  730 + _textField.returnKeyType = UIReturnKeyDone;
  731 + _textField.delegate = self;
  732 + }
  733 + return _textField;
  734 +}
  735 +
  736 +- (UITextView *)textView{
  737 + if(!_textView){
  738 + _textView = [[UITextView alloc] initWithFrame:CGRectMake(margin, 0, SCREEN_WIDTH-2*margin, 120)];
  739 + _textView.delegate = self;
  740 + _textView.backgroundColor = [UIColor whiteColor];// 设置背景颜色
  741 + _textView.textColor = [UIColor blackColor]; // 设置文字的颜色
  742 + _textView.font = [UIFont systemFontOfSize:16.0f];
  743 + }
  744 + return _textView;
  745 +}
  746 +
  747 +- (UILabel *)textNum {
  748 + if (!_textNum) {
  749 + _textNum = [[UILabel alloc] init];
  750 + _textNum.textColor = [UIColor colorWithRed:206/255.0 green:206/255.0 blue:206/255.0 alpha:1.0];
  751 + _textNum.font = [UIFont systemFontOfSize:16];
  752 + _textNum.text = @"30";
  753 + }
  754 + return _textNum;
  755 +}
  756 +
  757 +- (UITableView *)tableView {
  758 + if (!_tableView) {
  759 + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 100) style:UITableViewStylePlain];
  760 + _tableView.delegate = self;
  761 + _tableView.dataSource = self;
  762 + _tableView.showsVerticalScrollIndicator = NO;
  763 + _tableView.showsHorizontalScrollIndicator = NO;
  764 + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  765 + [_tableView registerClass:[CNLiveInfoUpdateCell class] forCellReuseIdentifier:kCNLiveInfoUpdateCell];
  766 + _tableView.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
  767 + }
  768 + return _tableView;
  769 +}
  770 +
  771 +#pragma mark - 响应方法
  772 +- (void)goBack {
  773 + [self.textField resignFirstResponder];
  774 + [self.textView resignFirstResponder];
  775 +
  776 + if (self.presentingViewController != nil) {
  777 + [self dismissViewControllerAnimated:YES completion:nil];
  778 + }
  779 + else {
  780 + [self.navigationController popViewControllerAnimated:YES];
  781 + }
  782 +}
  783 +
  784 +@end
... ...
CNLiveBMineModule/Classes/UserInfo/CNLiveUserInfoCell.h 0 → 100644
  1 +//
  2 +// CNLiveUserInfoCell.m
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +@class CNLiveUserInfoModel;
  13 +static NSString * const kCNLiveUserInfoCell = @"CNLiveUserInfoCell";
  14 +
  15 +@interface CNLiveUserInfoCell : UITableViewCell
  16 +
  17 +@property (nonatomic, strong) CNLiveUserInfoModel *model;
  18 +@property (nonatomic, strong) UIImage *image;
  19 +
  20 +@end
  21 +
  22 +NS_ASSUME_NONNULL_END
... ...
CNLiveBMineModule/Classes/UserInfo/CNLiveUserInfoCell.m 0 → 100644
  1 +//
  2 +// CNLiveUserInfoCell.m
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveUserInfoCell.h"
  10 +#import <Masonry/Masonry.h>
  11 +#import <SDWebImage/SDWebImage.h>
  12 +#import "CNLiveUserInfoModel.h"
  13 +#import "CNLiveCategory.h"
  14 +
  15 +@interface CNLiveUserInfoCell()
  16 +@property (nonatomic, strong) UIView *line;
  17 +@property (nonatomic, strong) UILabel *title;
  18 +@property (nonatomic, strong) UILabel *content;
  19 +@property (nonatomic, strong) UIImageView *front;
  20 +@property (nonatomic, strong) UIImageView *pic;
  21 +
  22 +@end
  23 +
  24 +@implementation CNLiveUserInfoCell
  25 +static const NSInteger margin = 12;
  26 +
  27 +- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  28 + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  29 + if (self) {
  30 + self.contentView.backgroundColor = [UIColor whiteColor];
  31 +
  32 + [self.contentView addSubview:self.line];
  33 + [self.contentView addSubview:self.title];
  34 + [self.contentView addSubview:self.content];
  35 + [self.contentView addSubview:self.front];
  36 + [self.contentView addSubview:self.pic];
  37 +
  38 + }
  39 + return self;
  40 +}
  41 +
  42 +- (void)setImage:(UIImage *)image{
  43 + _image = image;
  44 + if(self.model.dataType == CNLiveUserInfoDataTypeHeader){
  45 + _pic.image = image;
  46 + }
  47 +}
  48 +
  49 +- (void)setModel:(CNLiveUserInfoModel *)model{
  50 + _model = model;
  51 + _title.text = model.title;
  52 +
  53 + _content.text = model.info;
  54 +
  55 + if(model.dataType == CNLiveUserInfoDataTypeHeader){
  56 + _pic.backgroundColor = [UIColor whiteColor];
  57 + _pic.contentMode = UIViewContentModeScaleToFill;
  58 + _pic.layer.masksToBounds = YES;
  59 + _pic.layer.cornerRadius = 5.0;
  60 + UIImage *xw_image = [self getImageWithImageName:@"default_avatar_y" bundleName:@"CNLiveBMineModule" targetClass:[self class]];
  61 + [_pic sd_setImageWithURL:[NSURL URLWithString:model.info] placeholderImage:xw_image];
  62 +
  63 + }else if (model.dataType == CNLiveUserInfoDataTypeNickname){
  64 +
  65 +
  66 + }else if (model.dataType == CNLiveUserInfoDataTypeGender){
  67 + if([model.info isEqualToString:@"m"]){
  68 + _content.text = @"男";
  69 + }else if([model.info isEqualToString:@"f"]){
  70 + _content.text = @"女";
  71 + }else{
  72 + _content.text = @"未知";
  73 + }
  74 +
  75 + }else if (model.dataType == CNLiveUserInfoDataTypeCode){
  76 +
  77 + }else if (model.dataType == CNLiveUserInfoDataTypeAddress){
  78 +
  79 + }else if (model.dataType == CNLiveUserInfoDataTypeIntroduction){
  80 +
  81 + }
  82 +
  83 + [self xw_layoutSubviews];
  84 +}
  85 +
  86 +- (void)xw_layoutSubviews{
  87 +
  88 + CGFloat line_margin = self.model.lineHeight >= 5?0:margin;
  89 +
  90 + [_line mas_updateConstraints:^(MASConstraintMaker *make) {
  91 + make.left.equalTo(self.contentView.mas_left).with.offset(line_margin);
  92 + make.right.equalTo(self.contentView.mas_right).with.offset(-line_margin);
  93 + make.bottom.equalTo(self.contentView.mas_bottom).with.offset(0);
  94 + make.height.offset(self.model.lineHeight);
  95 +
  96 + }];
  97 +
  98 + [_title mas_updateConstraints:^(MASConstraintMaker *make) {
  99 + make.left.equalTo(self.contentView.mas_left).with.offset(margin);
  100 + make.top.equalTo(self.contentView.mas_top).with.offset(0);
  101 + make.height.offset(self.model.height-self.model.lineHeight);
  102 +
  103 + }];
  104 +
  105 + [_front mas_updateConstraints:^(MASConstraintMaker *make) {
  106 + make.right.equalTo(self.contentView.mas_right).with.offset(-margin);
  107 + make.top.equalTo(self.title.mas_top).with.offset(0);
  108 + make.width.with.offset(margin);
  109 + make.height.equalTo(self.title.mas_height);
  110 +
  111 + }];
  112 +
  113 + switch (self.model.layoutType) {
  114 + case CNLiveUserInfoLayoutTypeText:
  115 + {
  116 + _content.hidden = NO;
  117 + _pic.hidden = YES;
  118 + [_content mas_updateConstraints:^(MASConstraintMaker *make) {
  119 + make.top.equalTo(self.title.mas_top).with.offset(0);
  120 + make.left.equalTo(self.title.mas_right).with.offset(margin);
  121 + make.right.equalTo(self.front.mas_left).with.offset(-margin);
  122 + make.height.equalTo(self.title.mas_height);
  123 +
  124 + }];
  125 + }
  126 + break;
  127 + case CNLiveUserInfoLayoutTypeImage:
  128 + {
  129 + CGFloat height = self.model.height-self.model.lineHeight-2*margin;
  130 + _content.hidden = YES;
  131 + _pic.hidden = NO;
  132 + [_pic mas_updateConstraints:^(MASConstraintMaker *make) {
  133 + make.top.equalTo(self.contentView.mas_top).with.offset(margin);
  134 + make.right.equalTo(self.front.mas_left).with.offset(-margin);
  135 + make.width.height.offset(height);
  136 +
  137 + }];
  138 +
  139 + }
  140 + break;
  141 +
  142 + default:
  143 + {
  144 + _content.hidden = YES;
  145 + _pic.hidden = YES;
  146 +
  147 + }
  148 + break;
  149 + }
  150 +
  151 +}
  152 +- (void)awakeFromNib {
  153 + [super awakeFromNib];
  154 + // Initialization code
  155 +}
  156 +
  157 +- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  158 + [super setSelected:selected animated:animated];
  159 +
  160 + // Configure the view for the selected state
  161 +}
  162 +#pragma mark - 懒加载
  163 +- (UIView *)line {
  164 + if (!_line) {
  165 + _line = [[UIView alloc] init];
  166 + _line.backgroundColor = [UIColor colorWithRed:235/255.0 green:235/255.0 blue:235/255.0 alpha:1.0];
  167 + }
  168 + return _line;
  169 +}
  170 +
  171 +- (UILabel *)title {
  172 + if (!_title) {
  173 + _title = [[UILabel alloc] init];
  174 + _title.numberOfLines = 1;
  175 + _title.textColor = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0];
  176 + _title.font = [UIFont systemFontOfSize:16];
  177 + }
  178 + return _title;
  179 +}
  180 +
  181 +- (UILabel *)content {
  182 + if (!_content) {
  183 + _content = [[UILabel alloc] init];
  184 + _content.numberOfLines = 1;
  185 + _content.lineBreakMode = NSLineBreakByTruncatingTail;
  186 + _content.textColor = [UIColor colorWithRed:102/255.0 green:102/255.0 blue:102/255.0 alpha:1.0];
  187 + _content.font = [UIFont systemFontOfSize:14];
  188 + _content.textAlignment = NSTextAlignmentRight;
  189 + }
  190 + return _content;
  191 +}
  192 +
  193 +- (UIImageView *)front {
  194 + if (!_front) {
  195 + _front = [[UIImageView alloc] init];
  196 + UIImage *xw_image = [self getImageWithImageName:@"mine_into" bundleName:@"CNLiveBMineModule" targetClass:[self class]];
  197 + _front.image = xw_image;
  198 + _front.contentMode = UIViewContentModeCenter;
  199 +
  200 + }
  201 + return _front;
  202 +}
  203 +- (UIImageView *)pic {
  204 + if (!_pic) {
  205 + _pic = [[UIImageView alloc] init];
  206 + }
  207 + return _pic;
  208 +}
  209 +#pragma mark - 响应方法
  210 +- (void)switchChanged:(UISwitch *)sw{
  211 +
  212 +}
  213 +
  214 +@end
... ...
CNLiveBMineModule/Classes/UserInfo/CNLiveUserInfoController.h 0 → 100644
  1 +//
  2 +// CNLiveBMineController.m
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +/**
  10 + * 个人资料
  11 + */
  12 +
  13 +#import <UIKit/UIKit.h>
  14 +#import "CNCommonViewController.h"
  15 +
  16 +NS_ASSUME_NONNULL_BEGIN
  17 +
  18 +@interface CNLiveUserInfoController : CNCommonViewController
  19 +
  20 +@end
  21 +
  22 +NS_ASSUME_NONNULL_END
... ...
CNLiveBMineModule/Classes/UserInfo/CNLiveUserInfoController.m 0 → 100644
  1 +//
  2 +// CNLiveBMineController.m
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveUserInfoController.h"
  10 +#import "MJExtension.h"
  11 +#import "QMUIKit.h"
  12 +
  13 +#import "CNUserInfoManager.h"
  14 +#import "CNLiveServices.h"
  15 +#import "CNLiveNavigationBar.h"
  16 +
  17 +#import "CNLiveUserInfoCell.h"
  18 +#import "CNLiveUserInfoModel.h"
  19 +#import "CNLiveInfoUpdateController.h"
  20 +#import "CNLiveUserInfoNotification.h"
  21 +
  22 +@interface CNLiveUserInfoController ()<UITableViewDelegate, UITableViewDataSource>{
  23 + UIImage *_image;
  24 +}
  25 +@property (nonatomic, strong) CNLiveNavigationBar *navigationBar;
  26 +@property (nonatomic, strong) UITableView *tableView;
  27 +@property (nonatomic, strong) NSMutableArray *data;
  28 +
  29 +@end
  30 +
  31 +@implementation CNLiveUserInfoController
  32 +#pragma mark - 加载数据
  33 +- (void)loadData {
  34 + NSArray *data = @[
  35 + @{
  36 + @"layout":@"2",
  37 + @"data":@"0",
  38 + @"title":@"头像",
  39 + @"info":CNUserShareModel.faceUrl?CNUserShareModel.faceUrl:@"",
  40 + @"height":@"81",
  41 + @"lineHeight":@"0.5"
  42 + },
  43 + @{
  44 + @"layout":@"1",
  45 + @"data":@"1",
  46 + @"title":@"昵称",
  47 + @"info":CNUserShareModel.nickname?CNUserShareModel.nickname:@"",
  48 + @"height":@"51",
  49 + @"lineHeight":@"0.5"
  50 + },
  51 + @{
  52 + @"layout":@"1",
  53 + @"data":@"2",
  54 + @"title":@"性别",
  55 + @"info":CNUserShareModel.gender?CNUserShareModel.gender:@"未知",
  56 + @"height":@"60",
  57 + @"lineHeight":@"10"
  58 + },
  59 + @{
  60 + @"layout":@"1",
  61 + @"data":@"4",
  62 + @"title":@"地区",
  63 + @"info":CNUserShareModel.location?CNUserShareModel.location:@"",
  64 + @"height":@"60",
  65 + @"lineHeight":@"10"
  66 + }
  67 +
  68 + ];
  69 + for(NSDictionary *dic in data){
  70 + [self.data addObject:[CNLiveUserInfoModel mj_objectWithKeyValues:dic]];
  71 + }
  72 + [self.tableView reloadData];
  73 +
  74 +}
  75 +
  76 +#pragma mark - 生命周期
  77 +- (void)viewWillAppear:(BOOL)animated{
  78 + [super viewWillAppear:animated];
  79 + self.navigationController.navigationBarHidden = YES;
  80 +}
  81 +
  82 +- (void)viewDidLoad {
  83 + [super viewDidLoad];
  84 + self.view.backgroundColor = [UIColor whiteColor];
  85 + if (@available(iOS 11, *)) {
  86 + self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  87 + }
  88 + else {
  89 + self.automaticallyAdjustsScrollViewInsets = NO;
  90 + }
  91 + [CNLiveUserInfoNotification addUserInfoUpdateObserver:self selector:@selector(userInfoUpdateNotification:)];
  92 +
  93 + [self createSubViews];
  94 + [self loadData];
  95 +
  96 +}
  97 +
  98 +- (void)dealloc {
  99 + [CNLiveUserInfoNotification removeObserver:self];
  100 +}
  101 +
  102 +- (void)createSubViews {
  103 + [self.view addSubview:self.navigationBar];
  104 + [self.view addSubview:self.tableView];
  105 +
  106 +}
  107 +
  108 +#pragma mark - UITableViewDelegate
  109 +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  110 + CNLiveUserInfoModel *model = self.data[indexPath.row];
  111 + return model.height;
  112 +}
  113 +
  114 +#pragma mark - UITableViewDataSource
  115 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  116 + return self.data.count;
  117 +}
  118 +
  119 +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  120 + CNLiveUserInfoCell *cell = [tableView dequeueReusableCellWithIdentifier:kCNLiveUserInfoCell];
  121 + cell.selectionStyle = UITableViewCellSelectionStyleNone;
  122 + CNLiveUserInfoModel *model = self.data[indexPath.row];
  123 + cell.model = model;
  124 + if(_image){
  125 + cell.image = _image;
  126 + }
  127 + return cell;
  128 +}
  129 +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  130 + CNLiveUserInfoModel *model = self.data[indexPath.row];
  131 + switch (model.dataType) {
  132 + case CNLiveUserInfoDataTypeCode:
  133 + {
  134 + id<CNLiveQrCodeServiceProtocol> service = [[BeeHive shareInstance] createService:@protocol(CNLiveQrCodeServiceProtocol)];
  135 + [service pushToMyQrCodeController:NO];
  136 + }
  137 + break;
  138 + default:
  139 + {
  140 + CNLiveInfoUpdateController *vc = [[CNLiveInfoUpdateController alloc]initWithModel:model];
  141 + [self.navigationController pushViewController:vc animated:YES];
  142 + }
  143 + break;
  144 + }
  145 +}
  146 +
  147 +#pragma mark - 监听
  148 +// 更新用户信息
  149 +- (void)userInfoUpdateNotification:(NSNotification *)noti{
  150 + //使用userInfo处理消息
  151 + NSDictionary *dic = [noti userInfo];
  152 + CNLiveUserInfoDataType dataType = [[dic objectForKey:@"dataType"] integerValue];
  153 + NSString *info = [dic objectForKey:@"info"];
  154 +
  155 + // 更新cell展示信息
  156 + for(CNLiveUserInfoModel *model in self.data){
  157 + if(dataType == model.dataType){
  158 + model.info = info;
  159 + break;
  160 + }
  161 + }
  162 + [self.tableView reloadData];
  163 +
  164 +}
  165 +
  166 +#pragma mark - 懒加载
  167 +- (CNLiveNavigationBar *)navigationBar {
  168 + if (!_navigationBar) {
  169 + _navigationBar = [CNLiveNavigationBar navigationBar];
  170 + _navigationBar.title.text = @"个人资料";
  171 + __weak typeof(self) weakSelf = self;
  172 + _navigationBar.onClickLeftButton = ^{
  173 + [weakSelf goBack];
  174 + };
  175 + }
  176 + return _navigationBar;
  177 +}
  178 +
  179 +- (NSMutableArray *)data {
  180 + if (!_data) {
  181 + _data = [NSMutableArray array];
  182 + }
  183 + return _data;
  184 +}
  185 +
  186 +- (UITableView *)tableView{
  187 + if(!_tableView){
  188 + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop) style:UITableViewStylePlain];
  189 + _tableView.delegate = self;
  190 + _tableView.dataSource = self;
  191 + _tableView.bounces = NO;
  192 + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  193 + _tableView.backgroundColor = [UIColor whiteColor];
  194 + _tableView.estimatedRowHeight = 0;
  195 + _tableView.estimatedSectionHeaderHeight = 0;
  196 + _tableView.estimatedSectionFooterHeight = 0;
  197 + [_tableView registerClass:[CNLiveUserInfoCell class] forCellReuseIdentifier:kCNLiveUserInfoCell];
  198 + }
  199 + return _tableView;
  200 +}
  201 +
  202 +#pragma mark - 响应方法
  203 +- (void)goBack {
  204 + if (self.presentingViewController != nil) {
  205 + [self dismissViewControllerAnimated:YES completion:nil];
  206 + }
  207 + else {
  208 + [self.navigationController popViewControllerAnimated:YES];
  209 + }
  210 +}
  211 +
  212 +@end
... ...
CNLiveBMineModule/Classes/UserInfo/CNLiveUserInfoModel.h 0 → 100644
  1 +//
  2 +// CNLiveBMineController.m
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +
  13 +typedef NS_ENUM(NSInteger, CNLiveUserInfoLayoutType) {
  14 + CNLiveUserInfoLayoutTypeDefault = 0,
  15 + CNLiveUserInfoLayoutTypeText = 1,
  16 + CNLiveUserInfoLayoutTypeImage = 2
  17 +};
  18 +
  19 +typedef NS_ENUM(NSInteger, CNLiveUserInfoDataType) {
  20 + CNLiveUserInfoDataTypeNickname = 0,
  21 + CNLiveUserInfoDataTypeHeader = 1,
  22 + CNLiveUserInfoDataTypeGender = 2,
  23 + CNLiveUserInfoDataTypeCode = 3,
  24 + CNLiveUserInfoDataTypeAddress = 4,
  25 + CNLiveUserInfoDataTypeIntroduction = 5
  26 +
  27 +};
  28 +
  29 +
  30 +@interface CNLiveUserInfoModel : NSObject
  31 +@property (nonatomic, copy) NSString *title;
  32 +@property (nonatomic, copy) NSString *info;
  33 +@property (nonatomic, copy) NSString *layout;
  34 +@property (nonatomic, copy) NSString *data;
  35 +
  36 +@property (nonatomic, assign) CNLiveUserInfoLayoutType layoutType;
  37 +@property (nonatomic, assign) CNLiveUserInfoDataType dataType;
  38 +
  39 +@property (nonatomic, assign) CGFloat height;
  40 +@property (nonatomic, assign) CGFloat lineHeight;
  41 +
  42 +@end
  43 +
  44 +NS_ASSUME_NONNULL_END
... ...
CNLiveBMineModule/Classes/UserInfo/CNLiveUserInfoModel.m 0 → 100644
  1 +//
  2 +// CNLiveBMineController.m
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveUserInfoModel.h"
  10 +
  11 +@implementation CNLiveUserInfoModel
  12 +- (CNLiveUserInfoLayoutType)layoutType{
  13 + if([self.layout isEqualToString:@"0"]){
  14 + return CNLiveUserInfoLayoutTypeDefault;
  15 + }
  16 + else if([self.layout isEqualToString:@"1"]){
  17 + return CNLiveUserInfoLayoutTypeText;
  18 +
  19 + }
  20 + else if([self.layout isEqualToString:@"2"]){
  21 + return CNLiveUserInfoLayoutTypeImage;
  22 +
  23 + }
  24 + return CNLiveUserInfoLayoutTypeDefault;
  25 +}
  26 +
  27 +- (CNLiveUserInfoDataType)dataType{
  28 + if([self.data isEqualToString:@"0"]){
  29 + return CNLiveUserInfoDataTypeHeader;
  30 + }
  31 + else if([self.data isEqualToString:@"1"]){
  32 + return CNLiveUserInfoDataTypeNickname;
  33 +
  34 + }
  35 + else if([self.data isEqualToString:@"2"]){
  36 + return CNLiveUserInfoDataTypeGender;
  37 +
  38 + }
  39 + else if([self.data isEqualToString:@"3"]){
  40 + return CNLiveUserInfoDataTypeCode;
  41 +
  42 + }
  43 + else if([self.data isEqualToString:@"4"]){
  44 + return CNLiveUserInfoDataTypeAddress;
  45 +
  46 + }
  47 + else if([self.data isEqualToString:@"5"]){
  48 + return CNLiveUserInfoDataTypeIntroduction;
  49 +
  50 + }
  51 + return CNLiveUserInfoDataTypeNickname;
  52 +}
  53 +
  54 +@end
... ...
CNLiveBMineModule/Classes/UserInfo/CNLiveUserInfoNotification.h 0 → 100644
  1 +//
  2 +// CNLiveUserInfoNotification.m
  3 +// CNLiveBMineModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright (c) 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +#import "CNLiveUserInfoModel.h"
  11 +
  12 +NS_ASSUME_NONNULL_BEGIN
  13 +extern NSString * const kCNLiveUserInfoUpdateNotification;
  14 +
  15 +@interface CNLiveUserInfoNotification : NSObject
  16 ++ (void)postUserInfoUpdateNotificationType:(CNLiveUserInfoDataType)type info:(id)info;
  17 +//NSDictionary *dic = @{@"type":@(type),@"info":info};
  18 ++ (void)addUserInfoUpdateObserver:(id)observer selector:(SEL)selector;
  19 +
  20 ++ (void)removeObserver:(id)observer;
  21 +
  22 +@end
  23 +
  24 +NS_ASSUME_NONNULL_END
... ...