Commit b73ae247bf714c98fa46fbe39e872b80504f0664

Authored by zhangxiaowen
1 parent 0f9973a4

no message

Showing 100 changed files with 3156 additions and 0 deletions

Too many changes to show.

To preserve performance only 100 of 132 files are displayed.

CNLiveIntegralModule.podspec 0 → 100644
  1 +#
  2 +# Be sure to run `pod lib lint CNLiveIntegralModule.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 = 'CNLiveIntegralModule'
  11 + s.version = '0.0.1'
  12 + s.summary = 'CNLiveIntegralModule.'
  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/CNLiveIntegralModule'
  25 + # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
  26 + s.license = { :type => 'MIT', :file => 'LICENSE' }
  27 + s.author = { '153993236@qq.com' => 'zhangxiaowen@cnlive.com' }
  28 + s.source = { :git => 'http://bj.gitlab.cnlive.com/ios-team/CNLiveIntegralModule.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 = 'CNLiveIntegralModule/Classes/**/*'
  34 +
  35 + # Module
  36 + s.subspec 'Module' do |ss|
  37 + ss.source_files = 'CNLiveIntegralModule/Classes/Module/*.{h,m}'
  38 + ss.dependency 'CNLiveIntegralModule/Controller'
  39 + end
  40 +
  41 + # Controller
  42 + s.subspec 'Controller' do |ss|
  43 + ss.source_files = 'CNLiveIntegralModule/Classes/Controller/*.{h,m}'
  44 + end
  45 +
  46 + # View
  47 + s.subspec 'View' do |ss|
  48 + ss.source_files = 'CNLiveIntegralModule/Classes/View/*.{h,m}'
  49 + end
  50 +
  51 + # Model
  52 + s.subspec 'Model' do |ss|
  53 + ss.source_files = 'CNLiveIntegralModule/Classes/Model/*.{h,m}'
  54 + end
  55 +
  56 + s.resource_bundles = {
  57 + 'CNLiveIntegralModule' => ['CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets']
  58 + }
  59 +
  60 + # s.public_header_files = 'Pod/Classes/**/*.h'
  61 + # s.frameworks = 'UIKit', 'MapKit'
  62 + # s.dependency 'AFNetworking', '~> 2.3'
  63 +
  64 + # pod
  65 + s.dependency 'CNLiveTripartiteManagement/QMUIKit'
  66 + s.dependency 'CNLiveTripartiteManagement/SDWebImage'
  67 + s.dependency 'CNLiveTripartiteManagement/Masonry'
  68 + s.dependency 'CNLiveTripartiteManagement/MJExtension'
  69 + s.dependency 'CNLiveTripartiteManagement/MJRefresh'
  70 + s.dependency 'CNLiveTripartiteManagement/YYKit'
  71 +
  72 + # 服务层
  73 + s.dependency 'CNLiveServices'
  74 +
  75 + # 基类
  76 + s.dependency 'CNLiveCommonClass'
  77 +
  78 + # 环境
  79 + s.dependency 'CNLiveEnvironment'
  80 +
  81 + # 数据请求
  82 + s.dependency 'CNLiveRequestBastKit'
  83 +
  84 + # 用户信息本地化
  85 + s.dependency 'CNLiveUserManagement'
  86 +
  87 + # 用户协议
  88 + s.dependency 'CNLiveUserAgreementManager'
  89 +
  90 +end
CNLiveIntegralModule/Assets/.gitkeep 0 → 100644
CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/Contents.json 0 → 100644
  1 +{
  2 + "info" : {
  3 + "version" : 1,
  4 + "author" : "xcode"
  5 + }
  6 +}
0 \ No newline at end of file 7 \ No newline at end of file
CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/add_score_bg.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "idiom" : "universal",
  9 + "filename" : "add_score_bg@2x.png",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "idiom" : "universal",
  14 + "filename" : "add_score_bg@3x.png",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "version" : 1,
  20 + "author" : "xcode"
  21 + }
  22 +}
0 \ No newline at end of file 23 \ No newline at end of file
CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/add_score_bg.imageset/add_score_bg@2x.png 0 → 100644

406 KB

CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/add_score_bg.imageset/add_score_bg@3x.png 0 → 100644

839 KB

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

1.38 KB

CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/add_score_close.imageset/add_score_close@3x.png 0 → 100644

2.86 KB

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

20.7 KB

CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/add_score_label.imageset/add_score_label@3x.png 0 → 100644

34.9 KB

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

1.49 KB

CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/code_back_black_b.imageset/code_back_black_b@3x.png 0 → 100644

1.79 KB

CNLiveIntegralModule/Assets/CNLiveIntegralModule.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 \ No newline at end of file 22 \ No newline at end of file
CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/default_avatar_f.imageset/default_avatar_f.png 0 → 100644

11.1 KB

CNLiveIntegralModule/Assets/CNLiveIntegralModule.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 \ No newline at end of file 22 \ No newline at end of file
CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/default_avatar_y.imageset/default_avatar_y.png 0 → 100644

10.7 KB

CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/gold_whereabouts1.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "filename" : "gold_whereabouts1.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 \ No newline at end of file 22 \ No newline at end of file
CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/gold_whereabouts1.imageset/gold_whereabouts1.png 0 → 100644

22.1 KB

CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/gold_whereabouts2.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "filename" : "gold_whereabouts2.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 \ No newline at end of file 22 \ No newline at end of file
CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/gold_whereabouts2.imageset/gold_whereabouts2.png 0 → 100644

25.1 KB

CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/gold_whereabouts3.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "filename" : "gold_whereabouts3.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 \ No newline at end of file 22 \ No newline at end of file
CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/gold_whereabouts3.imageset/gold_whereabouts3.png 0 → 100644

21.7 KB

CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/gold_whereabouts4.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "filename" : "gold_whereabouts4.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 \ No newline at end of file 22 \ No newline at end of file
CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/gold_whereabouts4.imageset/gold_whereabouts4.png 0 → 100644

24.5 KB

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

78 KB

CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/integrate_list_bg.imageset/integrate_list_bg@3x.png 0 → 100644

131 KB

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

380 Bytes

CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/integrate_next_white.imageset/integrate_next_white@3x.png 0 → 100644

686 Bytes

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

2.1 KB

CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/mf_soccer_smallcoin.imageset/mf_soccer_smallcoin@3x.png 0 → 100644

4.2 KB

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

266 Bytes

CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/mine_all_front.imageset/mine_all_front@3x.png 0 → 100644

615 Bytes

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

2.03 KB

CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/mine_back_white_b.imageset/mine_back_white_b@3x.png 0 → 100644

2.28 KB

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

448 Bytes

CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/mine_code_more.imageset/mine_code_more@3x.png 0 → 100644

771 Bytes

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

1.24 KB

CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/mine_info_front.imageset/mine_info_front@3x.png 0 → 100644

1.51 KB

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

30 KB

CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/my_soccer_task.imageset/my_soccer_task@3x.png 0 → 100644

67.4 KB

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

7.47 KB

CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/qr_code_icon.imageset/qr_code_icon@3x.png 0 → 100644

11.1 KB

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

40.4 KB

CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/sign_allday_bg.imageset/sign_allday_bg@3x.png 0 → 100644

123 KB

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

14.7 KB

CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/sign_day_bg.imageset/sign_day_bg@3x.png 0 → 100644

27.7 KB

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

34.1 KB

CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/sign_day_bg7.imageset/sign_day_bg7@3x.png 0 → 100644

69.6 KB

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

1.54 KB

CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/sign_day_close.imageset/sign_day_close@3x.png 0 → 100644

4.23 KB

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

3.09 KB

CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/sign_day_select.imageset/sign_day_select@3x.png 0 → 100644

6.83 KB

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

1.64 KB

CNLiveIntegralModule/Assets/CNLiveIntegralModule.xcassets/sign_in_soccer.imageset/sign_in_soccer@3x.png 0 → 100644

4.54 KB

CNLiveIntegralModule/Classes/.gitkeep 0 → 100644
CNLiveIntegralModule/Classes/Controller/CNLiveIntegralDetailsController.h 0 → 100644
  1 +//
  2 +// CNLiveIntegralDetailsController.h
  3 +// CNLiveIntegralModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/3/1.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +// 积分明细
  10 +
  11 +#import <UIKit/UIKit.h>
  12 +#import "CNCommonViewController.h"
  13 +
  14 +NS_ASSUME_NONNULL_BEGIN
  15 +
  16 +@interface CNLiveIntegralDetailsController : CNCommonViewController
  17 +
  18 +@end
  19 +
  20 +NS_ASSUME_NONNULL_END
CNLiveIntegralModule/Classes/Controller/CNLiveIntegralDetailsController.m 0 → 100644
  1 +//
  2 +// CNLiveIntegralDetailsController.m
  3 +// CNLiveIntegralModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/3/1.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveIntegralDetailsController.h"
  10 +
  11 +#import "QMUIKit.h"
  12 +#import "MJRefresh.h"
  13 +#import "MJExtension.h"
  14 +#import <Masonry/Masonry.h>
  15 +#import <SDWebImage/SDWebImage.h>
  16 +
  17 +#import "CNLiveNetworking.h"
  18 +#import "CNLiveEnvironment.h"
  19 +#import "CNUserInfoManager.h"
  20 +#import "CNLiveUserAgreementManager.h"
  21 +
  22 +#import "CNIntegralDetailsTableViewCell.h"
  23 +#import "CNScoreModel.h"
  24 +#import "CNLiveIntegralRulesController.h"
  25 +#import "CNLiveIntegralNavigationBar.h"
  26 +
  27 +@interface CNLiveIntegralDetailsController ()<UITableViewDelegate,UITableViewDataSource,CNLiveIntegralNavigationBarDelegate>
  28 +
  29 +@property (nonatomic, strong) CNLiveIntegralNavigationBar *navigationBar;
  30 +
  31 +@property (nonatomic, strong) UITableView *tableView;
  32 +@property (nonatomic, strong) NSMutableArray *data;
  33 +@property (nonatomic, assign) NSInteger pageNo;
  34 +@property (nonatomic, assign) BOOL isRefreshing;
  35 +
  36 +@end
  37 +
  38 +@implementation CNLiveIntegralDetailsController
  39 +
  40 +#pragma mark - Data
  41 +- (void)loadData{
  42 +// NSDictionary *params = @{@"pageSize":@"10",
  43 +// @"pageNo":[NSString stringWithFormat:@"%ld",_pageNo],
  44 +// @"sid":CNUserShareModel.uid};
  45 + NSDictionary *params = @{@"pageSize":@"10",
  46 + @"pageNo":[NSString stringWithFormat:@"%ld",_pageNo],
  47 + @"sid":@"10514405"};
  48 + [CNLiveNetworking setAllowRequestDefaultArgument:YES];
  49 + [CNLiveNetworking setupShowDataResult:NO];
  50 + [QMUITips showLoadingInView:[UIApplication sharedApplication].keyWindow];
  51 + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodGET URLString:CNIntegralDetailsUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) {
  52 + [QMUITips hideAllTipsInView:[UIApplication sharedApplication].keyWindow];
  53 + [self hideEmptyView];
  54 +
  55 + if (error) {
  56 + if (self.data.count == 0) {
  57 + if (error.code == -1001||error.code == -1003||error.code == -1009) {
  58 + [self showEmptyViewWithImage:[UIImage imageNamed:@"dd_wlcw"] text:@"无法连接网络" detailText:@"别紧张,试试看刷新页面~" buttonTitle:@" 重试 " buttonAction:@selector(loadData)];
  59 + [self setCNAPIErrorEmptyView];
  60 + self.tableView.mj_footer.hidden = self.data.count == 0;
  61 + }
  62 +
  63 + }
  64 + return;
  65 + }
  66 + if ([responseObject isKindOfClass:[NSDictionary class]] && [responseObject[@"errorCode"] isEqualToString:@"0"]) {
  67 + _isRefreshing = NO;
  68 + _pageNo++;
  69 + NSArray *arr = [CNScoreModel mj_objectArrayWithKeyValuesArray:responseObject[@"data"][@"list"]];
  70 + [self.data addObjectsFromArray:arr];
  71 + if (arr.count < 10) {
  72 + [self.tableView.mj_footer endRefreshingWithNoMoreData];
  73 +
  74 + } else {
  75 + [self.tableView.mj_footer endRefreshing];
  76 +
  77 + }
  78 + }
  79 + self.tableView.mj_footer.hidden = self.data.count == 0;
  80 + [self.tableView reloadData];
  81 +
  82 + if (self.data.count == 0) {//显示empty
  83 +// [self showEmptyViewWithImage:[UIImage imageNamed:@"zhuangtai_kong"] text:@"您现在没有相关内容哦" detailText:@"" buttonTitle:@"" buttonAction:nil];
  84 +// [self setCNNoDataEmptyView];
  85 + self.tableView.tableFooterView = nil;
  86 + }
  87 + }];
  88 +
  89 +}
  90 +
  91 +- (void)loadMoreData{
  92 + if(!_isRefreshing){
  93 + _isRefreshing = YES;
  94 + [self loadData];
  95 + }
  96 +}
  97 +
  98 +- (void)viewWillAppear:(BOOL)animated{
  99 + [super viewWillAppear:animated];
  100 + self.navigationController.navigationBar.hidden = YES;
  101 +}
  102 +
  103 +- (void)viewDidLoad {
  104 + [super viewDidLoad];
  105 + // Do any additional setup after loading the view.
  106 + _pageNo = 1;
  107 + _isRefreshing = NO;
  108 +
  109 + [self loadData];
  110 + [self createUI];
  111 +
  112 +}
  113 +
  114 +#pragma mark - UI
  115 +- (void)createUI {
  116 + [self.view addSubview:self.navigationBar];
  117 + [self.view addSubview:self.tableView];
  118 +
  119 +}
  120 +
  121 +/*
  122 + #pragma mark - Navigation
  123 +
  124 + // In a storyboard-based application, you will often want to do a little preparation before navigation
  125 + - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  126 + // Get the new view controller using [segue destinationViewController].
  127 + // Pass the selected object to the new view controller.
  128 + }
  129 + */
  130 +#pragma mark - UITableViewDataSource
  131 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  132 + return self.data.count;
  133 +
  134 +}
  135 +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  136 + CNIntegralDetailsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCNIntegralDetailsTableViewCell forIndexPath:indexPath];
  137 + cell.selectionStyle = UITableViewCellSelectionStyleNone;
  138 + cell.model = self.data[indexPath.row];
  139 + return cell;
  140 +
  141 +}
  142 +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  143 + return 30+40;
  144 +
  145 +}
  146 +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  147 +
  148 +
  149 +}
  150 +
  151 +/*
  152 + #pragma mark - Navigation
  153 +
  154 + // In a storyboard-based application, you will often want to do a little preparation before navigation
  155 + - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  156 + // Get the new view controller using [segue destinationViewController].
  157 + // Pass the selected object to the new view controller.
  158 + }
  159 + */
  160 +
  161 +#pragma mark - CNLiveIntegralNavigationBarDelegate
  162 +- (void)navigationBar:(CNLiveIntegralNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{
  163 + if([actionEvents isEqualToString:@"1"]){
  164 + [self.navigationController popViewControllerAnimated:YES];
  165 + }else if([actionEvents isEqualToString:@"2"]){
  166 + [CNLiveUserAgreementManager jumpToAgreementH5WithType:CNLiveUserAgreementIntegralRules];
  167 + }
  168 +}
  169 +
  170 +#pragma mark - Lazy loading
  171 +- (CNLiveIntegralNavigationBar *)navigationBar {
  172 + if (!_navigationBar) {
  173 + _navigationBar = [[CNLiveIntegralNavigationBar alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)];
  174 + _navigationBar.backgroundColor = [UIColor whiteColor];
  175 + _navigationBar.delegate = self;
  176 + _navigationBar.title.text = @"积分明细";
  177 + [_navigationBar.right setTitle:@"积分规则" forState:UIControlStateNormal];
  178 + [_navigationBar.right setTitleColor:[UIColor colorWithRed:102/255.0 green:102/255.0 blue:102/255.0 alpha:1.0] forState:UIControlStateNormal];
  179 + _navigationBar.right.titleLabel.font = [UIFont systemFontOfSize:16.0];
  180 + _navigationBar.right.frame = CGRectMake(SCREEN_WIDTH-80-15, StatusBarHeight, 80, NavigationBarHeight);
  181 + }
  182 + return _navigationBar;
  183 +}
  184 +
  185 +- (UITableView *)tableView {
  186 + if (!_tableView) {
  187 + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop) style:UITableViewStylePlain];
  188 + _tableView.backgroundColor = [UIColor whiteColor];
  189 + _tableView.delegate = self;
  190 + _tableView.dataSource = self;
  191 + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  192 + _tableView.showsVerticalScrollIndicator = NO;
  193 + _tableView.showsHorizontalScrollIndicator = NO;
  194 + [_tableView registerClass:[CNIntegralDetailsTableViewCell class] forCellReuseIdentifier:kCNIntegralDetailsTableViewCell];
  195 + __weak __typeof(self)weakSelf = self;
  196 + MJRefreshAutoNormalFooter *refreshView = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
  197 + [weakSelf loadMoreData];
  198 + }];
  199 + _tableView.mj_footer = refreshView;
  200 + }
  201 + return _tableView;
  202 +}
  203 +
  204 +- (NSMutableArray *)data{
  205 + if (!_data) {
  206 + _data = [[NSMutableArray alloc] init];
  207 + }
  208 + return _data;
  209 +}
  210 +
  211 +- (void)dealloc{
  212 +
  213 +}
  214 +
  215 +@end
