景徳镇旅游微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

397 lines
9.2 KiB

9 months ago
8 months ago
7 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
8 months ago
6 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
7 months ago
9 months ago
8 months ago
6 months ago
9 months ago
7 months ago
9 months ago
9 months ago
9 months ago
6 months ago
9 months ago
9 months ago
8 months ago
7 months ago
9 months ago
8 months ago
7 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
9 months ago
8 months ago
7 months ago
8 months ago
9 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
9 months ago
9 months ago
8 months ago
9 months ago
7 months ago
8 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
8 months ago
8 months ago
7 months ago
9 months ago
8 months ago
7 months ago
8 months ago
9 months ago
7 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
7 months ago
6 months ago
7 months ago
8 months ago
7 months ago
8 months ago
8 months ago
8 months ago
8 months ago
7 months ago
6 months ago
9 months ago
8 months ago
9 months ago
  1. <template>
  2. <view class="Locations">
  3. <map
  4. style="width: 100%;height: 60vh"
  5. :layer-style='5'
  6. :show-location='true'
  7. :latitude="position.latitude"
  8. :longitude="position.longitude"
  9. :markers="spotGuideMarkers"
  10. :scale="scale"
  11. @markertap="markertap"
  12. id="mapId"
  13. @callouttap="callouttap">
  14. </map>
  15. <view class="tabs">
  16. <view class=""
  17. v-for="(item, index) in tabs"
  18. :key="index"
  19. @click="setSpotGuideIndex(index)"
  20. :class="{act : spotGuideIndex == index}">
  21. {{ item }}
  22. </view>
  23. </view>
  24. <uv-tabs :list="areaList"
  25. :activeStyle="{color : '#B12026', fontWeight : 600}"
  26. lineColor="#B12026"
  27. lineHeight="8rpx"
  28. lineWidth="50rpx"
  29. keyName="areaName"
  30. :current="currentArea"
  31. @click="clickTabs"></uv-tabs>
  32. <!-- '文化遗产', '找厕所', '找美食', '找民宿' -->
  33. <!-- v-if="spotGuideIndex != 1" -->
  34. <view class="Locations-list">
  35. <view class="main"
  36. @click="selectArea"
  37. v-if="spotGuideIndex == 0 && area">
  38. <image
  39. class="main-image"
  40. :src="area.areaImage"
  41. mode="aspectFill"></image>
  42. <view class="info">
  43. <view class="title">
  44. {{ area.areaName }}
  45. </view>
  46. <view class="tips">
  47. {{ spotGuide.length }}个遗产点
  48. </view>
  49. <!-- <view class="btn">
  50. <image src="/static/image/tourGuide/a.png"
  51. mode=""></image>
  52. <text class=""
  53. @click.stop="textToSpeech(area.areaBrief)">
  54. 语音讲解
  55. </text>
  56. </view> -->
  57. </view>
  58. <view class="controls">
  59. <!-- <view class="f">
  60. <image src="/static/image/tourGuide/f.png" mode=""></image>
  61. </view> -->
  62. <view class="btn"
  63. @click.stop="show = !show">
  64. <text class="">
  65. {{ show ? '收起' : '展开' }}
  66. </text>
  67. <uv-icon
  68. :name="show ? 'arrow-up' : 'arrow-down'"
  69. size="30rpx"></uv-icon>
  70. </view>
  71. </view>
  72. </view>
  73. <view class="list"
  74. v-if="show && spotGuide.length > 0">
  75. <view class="main"
  76. v-for="(item, index) in spotGuide"
  77. @click.stop="moveTolocation(item.spotLatitude ,item.spotLongitude)"
  78. :key="index">
  79. <image
  80. class="main-image"
  81. :src="item.spotImage"
  82. @click.stop="toUrl(item)"
  83. mode="aspectFill"></image>
  84. <view class="info">
  85. <view class="title">
  86. {{ item.spotName }}
  87. </view>
  88. <view class="tips" v-if="item.distance > 1">
  89. 距离您{{ item.distance }}km
  90. </view>
  91. <view class="tips" v-else>
  92. 距离您{{ item.distance * 1000 }}m
  93. </view>
  94. </view>
  95. <view class="controls">
  96. <view class="f"
  97. style="transform: scale(1.3);"
  98. v-if="item.categoryId != 0">
  99. <image
  100. :src="`/static/image/tourGuide/${item.categoryId}.png`" mode=""></image>
  101. </view>
  102. <view class="f">
  103. <image
  104. @click.stop="openLocation(item)"
  105. src="/static/image/tourGuide/f.png" mode=""></image>
  106. </view>
  107. <!-- <view
  108. v-if="item.categoryId == 0"
  109. class="f">
  110. <image
  111. @click.stop="textToSpeech"
  112. src="/static/image/tourGuide/a.png" mode=""></image>
  113. </view> -->
  114. </view>
  115. </view>
  116. </view>
  117. <uv-empty
  118. v-else
  119. text="该景区没有哦"
  120. textSize="30rpx"
  121. iconSize="200rpx"
  122. icon="list"></uv-empty>
  123. </view>
  124. <!-- '路径定制', -->
  125. </view>
  126. </template>
  127. <script>
  128. // var plugin = requirePlugin("WechatSI")
  129. // "plugins" : {
  130. // "WechatSI" : {
  131. // "version" : "0.3.1",
  132. // "provider" : "wx069ba97219f66d99"
  133. // }
  134. // }
  135. import { mapState, mapGetters } from 'vuex'
  136. export default {
  137. props : ['spotGuide', 'spotGuideMarkers', 'area'],
  138. data() {
  139. return {
  140. latitude: 23.106574, //纬度
  141. longitude: 113.324587, //经度
  142. scale: 12, //缩放级别
  143. show : true,
  144. context : uni.createInnerAudioContext(),
  145. tabs : ['文化遗产',
  146. // '路径定制',
  147. '找美食'
  148. , '找民宿', '找厕所'],
  149. areaList : [],
  150. currentArea : 0,
  151. }
  152. },
  153. computed : {
  154. // ...mapGetters(['spotGuide', 'spotGuideMarkers']),
  155. ...mapState(['position', 'spotGuideIndex', 'areaId']),
  156. },
  157. created() {
  158. this.queryAreaList()
  159. },
  160. methods: {
  161. //点击tab栏
  162. clickTabs({ index, name }) {
  163. this.currentArea = index
  164. this.$store.commit('setAreaId', this.areaList[index].id)
  165. this.$emit('getData')
  166. },
  167. // 修改前选择的菜单,0-景点 1-美食店铺 2-民宿 3-厕所
  168. setSpotGuideIndex(index){
  169. this.$store.commit('setSpotGuideIndex', index)
  170. },
  171. textToSpeech(){
  172. console.log('textToSpeech');
  173. let self = this
  174. // self.context.src = this.$config.baseUrl + '/info/textToAudio?text=' + "你好"
  175. // self.context.play()
  176. // return
  177. plugin.textToSpeech({
  178. lang: "zh_CN",
  179. tts: true,
  180. content: "景德镇市陶阳里御窑景区位于景德镇的城市中心地带,北起瓷都大桥、昌江大道,南至昌江大桥、西至沿江西路,东至莲社路、胜利路。 自宋以来,景德镇先民“沿河建窑,因窑成市”,渐呈“码头—民窑—老街—里弄—御窑”聚落的历史空间和瓷业肌理,形成了世界建筑史上绝无仅有的老城格局,成就了中国“东方瓷国”的盛誉,陶瓷成为了中国走向世界,世界认识中国的文化符号。这里是景德镇历史上制瓷业的中心、原点和高峰,是“一带一路”海上陶瓷之路的零公里起点,是研究皇家御窑制瓷历史文化和景德镇陶瓷技艺,讲好景德镇故事,传播中国声音的“窗口”和“名片”。",
  181. success: function(res) {
  182. self.context.src = res.filename;
  183. self.context.play()
  184. },
  185. fail: function(res) {
  186. console.log("fail tts", res)
  187. }
  188. })
  189. },
  190. //地图点击事件
  191. markertap(e) {
  192. console.log("markertap===你点击了标记点===", e)
  193. let spot = this.spotGuideMarkers[e.markerId]
  194. this.toUrl(spot)
  195. // uni.openLocation({
  196. // latitude: spot.latitude,
  197. // longitude: spot.longitude,
  198. // })
  199. // BYCLICK隐藏
  200. // ALWAYS显示
  201. // this.$store.commit('setDisplay',
  202. // this.spotGuideMarkers[e.markerId].id)
  203. // this.$forceUpdate()
  204. // this.spotGuideMarkers.forEach((n, i) => {
  205. // if(i == e.markerId){
  206. // // 显示气泡
  207. // n.callout.display = 'ALWAYS'
  208. // }else{
  209. // // 隐藏气泡
  210. // n.callout.display = 'BYCLICK'
  211. // }
  212. // })
  213. },
  214. openLocation(n){
  215. uni.openLocation({
  216. latitude: n.spotLatitude,
  217. longitude: n.spotLongitude,
  218. })
  219. },
  220. //地图点击事件
  221. callouttap(e) {
  222. console.log('callouttap地图点击事件', e)
  223. let spot = this.spotGuideMarkers[e.markerId]
  224. uni.openLocation({
  225. latitude: spot.latitude,
  226. longitude: spot.longitude,
  227. })
  228. },
  229. toUrl(item){
  230. if(item.categoryId == 0){
  231. this.$utils.navigateTo(`/pages_order/service/articleDetail?id=${item.id}&type=Inheritance`)
  232. }
  233. },
  234. queryAreaList(){
  235. this.$api('queryAreaList', res => {
  236. if(res.code == 200){
  237. this.areaList = res.result.records
  238. this.areaList.forEach((n, i) => {
  239. if(this.areaId == n.id){
  240. this.currentArea = i
  241. }
  242. })
  243. }
  244. })
  245. },
  246. // 点击按钮将地图中心移动到指定定位点
  247. moveTolocation(latitude, longitude){
  248. let mapObjs = uni.createMapContext('mapId', this)
  249. mapObjs.moveToLocation(
  250. {
  251. latitude,
  252. longitude
  253. },
  254. {
  255. complete: res=>{
  256. console.log('移动完成:', res)
  257. }
  258. })
  259. // this.onRegionChange('',true)
  260. },
  261. // 点击景区,选择最近的一个景点
  262. selectArea(){
  263. let item = this.spotGuide[0]
  264. if(item && item.spotLatitude && item.spotLongitude){
  265. this.moveTolocation(item.spotLatitude, item.spotLongitude)
  266. }
  267. },
  268. }
  269. }
  270. </script>
  271. <style scoped lang="scss">
  272. .Locations{
  273. .tabs{
  274. display: flex;
  275. &>view{
  276. flex: 1;
  277. margin: 20rpx 10rpx;
  278. padding: 20rpx 10rpx;
  279. background-color: #F8E2E2;
  280. color: #C83741;
  281. border-radius: 40rpx;
  282. font-size: 24rpx;
  283. text-align: center;
  284. }
  285. .act{
  286. background-color: #C83741;
  287. color: #fff;
  288. }
  289. }
  290. .Locations-list{
  291. .main{
  292. display: flex;
  293. margin: 20rpx;
  294. .main-image{
  295. width: 150rpx;
  296. height: 150rpx;
  297. border-radius: 20rpx;
  298. }
  299. .info{
  300. margin-left: 20rpx;
  301. .title{
  302. font-size: 30rpx;
  303. font-weight: 900;
  304. }
  305. .tips{
  306. font-size: 24rpx;
  307. color: #999999;
  308. margin-top: 10rpx;
  309. }
  310. }
  311. .controls{
  312. margin-left: auto;
  313. display: flex;
  314. flex-direction: column;
  315. justify-content: center;
  316. align-items: center;
  317. .f{
  318. image{
  319. width: 50rpx;
  320. height: 50rpx;
  321. }
  322. }
  323. }
  324. .btn{
  325. padding: 10rpx;
  326. font-size: 22rpx;
  327. color: $uni-color;
  328. border: 1rpx solid $uni-color;
  329. background-color: #F4E4C4;
  330. display: flex;
  331. justify-content: center;
  332. align-items: center;
  333. margin-top: 10rpx;
  334. border-radius: 15rpx;
  335. image{
  336. width: 25rpx;
  337. height: 25rpx;
  338. }
  339. text{
  340. margin: 0 10rpx;
  341. }
  342. }
  343. }
  344. .list{
  345. padding-left: 40rpx;
  346. .main{
  347. align-items: center;
  348. .main-image{
  349. width: 140rpx;
  350. height: 140rpx;
  351. }
  352. .controls{
  353. flex-direction: row;
  354. .f{
  355. margin: 30rpx;
  356. image{
  357. width: 40rpx;
  358. height: 40rpx;
  359. }
  360. }
  361. }
  362. }
  363. }
  364. }
  365. }
  366. </style>