Commit 13e339fb authored by fengruiyu's avatar fengruiyu

首页的跳转h5 已完成

搜索的境内和境外跳转h5 已完成
parent c520d1f0
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
var lng = getParam("lng");//39.915表示纬度 var lng = getParam("lng");//39.915表示纬度
var d = getParam("d");//39.915表示纬度 var d = getParam("d");//39.915表示纬度
console.log("baiduinit",lat,lng,d)
var panorama = new BMap.Panorama('panorama', { var panorama = new BMap.Panorama('panorama', {
linksControl: false, //显示道路指示控件 linksControl: false, //显示道路指示控件
...@@ -61,7 +62,7 @@ ...@@ -61,7 +62,7 @@
// a=116.316169 // a=116.316169
// b=40.005567 // b=40.005567
// panorama.setPosition(new BMap.Point(a,b)); // panorama.setPosition(new BMap.Point(a,b));
if (d == null || d == "") { if (d != null && d != "") {
panorama.setId(d);//根据全景id展示全景图 panorama.setId(d);//根据全景id展示全景图
} else { } else {
panorama.setPosition(new BMap.Point(lng, lat)); panorama.setPosition(new BMap.Point(lng, lat));
......
package com.mints.street.adapter package com.mints.street.adapter
import android.content.Context import android.content.Context
import android.content.Intent
import android.view.View import android.view.View
import com.alibaba.android.vlayout.layout.LinearLayoutHelper import com.alibaba.android.vlayout.layout.LinearLayoutHelper
import com.bumptech.glide.GlideBuilder import com.bumptech.glide.GlideBuilder
...@@ -10,6 +11,9 @@ import com.fry.base.utils.ImageLoader ...@@ -10,6 +11,9 @@ import com.fry.base.utils.ImageLoader
import com.mints.street.R import com.mints.street.R
import com.mints.street.bean.Places import com.mints.street.bean.Places
import com.mints.street.databinding.ItemPopularSceneAdapterBinding import com.mints.street.databinding.ItemPopularSceneAdapterBinding
import com.mints.street.main.home.SearchMapViewModel
import com.mints.street.main.my.OpenvipActivity
import com.mints.street.manager.UserManager
import com.mints.street.webview.MintsWebViewActivity import com.mints.street.webview.MintsWebViewActivity
import me.goldze.mvvmhabit.utils.ImageUtils import me.goldze.mvvmhabit.utils.ImageUtils
import me.goldze.mvvmhabit.utils.KLog import me.goldze.mvvmhabit.utils.KLog
...@@ -19,7 +23,7 @@ import me.goldze.mvvmhabit.utils.RxUtils ...@@ -19,7 +23,7 @@ import me.goldze.mvvmhabit.utils.RxUtils
* Created by 冯瑞雨 on 2021/7/14. * Created by 冯瑞雨 on 2021/7/14.
* 热门景区的adapter * 热门景区的adapter
*/ */
class PopularSceneAdapter(val context: Context, var list: List<Places>? = null) : class PopularSceneAdapter(val context: Context, var list: List<Places>? = null,val viewMode: SearchMapViewModel) :
AbstractVLayoutBaseAdapter<ItemPopularSceneAdapterBinding, List<Places>>(context, list, 2) { AbstractVLayoutBaseAdapter<ItemPopularSceneAdapterBinding, List<Places>>(context, list, 2) {
fun setData(list: List<Places>?){ fun setData(list: List<Places>?){
...@@ -32,7 +36,20 @@ class PopularSceneAdapter(val context: Context, var list: List<Places>? = null) ...@@ -32,7 +36,20 @@ class PopularSceneAdapter(val context: Context, var list: List<Places>? = null)
position: Int position: Int
) { ) {
RxUtils.onMultiClick(holder.binding.bg){ RxUtils.onMultiClick(holder.binding.bg){
MintsWebViewActivity.startWebView(list?.get(position)?.name) if (viewMode.index.value==0){
viewMode.authorized(list?.get(position)?.name
,list?.get(position)?.latitude.toString()
,list?.get(position)?.longitude.toString())
}else{
if (UserManager.INSTANCE.userIsLogin()) {//是会员
viewMode.authorized(list?.get(position)?.name
,list?.get(position)?.latitude.toString()
,list?.get(position)?.longitude.toString())
}else{
context.startActivity(Intent(context, OpenvipActivity::class.java))
}
}
} }
holder.binding.tvName.text = list?.get(position)?.name holder.binding.tvName.text = list?.get(position)?.name
......
...@@ -13,8 +13,7 @@ class HomeButtonItemVM(viewModel: HomeViewModel,val name:String?,val image1:Stri ...@@ -13,8 +13,7 @@ class HomeButtonItemVM(viewModel: HomeViewModel,val name:String?,val image1:Stri
var latitude:String?,var longitude:String?) : ItemViewModel<HomeViewModel?>(viewModel) { var latitude:String?,var longitude:String?) : ItemViewModel<HomeViewModel?>(viewModel) {
val onItemClick = BindingCommand<Any?>(BindingAction { val onItemClick = BindingCommand<Any?>(BindingAction {
//SearchMapActivity.startSearchMapActivity() viewModel.authorized(name,latitude,longitude)
MintsWebViewActivity.startWebView(name)
}) })
} }
\ No newline at end of file
...@@ -13,6 +13,7 @@ import com.mints.street.manager.oaid.OaidManager ...@@ -13,6 +13,7 @@ import com.mints.street.manager.oaid.OaidManager
import com.mints.street.model.ApiModel import com.mints.street.model.ApiModel
import com.mints.street.netwrok.base.HttpSubscribeImpl import com.mints.street.netwrok.base.HttpSubscribeImpl
import com.mints.street.utils.DeviceUuidFactory import com.mints.street.utils.DeviceUuidFactory
import com.mints.street.webview.MintsWebViewActivity
import me.goldze.mvvmhabit.base.AppManager import me.goldze.mvvmhabit.base.AppManager
import me.goldze.mvvmhabit.base.BaseViewModel import me.goldze.mvvmhabit.base.BaseViewModel
import me.goldze.mvvmhabit.binding.command.BindingAction import me.goldze.mvvmhabit.binding.command.BindingAction
...@@ -50,6 +51,21 @@ class HomeViewModel(application: Application):BaseViewModel(application) { ...@@ -50,6 +51,21 @@ class HomeViewModel(application: Application):BaseViewModel(application) {
}) })
} }
fun authorized(name:String?=null,lat:String?,lng:String?) {
ApiModel.authorized().safeSubscribe(object
: HttpSubscribeImpl<BaseResponse<AuthorizedBean>>(
this@HomeViewModel,false
) {
override fun onBusinessSuccess(response: BaseResponse<AuthorizedBean>) {
if(!Gson().toJson(response.result).equals(Gson().toJson(authorizedBean.value))){
authorizedBean.value = response.result
}
MintsWebViewActivity.startWebView(name,
MintsWebViewActivity.toBaduVR(lat,lng,response.result?.bk))
}
})
}
fun getMapBean(){ fun getMapBean(){
val assets = AppManager.getAppManager().currentActivity.assets val assets = AppManager.getAppManager().currentActivity.assets
val stringBuilder = StringBuilder() val stringBuilder = StringBuilder()
......
...@@ -85,7 +85,7 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo ...@@ -85,7 +85,7 @@ class SearchMapActivity : BaseActivity<ActivitySearchMapBinding, SearchMapViewMo
historyRecordAdapter = HistoryRecordAdapter(this, viewModel) historyRecordAdapter = HistoryRecordAdapter(this, viewModel)
//热门景点 //热门景点
popularSceneAdapter = PopularSceneAdapter(this) popularSceneAdapter = PopularSceneAdapter(this,viewMode = viewModel)
mAdapter?.addAdapter(historyRecordAdapter) mAdapter?.addAdapter(historyRecordAdapter)
mAdapter?.addAdapter(popularSceneAdapter) mAdapter?.addAdapter(popularSceneAdapter)
......
...@@ -10,8 +10,10 @@ import com.google.gson.Gson ...@@ -10,8 +10,10 @@ import com.google.gson.Gson
import com.mints.street.BR import com.mints.street.BR
import com.mints.street.R import com.mints.street.R
import com.mints.street.bean.* import com.mints.street.bean.*
import com.mints.street.model.ApiModel
import com.mints.street.model.BaiduModel import com.mints.street.model.BaiduModel
import com.mints.street.netwrok.base.HttpSubscribeImpl import com.mints.street.netwrok.base.HttpSubscribeImpl
import com.mints.street.webview.MintsWebViewActivity
import me.goldze.mvvmhabit.base.AppManager import me.goldze.mvvmhabit.base.AppManager
import me.goldze.mvvmhabit.base.BaseViewModel import me.goldze.mvvmhabit.base.BaseViewModel
import me.goldze.mvvmhabit.binding.command.BindingAction import me.goldze.mvvmhabit.binding.command.BindingAction
...@@ -112,5 +114,29 @@ class SearchMapViewModel(application: Application) : BaseViewModel(application) ...@@ -112,5 +114,29 @@ class SearchMapViewModel(application: Application) : BaseViewModel(application)
} }
) )
} }
fun authorized(name:String?=null,lat:String?,lng:String?) {
ApiModel.authorized().safeSubscribe(object
: HttpSubscribeImpl<BaseResponse<AuthorizedBean>>(
this@SearchMapViewModel,false
) {
override fun onBusinessSuccess(response: BaseResponse<AuthorizedBean>) {
if(index.value == 0){
MintsWebViewActivity.startWebView(name,
MintsWebViewActivity.toBaduVR(lat,lng,response.result?.bk))
}else{
MintsWebViewActivity.startWebView(name,
MintsWebViewActivity.toGoogleVR(
response.result.u,
response.result.gk,
response.result.base,
lat,
lng,
response.result.ut
))
}
}
})
}
} }
\ No newline at end of file
...@@ -32,12 +32,20 @@ class MintsWebViewActivity : BaseActivity<ActivityMintsWebViewBinding, MintsWebV ...@@ -32,12 +32,20 @@ class MintsWebViewActivity : BaseActivity<ActivityMintsWebViewBinding, MintsWebV
} }
} }
fun toGoogleVR(u:String?,gk:String?,base:String?,lat:String?,lng:String?,ut:String?):String{ fun toGoogleVR(u:String?,gk:String?,base:String?,lat:String?,lng:String?,ut:String?):String{
KLog.i("MintsWebViewActivity","file:///android_asset/web/streets.html?u=${u
}&gk=${gk}&base=${base}&lat=${lat}&lng=${lng}&ut=${ut}")
return "file:///android_asset/web/streets.html?u=${u return "file:///android_asset/web/streets.html?u=${u
}&gk=${gk}&base=${base}&lat=${lat}&lng=${lng}&ut=${ut}" }&gk=${gk}&base=${base}&lat=${lat}&lng=${lng}&ut=${ut}"
} }
fun toBaduVR(d:String?,bk:String?):String{ fun toBaduVR(d:String?,bk:String?):String{
KLog.i("MintsWebViewActivity","file:///android_asset/web/m.html?d=${d}&bk=${bk}")
return "file:///android_asset/web/m.html?d=${d}&bk=${bk}" return "file:///android_asset/web/m.html?d=${d}&bk=${bk}"
} }
fun toBaduVR(lat:String?,lng:String?,bk:String?):String{
KLog.i("MintsWebViewActivity","file:///android_asset/web/m.html?lat=${lat}&lng=${lng}&bk=${bk}")
return "file:///android_asset/web/m.html?lat=${lat}&lng=${lng}&bk=${bk}"
}
} }
override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_mints_web_view override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_mints_web_view
......
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