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

309 lines
7.2 KiB

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