Commit ac209919 by 徐健

首页组件编写

parent 99cdb473
...@@ -186,7 +186,7 @@ dependencies { ...@@ -186,7 +186,7 @@ dependencies {
implementation project(':m-confide') implementation project(':m-confide')
implementation project(':m-home') api project(':m-home')
// api "com.ydl:m-consultant-api:0.0.2" // api "com.ydl:m-consultant-api:0.0.2"
// api 'com.ydl:m-consultant-module-ydl:0.0.18@aar' // api 'com.ydl:m-consultant-module-ydl:0.0.18@aar'
......
...@@ -14,6 +14,7 @@ import com.alibaba.android.arouter.launcher.ARouter ...@@ -14,6 +14,7 @@ import com.alibaba.android.arouter.launcher.ARouter
import com.tbruyelle.rxpermissions2.RxPermissions import com.tbruyelle.rxpermissions2.RxPermissions
import com.umeng.analytics.MobclickAgent import com.umeng.analytics.MobclickAgent
import com.ydl.audioim.YDLavManager import com.ydl.audioim.YDLavManager
import com.ydl.component.home.HomeActivity
import com.ydl.component.music.MusicPlayActivity import com.ydl.component.music.MusicPlayActivity
import com.ydl.component.mvp.DemoContract import com.ydl.component.mvp.DemoContract
import com.ydl.component.mvp.DemoPresenter import com.ydl.component.mvp.DemoPresenter
...@@ -63,7 +64,7 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>( ...@@ -63,7 +64,7 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
override fun initDataAndEvent() { override fun initDataAndEvent() {
YDLavManager.instances.init(this, "3387e9b251f3491e9221a9877e8f7830") // YDLavManager.instances.init(this, "3387e9b251f3491e9221a9877e8f7830")
bindService() bindService()
reLoadData() reLoadData()
...@@ -97,10 +98,10 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>( ...@@ -97,10 +98,10 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
bt_to_tests.setOnClickListener { bt_to_tests.setOnClickListener {
startActivity(Intent(this, NewTestHomeActivity::class.java)) startActivity(Intent(this, NewTestHomeActivity::class.java))
} }
bt_to_confide.setOnClickListener { // bt_to_confide.setOnClickListener {
YDLavManager.instances.login("1193016") // YDLavManager.instances.login("1193016")
startActivity(Intent(this, ConfideHomeActivity::class.java)) // startActivity(Intent(this, ConfideHomeActivity::class.java))
} // }
bt_to_muse.setOnClickListener { bt_to_muse.setOnClickListener {
YDLRouterManager.router(IYDLRouterConstant.ROUTER_MUSE, YDLRouterManager.router(IYDLRouterConstant.ROUTER_MUSE,
YDLRouterParams().putExtra(IYDLRouterConstant.MUSIC_URL, "http://video.yidianling.com/2019/05/30/e6d4a71e8c895f2156a2ff37d93ca3a9.mp3") YDLRouterParams().putExtra(IYDLRouterConstant.MUSIC_URL, "http://video.yidianling.com/2019/05/30/e6d4a71e8c895f2156a2ff37d93ca3a9.mp3")
...@@ -133,7 +134,7 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>( ...@@ -133,7 +134,7 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
.navigation() .navigation()
} }
bt_to_home.setOnClickListener { bt_to_home.setOnClickListener {
startActivity(Intent(this, HomeActivity::class.java))
} }
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
android:id="@+id/home_fragment" android:id="@+id/home_fragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:name="com.yidianling.home.ui.fragment.YdlHomeFragment"
/> />
......
...@@ -43,7 +43,7 @@ ext { ...@@ -43,7 +43,7 @@ ext {
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
"m-confide" : "0.0.31.10", "m-confide" : "0.0.40",
"m-consultant" : "0.0.44", "m-consultant" : "0.0.44",
"m-fm" : "0.0.21", "m-fm" : "0.0.21",
"m-user" : "0.0.37", "m-user" : "0.0.37",
...@@ -85,7 +85,7 @@ ext { ...@@ -85,7 +85,7 @@ ext {
ydlCompileVersion = [ ydlCompileVersion = [
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
"m-confide" : "0.0.27.1", "m-confide" : "0.0.40",
"m-consultant" : "0.0.26", "m-consultant" : "0.0.26",
"m-course" : "0.0.22", "m-course" : "0.0.22",
"m-fm" : "0.0.15", "m-fm" : "0.0.15",
......
...@@ -68,17 +68,17 @@ dependencies { ...@@ -68,17 +68,17 @@ dependencies {
if (rootProject.ext.dev_mode){ if (rootProject.ext.dev_mode){
//开发时使用 //开发时使用
implementation "com.ydl:m-consultant-api:0.0.3" implementation modularPublication('com.ydl:m-consultant-api')
implementation "com.ydl:m-user-api:0.0.7" implementation modularPublication('com.ydl:m-user-api')
implementation project(':ydl-webview') implementation project(':ydl-webview')
implementation project(':ydl-media') implementation project(':ydl-media')
implementation project(":ydl-platform") implementation project(":ydl-platform")
} else { } else {
//发布时使用 //发布时使用
implementation "com.ydl:m-consultant-api:0.0.3" compileOnly rootProject.ext.dependencies["ydl-m-consultant-api"]
implementation "com.ydl:m-user-api:0.0.7" compileOnly rootProject.ext.dependencies["ydl-m-user-api"]
implementation "com.ydl:m-home-api:0.0.2" compileOnly rootProject.ext.dependencies["ydl-m-home-api"]
api (rootProject.ext.dependencies["ydl-platform"]) { api (rootProject.ext.dependencies["ydl-platform"]) {
transitive = true transitive = true
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
package com.yidianling.home.http package com.yidianling.home.http
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.data.http.BaseAPIResponse import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlcommon.data.http.RxUtils import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.router.YdlCommonRouterManager import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlnet.YDLHttpUtils import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.home.model.bean.* import com.yidianling.home.model.bean.*
import com.yidianling.user.api.service.IUserService
import io.reactivex.Observable import io.reactivex.Observable
/** /**
...@@ -59,30 +59,30 @@ class HomeHttp private constructor() { ...@@ -59,30 +59,30 @@ class HomeHttp private constructor() {
//首页倾述请求 //首页倾述请求
fun getConfideData(goodType: String): Observable<BaseAPIResponse<HomeConfideBean>> { fun getConfideData(goodType: String): Observable<BaseAPIResponse<HomeConfideBean>> {
val loginBean = YdlCommonRouterManager.getYdlCommonRoute().getUserInfo() val loginBean = ModularServiceManager.provide(IUserService::class.java).getUserInfo()
var userId = loginBean?.userId ?: ""; var userId = loginBean?.uid ?: "";
return getHomPagerApi().getConfideData(goodType, uid = userId); return getHomPagerApi().getConfideData(goodType, uid = userId);
} }
//首页课程请求 //首页课程请求
fun getCourseData(listType: String = "10"): Observable<BaseAPIResponse<HomeCourseBean>> { fun getCourseData(listType: String = "10"): Observable<BaseAPIResponse<HomeCourseBean>> {
val loginBean = YdlCommonRouterManager.getYdlCommonRoute().getUserInfo() val loginBean = ModularServiceManager.provide(IUserService::class.java).getUserInfo()
var userId = loginBean?.userId ?: ""; var userId = loginBean?.uid ?: "";
return getHomPagerApi().getCourseData(listType, uid = userId); return getHomPagerApi().getCourseData(listType, uid = userId);
} }
//首页测试请求 //首页测试请求
fun getTestData(): Observable<BaseAPIResponse<MutableList<HomeTestItemBean>>> { fun getTestData(): Observable<BaseAPIResponse<MutableList<HomeTestItemBean>>> {
val loginBean = YdlCommonRouterManager.getYdlCommonRoute().getUserInfo() val loginBean = ModularServiceManager.provide(IUserService::class.java).getUserInfo()
var userId = loginBean?.userId ?: ""; var userId = loginBean?.uid ?: "";
return getHomPagerApi().getTestData(uid = userId) return getHomPagerApi().getTestData(uid = userId)
} }
//首页问答请求 //首页问答请求
fun getAskData(): Observable<BaseAPIResponse<HomeAskBean>> { fun getAskData(): Observable<BaseAPIResponse<HomeAskBean>> {
val loginBean = YdlCommonRouterManager.getYdlCommonRoute().getUserInfo() val loginBean = ModularServiceManager.provide(IUserService::class.java).getUserInfo()
var userId = loginBean?.userId ?: ""; var userId = loginBean?.uid ?: "";
var token = loginBean?.token ?: ""; var token = loginBean?.accessToken ?: "";
return getHomPagerApi().getAskData(accessToken = token, uid = userId); return getHomPagerApi().getAskData(accessToken = token, uid = userId);
} }
...@@ -98,8 +98,8 @@ class HomeHttp private constructor() { ...@@ -98,8 +98,8 @@ class HomeHttp private constructor() {
//首页咨询请求 //首页咨询请求
fun getConsultData(goodType: String): Observable<BaseAPIResponse<HomeConsultBean>> { fun getConsultData(goodType: String): Observable<BaseAPIResponse<HomeConsultBean>> {
val loginBean = YdlCommonRouterManager.getYdlCommonRoute().getUserInfo() val loginBean = ModularServiceManager.provide(IUserService::class.java).getUserInfo()
var userId = loginBean?.userId ?: "" var userId = loginBean?.uid ?: ""
return getHomPagerApi().getConsultData(category = goodType, uid = userId) return getHomPagerApi().getConsultData(category = goodType, uid = userId)
} }
...@@ -120,4 +120,6 @@ class HomeHttp private constructor() { ...@@ -120,4 +120,6 @@ class HomeHttp private constructor() {
fun newMuseRequest(): Observable<BaseAPIResponse<MuseModuleBean>> { fun newMuseRequest(): Observable<BaseAPIResponse<MuseModuleBean>> {
return getHomPagerApi().getMuseData() return getHomPagerApi().getMuseData()
} }
} }
\ No newline at end of file
...@@ -78,7 +78,7 @@ class HomeConsultBean: HomeItemBaseBean { ...@@ -78,7 +78,7 @@ class HomeConsultBean: HomeItemBaseBean {
var hUrl: String? = null var hUrl: String? = null
var share: ShareBean? = null var share: ShareBean? = null
var isHiddenXcx: String? = null var isHiddenXcx: String? = null
var tags: String? = null var tags: ArrayList<String>? = null
class ShareBean { class ShareBean {
/** /**
......
...@@ -8,6 +8,7 @@ import com.google.gson.reflect.TypeToken ...@@ -8,6 +8,7 @@ import com.google.gson.reflect.TypeToken
import com.ydl.ydlcommon.base.BaseApp import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.data.http.RxUtils import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.data.http.ThrowableConsumer import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.mvp.base.SimplePresenter import com.ydl.ydlcommon.mvp.base.SimplePresenter
import com.ydl.ydlcommon.utils.SharedPreferencesEditor import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.YDLAsyncUtils import com.ydl.ydlcommon.utils.YDLAsyncUtils
...@@ -19,6 +20,7 @@ import com.yidianling.home.utils.HomeFileUtils ...@@ -19,6 +20,7 @@ import com.yidianling.home.utils.HomeFileUtils
import com.yidianling.home.utils.HomeLogPrinter import com.yidianling.home.utils.HomeLogPrinter
import com.yidianling.common.tools.LogUtil import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxAppTool import com.yidianling.common.tools.RxAppTool
import com.yidianling.consultant.api.IConsultantService
import com.yidianling.router.RouterManager import com.yidianling.router.RouterManager
import io.reactivex.Observable import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
...@@ -100,7 +102,7 @@ class HomePresenterImpl : SimplePresenter<IHomeContract.View>() { ...@@ -100,7 +102,7 @@ class HomePresenterImpl : SimplePresenter<IHomeContract.View>() {
} }
override fun asyncResult(`object`: Any?) { override fun asyncResult(`object`: Any?) {
//如果没有缓存数据,显示加载框 //如果没 有缓存数据,显示加载框
if (`object` !is String || TextUtils.isEmpty(`object`)) { if (`object` !is String || TextUtils.isEmpty(`object`)) {
mView?.let { it.showRefreshLayout() } mView?.let { it.showRefreshLayout() }
} }
...@@ -370,18 +372,18 @@ class HomePresenterImpl : SimplePresenter<IHomeContract.View>() { ...@@ -370,18 +372,18 @@ class HomePresenterImpl : SimplePresenter<IHomeContract.View>() {
mConsultType = type mConsultType = type
mConsultDisposable = HomeModelImpl.consultRequest(type) // mConsultDisposable = HomeModelImpl.consultRequest(type)
.map { it } // .map { it }
.filter { true } // .filter { true }
.subscribeOn(Schedulers.io()) // .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) // .observeOn(AndroidSchedulers.mainThread())
.subscribe(Consumer { // .subscribe(Consumer {
mView?.consultDataResponse(it, selectPosition) // mView?.consultDataResponse(it, selectPosition)
}, object : ThrowableConsumer() { // }, object : ThrowableConsumer() {
override fun accept(msg: String) { // override fun accept(msg: String) {
mView?.homeDataFail(msg) // mView?.homeDataFail(msg)
} // }
}) // })
} }
fun disposeConfide() { fun disposeConfide() {
......
...@@ -40,6 +40,7 @@ import com.yidianling.home.ui.view.CouponDialog ...@@ -40,6 +40,7 @@ import com.yidianling.home.ui.view.CouponDialog
import com.yidianling.home.utils.Double11ActivityManagerUtils import com.yidianling.home.utils.Double11ActivityManagerUtils
import com.yidianling.home.utils.HomeAnimUtils import com.yidianling.home.utils.HomeAnimUtils
import com.yidianling.router.RouterManager import com.yidianling.router.RouterManager
import com.yidianling.user.api.service.IUserService
import kotlinx.android.synthetic.ydl.home_module_fragment.* import kotlinx.android.synthetic.ydl.home_module_fragment.*
...@@ -252,7 +253,7 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>() ...@@ -252,7 +253,7 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
} }
} }
if (RouterManager.getUserRouter()?.isLogin() != true) { if (!ModularServiceManager.provide(IUserService::class.java).isLogin()) {
//未登录不显示 //未登录不显示
return return
} }
......
...@@ -48,7 +48,7 @@ class HomeConsultItemView(private var mContext: Context, private var homeEvent: ...@@ -48,7 +48,7 @@ class HomeConsultItemView(private var mContext: Context, private var homeEvent:
//设置名称 //设置名称
tv_consult_name.text = bean.doctorName tv_consult_name.text = bean.doctorName
//咨询师标签 //咨询师标签
tag_view.initData(StringUtils.strToList(bean.tags)) tag_view.initData(bean.tags)
//设置向TA倾诉人数 //设置向TA倾诉人数
setConfideNum(bean) setConfideNum(bean)
//设置接通率文案 //设置接通率文案
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment