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

283 lines
6.5 KiB

1 year ago
11 months ago
11 months ago
1 year ago
11 months ago
1 year ago
11 months ago
1 year ago
11 months ago
1 year ago
1 year ago
11 months ago
1 year ago
11 months ago
1 year ago
11 months ago
1 year ago
11 months ago
1 year ago
11 months ago
1 year ago
1 year ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
11 months ago
1 year ago
11 months ago
1 year ago
11 months ago
1 year ago
11 months ago
1 year ago
11 months ago
1 year ago
1 year ago
11 months ago
1 year ago
11 months ago
1 year ago
11 months ago
1 year ago
11 months ago
11 months ago
11 months ago
1 year ago
11 months 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. @callouttap='callouttap'>
  13. </map>
  14. <view class="tabs">
  15. <view class=""
  16. v-for="(item, index) in tabs"
  17. :key="index"
  18. @click="setSpotGuideIndex(index)"
  19. :class="{act : spotGuideIndex == index}">
  20. {{ item }}
  21. </view>
  22. </view>
  23. <!-- '文化遗产', '找厕所', '找美食', '找民宿' -->
  24. <!-- v-if="spotGuideIndex != 1" -->
  25. <view class="Locations-list">
  26. <view class="main" v-if="spotGuideIndex == 0 && area">
  27. <image
  28. class="main-image"
  29. :src="area.areaImage"
  30. mode="aspectFill"></image>
  31. <view class="info">
  32. <view class="title">
  33. {{ area.areaName }}
  34. </view>
  35. <view class="tips">
  36. {{ spotGuide.length }}个遗产点
  37. </view>
  38. <view class="btn">
  39. <image src="/static/image/tourGuide/a.png"
  40. mode=""></image>
  41. <text class=""
  42. @click="textToSpeech(area.areaBrief)">
  43. 语音讲解
  44. </text>
  45. </view>
  46. </view>
  47. <view class="controls">
  48. <view class="f">
  49. <image src="/static/image/tourGuide/f.png" mode=""></image>
  50. </view>
  51. <view class="btn"
  52. @click="show = !show">
  53. <text class="">
  54. {{ show ? '收起' : '展开' }}
  55. </text>
  56. <uv-icon
  57. :name="show ? 'arrow-up' : 'arrow-down'"
  58. size="30rpx"></uv-icon>
  59. </view>
  60. </view>
  61. </view>
  62. <view class="list"
  63. v-if="show">
  64. <view class="main"
  65. v-for="(item, index) in spotGuide"
  66. :key="index">
  67. <image
  68. class="main-image"
  69. :src="item.spotImage"
  70. mode="aspectFill"></image>
  71. <view class="info">
  72. <view class="title">
  73. {{ item.spotName }}
  74. </view>
  75. <view class="tips" v-if="item.distance > 1">
  76. 距离您{{ item.distance }}km
  77. </view>
  78. <view class="tips" v-else>
  79. 距离您{{ item.distance * 1000 }}m
  80. </view>
  81. </view>
  82. <view class="controls">
  83. <view class="f">
  84. <image
  85. @click="openLocation(item)"
  86. src="/static/image/tourGuide/f.png" mode=""></image>
  87. </view>
  88. <view class="f">
  89. <image
  90. @click="textToSpeech"
  91. src="/static/image/tourGuide/a.png" mode=""></image>
  92. </view>
  93. </view>
  94. </view>
  95. </view>
  96. </view>
  97. <!-- '路径定制', -->
  98. </view>
  99. </template>
  100. <script>
  101. // var plugin = requirePlugin("WechatSI")
  102. // "plugins" : {
  103. // "WechatSI" : {
  104. // "version" : "0.3.1",
  105. // "provider" : "wx069ba97219f66d99"
  106. // }
  107. // }
  108. import { mapState, mapGetters } from 'vuex'
  109. export default {
  110. props : ['spotGuide', 'spotGuideMarkers', 'area'],
  111. data() {
  112. return {
  113. latitude: 23.106574, //纬度
  114. longitude: 113.324587, //经度
  115. scale: 12, //缩放级别
  116. show : true,
  117. context : uni.createInnerAudioContext(),
  118. tabs : ['文化遗产',
  119. // '路径定制',
  120. '找厕所'
  121. , '找美食', '找民宿'],
  122. }
  123. },
  124. computed : {
  125. // ...mapGetters(['spotGuide', 'spotGuideMarkers']),
  126. ...mapState(['position', 'spotGuideIndex']),
  127. },
  128. methods: {
  129. // 修改前选择的菜单,0-景点 1-美食店铺 2-民宿 3-厕所
  130. setSpotGuideIndex(index){
  131. this.$store.commit('setSpotGuideIndex', index)
  132. },
  133. textToSpeech(){
  134. console.log('textToSpeech');
  135. let self = this
  136. plugin.textToSpeech({
  137. lang: "zh_CN",
  138. tts: true,
  139. content: "景德镇市陶阳里御窑景区位于景德镇的城市中心地带,北起瓷都大桥、昌江大道,南至昌江大桥、西至沿江西路,东至莲社路、胜利路。 自宋以来,景德镇先民“沿河建窑,因窑成市”,渐呈“码头—民窑—老街—里弄—御窑”聚落的历史空间和瓷业肌理,形成了世界建筑史上绝无仅有的老城格局,成就了中国“东方瓷国”的盛誉,陶瓷成为了中国走向世界,世界认识中国的文化符号。这里是景德镇历史上制瓷业的中心、原点和高峰,是“一带一路”海上陶瓷之路的零公里起点,是研究皇家御窑制瓷历史文化和景德镇陶瓷技艺,讲好景德镇故事,传播中国声音的“窗口”和“名片”。",
  140. success: function(res) {
  141. self.context.src = res.filename;
  142. self.context.play()
  143. },
  144. fail: function(res) {
  145. console.log("fail tts", res)
  146. }
  147. })
  148. },
  149. //地图点击事件
  150. markertap(e) {
  151. console.log("===你点击了标记点===", e)
  152. let spot = this.spotGuideMarkers[e.markerId]
  153. uni.openLocation({
  154. latitude: spot.latitude,
  155. longitude: spot.longitude,
  156. })
  157. },
  158. openLocation(n){
  159. uni.openLocation({
  160. latitude: n.spotLatitude,
  161. longitude: n.spotLongitude,
  162. })
  163. },
  164. //地图点击事件
  165. callouttap(e) {
  166. console.log('地图点击事件', e)
  167. },
  168. }
  169. }
  170. </script>
  171. <style scoped lang="scss">
  172. .Locations{
  173. .tabs{
  174. display: flex;
  175. &>view{
  176. flex: 1;
  177. margin: 20rpx 10rpx;
  178. padding: 20rpx 10rpx;
  179. background-color: #F8E2E2;
  180. color: #C83741;
  181. border-radius: 40rpx;
  182. font-size: 24rpx;
  183. text-align: center;
  184. }
  185. .act{
  186. background-color: #C83741;
  187. color: #fff;
  188. }
  189. }
  190. .Locations-list{
  191. .main{
  192. display: flex;
  193. margin: 20rpx;
  194. .main-image{
  195. width: 150rpx;
  196. height: 150rpx;
  197. border-radius: 20rpx;
  198. }
  199. .info{
  200. margin-left: 20rpx;
  201. .title{
  202. font-size: 30rpx;
  203. font-weight: 900;
  204. }
  205. .tips{
  206. font-size: 24rpx;
  207. color: #999999;
  208. margin-top: 10rpx;
  209. }
  210. }
  211. .controls{
  212. margin-left: auto;
  213. display: flex;
  214. flex-direction: column;
  215. justify-content: center;
  216. align-items: center;
  217. .f{
  218. image{
  219. width: 50rpx;
  220. height: 50rpx;
  221. }
  222. }
  223. }
  224. .btn{
  225. padding: 10rpx;
  226. font-size: 22rpx;
  227. color: $uni-color;
  228. border: 1rpx solid $uni-color;
  229. background-color: #F4E4C4;
  230. display: flex;
  231. justify-content: center;
  232. align-items: center;
  233. margin-top: 10rpx;
  234. border-radius: 15rpx;
  235. image{
  236. width: 25rpx;
  237. height: 25rpx;
  238. }
  239. text{
  240. margin: 0 10rpx;
  241. }
  242. }
  243. }
  244. .list{
  245. padding-left: 40rpx;
  246. .main{
  247. align-items: center;
  248. .main-image{
  249. width: 140rpx;
  250. height: 140rpx;
  251. }
  252. .controls{
  253. flex-direction: row;
  254. .f{
  255. margin: 30rpx;
  256. image{
  257. width: 40rpx;
  258. height: 40rpx;
  259. }
  260. }
  261. }
  262. }
  263. }
  264. }
  265. }
  266. </style>