CNLiveIntegralModule/Classes/Controller/CNLiveIntegralRulesController.h 0 → 100644
  1 +//
  2 +// CNLiveIntegralRulesController.h
  3 +// CNLiveIntegralModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/3/12.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +// 积分规则
  10 +
  11 +#import "CNCommonViewController.h"
  12 +
  13 +NS_ASSUME_NONNULL_BEGIN
  14 +
  15 +@interface CNLiveIntegralRulesController : CNCommonViewController
  16 +@property (nonatomic, copy) NSString *url;
  17 +@property (nonatomic, copy) NSString *name;
  18 +@end
  19 +
  20 +NS_ASSUME_NONNULL_END
CNLiveIntegralModule/Classes/Controller/CNLiveIntegralRulesController.m 0 → 100644
  1 +//
  2 +// CNLiveIntegralRulesController.m
  3 +// CNLiveIntegralModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/3/12.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveIntegralRulesController.h"
  10 +#import <WebKit/WebKit.h>
  11 +#import "QMUIKit.h"
  12 +#import <Masonry/Masonry.h>
  13 +#import <SDWebImage/SDWebImage.h>
  14 +
  15 +@interface CNLiveIntegralRulesController ()<WKNavigationDelegate,WKUIDelegate>
  16 +@property (nonatomic, weak) WKWebView *webView;
  17 +
  18 +@end
  19 +
  20 +@implementation CNLiveIntegralRulesController
  21 +#pragma mark - Data
  22 +- (void)setData{
  23 + [QMUITips showLoadingInView:self.view];
  24 + [_webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.url]]];
  25 +}
  26 +- (void)viewDidLoad {
  27 + [super viewDidLoad];
  28 + // Do any additional setup after loading the view.
  29 + [self createUI];
  30 + [self layoutUI];
  31 + [self setData];
  32 +
  33 +}
  34 +- (void)dealloc{
  35 +
  36 +}
  37 +#pragma mark - UI
  38 +- (void)createUI{
  39 + self.title = self.name;
  40 +
  41 + WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc]init];
  42 + config.preferences = [WKPreferences new];
  43 + config.preferences.javaScriptEnabled = YES;
  44 + config.preferences.minimumFontSize = 15;
  45 + config.preferences.javaScriptCanOpenWindowsAutomatically = YES;
  46 +
  47 + WKUserContentController *userController = [WKUserContentController new];
  48 + NSString *js = @"var script = document.createElement('meta');"
  49 + "script.name = 'viewport';"
  50 + "script.content=\"width=device-width, initial-scale=1.0,maximum-scale=1.0, minimum-scale=1.0, user-scalable=no\";"
  51 + "document.getElementsByTagName('body')[0].appendChild(script);";
  52 + WKUserScript *script = [[WKUserScript alloc] initWithSource:js injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:NO];
  53 +
  54 + NSMutableString *javascript = [NSMutableString string];
  55 + [javascript appendString:@"document.documentElement.style.webkitTouchCallout='none';"];//禁止长按
  56 + [javascript appendString:@"document.documentElement.style.webkitUserSelect='none';"];//禁止选择
  57 + WKUserScript *noneSelectScript = [[WKUserScript alloc] initWithSource:javascript injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES];
  58 + [userController addUserScript:script];
  59 + [userController addUserScript:noneSelectScript];
  60 + config.userContentController = userController;
  61 +
  62 + WKWebView *webView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:config];
  63 + webView.navigationDelegate = self;
  64 + webView.UIDelegate = self;
  65 + webView.scrollView.bounces = NO;
  66 + webView.scrollView.exclusiveTouch = NO;
  67 + webView.scrollView.showsVerticalScrollIndicator = NO;
  68 + webView.scrollView.showsHorizontalScrollIndicator = NO;
  69 + [self.view addSubview:webView];
  70 + _webView = webView;
  71 +
  72 +}
  73 +- (void)layoutUI{
  74 + [_webView mas_makeConstraints:^(MASConstraintMaker *make) {
  75 + make.top.equalTo(self.view.mas_top).with.offset(0);
  76 + make.left.equalTo(self.view.mas_left).with.offset(0);
  77 + make.right.equalTo(self.view.mas_right).with.offset(-0);
  78 + make.bottom.equalTo(self.view.mas_bottom).with.offset(-0);
  79 +
  80 + }];
  81 +
  82 +}
  83 +#pragma mark - WKNavigationDelegate
  84 +// 页面加载完成之后调用
  85 +- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
  86 + [QMUITips hideAllTipsInView:self.view];
  87 +
  88 +}
  89 +
  90 +// 页面加载失败时调用
  91 +- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(null_unspecified WKNavigation *)navigation withError:(nonnull NSError *)error{
  92 + [QMUITips hideAllTipsInView:self.view];
  93 +
  94 + NSString *errorMsg = @"接口请求失败,请稍后再试!";
  95 + //404->102->返回按钮
  96 + if (error.code==-1009||error.code==102) {
  97 + errorMsg = @"网络连接失败,请稍后再试!";
  98 + [self showEmptyViewWithImage:[UIImage imageNamed:@"wufalianjie"] text:errorMsg detailText:@" " buttonTitle:@" 返回 " buttonAction:@selector(goBack)];
  99 + self.emptyView.backgroundColor = [UIColor whiteColor];
  100 +
  101 + } else {
  102 + [self showEmptyViewWithImage:[UIImage imageNamed:@"wufalianjie"] text:errorMsg detailText:@"别紧张,试试看刷新页面~" buttonTitle:@" 重试 " buttonAction:@selector(setData)];
  103 + self.emptyView.backgroundColor = [UIColor whiteColor];
  104 +
  105 + }
  106 + [self setCNAPIErrorEmptyView];
  107 +
  108 +}
  109 +- (void)goBack{
  110 + [self.navigationController popViewControllerAnimated:YES];
  111 +
  112 +}
  113 +/*
  114 +#pragma mark - Navigation
  115 +
  116 +// In a storyboard-based application, you will often want to do a little preparation before navigation
  117 +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  118 + // Get the new view controller using [segue destinationViewController].
  119 + // Pass the selected object to the new view controller.
  120 +}
  121 +*/
  122 +
  123 +@end
CNLiveIntegralModule/Classes/Controller/CNLiveTaskListController.h 0 → 100644
  1 +//
  2 +// CNLiveMineController.h
  3 +// CNLiveIntegralModule
  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 CNLiveTaskListController : CNCommonViewController
  18 +@property (nonatomic, copy) NSString *isFrom;
  19 +
  20 +@end
  21 +
  22 +NS_ASSUME_NONNULL_END
