Commit ac209919 by 徐健

首页组件编写

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