Commit 29df3db0 authored by 张释方's avatar 张释方

修改home_fragment

parent 05dc5871
......@@ -6,29 +6,7 @@ var isWindowLoad = false;//页面加载
var BridgeIsLoad = false;//框架加载
//[h(街道图)、m(街道图)、p(街道图)、r(街道图)、s(影像无注记)、y(影像含注记)、t(地形图)]
var gtype = 's';
function zsChangeUrl(d) {
var sub = d.split("?")[1];
//console.log(sub)
if (G_MAP.getMapTypeId() == 'hybrid' ) {
gtype = 's'
}
if(G_MAP.getMapTypeId() == 'satellite'){
gtype = 'y'
}
if (G_MAP.getMapTypeId() == 'roadmap') {
gtype = 'r'
}
if (G_MAP.getMapTypeId() == 'terrain') {
gtype = 't'
}
var url = 'http://r.mints-id.com/ab/1/2/maps/vt?lyrs=' + gtype + '&gl=cn&' + sub.replace("hl=zh-CN", "").replace("v=", "");
//console.log(url)
return url;
}
function tryAllIsOk() {
//console.log("tryAllIsOk", "isWindowLoad", isWindowLoad, "BridgeIsLoad", BridgeIsLoad)
......@@ -204,7 +182,6 @@ connectWebViewJavascriptBridge(function (bridge) {
});
bridge.registerHandler("showScenics", function (data, responseCallback) {
data = JSON.parse(data)
console.log('ksssssssssssssssssss',data)
vm.doShowScenics(data.list);
responseCallback(getVmMsg("suc:showScenics"));
});
......
var gtype = 's';
function zsChangeUrl(d) {
var sub = d.split("?")[1];
//console.log(sub)
if (G_MAP.getMapTypeId() == 'hybrid' ) {
gtype = 'y'
}
if(G_MAP.getMapTypeId() == 'satellite'){
gtype = 's'
}
if (G_MAP.getMapTypeId() == 'roadmap') {
gtype = 'r'
}
if (G_MAP.getMapTypeId() == 'terrain') {
gtype = 't'
}
var url = 'http://r.'+getParam("base")+"/" + getParam("u") + '/maps/vt?lyrs=' + gtype + '&gl=cn&' + sub.replace("hl=zh-CN", "").replace("v=", "");
//console.log(url)
return url;
}
function getZsKey() {
return getParam("gk")==null?"":getParam("gk");
}
......@@ -14,6 +39,7 @@ function getRequestUrl(a) {
}
function getVrUrls() {
......
......@@ -148,5 +148,8 @@
<script type="text/javascript" charset="UTF-8" src="./zsmap_files/onion.js"></script>
<script type="text/javascript" charset="UTF-8" src="./zsmap_files/controls.js"></script>
<script src="./zsmap_files/js" async=""></script>
<!--<script src="vconsole.min.js"></script>-->
<!--<script>-->
<!-- var vConsole = new VConsole();-->
<!--</script>-->
</html>
......@@ -16,9 +16,7 @@
// G_MAP.addListener("center_changed", () => {
// console.log("center_changed", {lat: G_MAP.getCenter().lat(), lng: G_MAP.getCenter().lng()})
// });
// G_MAP.addListener('zoom_changed', () => {
// console.log(G_MAP.getZoom())
// });
let G_MAP; //gmap
......@@ -60,6 +58,7 @@ var vm = new Vue({
scenics: [],
markes: [],
pxValue: 50,
gdcenter:null
},
created: function () {
......@@ -101,15 +100,23 @@ var vm = new Vue({
for (i in vm.markes) {
vm.markes[i].setMap(null);
}
vm.markes = [];
vm.scenics = [];
// vm.markes = [];
// vm.scenics = [];
},
doShowScenics: function (list) {
this.showScenics = true;
this.scenics = list;
this.makeSenics();
G_MAP.setZoom(10)
if (vm.markes.length == 0) {
this.scenics = list;
this.makeSenics();
} else {
for (i in vm.markes) {
vm.markes[i].setMap(G_MAP);
}
}
// G_MAP.setZoom(10)
},
makeSenics: function () {
......@@ -125,7 +132,7 @@ var vm = new Vue({
icon: image,//msg.img,
animation: google.maps.Animation.DROP,
optimized: false,
map:G_MAP,
map: G_MAP,
label: {
text: msg.name,
className: "zsmaker",
......@@ -214,6 +221,9 @@ var vm = new Vue({
rotateControl: false,
fullscreenControl: false,
clickableIcons: false,
// gestureHandling:"none",
// gestureHandling: "greedy",
// scaleControlOptions: {
// position: google.maps.ControlPosition.LEFT_CENTER,
// },
......@@ -228,9 +238,39 @@ var vm = new Vue({
vm.mapScale = getScaleInfos(zoomLevel, lat, vm);
});
G_MAP.addListener('zoom_changed', function () {
console.log("拖动",vm.gdcenter)
if(vm.gdcenter!=null){
console.log("++++>")
// G_MAP.panTo(vm.gdcenter) //第二次初始化
}
});
G_MAP.addListener("dragend", () => {
centerChanged();
});
document.addEventListener("touchstart", function (e) {
console.log(e.touches);
if (e.touches.length > 1) {
vm.gdcenter=
{
lat:G_MAP.getCenter().lat(),
lng:G_MAP.getCenter().lng()
};
console.log("两指",vm.gdcenter)
} else {
vm.gdcenter=null;
console.log("一指",vm.gdcenter)
}
}, false);
// G_MAP.addListener('zoom_changed', () => {
// console.log(G_MAP.getCenter().lat())
// });
}
window.google.maps.Load && window.google.maps.Load(G_ZSYDA);
} else {
......@@ -244,7 +284,7 @@ var vm = new Vue({
window.onload = function () {
allIsOk();
//init();
// init();
}
function init() {
......@@ -266,15 +306,15 @@ function init() {
}, 3000)
setTimeout(function () {
vm.showVrButton=true;
vm.showVrButton = true;
}, 5000)
setTimeout(function () {
vm.showVrButton=false;
vm.showVrButton = false;
}, 7000)
setTimeout(function () {
vm.showVrButton=true;
vm.showVrButton = true;
}, 8000)
setTimeout(function () {
......@@ -314,4 +354,5 @@ function init() {
]);
}, 9000)
}
\ No newline at end of file
}
This diff is collapsed.
......@@ -220,7 +220,9 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
override fun onItemClick(position: Int, itemBean: HotViewBean.Dataslist?) {
itemBean?.apply {
//todo 冯瑞雨 修改toDouble
//点击调转页面
viewModel.authorized(bvid,name)
//更新当前坐标(控制js页面做回调)
binding.webview.callHandler("initZsMap"
,Gson().toJson(GPS(lat?.toDouble()?:0.0,
lng?.toDouble()?:0.0,0)) ) {
......
......@@ -23,9 +23,11 @@ import com.fry.base.base.BaseFragment
import com.google.gson.Gson
import com.mints.street.BR
import com.mints.street.R
import com.mints.street.bean.HotViewBean
import com.mints.street.bean.MapBean
import com.mints.street.bean.PositioningBean
import com.mints.street.databinding.FragmentHomeBinding
import com.mints.street.main.my.OpenvipActivity
import com.mints.street.manager.UmengManager
import com.mints.street.widget.ScrollLayout
import com.mints.street.widget.dialog.DialogMapStyle
......@@ -127,15 +129,17 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
false
)
}
//地图样式
RxUtils.onMultiClick(binding.imageMapChangeIcon) {
// context?.apply {
// if (dialogMapStyle == null) {
// dialogMapStyle = DialogMapStyle(this)
// }
// if (this@HomeFragment.fragmentManager != null) {
// dialogMapStyle?.show(this@HomeFragment.fragmentManager!!, "dialogMapStyle")
// }
// }
HotViewDialog(requireActivity(), viewModel,
currentLat, currentLon,
this,object :HotViewDialog.OnHotItemClick{
override fun onItemClick(position: Int, itemBean: HotViewBean.Dataslist?) {
itemBean?.apply {
startActivity(OpenvipActivity::class.java)
}
}
}).init().show()
}
//点击热门景点
......
......@@ -221,6 +221,9 @@ class HomeViewModel(application: Application) : BaseViewModel(application) {
)
}
/**
* 跳转百度坐标页面
*/
fun authorized(bvid:String?,name:String?) {
ApiModel.authorized().safeSubscribe(object
: HttpSubscribeImpl<BaseResponse<AuthorizedBean>>(
......
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
android:orientation="vertical">
<com.github.lzyzsd.jsbridge.BridgeWebView
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="40dp"
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="0dp"
/>
android:layout_marginBottom="40dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:visibility="gone"
android:id="@+id/image_map_history"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="15dp"
android:src="@mipmap/map_history_icon"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/image_location_icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginBottom="220dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="220dp"
android:src="@mipmap/location_icon"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
......@@ -46,18 +44,18 @@
android:id="@+id/image_map_change_icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginBottom="220dp"
android:layout_marginTop="40dp"
android:layout_marginBottom="220dp"
android:src="@mipmap/map_change_icon"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
/>
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/ly_hotview"
android:layout_width="40dp"
android:layout_height="40dp"
android:padding="3dp"
android:layout_marginTop="10dp"
android:padding="3dp"
android:src="@mipmap/icon_hotview"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/image_map_change_icon" />
......@@ -66,8 +64,8 @@
android:id="@+id/map_a_d"
android:layout_width="36dp"
android:layout_height="73dp"
android:layout_marginBottom="10dp"
android:layout_marginEnd="2dp"
android:layout_marginBottom="10dp"
android:background="@drawable/shape_gold_card"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@id/image_location_icon"
......@@ -80,14 +78,15 @@
android:layout_width="36dp"
android:layout_height="36dp"
android:padding="10dp"
android:src="@mipmap/scale_add_icon" />
android:src="@mipmap/scale_add_icon" />
<View
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginEnd="12dp"
android:layout_marginStart="12dp"
android:background="@color/color_333" />
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:background="@color/color_333" />
<ImageView
android:id="@+id/image_out"
......@@ -96,7 +95,6 @@
android:padding="10dp"
android:src="@mipmap/scale_shrink_icon" />
</LinearLayout>
......@@ -114,8 +112,8 @@
android:layout_height="wrap_content"
android:background="@drawable/cursor_bg"
android:gravity="center_horizontal"
android:paddingBottom="10dp"
android:orientation="vertical">
android:orientation="vertical"
android:paddingBottom="10dp">
<ImageView
android:id="@+id/image_under"
......@@ -131,53 +129,53 @@
android:id="@+id/stb_bg_search"
android:layout_width="match_parent"
android:layout_height="37dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/image_under"
app:stv_corner="20dp"
app:stv_solid="#F5F9FA"
app:stv_stroke_color="#ffe1e1e1"
app:stv_stroke_width="1dp"
/>
app:stv_stroke_width="1dp" />
<ImageView
android:layout_marginStart="16dp"
android:id="@+id/im_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:src="@mipmap/search_icon"
app:layout_constraintBottom_toBottomOf="@id/stb_bg_search"
app:layout_constraintStart_toStartOf="@id/stb_bg_search"
app:layout_constraintTop_toTopOf="@id/stb_bg_search" />
<View
android:background="#A1A3AF"
android:layout_width="0.5dp"
android:layout_height="14dp"
android:layout_marginStart="16dp"
android:background="#A1A3AF"
app:layout_constraintBottom_toBottomOf="@id/stb_bg_search"
app:layout_constraintStart_toEndOf="@id/im_search"
app:layout_constraintTop_toTopOf="@id/stb_bg_search" />
<TextView
android:layout_marginStart="27dp"
app:layout_constraintBottom_toBottomOf="@id/stb_bg_search"
app:layout_constraintStart_toEndOf="@id/im_search"
app:layout_constraintTop_toTopOf="@id/stb_bg_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="27dp"
android:text="搜索境内、境外地址"
android:textColor="#A2A4B1"
android:textSize="14sp" />
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="@id/stb_bg_search"
app:layout_constraintStart_toEndOf="@id/im_search"
app:layout_constraintTop_toTopOf="@id/stb_bg_search" />
</androidx.constraintlayout.widget.ConstraintLayout>
<com.mints.street.widget.ScrollRecyclerView
android:background="@color/white"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
app:itemBinding="@{viewModel.addressItemBinding}"
app:items="@{viewModel.addressList}"
tools:listitem="@layout/item_home_button">
......
......@@ -11,108 +11,18 @@
android:id="@+id/bmapView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="80dp"
android:layout_marginBottom="40dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_click"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_centerInParent="true"
android:layout_marginBottom="40dp"
android:src="@mipmap/positioning_icon"
app:layout_constraintBottom_toBottomOf="@id/bmapView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/bmapView" />
<ImageView
android:id="@+id/image_map_history"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="25dp"
android:src="@mipmap/map_history_icon"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/image_map_change_icon" />
<ImageView
android:id="@+id/ly_hotview"
android:layout_width="40dp"
android:layout_height="40dp"
android:padding="3dp"
android:layout_marginTop="10dp"
android:src="@mipmap/icon_hotview"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/image_map_change_icon" />
<ImageView
android:id="@+id/image_location_icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="220dp"
android:src="@mipmap/location_icon"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<ImageView
android:id="@+id/image_map_change_icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginBottom="220dp"
android:layout_marginTop="35dp"
android:src="@mipmap/map_change_icon"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
/>
<LinearLayout
android:id="@+id/map_a_d"
android:layout_width="36dp"
android:layout_height="73dp"
android:layout_marginEnd="2dp"
android:layout_marginBottom="10dp"
android:background="@drawable/shape_gold_card"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@id/image_location_icon"
app:layout_constraintEnd_toEndOf="parent">
<ImageView
android:id="@+id/image_in"
android:layout_width="36dp"
android:layout_height="36dp"
android:padding="10dp"
android:src="@mipmap/scale_add_icon" />
<View
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:background="@color/color_333" />
<ImageView
android:id="@+id/image_out"
android:layout_width="36dp"
android:layout_height="36dp"
android:padding="10dp"
android:src="@mipmap/scale_shrink_icon" />
</LinearLayout>
<com.mints.street.widget.ScrollLayout
android:id="@+id/scroll_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00000000"
android:fillViewport="true"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp">
android:fillViewport="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
......@@ -192,6 +102,94 @@
</com.mints.street.widget.ScrollLayout>
<ImageView
android:id="@+id/iv_click"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_centerInParent="true"
android:layout_marginBottom="40dp"
android:src="@mipmap/positioning_icon"
app:layout_constraintBottom_toBottomOf="@id/bmapView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/bmapView" />
<ImageView
android:id="@+id/image_map_history"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="25dp"
android:src="@mipmap/map_history_icon"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/image_map_change_icon" />
<ImageView
android:id="@+id/ly_hotview"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="10dp"
android:padding="3dp"
android:src="@mipmap/icon_hotview"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/image_map_change_icon" />
<ImageView
android:id="@+id/image_location_icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="220dp"
android:src="@mipmap/location_icon"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<ImageView
android:id="@+id/image_map_change_icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="35dp"
android:layout_marginBottom="220dp"
android:src="@mipmap/map_change_icon"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/map_a_d"
android:layout_width="36dp"
android:layout_height="73dp"
android:layout_marginEnd="2dp"
android:layout_marginBottom="10dp"
android:background="@drawable/shape_gold_card"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@id/image_location_icon"
app:layout_constraintEnd_toEndOf="parent">
<ImageView
android:id="@+id/image_in"
android:layout_width="36dp"
android:layout_height="36dp"
android:padding="10dp"
android:src="@mipmap/scale_add_icon" />
<View
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:background="@color/color_333" />
<ImageView
android:id="@+id/image_out"
android:layout_width="36dp"
android:layout_height="36dp"
android:padding="10dp"
android:src="@mipmap/scale_shrink_icon" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<data>
......
......@@ -59,9 +59,7 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/image2"
app:url="@{viewModel.image3}"
/>
app:url="@{viewModel.image3}" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
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