CNLiveIntegralModule/Classes/Controller/CNLiveTaskListController.m 0 → 100644
  1 +//
  2 +// CNLiveTaskListController.m
  3 +// CNLiveIntegralModule
  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 "CNLiveTaskListController.h"
  10 +
  11 +#import "MJExtension.h"
  12 +#import "QMUIKit.h"
  13 +#import "YYKit.h"
  14 +#import <Masonry/Masonry.h>
  15 +
  16 +#import "CNLiveServices.h"
  17 +
  18 +//#import "CNLiveMineNavigationBar.h"
  19 +#import "CNTaskListTableViewCell.h"
  20 +#import "CNTaskListModel.h"
  21 +#import "CNGoldWhereaboutsView.h"//金币下落
  22 +#import "CNAddScoreView.h"
  23 +
  24 +#import "CNLiveNetworking.h"
  25 +#import "CNLiveEnvironment.h"
  26 +#import "CNUserInfoManager.h"
  27 +
  28 +//#import "CNTabBarViewController.h"
  29 +//#import "CNNavigationController.h"
  30 +//#import "CNClassifySegmentController.h"
  31 +//#import "CNSubClassifySegmentController.h"
  32 +
  33 +//#import "CNMinePersonInfoController.h"//个人资料
  34 +//#import "CNAddNewFriendViewController.h"//添加好友
  35 +//#import "CNFirendNewListViewController.h"//生活圈
  36 +//#import "CNReportAndComplaintWebController.h"//帮助与反馈
  37 +//#import "CNGifFaceListHeaderView.h"
  38 +#import "CNTaskListHeadView.h"
  39 +#import "CNLiveIntegralDetailsController.h"//积分明细
  40 +#import "CNAddScoreManager.h"
  41 +//#import "CNTouristsLoginTipsView.h"
  42 +//#import "CNWebRedirectHandle.h"
  43 +
  44 +//@interface CNLiveTaskListController ()<UITableViewDelegate,UITableViewDataSource,CNTaskListTableViewCellDelegate,CNTaskListHeadViewDelegate,TouristsLoginTipsViewDelegate>
  45 +@interface CNLiveTaskListController ()<UITableViewDelegate,UITableViewDataSource,CNTaskListTableViewCellDelegate,CNTaskListHeadViewDelegate>
  46 +@property (nonatomic, strong) UITableView *tableView;
  47 +@property (nonatomic, strong) CNTaskListHeadView *headView;
  48 +@property (nonatomic, strong) NSMutableArray *data;
  49 +
  50 +@property (nonatomic, strong) UIButton *backButton;
  51 +@property (nonatomic, strong) UILabel *titleLabel;
  52 +
  53 +//@property (nonatomic, strong) CNTouristsLoginTipsView *fuzzyView;//游客登录弹框
  54 +
  55 +@end
  56 +
  57 +@implementation CNLiveTaskListController
  58 +#pragma mark - CNTaskListTableViewCellDelegate
  59 +- (void)clickedCellButton:(CNTaskListTableViewCell *)cell type:(NSString *)type{
  60 + if([type isEqualToString:@"update_face"]||[type isEqualToString:@"update_nick"]){//头像 昵称
  61 +// CNMinePersonInfoController *infoVC = [[CNMinePersonInfoController alloc] init];
  62 +// [[AppDelegate sharedAppDelegate] pushViewController:infoVC withBackTitle:@" "];
  63 +
  64 + }
  65 + else if ([type isEqualToString:@"publish_witness"]){//发布目击者
  66 + [self selectChannelId:@"1" classifyId:@"101"];
  67 +
  68 + }
  69 + else if ([type isEqualToString:@"add_friend"]){//添加好友
  70 +// CNAddNewFriendViewController *newFriendVC = [[CNAddNewFriendViewController alloc] init];
  71 +// [[AppDelegate sharedAppDelegate] pushViewController:newFriendVC withBackTitle:@"返回"];
  72 +
  73 + }
  74 + else if ([type isEqualToString:@"publish_moment"]){//生活圈
  75 +// CNFirendNewListViewController *vc = [[CNFirendNewListViewController alloc] init];
  76 +// [[AppDelegate sharedAppDelegate] pushViewController:vc withBackTitle:@" "];
  77 +
  78 + }
  79 + else if ([type isEqualToString:@"share_video"]){//分享目击者视频
  80 + [self selectChannelId:@"1" classifyId:@"101"];
  81 +
  82 + }
  83 + else if ([type isEqualToString:@"share_article"]){//分享文章
  84 + [self selectChannelId:@"1" classifyId:@"102"];
  85 +
  86 + }
  87 + else if ([type isEqualToString:@"publish_comment"]){//评论
  88 + [self selectChannelId:@"1" classifyId:@"101"];
  89 +
  90 + }
  91 + else if ([type isEqualToString:@"read_article"]){//看文章-> 视讯中国 -> 今日要闻
  92 + [self selectChannelId:@"1" classifyId:@"102"];
  93 +
  94 + }
  95 + else if ([type isEqualToString:@"customer_feedback"]){//帮助与反馈
  96 +// NSString *savePath = [NSString stringWithFormat:@"%@%@",CNWjjUserTermsUrls,@"bzfk"];
  97 +// NSDictionary *h5Dic = [[NSUserDefaults standardUserDefaults] objectForKey:savePath];
  98 +// NSString *uuid = [CNLiveBusinessTools uuid];
  99 +// NSString *defaultH5Url = @"http://wjjh5.cnlive.com/cnhf.html";
  100 +// NSString *baseH5Url = [NSString isEmpty:h5Dic[@"detailUrl"]]?defaultH5Url:h5Dic[@"detailUrl"];
  101 +// NSString *h5Url = [NSString stringWithFormat:@"%@?sid=%@&uuid=%@",baseH5Url,CNUserShareModel.uid,uuid];
  102 +// NSString *h5Title = [NSString stringWithFormat:@"%@",h5Dic[@"title"]];
  103 +// CNReportAndComplaintWebController *webVC = [[CNReportAndComplaintWebController alloc] initWithUrl:h5Url webType:CNFeedbackWebType pageTitle:h5Title];
  104 +// [[AppDelegate sharedAppDelegate] pushViewController:webVC withBackTitle:@" "];
  105 + }
  106 + else if ([type isEqualToString:@"watch_video"]){//看视频 -> 视讯中国 -> 目击者
  107 + [self selectChannelId:@"1" classifyId:@"101"];
  108 +
  109 + }
  110 + else if ([type isEqualToString:@"check_in"]){//签到
  111 +// if([self.isFrom isEqualToString:@"Classify"]){
  112 +// CNTabBarViewController *tabbarController = (CNTabBarViewController *)[AppDelegate sharedAppDelegate].window.rootViewController;
  113 +// tabbarController.selectedIndex = 2;
  114 +// }
  115 +// [self.navigationController popViewControllerAnimated:YES];
  116 + }
  117 + else if ([type isEqualToString:@"listen_novel"]){//听小说
  118 + [self selectChannelId:@"219" classifyId:@"215"];
  119 +
  120 + }
  121 +
  122 +
  123 +}
  124 +- (void)selectChannelId:(NSString *)channelId classifyId:(NSString *)classifyId{
  125 + NSInteger channel = [self containsWithChannelId:channelId];
  126 + if(channel == -1){
  127 +// [[UIApplication sharedApplication].keyWindow addSubview:self.fuzzyView];
  128 +
  129 + }else{
  130 + NSInteger classify = [self containsWithChannelIndex:channel classifyId:classifyId];
  131 + if(classify == -1){
  132 + [self selectTabbarControllerItem:1 channelId:channel classifyId:0];
  133 +
  134 + }else{
  135 + [self selectTabbarControllerItem:1 channelId:channel classifyId:classify];
  136 +
  137 + }
  138 +
  139 + }
  140 +}
  141 +- (void)selectTabbarControllerItem:(NSInteger)item channelId:(NSInteger)channelId classifyId:(NSInteger)classifyId{
  142 +// CNTabBarViewController *tabbarController = (CNTabBarViewController *)[AppDelegate sharedAppDelegate].window.rootViewController;
  143 +// tabbarController.selectedIndex = item;
  144 +// if([self.isFrom isEqualToString:@"Classify"]){
  145 +// [self.navigationController popViewControllerAnimated:YES];
  146 +// }
  147 +//
  148 +// if (![CNWebRedirectHandle manager].isSelectedClassify) {
  149 +// [CNWebRedirectHandle manager].isClickedIntegral = YES;
  150 +// [CNWebRedirectHandle manager].channelId = channelId;
  151 +// [CNWebRedirectHandle manager].classifyId = classifyId;
  152 +// return;
  153 +// }
  154 +//
  155 +// //分类
  156 +// CNNavigationController *nav = tabbarController.childViewControllers[item];
  157 +// CNClassifySegmentController *vc = nav.childViewControllers[0];
  158 +//
  159 +// if([vc isKindOfClass:[CNClassifySegmentController class]]){
  160 +// //视讯中国 - 听见中国
  161 +// [vc categoryView:vc.titleImageCategoryView didSelectedItemAtIndex:channelId];
  162 +//
  163 +// CNSubClassifySegmentController *svc = [vc.vcArrayM safetyObjectAtIndex:channelId];
  164 +// if([svc isKindOfClass:[CNSubClassifySegmentController class]]){
  165 +// //目击者 - 今日要闻 - 中国冰雪
  166 +// [svc categoryView:svc.categoryView didSelectedItemAtIndex:classifyId];
  167 +//
  168 +// }
  169 +// }
  170 +}
  171 +//判断是否有这个频道 -- 一级
  172 +- (NSInteger)containsWithChannelId:(NSString *)channelId {
  173 +// NSString *normalKey = [NSString stringWithFormat:@"%@_%@",NormalChannelArray,CNUserShareModel.uid];
  174 +// NSMutableArray *channelArray = [[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:normalKey]];
  175 +//
  176 +// NSInteger i = 0;
  177 +// for (NSString *str in channelArray) {
  178 +// NSDictionary *dic = CNLiveStringJsonToDictionary(str);
  179 +// CNCategoryGetChannelModel *model = [CNCategoryGetChannelModel mj_objectWithKeyValues:dic];
  180 +// if ([model.id isEqualToString:channelId]) {
  181 +// return i;
  182 +// }
  183 +// i++;
  184 +// }
  185 + return -1;
  186 +
  187 +}
  188 +//判断有这个频道的分类在第几个 -- 二级
  189 +- (NSInteger)containsWithChannelIndex:(NSInteger)index classifyId:(NSString *)classifyId {
  190 +// NSString *normalKey = [NSString stringWithFormat:@"%@_%@",NormalChannelArray,CNUserShareModel.uid];
  191 +// NSMutableArray *channelArray = [[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:normalKey]];
  192 +// NSInteger i = 0;
  193 +//
  194 +// if(channelArray.count > index){
  195 +// NSString *modelStr = channelArray[index];
  196 +// NSDictionary *dic = CNLiveStringJsonToDictionary(modelStr);
  197 +// CNCategoryGetChannelModel *model = [CNCategoryGetChannelModel mj_objectWithKeyValues:dic];
  198 +// for (CNCategoryGetChannelModel *subModel in model.pageStyleList) {
  199 +// if ([subModel.id isEqualToString:classifyId]) {
  200 +// return i;
  201 +// }
  202 +// if (CNLiveStringIsEmpty(subModel.pageType)) {
  203 +// continue;
  204 +// }else{
  205 +// i++;
  206 +// }
  207 +// }
  208 +// }
  209 + return -1;
  210 +
  211 +}
  212 +#pragma mark - Data
  213 +- (void)loadData{
  214 +// NSDictionary *params = @{@"sid":CNUserShareModel.uid};
  215 + NSDictionary *params = @{@"sid":@"10514405",@"appId":AppId};
  216 + [CNLiveNetworking setAllowRequestDefaultArgument:YES];
  217 + [CNLiveNetworking setupShowDataResult:NO];
  218 + [QMUITips showLoadingInView:[UIApplication sharedApplication].keyWindow];
  219 + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodGET URLString:CNIntegralGetTasksUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) {
  220 + [QMUITips hideAllTipsInView:[UIApplication sharedApplication].keyWindow];
  221 + [self hideEmptyView];
  222 + if (error) {
  223 + if (self.data.count == 0) {
  224 + if (error.code == -1001) {
  225 + [self showEmptyViewWithImage:[UIImage imageNamed:@"dd_wlcw"] text:@"无法连接网络" detailText:@"别紧张,试试看刷新页面~" buttonTitle:@" 重试 " buttonAction:@selector(loadData)];
  226 + [self setCNAPIErrorEmptyView];
  227 + }
  228 + }
  229 + return;
  230 + }
  231 + if(responseObject[@"data"] && [responseObject[@"data"] isKindOfClass:[NSDictionary class]]){
  232 + CNTaskListModel *model = [CNTaskListModel mj_objectWithKeyValues:responseObject[@"data"]];
  233 + [self.data addObject:model];
  234 + self.headView.score = model.integral;
  235 + [self.tableView reloadData];
  236 + if ([responseObject isKindOfClass:[NSDictionary class]] && [responseObject[@"errorCode"] isEqualToString:@"0"]) {
  237 + if([responseObject isKindOfClass:[NSDictionary class]]){
  238 + //存入任务列表
  239 + if(responseObject[@"data"] && [responseObject[@"data"] isKindOfClass:[NSDictionary class]]){
  240 + [CNAddScoreManager writeJsonName:@"TaskList.json" dic:responseObject[@"data"]];
  241 + }
  242 + }
  243 +
  244 + }
  245 + }
  246 +
  247 + }];
  248 +
  249 +}
  250 +- (void)viewWillAppear:(BOOL)animated {
  251 + [super viewWillAppear: animated];
  252 + self.navigationController.navigationBar.hidden = YES;
  253 +
  254 +}
  255 +
  256 +- (void)viewDidLoad {
  257 + [super viewDidLoad];
  258 + if (@available(iOS 11.0, *)) {
  259 + self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  260 + } else {
  261 + self.automaticallyAdjustsScrollViewInsets = NO;
  262 + }
  263 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notification:) name:@"AddScoreRequestSuccess" object:nil];
  264 +
  265 + [self loadData];
  266 + [self createUI];
  267 +
  268 +}
  269 +- (void)dealloc{
  270 + [[NSNotificationCenter defaultCenter] removeObserver:self name:@"AddScoreRequestSuccess" object:nil];
  271 +
  272 +}
  273 +//实现方法
  274 +- (void)notification:(NSNotification *)noti{
  275 + NSString *taskId = noti.userInfo[@"taskId"];
  276 +
  277 + //改变总积分
  278 + NSInteger addScore = [noti.userInfo[@"score"] integerValue];
  279 + NSInteger scored = [self.headView.score integerValue];
  280 + NSString *scoreStr = [NSString stringWithFormat:@"%ld",scored + addScore];
  281 + self.headView.score = scoreStr;
  282 +
  283 + //改变任务次数
  284 + NSArray *arr = [self.tableView indexPathsForVisibleRows];
  285 + for (NSIndexPath *indexPath in arr) {
  286 + CNTaskListTableViewCell *cell = (CNTaskListTableViewCell *)[self.tableView cellForRowAtIndexPath:indexPath];
  287 + if([taskId isEqualToString:cell.model.taskId]){
  288 + cell.model.times++;
  289 + cell.model = cell.model;
  290 + }
  291 + }
  292 +
  293 +}
  294 +
  295 +//- (void)viewWillDisappear:(BOOL)animated{
  296 +// [super viewWillDisappear:animated];
  297 +// self.navigationController.navigationBar.hidden = NO;
  298 +//}
  299 +
  300 +#pragma mark - UI
  301 +- (void)createUI {
  302 + [self.headView addSubview:self.backButton];
  303 + [self.headView addSubview:self.titleLabel];
  304 + [self.view addSubview:self.headView];
  305 + [self.view addSubview:self.tableView];
  306 +
  307 +}
  308 +
  309 +- (void)viewDidLayoutSubviews {
  310 + [super viewDidLayoutSubviews];
  311 + [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
  312 + make.top.equalTo(self.headView.mas_bottom);
  313 + make.bottom.left.right.equalTo(self.view);
  314 +
  315 + }];
  316 +
  317 +}
  318 +/*
  319 +#pragma mark - Navigation
  320 +
  321 +// In a storyboard-based application, you will often want to do a little preparation before navigation
  322 +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  323 + // Get the new view controller using [segue destinationViewController].
  324 + // Pass the selected object to the new view controller.
  325 +}
  326 +*/
  327 +#pragma mark - UITableViewDataSource
  328 +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  329 + return 2;
  330 +}
  331 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  332 + if(self.data.count > 0){
  333 + if(section == 0){
  334 + CNTaskListModel *model = self.data[0];
  335 + return model.dailyTask.count;
  336 +
  337 + }else if(section == 1){
  338 + CNTaskListModel *model = self.data[0];
  339 + return model.firstTask.count;
  340 +
  341 + }
  342 + }
  343 + return 0;
  344 +
  345 +}
  346 +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  347 + CNTaskListTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCNTaskListTableViewCell forIndexPath:indexPath];
  348 + cell.delegate = self;
  349 + if(self.data.count > 0){
  350 + CNTaskListModel *model = self.data[0];
  351 + if(indexPath.section == 0){
  352 + cell.model = model.dailyTask[indexPath.row];
  353 +
  354 + }else if(indexPath.section == 1){
  355 + cell.model = model.firstTask[indexPath.row];
  356 +
  357 + }
  358 + }
  359 + cell.selectionStyle = UITableViewCellSelectionStyleNone;
  360 + return cell;
  361 +
  362 +}
  363 +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
  364 + NSArray *arr = @[@"每日任务",@"首次任务"];
  365 + UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 45)];
  366 + view.backgroundColor = [UIColor whiteColor];
  367 + UILabel *title = [[UILabel alloc]initWithFrame:CGRectMake(15, 0, SCREEN_WIDTH-30, 45)];
  368 + title.text = arr[section];
  369 + title.textColor = [UIColor blackColor];
  370 + title.font = [UIFont systemFontOfSize:15.0];
  371 + [view addSubview:title];
  372 + return view;
  373 +}
  374 +- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
  375 + return 0.1; // 注意要设置为0.1,不能设置为0
  376 +}
  377 +
  378 +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
  379 + return 45; // 注意要设置为0.1,不能设置为0
  380 +}
  381 +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  382 + return 40+30;
  383 +
  384 +}
  385 +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  386 +
  387 +
  388 +}
  389 +
  390 +#pragma mark - CNTaskListHeadViewDelegate
  391 +- (void)clickedDetailButton:(CNTaskListHeadView *)view{
  392 + CNLiveIntegralDetailsController *vc = [[CNLiveIntegralDetailsController alloc] init];
  393 + [self.navigationController pushViewController:vc animated:YES];
  394 +}
  395 +#pragma mark - TouristsLoginTipsViewDelegate
  396 +//- (void)touristsLoginTipsView:(CNTouristsLoginTipsView *)view isClassify:(NSString *)isClassify{
  397 +// if([isClassify isEqualToString:@"close"]){
  398 +// //隐藏TouristsLoginTipsView
  399 +// [self.fuzzyView removeFromSuperview];
  400 +//
  401 +// }else if([isClassify isEqualToString:@"jump"]){
  402 +// //进入频道管理页面
  403 +// [self.fuzzyView removeFromSuperview];
  404 +// CNTabBarViewController *tabbarController = (CNTabBarViewController *)[AppDelegate sharedAppDelegate].window.rootViewController;
  405 +// tabbarController.selectedIndex = 1;
  406 +// //分类
  407 +// CNNavigationController *nav = tabbarController.childViewControllers[1];
  408 +// CNClassifySegmentController *vc = nav.childViewControllers[0];
  409 +//
  410 +// if([vc isKindOfClass:[CNClassifySegmentController class]]){
  411 +// [vc customAction:nil];
  412 +//
  413 +// }
  414 +//
  415 +// }
  416 +//
  417 +//}
  418 +/*
  419 + #pragma mark - Navigation
  420 +
  421 + // In a storyboard-based application, you will often want to do a little preparation before navigation
  422 + - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  423 + // Get the new view controller using [segue destinationViewController].
  424 + // Pass the selected object to the new view controller.
  425 + }
  426 + */
  427 +
  428 +#pragma mark - Action
  429 +- (void)backAction:(UIButton *)btn{
  430 + [self.navigationController popViewControllerAnimated:YES];
  431 +
  432 +}
  433 +
  434 +#pragma mark - Lazy loading
  435 +- (UIButton *)backButton {
  436 + if (!_backButton) {
  437 + _backButton = [UIButton buttonWithType:UIButtonTypeCustom];
  438 + _backButton.frame = CGRectMake(15, StatusBarHeight, 44, 44);
  439 + [_backButton setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft];
  440 + UIImage *image = [self xw_getImageName:@"mine_back_white_b" bundleName:@"CNLiveIntegralModule" targetClass:[self class]];
  441 + [_backButton setImage:image forState:UIControlStateNormal];
  442 +// _backButton.touchAreaInsets = UIEdgeInsetsMake(15, 15, 15, 15);
  443 + [_backButton addTarget:self action:@selector(backAction:) forControlEvents:UIControlEventTouchUpInside];
  444 + }
  445 + return _backButton;
  446 +}
  447 +
  448 +- (UILabel *)titleLabel{
  449 + if (!_titleLabel) {
  450 + _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, StatusBarHeight, 120, 44)];
  451 + _titleLabel.centerX = self.view.centerX;
  452 + _titleLabel.text = @"任务列表";
  453 + _titleLabel.font = [UIFont systemFontOfSize:18.0];
  454 + _titleLabel.textColor = [UIColor whiteColor];
  455 + _titleLabel.textAlignment = NSTextAlignmentCenter;
  456 + }
  457 + return _titleLabel;
  458 +}
  459 +
  460 +- (UITableView *)tableView {
  461 + if (!_tableView) {
  462 + _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
  463 + _tableView.backgroundColor = [UIColor whiteColor];
  464 + _tableView.delegate = self;
  465 + _tableView.dataSource = self;
  466 + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  467 + _tableView.showsVerticalScrollIndicator = NO;
  468 + _tableView.showsHorizontalScrollIndicator = NO;
  469 + _tableView.bounces = NO;
  470 + [_tableView registerClass:[CNTaskListTableViewCell class] forCellReuseIdentifier:kCNTaskListTableViewCell];
  471 +// [_tableView registerClass:[CNGifFaceListHeaderView class] forHeaderFooterViewReuseIdentifier:kCNGifFaceListHeaderView];
  472 + }
  473 + return _tableView;
  474 +}
  475 +
  476 +- (NSMutableArray *)data{
  477 + if (!_data) {
  478 + _data = [[NSMutableArray alloc] init];
  479 + }
  480 + return _data;
  481 +}
  482 +
  483 +- (CNTaskListHeadView *)headView{
  484 + if (!_headView) {
  485 + _headView = [[CNTaskListHeadView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop+SCREEN_WIDTH*100/375.0)];
  486 + _headView.backgroundColor = [UIColor whiteColor];
  487 + UIImage *image = [self xw_getImageName:@"integrate_list_bg" bundleName:@"CNLiveIntegralModule" targetClass:[CNLiveTaskListController class]];
  488 + _headView.image = image;
  489 + _headView.delegate = self;
  490 + }
  491 + return _headView;
  492 +}
  493 +
  494 +//- (CNTouristsLoginTipsView *)fuzzyView{
  495 +// if (!_fuzzyView) {
  496 +// _fuzzyView = [[CNTouristsLoginTipsView alloc] initWithFrame:[UIApplication sharedApplication].keyWindow.bounds];
  497 +// _fuzzyView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.6];
  498 +// _fuzzyView.delegate = self;
  499 +// }
  500 +// return _fuzzyView;
  501 +//
  502 +//}
  503 +
  504 +- (UIImage *)navigationBarBackgroundImage{
  505 + return [UIImage imageWithColor:[UIColor clearColor]];
  506 +}
  507 +
  508 +- (UIStatusBarStyle)preferredStatusBarStyle{
  509 + return UIStatusBarStyleLightContent;
  510 +}
  511 +
  512 +/**
  513 + * 创建图片
  514 + *
  515 + * @param imageName 图片名字
  516 + * @param bundleName 图片所在的bundle名字
  517 + * @param targetClass 类和bundle的同级目录
  518 + * @return 返回UIImage
  519 + */
  520 +- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{
  521 + NSBundle *bundle = [NSBundle bundleForClass:targetClass];
  522 + NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"];
  523 + NSBundle *targetBundle = [NSBundle bundleWithURL:url];
  524 + UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil];
  525 + return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil];
  526 +}
  527 +
  528 +@end
CNLiveIntegralModule/Classes/Model/CNAddScoreManager.h 0 → 100644
  1 +//
  2 +// CNAddScoreManager.h
  3 +// CNLiveIntegralModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/3/5.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +typedef void(^RequestCompleted) (BOOL isSuccess, NSString *desc, NSString *score);
  13 +@interface CNAddScoreManager : NSObject
  14 +@property (nonatomic, copy) RequestCompleted block;
  15 +
  16 +//延时调用
  17 ++ (instancetype)manager;
  18 +- (void)requestTime:(NSInteger)time taskId:(NSString *)taskId contentId:(NSString *)contentId block:(RequestCompleted _Nullable)block;
  19 +//取消延时
  20 +- (void)cancelSendRequest;
  21 +
  22 +//首次登录加积分
  23 ++ (void)firstLogin:(RequestCompleted _Nullable)block;
  24 +
  25 +//直接调用
  26 ++ (void)requestTaskId:(NSString *)taskId contentId:(NSString *)contentId block:(RequestCompleted _Nullable)block;
  27 +
  28 ++ (BOOL)judgeIsAddScoreJson:(NSString *)name taskType:(NSString *)taskType taskId:(NSString *)taskId;
  29 ++ (BOOL)writeJsonName:(NSString *)name dic:(NSDictionary *)dic;
  30 +
  31 +@end
  32 +
  33 +NS_ASSUME_NONNULL_END
CNLiveIntegralModule/Classes/Model/CNAddScoreManager.m 0 → 100644
  1 +//
  2 +// CNAddScoreManager.m
  3 +// CNLiveIntegralModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/3/5.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "CNAddScoreManager.h"
  10 +
  11 +#import "MJExtension.h"
  12 +
  13 +#import "CNLiveNetworking.h"
  14 +#import "CNUserInfoManager.h"
  15 +#import "CNLiveEnvironment.h"
  16 +
  17 +#import "CNScoreModel.h"
  18 +#import "CNTaskListModel.h"
  19 +
  20 +@interface CNAddScoreManager()
  21 +@property (nonatomic, weak) NSTimer *timer;
  22 +@property (nonatomic, copy) NSString *taskId;
  23 +@property (nonatomic, copy) NSString *contentId;
  24 +
  25 +@end
  26 +@implementation CNAddScoreManager
  27 +#pragma mark - 单例
  28 ++ (instancetype)manager {
  29 + static CNAddScoreManager *_singleton = nil;
  30 + static dispatch_once_t onceToken;
  31 + dispatch_once(&onceToken, ^{
  32 + //不能再使用alloc方法
  33 + //因为已经重写了allocWithZone方法,所以这里要调用父类的分配空间的方法
  34 + _singleton = [[super allocWithZone:NULL] init];
  35 + });
  36 + return _singleton;
  37 +}
  38 +// 防止外部调用alloc 或者 new
  39 ++ (instancetype)allocWithZone:(struct _NSZone *)zone {
  40 + return [CNAddScoreManager manager];
  41 +}
  42 +// 防止外部调用copy
  43 +- (id)copyWithZone:(nullable NSZone *)zone {
  44 + return [CNAddScoreManager manager];
  45 +}
  46 +// 防止外部调用mutableCopy
  47 +- (id)mutableCopyWithZone:(nullable NSZone *)zone {
  48 + return [CNAddScoreManager manager];
  49 +}
  50 +
  51 +#pragma mark - 工具方法
  52 +/*
  53 + errorCode 432 errorMessage 此内容今日上限
  54 + errorCode 431 errorMessage 积分任务上限
  55 + errorCode 0 errorMessage 成功
  56 + errorCode 403 errorMessage 缺少必要参数
  57 + */
  58 +#pragma mark - 延时请求加分接口
  59 +- (void)requestTime:(NSInteger)time taskId:(NSString *)taskId contentId:(NSString *)contentId block:(RequestCompleted _Nullable)block{
  60 + CNAddScoreManager *manager = [CNAddScoreManager manager];
  61 + manager.taskId = taskId;
  62 + manager.contentId = contentId;
  63 + manager.block = block;
  64 + [manager performSelector:@selector(sendRequest) withObject:nil afterDelay:time];
  65 +
  66 +}
  67 +- (void)sendRequest{
  68 + [CNAddScoreManager requestTaskId:self.taskId contentId:self.contentId block:self.block];
  69 +}
  70 +#pragma mark - 取消延时请求加分接口
  71 +- (void)cancelSendRequest{
  72 + [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(sendRequest) object:nil];
  73 +
  74 +}
  75 +//首次登录加积分
  76 ++ (void)firstLogin:(RequestCompleted _Nullable)block {
  77 + //根据后台数据设置
  78 + NSDictionary *dic = [[NSUserDefaults standardUserDefaults] objectForKey:@"CNWjjAddSourceTime"];
  79 + if(!dic[@"isShowIntegral"]||[dic[@"isShowIntegral"] isEqualToString:@"false"]||[dic[@"isShowIntegral"] isEqualToString:@"0"]){
  80 + block?block(NO, @"关闭增加积分", @"0"):@"";
  81 + return;
  82 + }
  83 + //判断是否可以请求加分
  84 + NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
  85 + BOOL haveAdd = [userDefault boolForKey:@"kAddScoreFirstLogin"];
  86 + if(!haveAdd){
  87 + NSDictionary *params = @{@"sid":CNUserShareModel.uid,@"taskId":@"first_login",@"contentId":@""};
  88 + [CNLiveNetworking setAllowRequestDefaultArgument:YES];
  89 + [CNLiveNetworking setupShowDataResult:NO];
  90 + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNIntegralAddUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) {
  91 +
  92 + if ([responseObject isKindOfClass:[NSDictionary class]] && [responseObject[@"errorCode"] isEqualToString:@"0"]) {
  93 + //完成次数加一
  94 + [CNAddScoreManager updateAddScoreJson:@"TaskList.json" taskType:@"firstTask" taskId:@"first_login"];
  95 + CNScoreModel *model = [CNScoreModel mj_objectWithKeyValues:responseObject[@"data"]];
  96 +
  97 + //发送通知
  98 + [[NSNotificationCenter defaultCenter] postNotificationName:@"AddScoreRequestSuccess" object:nil userInfo:@{@"taskType":@"firstTask", @"taskId":@"first_login", @"score":model.score}];
  99 + [userDefault setBool:YES forKey:@"kAddScoreFirstLogin"];
  100 + block?block(YES, model.desc, model.score):@"";
  101 +
  102 + }else{
  103 + block?block(NO, @"失败", @"0"):@"";
  104 + }
  105 + }];
  106 +
  107 + }else{
  108 + block?block(NO, @"首次登录已增加积分", @"0"):@"";
  109 +
  110 + }
  111 +
  112 +}
  113 +
  114 +#pragma mark - 直接请求加分接口
  115 ++ (void)requestTaskId:(NSString *)taskId contentId:(NSString *)contentId block:(RequestCompleted _Nullable)block{
  116 + if(!CNUserShareManager.isLogin){
  117 + block(NO, @"用户未登录", @"0");
  118 + return;
  119 + }
  120 + //根据后台数据设置
  121 + NSDictionary *dic = [[NSUserDefaults standardUserDefaults] objectForKey:@"CNWjjAddSourceTime"];
  122 + if(!dic[@"isShowIntegral"]||[dic[@"isShowIntegral"] isEqualToString:@"false"]||[dic[@"isShowIntegral"] isEqualToString:@"0"]){
  123 + block(NO, @"关闭增加积分", @"0");
  124 + return;
  125 + }
  126 + //首次任务
  127 + NSString *taskType = nil;
  128 + if([taskId isEqualToString:@"update_face"]){//更新头像
  129 + taskType = @"firstTask";
  130 + }
  131 + else if ([taskId isEqualToString:@"update_nick"]){//换个昵称
  132 + taskType = @"firstTask";
  133 +
  134 + }
  135 + else if ([taskId isEqualToString:@"publish_witness"]){//发条目击者
  136 + taskType = @"firstTask";
  137 +
  138 + }
  139 + else if ([taskId isEqualToString:@"add_friend"]){//添加好友
  140 + taskType = @"firstTask";
  141 +
  142 + }
  143 + else if ([taskId isEqualToString:@"publish_moment"]){//发条生活圈
  144 + taskType = @"firstTask";
  145 +
  146 + }
  147 + else if ([taskId isEqualToString:@"customer_feedback"]){//客服留言
  148 + taskType = @"firstTask";
  149 +
  150 + }
  151 + //每日任务
  152 + else if ([taskId isEqualToString:@"check_in"]){//签到
  153 + taskType = @"dailyTask";
  154 +
  155 + }
  156 + else if ([taskId isEqualToString:@"watch_video"]){//观看视频
  157 + taskType = @"dailyTask";
  158 +
  159 + }
  160 + else if ([taskId isEqualToString:@"listen_novel"]){//听本小说
  161 + taskType = @"dailyTask";
  162 +
  163 + }
  164 + else if ([taskId isEqualToString:@"read_article"]){//啃篇文档
  165 + taskType = @"dailyTask";
  166 +
  167 + }
  168 + else if ([taskId isEqualToString:@"publish_comment"]){//发布评论
  169 + taskType = @"dailyTask";
  170 +
  171 + }
  172 + else if ([taskId isEqualToString:@"share_video"]){//分享目击者视频
  173 + taskType = @"dailyTask";
  174 +
  175 + }
  176 + else if ([taskId isEqualToString:@"share_article"]){//分享文章
  177 + taskType = @"dailyTask";
  178 +
  179 + }
  180 +
  181 + //判断是否可以请求加分
  182 + BOOL isOk = [CNAddScoreManager judgeIsAddScoreJson:@"TaskList.json" taskType:taskType taskId:taskId];
  183 + if(isOk){
  184 + NSDictionary *params = @{@"sid":CNUserShareModel.uid,@"taskId":taskId,@"contentId":!contentId?@"":contentId};
  185 + [CNLiveNetworking setAllowRequestDefaultArgument:YES];
  186 + [CNLiveNetworking setupShowDataResult:NO];
  187 + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNIntegralAddUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) {
  188 +
  189 + if ([responseObject isKindOfClass:[NSDictionary class]] && [responseObject[@"errorCode"] isEqualToString:@"0"]) {
  190 + //完成次数加一
  191 + [CNAddScoreManager updateAddScoreJson:@"TaskList.json" taskType:taskType taskId:taskId];
  192 + CNScoreModel *model = [CNScoreModel mj_objectWithKeyValues:responseObject[@"data"]];
  193 +
  194 + //发送通知
  195 + [[NSNotificationCenter defaultCenter] postNotificationName:@"AddScoreRequestSuccess" object:nil userInfo:@{@"taskType":taskType, @"taskId":taskId, @"score":model.score}];
  196 + block(YES, model.desc, model.score);
  197 +
  198 + }else{
  199 + block(NO, @"失败", @"0");
  200 +
  201 + }
  202 +
  203 + }];
  204 + }else{
  205 + block(NO, @"任务达到上限", @"0");
  206 +
  207 + }
  208 +
  209 +}
  210 +
  211 +#pragma mark - 判断是否完成任务
  212 ++ (BOOL)judgeIsAddScoreJson:(NSString *)name taskType:(NSString *)taskType taskId:(NSString *)taskId{
  213 + CNTaskListModel *model = [CNAddScoreManager readJson:name taskType:taskType taskId:taskId];
  214 +
  215 + if([taskType isEqualToString:@"dailyTask"]){
  216 + for (CNTaskListItemModel *smodel in model.dailyTask) {
  217 + if([smodel.taskId isEqualToString:taskId]){
  218 + return smodel.times < smodel.totalCount;//能分享
  219 + }
  220 + }
  221 + }
  222 + if([taskType isEqualToString:@"firstTask"]){
  223 + for (CNTaskListItemModel *smodel in model.firstTask) {
  224 + if([smodel.taskId isEqualToString:taskId]){
  225 + return smodel.times < smodel.totalCount;//能分享
  226 + }
  227 + }
  228 + }
  229 + return NO;
  230 +
  231 +}
  232 +
  233 +#pragma mark - 更新本地完成任务次数
  234 ++ (BOOL)updateAddScoreJson:(NSString *)name taskType:(NSString *)taskType taskId:(NSString *)taskId{
  235 + CNTaskListModel *model = [CNAddScoreManager readJson:name taskType:taskType taskId:taskId];
  236 +
  237 + if([taskType isEqualToString:@"dailyTask"]){
  238 + for (CNTaskListItemModel *smodel in model.dailyTask) {
  239 + if([smodel.taskId isEqualToString:taskId]){
  240 + smodel.times++;
  241 + }
  242 + }
  243 + }
  244 + if([taskType isEqualToString:@"firstTask"]){
  245 + for (CNTaskListItemModel *smodel in model.firstTask) {
  246 + if([smodel.taskId isEqualToString:taskId]){
  247 + smodel.times++;
  248 + }
  249 + }
  250 + }
  251 + NSDictionary *dic = [model mj_keyValues];
  252 + return [CNAddScoreManager writeJsonName:name dic:dic];
  253 +
  254 +}
  255 +
  256 +#pragma mark - 读取本地json
  257 ++ (CNTaskListModel *)readJson:(NSString *)name taskType:(NSString *)taskType taskId:(NSString *)taskId{
  258 + NSString *docPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
  259 + NSString *filePath = [docPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@/%@",CNUserShareModel.uid,name]];
  260 + NSDictionary *jsonObject = [NSDictionary dictionaryWithContentsOfFile:filePath];
  261 + CNTaskListModel *model = [CNTaskListModel mj_objectWithKeyValues:jsonObject];
  262 + return model;
  263 +
  264 +}
  265 +
  266 +#pragma mark - 写入本地json
  267 ++ (BOOL)writeJsonName:(NSString *)name dic:(NSDictionary *)dic{
  268 + if (![NSJSONSerialization isValidJSONObject:dic]) {
  269 + return NO;
  270 + }
  271 + NSString *docPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
  272 + NSString *filePath = [docPath stringByAppendingPathComponent:CNUserShareModel.uid];
  273 +
  274 + NSFileManager *fileManager = [NSFileManager defaultManager];
  275 + BOOL isDir = NO;
  276 + BOOL isDirExist = [fileManager fileExistsAtPath:filePath isDirectory:&isDir];
  277 + if (isDir && isDirExist) {
  278 + NSString *savePath = [filePath stringByAppendingPathComponent:name];
  279 + return [dic writeToFile:savePath atomically:YES];
  280 +
  281 + }else{
  282 + BOOL success = [fileManager createDirectoryAtPath:filePath withIntermediateDirectories:YES attributes:nil error:nil];
  283 + if(success){
  284 + NSString *savePath = [filePath stringByAppendingPathComponent:name];
  285 + return [dic writeToFile:savePath atomically:YES];
  286 + }
  287 + }
  288 + return NO;
  289 +
  290 +}
  291 +
  292 +@end
CNLiveIntegralModule/Classes/Model/CNScoreModel.h 0 → 100644
  1 +//
  2 +// CNScoreModel.h
  3 +// CNLiveIntegralModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/3/2.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +
  13 +@interface CNScoreModel : NSObject
  14 +//积分明细
  15 +@property (nonatomic, copy) NSString *date;
  16 +@property (nonatomic, copy) NSString *integral;
  17 +@property (nonatomic, copy) NSString *source;
  18 +@property (nonatomic, copy) NSString *title;
  19 +
  20 +//签到
  21 +@property (nonatomic, strong) NSArray *scores;
  22 +@property (nonatomic, assign) NSInteger times;
  23 +@property (nonatomic, copy) NSString *url;
  24 +@property (nonatomic, copy) NSString *score;
  25 +@property (nonatomic, copy) NSString *desc;
  26 +
  27 +@property (nonatomic, copy) NSString *status;
  28 +
  29 +@end
  30 +
  31 +NS_ASSUME_NONNULL_END
CNLiveIntegralModule/Classes/Model/CNScoreModel.m 0 → 100644
  1 +//
  2 +// CNScoreModel.m
  3 +// CNLiveIntegralModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/3/2.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "CNScoreModel.h"
  10 +
  11 +@implementation CNScoreModel
  12 +
  13 +
  14 +@end
CNLiveIntegralModule/Classes/Model/CNTaskListModel.h 0 → 100644
  1 +//
  2 +// CNTaskListModel.h
  3 +// CNLiveIntegralModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/2/26.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +@interface CNTaskListItemModel : NSObject
  13 +@property (nonatomic, copy) NSString *icon;
  14 +@property (nonatomic, copy) NSString *score;
  15 +@property (nonatomic, copy) NSString *status;
  16 +@property (nonatomic, copy) NSString *taskId;
  17 +@property (nonatomic, copy) NSString *taskType;
  18 +
  19 +@property (nonatomic, assign) NSInteger times;
  20 +@property (nonatomic, copy) NSString *title;
  21 +@property (nonatomic, assign) NSInteger totalCount;
  22 +@property (nonatomic, copy) NSString *url;
  23 +
  24 +@end
  25 +@interface CNTaskListModel : NSObject
  26 +@property (nonatomic, copy) NSString *integral;
  27 +@property (nonatomic, strong) NSArray *dailyTask;
  28 +@property (nonatomic, strong) NSArray *firstTask;
  29 +
  30 +
  31 +@end
  32 +
  33 +NS_ASSUME_NONNULL_END
CNLiveIntegralModule/Classes/Model/CNTaskListModel.m 0 → 100644
  1 +//
  2 +// CNTaskListModel.m
  3 +// CNLiveIntegralModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/2/26.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "CNTaskListModel.h"
  10 +
  11 +@implementation CNTaskListItemModel
  12 +
  13 +@end
  14 +@implementation CNTaskListModel
  15 ++ (NSDictionary *)mj_objectClassInArray{
  16 + return @{
  17 + @"dailyTask" : @"CNTaskListItemModel",@"firstTask" : @"CNTaskListItemModel"
  18 + };
  19 +}
  20 +@end
CNLiveIntegralModule/Classes/Module/CNLiveIntegralModule.h 0 → 100644
  1 +//
  2 +// CNLiveIntegralModule.h
  3 +// CNLiveIntegralModule
  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 CNLiveIntegralModule : NSObject
  14 +
  15 +@end
  16 +
  17 +NS_ASSUME_NONNULL_END
CNLiveIntegralModule/Classes/Module/CNLiveIntegralModule.m 0 → 100644
  1 +//
  2 +// CNLiveIntegralModule.m
  3 +// CNLiveIntegralModule
  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 "CNLiveIntegralModule.h"
  10 +#import "CNLiveServices.h"
  11 +
  12 +@BeeHiveMod(CNLiveIntegralModule)
  13 +@interface CNLiveIntegralModule()<BHModuleProtocol>
  14 +
  15 +@end
  16 +
  17 +@implementation CNLiveIntegralModule
  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
CNLiveIntegralModule/Classes/Module/CNLiveIntegralService.h 0 → 100644
  1 +//
  2 +// CNLiveIntegralService.h
  3 +// CNLiveIntegralModule
  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 CNLiveIntegralService : NSObject
  14 +
  15 +@end
  16 +
  17 +NS_ASSUME_NONNULL_END
CNLiveIntegralModule/Classes/Module/CNLiveIntegralService.m 0 → 100644
  1 +//
  2 +// CNLiveIntegralService.m
  3 +// CNLiveIntegralModule
  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 "CNLiveIntegralService.h"
  10 +#import "CNLiveServices.h"
  11 +#import "CNLiveTaskListController.h"
  12 +
  13 +
  14 +@BeeHiveService(CNLiveMineServiceProtocol,CNLiveIntegralService)
  15 +@interface CNLiveIntegralService ()<CNLiveMineServiceProtocol>
  16 +
  17 +@end
  18 +
  19 +@implementation CNLiveIntegralService
  20 +
  21 +// 任务列表
  22 +- (UIViewController *)getTaskListViewController {
  23 + return [CNLiveTaskListController new];
  24 +}
  25 +
  26 +- (void)pushToTaskListViewController {
  27 + CNLiveTaskListController *vc = [[CNLiveTaskListController alloc]init];
  28 +// [CNLivePageJumpManager pushViewController:vc];
  29 +}
  30 +
  31 +
  32 +@end
CNLiveIntegralModule/Classes/View/CAEmitterLayerView.h 0 → 100644
  1 +//
  2 +// CAEmitterLayerView.h
  3 +// CNLiveIntegralModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/2/28.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +
  13 +@interface CAEmitterLayerView : UIView
  14 +//模仿setter,getter方法
  15 +- (void)setEmitterLayer:(CAEmitterLayer *)layer;
  16 +- (CAEmitterLayer *)emitterLayer;
  17 +
  18 +//显示出当前view
  19 +- (void)show;
  20 +//隐藏
  21 +- (void)hide;
  22 +
  23 +@end
  24 +
  25 +NS_ASSUME_NONNULL_END
CNLiveIntegralModule/Classes/View/CAEmitterLayerView.m 0 → 100644
  1 +//
  2 +// CAEmitterLayerView.m
  3 +// CNLiveIntegralModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/2/28.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "CAEmitterLayerView.h"
  10 +
  11 +@interface CAEmitterLayerView() {
  12 + CAEmitterLayer *_emitterLayer;
  13 +}
  14 +
  15 +@end
  16 +
  17 +@implementation CAEmitterLayerView
  18 ++ (Class)layerClass {
  19 + return [CAEmitterLayer class];
  20 +}
  21 +
  22 +- (instancetype)initWithFrame:(CGRect)frame {
  23 + self = [super initWithFrame:frame];
  24 + if (self) {
  25 + _emitterLayer = (CAEmitterLayer *)self.layer;
  26 + }
  27 + return self;
  28 +}
  29 +
  30 +- (void)setEmitterLayer:(CAEmitterLayer *)layer {
  31 + _emitterLayer = layer;
  32 +}
  33 +
  34 +- (CAEmitterLayer *)emitterLayer {
  35 + return _emitterLayer;
  36 +}
  37 +
  38 +- (void)show {
  39 +
  40 +}
  41 +
  42 +- (void)hide {
  43 +
  44 +}
  45 +@end
CNLiveIntegralModule/Classes/View/CNAddScoreView.h 0 → 100644
  1 +//
  2 +// CNAddScoreView.h
  3 +// CNLiveIntegralModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/2/28.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +@protocol CNAddScoreViewDelegate <NSObject>
  13 +@optional
  14 +- (void)login;
  15 +@end
  16 +
  17 +@interface CNAddScoreView : UIView
  18 +@property (nonatomic, weak) id<CNAddScoreViewDelegate> delegate;
  19 +
  20 ++ (void)showAddScoreViewWithDesc:(NSString *)desc score:(NSString *)score;
  21 ++ (void)showAddScoreViewWithDesc:(NSString *)desc login:(NSString *)login delegate:(id<CNAddScoreViewDelegate>)delegate;
  22 +
  23 ++ (void)hide;
  24 +
  25 +@end
  26 +
  27 +NS_ASSUME_NONNULL_END
CNLiveIntegralModule/Classes/View/CNAddScoreView.m 0 → 100644
  1 +//
  2 +// CNAddScoreView.m
  3 +// CNLiveIntegralModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/2/28.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "CNAddScoreView.h"
  10 +
  11 +#import <Masonry/Masonry.h>
  12 +#import <SDWebImage/SDWebImage.h>
  13 +#import "QMUIKit.h"
  14 +#import "YYKit.h"
  15 +
  16 +#import "NSString+CNLiveExtension.h"
  17 +
  18 +#import "CNGoldWhereaboutsView.h"
  19 +
  20 +@interface CNAddScoreView()
  21 +@property (nonatomic, strong) UIImageView *midImage;
  22 +@property (nonatomic, strong) UIButton *scoreBtn;
  23 +@property (nonatomic, strong) UILabel *scoreLabel;
  24 +@property (nonatomic, strong) UIButton *colseBtn;
  25 +
  26 +@property (nonatomic, strong) UILabel *descLabel;
  27 +
  28 +@property (nonatomic, copy) NSString *score;
  29 +@property (nonatomic, copy) NSString *desc;
  30 +@property (nonatomic, copy) NSString *login;
  31 +
  32 +@end
  33 +
  34 +@implementation CNAddScoreView
  35 +#pragma mark - Using Method
  36 ++ (void)showAddScoreViewWithDesc:(NSString *)desc score:(NSString *)score{
  37 + CNAddScoreView *view = [[CNAddScoreView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
  38 + view.backgroundColor = [UIColor colorWithWhite:0.2f alpha:0.4f];
  39 + view.desc = desc;
  40 + view.score = score;
  41 + [[UIApplication sharedApplication].keyWindow addSubview:view];
  42 +
  43 +}
  44 ++ (void)showAddScoreViewWithDesc:(NSString *)desc login:(NSString *)login delegate:(id<CNAddScoreViewDelegate>)delegate {
  45 + CNAddScoreView *view = [[CNAddScoreView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
  46 + view.backgroundColor = [UIColor colorWithWhite:0.2f alpha:0.4f];
  47 + view.desc = desc;
  48 + view.login = login;
  49 + view.delegate = delegate;
  50 + [[UIApplication sharedApplication].keyWindow addSubview:view];
  51 +}
  52 +
  53 +#pragma mark - Init
  54 +- (instancetype)initWithFrame:(CGRect)frame {
  55 + if (self = [super initWithFrame:frame]) {
  56 + self.userInteractionEnabled = YES;
  57 + self.clipsToBounds = YES;
  58 + [self setupUI];
  59 + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickedClose)];
  60 + [self addGestureRecognizer:tap];
  61 + }
  62 + return self;
  63 +}
  64 +#pragma mark - UI
  65 +- (void)setupUI{
  66 + [self addSubview:self.midImage];
  67 + [self addSubview:self.scoreBtn];
  68 + [self addSubview:self.scoreLabel];
  69 + [self addSubview:self.colseBtn];
  70 + [self addSubview:self.descLabel];
  71 +
  72 + [self xw_layoutSubviews];
  73 +
  74 + [self addAnimation];
  75 +}
  76 +
  77 +- (void)xw_layoutSubviews{
  78 + [_midImage mas_makeConstraints:^(MASConstraintMaker *make) {
  79 + make.centerX.equalTo(self.mas_centerX);
  80 + make.centerY.equalTo(self.mas_centerY).with.offset(-30*(SCREEN_WIDTH/375.0));
  81 + make.width.offset(SCREEN_WIDTH);
  82 + make.height.offset(SCREEN_WIDTH);
  83 +
  84 + }];
  85 + [_scoreBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  86 + make.centerX.equalTo(self.mas_centerX);
  87 + make.bottom.equalTo(_midImage.mas_bottom);
  88 + make.width.offset(160*(SCREEN_WIDTH/375.0));
  89 + make.height.offset(44*(SCREEN_WIDTH/375.0));
  90 +
  91 + }];
  92 + [_scoreLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  93 + make.centerX.equalTo(self.mas_centerX);
  94 + make.bottom.equalTo(_midImage.mas_bottom).with.offset(-2*(SCREEN_WIDTH/375.0));
  95 + make.width.offset(160*(SCREEN_WIDTH/375.0));
  96 + make.height.offset(44*(SCREEN_WIDTH/375.0));
  97 +
  98 + }];
  99 + [_colseBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  100 + make.top.equalTo(_midImage.mas_top).with.offset(0);
  101 + make.right.equalTo(self.mas_right).with.offset(-10*(SCREEN_WIDTH/375.0));
  102 + make.width.height.offset(30*(SCREEN_WIDTH/375.0));
  103 +
  104 + }];
  105 + [_descLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  106 + make.centerX.equalTo(self.mas_centerX);
  107 + make.centerY.equalTo(self.mas_centerY).with.offset(-35*(SCREEN_WIDTH/375.0));
  108 + make.width.offset(150*(SCREEN_WIDTH/375.0));
  109 + make.height.offset(80*(SCREEN_WIDTH/375.0));
  110 +
  111 + }];
  112 +
  113 +}
  114 +
  115 +#pragma mark - Data
  116 +- (void)setLogin:(NSString *)login{
  117 + _login = login;
  118 + _scoreLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:20];
  119 + _scoreLabel.text = login;
  120 +}
  121 +- (void)setScore:(NSString *)score{
  122 + _score = score;
  123 + _scoreLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:30];
  124 + _scoreLabel.text = [NSString stringWithFormat:@"+%@",score];
  125 +
  126 +}
  127 +
  128 +- (void)setDesc:(NSString *)desc{
  129 + _desc = desc;
  130 +
  131 + NSMutableString *str = [[NSMutableString alloc]initWithString:desc];
  132 +
  133 + CGSize size = [@"钱" textSizeIn:CGSizeMake(HUGE_VAL, HUGE_VAL) font:_descLabel.font];
  134 + NSInteger characters1 = ceil(140*(SCREEN_WIDTH/375.0)/size.width);
  135 + NSInteger characters2 = ceil(110*(SCREEN_WIDTH/375.0)/size.width);
  136 + NSInteger characters3 = ceil(90*(SCREEN_WIDTH/375.0)/size.width);
  137 +
  138 + if(str.length > characters1){
  139 + [str insertString:@"\n"atIndex:characters1];
  140 + }
  141 + if(str.length > characters1+characters2){
  142 + [str insertString:@"\n"atIndex:characters1+characters2];
  143 + }
  144 + if(str.length > characters1+characters2+characters3){
  145 + [str insertString:@"\n"atIndex:characters1+characters2+characters3];
  146 + }
  147 +
  148 + NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
  149 + paragraphStyle.lineSpacing = 10*(SCREEN_WIDTH/375.0);
  150 + paragraphStyle.alignment = NSTextAlignmentCenter;
  151 + paragraphStyle.lineBreakMode = NSLineBreakByTruncatingTail;
  152 + NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
  153 + [attributes setObject:paragraphStyle forKey:NSParagraphStyleAttributeName];
  154 + _descLabel.attributedText = [[NSAttributedString alloc] initWithString:str attributes:attributes];
  155 +
  156 +}
  157 +
  158 +/*
  159 + // Only override drawRect: if you perform custom drawing.
  160 + // An empty implementation adversely affects performance during animation.
  161 + - (void)drawRect:(CGRect)rect {
  162 + // Drawing code
  163 + }
  164 + */
  165 +
  166 +#pragma mark - Private Methods
  167 +- (void)addAnimation{
  168 + _midImage.transform = CGAffineTransformMake(0.01, 0, 0, 0.01, _midImage.left, _midImage.top);
  169 + _scoreBtn.transform = CGAffineTransformMake(0.01, 0, 0, 0.01, _scoreBtn.left, _scoreBtn.top);
  170 + _scoreLabel.transform = CGAffineTransformMake(0.01, 0, 0, 0.01, _scoreLabel.left, _scoreLabel.top);
  171 + _colseBtn.transform = CGAffineTransformMake(0.01, 0, 0, 0.01, _scoreLabel.left, _scoreLabel.top);
  172 + _descLabel.transform = CGAffineTransformMake(0.01, 0, 0, 0.01, _scoreLabel.left, _scoreLabel.top);
  173 +
  174 + [UIView animateWithDuration:0.3f animations:^{
  175 + _midImage.transform = CGAffineTransformMake(1.05f, 0, 0, 1.0f, 0, 0);
  176 + _scoreBtn.transform = CGAffineTransformMake(1.05f, 0, 0, 1.0f, 0, 0);
  177 + _scoreLabel.transform = CGAffineTransformMake(1.05f, 0, 0, 1.0f, 0, 0);
  178 + _colseBtn.transform = CGAffineTransformMake(1.05f, 0, 0, 1.0f, 0, 0);
  179 + _descLabel.transform = CGAffineTransformMake(1.05f, 0, 0, 1.0f, 0, 0);
  180 +
  181 + } completion:^(BOOL finished) {
  182 + [UIView animateWithDuration:0.1f animations:^{
  183 + _midImage.transform = CGAffineTransformMake(1, 0, 0, 1, 0, 0);
  184 + _scoreBtn.transform = CGAffineTransformMake(1, 0, 0, 1, 0, 0);
  185 + _scoreLabel.transform = CGAffineTransformMake(1, 0, 0, 1, 0, 0);
  186 + _colseBtn.transform = CGAffineTransformMake(1, 0, 0, 1, 0, 0);
  187 + _descLabel.transform = CGAffineTransformMake(1, 0, 0, 1, 0, 0);
  188 +
  189 + } completion:^(BOOL finished) {
  190 + // 恢复原位
  191 + _midImage.transform = CGAffineTransformIdentity;
  192 + _scoreBtn.transform = CGAffineTransformIdentity;
  193 + _scoreLabel.transform = CGAffineTransformIdentity;
  194 + _colseBtn.transform = CGAffineTransformIdentity;
  195 + _descLabel.transform = CGAffineTransformIdentity;
  196 +
  197 + }];
  198 +
  199 + }];
  200 +
  201 +}
  202 +- (void)hiddenAction{
  203 + _midImage.layer.transform = CATransform3DMakeScale(1, 1, 1);
  204 + _scoreBtn.layer.transform = CATransform3DMakeScale(1, 1, 1);
  205 + _scoreLabel.layer.transform = CATransform3DMakeScale(1, 1, 1);
  206 + _colseBtn.layer.transform = CATransform3DMakeScale(1, 1, 1);
  207 + _descLabel.layer.transform = CATransform3DMakeScale(1, 1, 1);
  208 +
  209 + [UIView animateWithDuration:0.3f animations:^{
  210 + // 按照比例scalex=0.001,y=0.001进行缩小
  211 + _midImage.layer.transform = CATransform3DMakeScale(0.001, 0.001, 1);
  212 + _scoreBtn.layer.transform = CATransform3DMakeScale(0.001, 0.001, 1);
  213 + _scoreLabel.layer.transform = CATransform3DMakeScale(0.001, 0.001, 1);
  214 + _colseBtn.layer.transform = CATransform3DMakeScale(0.001, 0.001, 1);
  215 + _descLabel.layer.transform = CATransform3DMakeScale(0.001, 0.001, 1);
  216 +
  217 + } completion:^(BOOL finished) {
  218 + [self removeFromSuperview];
  219 +
  220 + }];
  221 +
  222 +}
  223 +
  224 +#pragma mark - Action
  225 ++ (void)hide {
  226 + for (UIView *view in [UIApplication sharedApplication].keyWindow.subviews) {
  227 + if([view isKindOfClass:[CNGoldWhereaboutsView class]]){
  228 + [view removeAllSubviews];
  229 + [view removeFromSuperview];
  230 +
  231 + }
  232 + }
  233 + for (UIView *view in [UIApplication sharedApplication].keyWindow.subviews) {
  234 + if([view isKindOfClass:[CNAddScoreView class]]){
  235 + [view removeAllSubviews];
  236 + [view removeFromSuperview];
  237 +
  238 + }
  239 + }
  240 +
  241 +}
  242 +- (void)clickedClose {
  243 + [self hiddenAction];
  244 +
  245 + for (UIView *view in [UIApplication sharedApplication].keyWindow.subviews) {
  246 + if([view isKindOfClass:[CNGoldWhereaboutsView class]]){
  247 + [view removeFromSuperview];
  248 +
  249 + }
  250 + }
  251 +}
  252 +- (void)clickedCloseBtn:(UIButton *)btn{
  253 + [self clickedClose];
  254 +
  255 + if (self.delegate && [self.delegate respondsToSelector:@selector(login)]) {
  256 + [self.delegate login];
  257 + }
  258 +}
  259 +
  260 +#pragma mark - Lazy loading
  261 +- (UIImageView *)midImage{
  262 + if (!_midImage) {
  263 + _midImage = [[UIImageView alloc] init];
  264 + _midImage.userInteractionEnabled = YES;
  265 + UIImage *image = [self xw_getImageName:@"add_score_bg" bundleName:@"CNLiveIntegralModule" targetClass:[self class]];
  266 + _midImage.image = image;
  267 + _midImage.contentMode = UIViewContentModeCenter;
  268 + }
  269 + return _midImage;
  270 +}
  271 +- (UIButton *)scoreBtn{
  272 + if (!_scoreBtn) {
  273 + _scoreBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  274 + _scoreBtn.adjustsImageWhenHighlighted = NO;
  275 + UIImage *image = [self xw_getImageName:@"add_score_label" bundleName:@"CNLiveIntegralModule" targetClass:[self class]];
  276 + [_scoreBtn setImage:image forState:UIControlStateNormal];
  277 + [_scoreBtn addTarget:self action:@selector(clickedCloseBtn:) forControlEvents:UIControlEventTouchUpInside];
  278 +
  279 + }
  280 + return _scoreBtn;
  281 +}
  282 +- (UILabel *)scoreLabel{
  283 + if(!_scoreLabel){
  284 + _scoreLabel = [[UILabel alloc] init];
  285 + _scoreLabel.textColor = [UIColor colorWithRed:133/255.0 green:64/255.0 blue:4/255.0 alpha:1.0];
  286 + _scoreLabel.userInteractionEnabled = NO;
  287 + _scoreLabel.layer.cornerRadius = 20*(SCREEN_WIDTH/375.0);
  288 + _scoreLabel.layer.masksToBounds = YES;
  289 + _scoreLabel.textAlignment = NSTextAlignmentCenter;
  290 + _scoreLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:30];
  291 + }
  292 + return _scoreLabel;
  293 +}
  294 +- (UIButton *)colseBtn{
  295 + if(!_colseBtn){
  296 + _colseBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  297 + [_colseBtn addTarget:self action:@selector(clickedClose) forControlEvents:UIControlEventTouchUpInside];
  298 + UIImage *image = [self xw_getImageName:@"add_score_close" bundleName:@"CNLiveIntegralModule" targetClass:[self class]];
  299 + [_colseBtn setImage:image forState:UIControlStateNormal];
  300 +
  301 + }
  302 + return _colseBtn;
  303 +}
  304 +- (UILabel *)descLabel{
  305 + if(!_descLabel){
  306 + _descLabel = [[UILabel alloc] init];
  307 + _descLabel.textColor = [UIColor colorWithRed:160/255.0 green:17/255.0 blue:13/255.0 alpha:1.0];
  308 + _descLabel.userInteractionEnabled = NO;
  309 + _descLabel.textAlignment = NSTextAlignmentCenter;
  310 + _descLabel.numberOfLines = 3;
  311 + _descLabel.lineBreakMode = NSLineBreakByTruncatingTail;
  312 + _descLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:16*(SCREEN_WIDTH/375.0)];
  313 +
  314 + }
  315 + return _descLabel;
  316 +}
  317 +
  318 +/**
  319 + * 创建图片
  320 + *
  321 + * @param imageName 图片名字
  322 + * @param bundleName 图片所在的bundle名字
  323 + * @param targetClass 类和bundle的同级目录
  324 + * @return 返回UIImage
  325 + */
  326 +- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{
  327 + NSBundle *bundle = [NSBundle bundleForClass:targetClass];
  328 + NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"];
  329 + NSBundle *targetBundle = [NSBundle bundleWithURL:url];
  330 + UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil];
  331 + return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil];
  332 +}
  333 +
  334 +@end
