景徳镇旅游微信小程序
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.

385 lines
8.9 KiB

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