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

282 lines
6.5 KiB

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