CNLiveIntegralModule/Classes/View/CNGoldWhereaboutsView.h 0 → 100644
  1 +//
  2 +// CNGoldWhereaboutsView.h
  3 +// CNLiveIntegralModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/2/28.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "CAEmitterLayerView.h"
  10 +#import "CNSignInView.h"
  11 +
  12 +NS_ASSUME_NONNULL_BEGIN
  13 +@class CNScoreModel;
  14 +@protocol CNGoldWhereaboutsViewDelegate <NSObject>
  15 +@optional
  16 +- (void)login;
  17 +@end
  18 +
  19 +typedef NS_ENUM(NSUInteger, CNGoldWhereaboutsViewType) {
  20 + CNGoldWhereaboutsViewTypeDefault,//熊猫
  21 + CNGoldWhereaboutsViewTypeSignIn,//签到
  22 + CNGoldWhereaboutsViewTypeLogin,//熊猫
  23 +
  24 +};
  25 +
  26 +@interface CNGoldWhereaboutsView : CAEmitterLayerView
  27 +@property (nonatomic, weak) id<CNGoldWhereaboutsViewDelegate> delegate;
  28 +
  29 +// 游客模式浏览加积分
  30 ++ (void)showGoldWhereaboutsViewWithDesc:(NSString *)desc delegate:(id<CNGoldWhereaboutsViewDelegate>) delegate;
  31 +
  32 +// 默认展示添加积分视图
  33 ++ (void)showGoldWhereaboutsViewWithDesc:(NSString *)desc score:(NSString *)score;
  34 +
  35 +// 默认签到
  36 ++ (void)showGoldWhereaboutsViewModel:(CNScoreModel *)model controller:(id<CNSignInViewDelegate>)controller;
  37 ++ (void)hide;
  38 +
  39 +@end
  40 +
  41 +NS_ASSUME_NONNULL_END
