man_body.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <!DOCTYPE html>
  2. <html class="">
  3. <!--STATUS OK-->
  4. <head>
  5. <meta name="referrer" content="always" />
  6. <meta charset='utf-8' />
  7. <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
  8. <meta http-equiv="x-dns-prefetch-control" content="on">
  9. <meta name="description" content="">
  10. <meta name="format-detection" content="telephone=no" />
  11. <link rel="stylesheet" type="text/css" href="css/vant-ui.css" />
  12. <link rel="stylesheet" type="text/css" href="css/iconfont.css">
  13. <link rel="stylesheet" type="text/css" href="css/main.css" />
  14. <script src="js/vue.js"></script>
  15. <script src="js/vant-ui.js"></script>
  16. <script src="js/main.js"></script>
  17. <title></title>
  18. </head>
  19. <style>
  20. body {
  21. background: transparent;
  22. }
  23. .pageView.bdjl {
  24. background: transparent;
  25. }
  26. .pageView.bdjl .search {
  27. padding-top: 0;
  28. top: 0px
  29. }
  30. .doneBtn {
  31. font-size: 0.3rem;
  32. width: 40px;
  33. text-align: center;
  34. color: #fff;
  35. margin-left: 10px;
  36. }
  37. .pageView.bdjl {
  38. padding-top: 0rem;
  39. }
  40. .a-center p {
  41. font-size: 0.3rem
  42. }
  43. .a-center .address {
  44. font-size: 0.2rem;
  45. margin-top: 0.1rem;
  46. color: #999;
  47. }
  48. .addressItem {
  49. border-bottom: 1px solid#ccc;
  50. padding: 0.2rem 0;
  51. }
  52. .pagetitle {
  53. height: 1rem;
  54. font-size: 0.3rem;
  55. padding-top: 0.1rem;
  56. }
  57. </style>
  58. <body>
  59. <div id="app" v-cloak>
  60. <div class="pageView bdjl">
  61. <div class="pagetitle">
  62. <p>选择地址:{{chooseAddressDesc.address }}{{ chooseAddressDesc.sematicDescription }}</p>
  63. </div>
  64. <!-- <div class="search flex a-center">
  65. <div class="searchbox">
  66. <svg t="1589079341958" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5394" width="22" height="22">
  67. <path d="M883.626667 823.04l-145.066667-144.64A337.92 337.92 0 0 0 810.666667 469.333333a341.333333 341.333333 0 1 0-341.333334 341.333334 337.92 337.92 0 0 0 209.066667-72.106667l144.64 145.066667a42.666667 42.666667 0 0 0 60.586667 0 42.666667 42.666667 0 0 0 0-60.586667zM213.333333 469.333333a256 256 0 1 1 256 256 256 256 0 0 1-256-256z" p-id="5395" fill="#bfbfbf"></path>
  68. </svg>
  69. <input type="search" placeholder="请输入地址" v-model="keyword">
  70. </div>
  71. <div class="doneBtn">确定</div>
  72. </div> -->
  73. </div>
  74. </div>
  75. </body>
  76. <script type="text/javascript" src="../script/api.js"></script>
  77. <script type="text/javascript" src="../script/httpRequest.js"></script>
  78. <script type="text/javascript" src="../script/vue_plugins.js"></script>
  79. <script type="text/javascript">
  80. apiready = function() {
  81. var d = api.pageParam.d;
  82. new Vue({
  83. el: '#app',
  84. data: {
  85. radio: '1',
  86. map: '', // 百度地图
  87. keyword: '', // 关键字地址
  88. list: [],
  89. d: d,
  90. chooseAddress: '', // 选中的标注
  91. chooseAddressDesc : '', // 选中的标注经纬度对应的地址
  92. },
  93. watch: {
  94. keyword: function(nw, ow) {
  95. this.getCitysByKeyword();
  96. },
  97. chooseAddress: function(nw, ow) {
  98. this.getAddressByCoor();
  99. }
  100. },
  101. methods: {
  102. init: function() {
  103. var _this = this;
  104. this.map = api.require('bMap');
  105. if (api.systemType == 'ios') {
  106. this.map.initMapSDK(function(ret) {
  107. if (ret.status) {}
  108. });
  109. }
  110. this.openMap();
  111. // 监听键盘搜索时间
  112. this.addEvent('doneChoose',function() {
  113. _this.sendEvent('chooseDistict',{
  114. lon : _this.chooseAddressDesc.lon,
  115. lat : _this.chooseAddressDesc.lat,
  116. p : _this.chooseAddressDesc.province,
  117. c : _this.chooseAddressDesc.city,
  118. d : _this.chooseAddressDesc.district,
  119. a : _this.chooseAddressDesc.sematicDescription
  120. })
  121. })
  122. },
  123. // 通过关键字获取地址列表
  124. getCitysByKeyword: function() {
  125. this.map.searchInCity({
  126. city: this.d,
  127. keyword: this.keyword,
  128. pageIndex: 0,
  129. pageCapacity: 20
  130. }, function(ret, err) {
  131. if (ret.status) {
  132. console.log(JSON.stringify(ret));
  133. } else {
  134. alert(JSON.stringify(err));
  135. }
  136. });
  137. },
  138. // 打开地图
  139. openMap: function() {
  140. var _this = this;
  141. this.map.open({
  142. rect: {
  143. x: 0,
  144. y: 50,
  145. w: api.winWidth,
  146. h: api.frameHeight
  147. },
  148. zoomLevel: 15,
  149. showUserLocation: true,
  150. fixedOn: api.frameName,
  151. fixed: true,
  152. center : {
  153. lon: 116.213, //数字类型;打开地图时设置的中心点经度
  154. lat: 39.213
  155. }
  156. }, function(ret1) {
  157. if (ret1.status) {
  158. // 添加地图监听
  159. _this.addMap();
  160. // 获取当前订单
  161. _this.ifHasPrme('location', function(ret2) {
  162. if (ret2 == true) {
  163. _this.map.getLocation(function(ret3, err) {
  164. if (ret3.status == true || ret3.status == 'true') {
  165. _this.chooseAddress = ret3;
  166. _this.map.setCenter({
  167. coords: {
  168. lon: ret3.lon,
  169. lat: ret3.lat
  170. },
  171. animation: true
  172. });
  173. _this.addAntion();
  174. }
  175. })
  176. }else if(ret2 == false){
  177. api.closeWidget({
  178. id : 'A6040771066321', //这里是应用id
  179. silent : true,
  180. retData : {
  181. name : 'closeWidget'
  182. },
  183. animation : {
  184. type : 'flip',
  185. subType : 'from_bottom',
  186. duration : 500
  187. }
  188. });
  189. }
  190. })
  191. }
  192. });
  193. },
  194. // 为地图添加点击事件
  195. addMap: function() {
  196. var _this = this;
  197. this.map.addEventListener({
  198. name: 'click'
  199. }, function(ret3, err) {
  200. if (ret3) {
  201. if (ret3.status == true || ret3.status == 'true') {
  202. _this.chooseAddress = ret3;
  203. _this.map.setCenter({
  204. coords: {
  205. lon: ret3.lon,
  206. lat: ret3.lat
  207. },
  208. animation: true
  209. });
  210. }
  211. } else {
  212. alert(JSON.stringify(err));
  213. }
  214. });
  215. },
  216. // 将经纬度转换成地址
  217. getAddressByCoor: function() {
  218. var _this = this;
  219. _this.map.getNameFromCoords({
  220. lon: this.chooseAddress.lon,
  221. lat: this.chooseAddress.lat
  222. }, function(ret, err) {
  223. if (ret.status) {
  224. if(ret.status == true || ret.status == 'true'){
  225. _this.chooseAddressDesc = ret;
  226. _this.addAntion();
  227. }
  228. }
  229. });
  230. },
  231. // 为地图添加标注
  232. addAntion: function() {
  233. var _this = this;
  234. var an = {
  235. id: 1,
  236. lon: this.chooseAddress.lon,
  237. lat: this.chooseAddress.lat
  238. }
  239. _this.addBullde(1);
  240. this.map.addAnnotations({
  241. annotations: [an],
  242. icon: 'widget://',
  243. draggable: true
  244. }, function(ret) {
  245. if (ret) {
  246. _this.addBullde(ret.id)
  247. }
  248. });
  249. },
  250. // 点击显示旗袍
  251. addBullde: function() {
  252. return;
  253. var _this = this;
  254. this.map.setBubble({
  255. id: 1,
  256. rect: {
  257. x: 10,
  258. y: 5,
  259. w: 300,
  260. h: 100
  261. },
  262. content: {
  263. title: this.chooseAddressDesc.address,
  264. subTitle: this.chooseAddressDesc.sematicDescription,
  265. },
  266. styles: {
  267. titleColor: '#000',
  268. titleSize: 16,
  269. subTitleColor: '#999',
  270. subTitleSize: 12,
  271. illusAlign: 'left',
  272. width : 300,
  273. height : 200,
  274. }
  275. }, function(ret) {
  276. if (ret) {
  277. alert(JSON.stringify(ret));
  278. }
  279. });
  280. }
  281. },
  282. mounted: function() {
  283. this.init();
  284. }
  285. })
  286. }
  287. </script>
  288. </html>