CNLiveIntegralModule/Classes/View/CNGoldWhereaboutsView.m 0 → 100644
  1 +//
  2 +// CNGoldWhereaboutsView.m
  3 +// CNLiveIntegralModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/2/28.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "CNGoldWhereaboutsView.h"
  10 +#import "CNAddScoreView.h"
  11 +#import "CNSignInView.h"
  12 +#import "CNScoreModel.h"
  13 +//#import "CNAudioOrVideoMananger.h"
  14 +//#import "CNAudioPlayerManager.h"
  15 +//#import "LVCPlayer.h"
  16 +#import <AVFoundation/AVFoundation.h>
  17 +
  18 +@interface CNGoldWhereaboutsView()<CNAddScoreViewDelegate>
  19 +@property (nonatomic, copy) NSString *desc;
  20 +@property (nonatomic, copy) NSString *score;
  21 +
  22 +@property (nonatomic, weak) id<CNSignInViewDelegate> controller;
  23 +@property (nonatomic, strong) CNScoreModel *model;
  24 +
  25 +@end
  26 +@implementation CNGoldWhereaboutsView
  27 +#pragma mark - Using Method
  28 ++ (void)showGoldWhereaboutsViewWithDesc:(NSString *)desc delegate:(id<CNGoldWhereaboutsViewDelegate>) delegate{//浏览加积分
  29 + CNGoldWhereaboutsView *sView = [[CNGoldWhereaboutsView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
  30 + sView.desc = desc;
  31 + sView.delegate = delegate;
  32 + [[UIApplication sharedApplication].keyWindow addSubview:sView];
  33 + [sView show:CNGoldWhereaboutsViewTypeLogin];
  34 +}
  35 +
  36 ++ (void)showGoldWhereaboutsViewWithDesc:(NSString *)desc score:(NSString *)score{
  37 + CNGoldWhereaboutsView *sView = [[CNGoldWhereaboutsView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
  38 + sView.desc = desc;
  39 + sView.score = score;
  40 + [[UIApplication sharedApplication].keyWindow addSubview:sView];
  41 + [sView show:CNGoldWhereaboutsViewTypeDefault];
  42 +
  43 +}
  44 ++ (void)showGoldWhereaboutsViewModel:(CNScoreModel *)model controller:(id<CNSignInViewDelegate>)controller{
  45 + CNGoldWhereaboutsView *sView = [[CNGoldWhereaboutsView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
  46 + sView.model = model;
  47 + sView.controller = controller;
  48 + [[UIApplication sharedApplication].keyWindow addSubview:sView];
  49 + [sView show:CNGoldWhereaboutsViewTypeSignIn];
  50 +}
  51 +
  52 +#pragma mark - Init
  53 +- (instancetype)initWithFrame:(CGRect)frame {
  54 + self = [super initWithFrame:frame];
  55 + if (self) {
  56 + [self setup];
  57 + }
  58 + return self;
  59 +}
  60 +
  61 +#pragma mark - UI
  62 +- (void)setup {
  63 + //初始化一些参数
  64 + self.emitterLayer.masksToBounds = YES;
  65 + self.emitterLayer.emitterShape = kCAEmitterLayerLine;
  66 + self.emitterLayer.emitterMode = kCAEmitterLayerSurface;
  67 + self.emitterLayer.emitterSize = self.frame.size;
  68 + self.emitterLayer.emitterPosition = CGPointMake(self.bounds.size.width/2.0, -20);
  69 +
  70 +}
  71 +
  72 +#pragma mark - Private Methods
  73 +- (void)show:(CNGoldWhereaboutsViewType)type {
  74 +
  75 + self.emitterLayer.birthRate = 4;
  76 +
  77 + NSMutableArray *arr = [[NSMutableArray alloc]init];
  78 +
  79 + for (int i = 1; i <= 4; i++) {
  80 + __block CAEmitterCell *snowFlake = [CAEmitterCell emitterCell];
  81 + snowFlake.birthRate = 2.5f;
  82 + snowFlake.yAcceleration = 2500.f;
  83 + snowFlake.emissionRange = 0.5 * M_PI;
  84 + snowFlake.spinRange = 0.25 * M_PI;
  85 + snowFlake.contents = (__bridge id _Nullable)([UIImage imageNamed:[NSString stringWithFormat:@"gold_whereabouts%d",i]].CGImage);
  86 + snowFlake.lifetime = 100.f;
  87 +
  88 + snowFlake.scale = 0.08;
  89 + snowFlake.scaleRange = 0.08;
  90 + snowFlake.velocity = 0.0;
  91 + snowFlake.velocityRange = 100.f;
  92 +
  93 + [arr addObject:snowFlake];
  94 +
  95 + }
  96 + self.emitterLayer.emitterCells = arr;
  97 +
  98 + [self controlAmountOfGoldCOINS:arr];
  99 +
  100 + NSString *sounds = [[NSUserDefaults standardUserDefaults] valueForKey:@"GoldCoinSound"];//0有声音 1没声音
  101 +// if (!(sounds && [sounds isEqualToString:@"1"])) {//0有声音
  102 +// if(![CNAudioOrVideoMananger IsEnter] && ![[CNAudioPlayerManager sharedInstance] isPlaying] && ![LVCPlayer currentVCIsPalyer]){//不在语音通话
  103 +// AVAudioSession *audioSession = [AVAudioSession sharedInstance];
  104 +// [audioSession setCategory:AVAudioSessionCategoryAmbient error:nil];
  105 +// [audioSession setActive:YES error:nil];
  106 +// }
  107 +// }
  108 + NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"gold_whereabouts" ofType:@"mp3"]];
  109 + __block AVAudioPlayer *soundPlayer = [[AVAudioPlayer alloc]initWithContentsOfURL:url error:nil];
  110 + if (!(sounds && [sounds isEqualToString:@"1"])) {//0有声音
  111 + soundPlayer.volume = 0.5;//0.0~1.0之间
  112 + [soundPlayer prepareToPlay];
  113 + [soundPlayer play];//播放
  114 + }
  115 +
  116 + //停止金币产生
  117 + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  118 + [self.emitterLayer setValue:@0.f forKeyPath:@"birthRate"];
  119 +
  120 + });
  121 + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  122 + [soundPlayer stop];//播放
  123 + if(soundPlayer){
  124 + soundPlayer = nil;
  125 +
  126 + }
  127 + if (!(sounds && [sounds isEqualToString:@"1"])) {
  128 +// if(![CNAudioOrVideoMananger IsEnter] && ![[CNAudioPlayerManager sharedInstance] isPlaying]){//不在语音通话
  129 +// //金币下落结束
  130 +// [[NSNotificationCenter defaultCenter] postNotificationName:@"CNGoldWhereaboutsViewEnd" object:nil];
  131 +// }
  132 + }
  133 +
  134 + switch (type) {
  135 + case CNGoldWhereaboutsViewTypeDefault:
  136 + {
  137 + if(self.score && ![self.score isEqualToString:@""] && self.desc && ![self.desc isEqualToString:@""]){
  138 + [CNAddScoreView showAddScoreViewWithDesc:self.desc score:self.score];
  139 + }else{
  140 + [self hide];
  141 + }
  142 + }
  143 + break;
  144 +
  145 + case CNGoldWhereaboutsViewTypeSignIn:
  146 + {
  147 + [CNSignInView showSignInView:_model.score scores:_model.scores.count>0?_model.scores[0]:@"1000,2000,3000,4000,5000,6000,7000" day:_model.times url:_model.url delegate:_controller];
  148 + }
  149 + break;
  150 + case CNGoldWhereaboutsViewTypeLogin:
  151 + {
  152 + if(self.desc && ![self.desc isEqualToString:@""]){
  153 + [CNAddScoreView showAddScoreViewWithDesc:self.desc login:@"立即登录" delegate:self];
  154 + }else{
  155 + [self hide];
  156 + }
  157 +
  158 + }
  159 + break;
  160 + }
  161 +
  162 +
  163 + });
  164 +
  165 +}
  166 +
  167 +- (void)hide {
  168 + [self removeFromSuperview];
  169 +
  170 +}
  171 +
  172 ++ (void)hide {
  173 + for (UIView *view in [UIApplication sharedApplication].keyWindow.subviews) {
  174 + if([view isKindOfClass:[CNGoldWhereaboutsView class]]){
  175 + [view removeFromSuperview];
  176 +
  177 + }
  178 + }
  179 +
  180 +}
  181 +
  182 +- (void)controlAmountOfGoldCOINS:(NSMutableArray *)arr{
  183 +
  184 + __block CAEmitterCell *snowFlake0 = arr[0];
  185 + __block CAEmitterCell *snowFlake1 = arr[1];
  186 + __block CAEmitterCell *snowFlake2 = arr[2];
  187 + __block CAEmitterCell *snowFlake3 = arr[3];
  188 +
  189 + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  190 + snowFlake0.birthRate = 4;
  191 + snowFlake1.birthRate = 4;
  192 + snowFlake2.birthRate = 4;
  193 + snowFlake3.birthRate = 4;
  194 + [self.emitterLayer setValue:@4.f forKeyPath:@"birthRate"];
  195 +
  196 + });
  197 + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  198 + snowFlake0.birthRate = 1;
  199 + snowFlake1.birthRate = 1;
  200 + snowFlake2.birthRate = 1;
  201 + snowFlake3.birthRate = 1;
  202 + [self.emitterLayer setValue:@4.f forKeyPath:@"birthRate"];
  203 +
  204 + });
  205 + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  206 + snowFlake0.birthRate = 1;
  207 + snowFlake1.birthRate = 0;
  208 + snowFlake2.birthRate = 1;
  209 + snowFlake3.birthRate = 0;
  210 + [self.emitterLayer setValue:@1.f forKeyPath:@"birthRate"];
  211 +
  212 + });
  213 + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  214 + snowFlake0.birthRate = 1;
  215 + snowFlake1.birthRate = 1;
  216 + snowFlake2.birthRate = 1;
  217 + snowFlake3.birthRate = 0;
  218 + [self.emitterLayer setValue:@4.f forKeyPath:@"birthRate"];
  219 +
  220 + });
  221 +
  222 +}
  223 +/*
  224 + // Only override drawRect: if you perform custom drawing.
  225 + // An empty implementation adversely affects performance during animation.
  226 + - (void)drawRect:(CGRect)rect {
  227 + // Drawing code
  228 + }
  229 + */
  230 +- (void)dealloc{
  231 + NSLog(@"CNGoldWhereaboutsView - dealloc");
  232 +}
  233 +- (void)login{
  234 + if (self.delegate && [self.delegate respondsToSelector:@selector(login)]) {
  235 + [self.delegate login];
  236 + }
  237 +}
  238 +
  239 +@end
CNLiveIntegralModule/Classes/View/CNIntegralDetailsTableViewCell.h 0 → 100644
  1 +//
  2 +// CNIntegralDetailsTableViewCell.h
  3 +// CNLiveIntegralModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/3/1.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +
  13 +#define kCNIntegralDetailsTableViewCell @"CNIntegralDetailsTableViewCell"
  14 +@class CNScoreModel;
  15 +
  16 +@interface CNIntegralDetailsTableViewCell : UITableViewCell
  17 +@property (nonatomic, strong) CNScoreModel *model;
  18 +
  19 +@end
  20 +
  21 +NS_ASSUME_NONNULL_END
CNLiveIntegralModule/Classes/View/CNIntegralDetailsTableViewCell.m 0 → 100644
  1 +//
  2 +// CNIntegralDetailsTableViewCell.m
  3 +// CNLiveIntegralModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/3/1.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "CNIntegralDetailsTableViewCell.h"
  10 +#import "QMUIKit.h"
  11 +#import <Masonry/Masonry.h>
  12 +#import <SDWebImage/SDWebImage.h>
  13 +
  14 +#import "CNScoreModel.h"
  15 +
  16 +@interface CNIntegralDetailsTableViewCell()
  17 +@property (nonatomic, strong) UILabel *titleLabel;
  18 +@property (nonatomic, strong) UILabel *timeLabel;
  19 +@property (nonatomic, strong) QMUIButton *scoresBtn;
  20 +@property (nonatomic, strong) UIView *line;
  21 +
  22 +@end
  23 +
  24 +@implementation CNIntegralDetailsTableViewCell
  25 +static const NSInteger margin = 15;
  26 +
  27 +#pragma mark - Init
  28 +- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  29 + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  30 + if (self) {
  31 + self.contentView.backgroundColor = [UIColor whiteColor];
  32 + [self setupUI];
  33 +
  34 + }
  35 + return self;
  36 +}
  37 +
  38 +#pragma mark - UI
  39 +- (void)setupUI{
  40 + [self.contentView addSubview:self.titleLabel];
  41 + [self.contentView addSubview:self.timeLabel];
  42 + [self.contentView addSubview:self.scoresBtn];
  43 + [self.contentView addSubview:self.line];
  44 +
  45 +}
  46 +- (void)layoutSubviews{
  47 + [super layoutSubviews];
  48 + [_scoresBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  49 + make.centerY.equalTo(self.mas_centerY).with.offset(0);
  50 + make.right.equalTo(self.mas_right).with.offset(-margin);
  51 +
  52 + }];
  53 +
  54 + [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  55 + make.top.equalTo(self.mas_top).with.offset(margin);
  56 + make.left.equalTo(self.mas_left).with.offset(margin);
  57 + make.right.lessThanOrEqualTo(_scoresBtn.mas_left).offset(-margin);
  58 +
  59 + }];
  60 +
  61 + [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  62 + make.bottom.equalTo(self.mas_bottom).with.offset(-margin);
  63 + make.left.equalTo(self.mas_left).with.offset(margin);
  64 + make.right.equalTo(_scoresBtn.mas_left).with.offset(-margin);
  65 +
  66 + }];
  67 +
  68 + [_line mas_makeConstraints:^(MASConstraintMaker *make) {
  69 + make.bottom.equalTo(self.mas_bottom).with.offset(-0.5);
  70 + make.left.equalTo(self.mas_left).with.offset(margin);
  71 + make.right.equalTo(self.mas_right).with.offset(0);
  72 + make.height.offset(0.5);
  73 +
  74 + }];
  75 +
  76 +}
  77 +- (void)dealloc{
  78 +
  79 +}
  80 +#pragma mark - Data
  81 +- (void)setModel:(CNScoreModel *)model{
  82 + _model = model;
  83 + _titleLabel.text = model.title;
  84 + _timeLabel.text = model.date;
  85 + [_scoresBtn setTitle:[NSString stringWithFormat:@"%@%@",[model.source isEqualToString:@"1"]?@"+":@"-",model.integral] forState:UIControlStateNormal];
  86 +
  87 +}
  88 +
  89 +- (void)awakeFromNib {
  90 + [super awakeFromNib];
  91 + // Initialization code
  92 +}
  93 +
  94 +- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  95 + [super setSelected:selected animated:animated];
  96 +
  97 + // Configure the view for the selected state
  98 +}
  99 +#pragma mark - Private Methods
  100 +
  101 +
  102 +#pragma mark - Lazy loading
  103 +- (UILabel *)titleLabel{
  104 + if(_titleLabel == nil){
  105 + _titleLabel = [[UILabel alloc] init];
  106 + _titleLabel.textColor = [UIColor blackColor];
  107 + _titleLabel.font = UIFontMake(17);
  108 +
  109 + }
  110 + return _titleLabel;
  111 +
  112 +}
  113 +- (UILabel *)timeLabel{
  114 + if(_timeLabel == nil){
  115 + _timeLabel = [[UILabel alloc] init];
  116 + _timeLabel.textColor = [UIColor colorWithRed:136/255.0 green:136/255.0 blue:136/255.0 alpha:1.0];
  117 + _timeLabel.font = UIFontMake(11);
  118 + _timeLabel.userInteractionEnabled = YES;
  119 +
  120 + }
  121 + return _timeLabel;
  122 +
  123 +}
  124 +- ( QMUIButton *)scoresBtn{
  125 + if(_scoresBtn == nil){
  126 + _scoresBtn = [QMUIButton buttonWithType:UIButtonTypeCustom];
  127 + _scoresBtn.titleLabel.font = UIFontMake(14);
  128 + [_scoresBtn setTitleColor:[UIColor colorWithRed:249/255.0 green:171/255.0 blue:37/255.0 alpha:1.0] forState:UIControlStateNormal];
  129 + [_scoresBtn setImage:[UIImage imageNamed:@"mf_soccer_smallcoin"] forState:UIControlStateNormal];
  130 + _scoresBtn.adjustsImageWhenHighlighted = NO;
  131 + _scoresBtn.spacingBetweenImageAndTitle = 5;
  132 + _scoresBtn.imagePosition = QMUIButtonImagePositionRight;
  133 + }
  134 + return _scoresBtn;
  135 +
  136 +}
  137 +
  138 +- (UIView *)line{
  139 + if(_line == nil){
  140 + _line = [[UIView alloc] init];
  141 + _line.backgroundColor = [UIColor colorWithRed:235/255.0 green:235/255.0 blue:235/255.0 alpha:1.0];
  142 + }
  143 + return _line;
  144 +
  145 +}
  146 +@end
CNLiveIntegralModule/Classes/View/CNLiveIntegralNavigationBar.h 0 → 100644
  1 +//
  2 +// CNLiveIntegralNavigationBar.h
  3 +// CNLiveIntegralModule
  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 +
  13 +@class CNLiveIntegralNavigationBar;
  14 +
  15 +@protocol CNLiveIntegralNavigationBarDelegate <NSObject>
  16 +- (void)navigationBar:(CNLiveIntegralNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents;
  17 +
  18 +@end
  19 +
  20 +@interface CNLiveIntegralNavigationBar : UIView
  21 +@property (nonatomic, weak) id<CNLiveIntegralNavigationBarDelegate> delegate;
  22 +@property (nonatomic, strong) UIView *navView;
  23 +@property (nonatomic, strong) UIButton *left;
  24 +@property (nonatomic, strong) UILabel *title;
  25 +@property (nonatomic, strong, nullable) UIButton *right;
  26 +
  27 +
  28 +@end
  29 +
  30 +NS_ASSUME_NONNULL_END
CNLiveIntegralModule/Classes/View/CNLiveIntegralNavigationBar.m 0 → 100644
  1 +//
  2 +// CNLiveIntegralNavigationBar.m
  3 +// CNLiveIntegralModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright © 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveIntegralNavigationBar.h"
  10 +#import "QMUIKit.h"
  11 +
  12 +@interface CNLiveIntegralNavigationBar ()
  13 +
  14 +@end
  15 +
  16 +@implementation CNLiveIntegralNavigationBar
  17 +static const NSInteger margin = 15;
  18 +
  19 +- (instancetype)initWithFrame:(CGRect)frame{
  20 + self = [super initWithFrame:frame];
  21 + if(self){
  22 + self.userInteractionEnabled = YES;
  23 + self.backgroundColor = [UIColor clearColor];
  24 + [self createSubViews];
  25 + }
  26 + return self;
  27 +}
  28 +
  29 +- (void)dealloc {
  30 + NSLog(@"CNLiveIntegralNavigationBar -- dealloc");
  31 +}
  32 +
  33 +- (void)createSubViews {
  34 + [self addSubview:self.navView];
  35 + [self addSubview:self.left];
  36 + [self addSubview:self.title];
  37 + [self addSubview:self.right];
  38 +}
  39 +
  40 +/*
  41 + // Only override drawRect: if you perform custom drawing.
  42 + // An empty implementation adversely affects performance during animation.
  43 + - (void)drawRect:(CGRect)rect {
  44 + // Drawing code
  45 + }
  46 + */
  47 +
  48 +#pragma mark - 懒加载
  49 +- (UIView *)navView {
  50 + if (!_navView) {
  51 + _navView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)];
  52 + _navView.backgroundColor = [UIColor clearColor];
  53 + }
  54 + return _navView;
  55 +}
  56 +
  57 +- (UIButton *)left {
  58 + if (!_left) {
  59 + _left= [UIButton buttonWithType:UIButtonTypeCustom];
  60 + _left.adjustsImageWhenHighlighted = NO;
  61 + _left.frame = CGRectMake(margin, StatusBarHeight, NavigationBarHeight, NavigationBarHeight);
  62 + UIImage *image = [self xw_getImageName:@"code_back_black_b" bundleName:@"CNLiveIntegralModule" targetClass:[self class]];
  63 + [_left setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
  64 + [_left setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft];
  65 + [_left addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside];
  66 + }
  67 + return _left;
  68 +}
  69 +
  70 +- (UILabel *)title {
  71 + if (!_title) {
  72 + _title = [[UILabel alloc] initWithFrame:CGRectMake(margin+NavigationBarHeight, StatusBarHeight, SCREEN_WIDTH-2*(margin+NavigationBarHeight), NavigationBarHeight)];
  73 + [_title setFont:[UIFont systemFontOfSize:18]];
  74 + _title.textColor = [UIColor blackColor];
  75 + _title.textAlignment = NSTextAlignmentCenter;
  76 + }
  77 + return _title;
  78 +}
  79 +
  80 +- (UIButton *)right {
  81 + if (!_right) {
  82 + _right = [UIButton buttonWithType:UIButtonTypeCustom];
  83 + _right.frame = CGRectMake(SCREEN_WIDTH-50-margin, StatusBarHeight, 50, NavigationBarHeight);
  84 + [_right setContentHorizontalAlignment:UIControlContentHorizontalAlignmentRight];
  85 + _right.adjustsImageWhenHighlighted = NO;
  86 + _right.titleLabel.font = [UIFont systemFontOfSize:15];
  87 + [_right setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  88 + [_right addTarget:self action:@selector(rightDidClicked:) forControlEvents:UIControlEventTouchUpInside];
  89 + }
  90 + return _right;
  91 +}
  92 +
  93 +#pragma mark - 响应方法
  94 +- (void)goBack{
  95 + if (self.delegate && [self.delegate respondsToSelector:@selector(navigationBar:actionEvents:)]) {
  96 + [self.delegate navigationBar:self actionEvents:@"1"];
  97 + }
  98 +}
  99 +
  100 +- (void)rightDidClicked:(UIButton *)btn{
  101 + if (self.delegate && [self.delegate respondsToSelector:@selector(navigationBar:actionEvents:)]) {
  102 + [self.delegate navigationBar:self actionEvents:@"2"];
  103 + }
  104 +}
  105 +
  106 +/**
  107 + * 创建图片
  108 + *
  109 + * @param imageName 图片名字
  110 + * @param bundleName 图片所在的bundle名字
  111 + * @param targetClass 类和bundle的同级目录
  112 + * @return 返回UIImage
  113 + */
  114 +- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{
  115 + NSBundle *bundle = [NSBundle bundleForClass:targetClass];
  116 + NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"];
  117 + NSBundle *targetBundle = [NSBundle bundleWithURL:url];
  118 + UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil];
  119 + return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil];
  120 +
  121 +}
  122 +
  123 +@end
  124 +
CNLiveIntegralModule/Classes/View/CNRewardRulesView.h 0 → 100644
  1 +//
  2 +// CNRewardRulesView.h
  3 +// CNLiveIntegralModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/3/1.
  6 +// Copyright © 2019年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +
  13 +@interface CNRewardRulesView : UIView
  14 ++ (void)showRewardRulesView;
  15 ++ (void)showRewardRulesView:(NSString *)url;
  16 +
  17 +@end
  18 +
  19 +NS_ASSUME_NONNULL_END