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

360 lines
8.3 KiB

7 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
7 months ago
6 months ago
7 months ago
7 months ago
7 months ago
7 months ago
6 months ago
5 months ago
7 months ago
6 months ago
5 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
7 months ago
7 months ago
6 months ago
7 months ago
7 months ago
7 months ago
6 months ago
7 months ago
7 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
7 months ago
6 months ago
6 months ago
5 months ago
7 months ago
6 months ago
5 months ago
6 months ago
7 months ago
5 months ago
6 months ago
7 months ago
6 months ago
6 months ago
6 months ago
6 months ago
7 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
5 months ago
7 months ago
6 months ago
7 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. <uv-tabs :list="areaList"
  16. :activeStyle="{color : '#B12026', fontWeight : 600}"
  17. lineColor="#B12026"
  18. lineHeight="8rpx"
  19. lineWidth="50rpx"
  20. keyName="areaName"
  21. :current="currentArea"
  22. @click="clickTabs"></uv-tabs>
  23. <view class="tabs">
  24. <view class=""
  25. v-for="(item, index) in tabs"
  26. :key="index"
  27. @click="setSpotGuideIndex(index)"
  28. :class="{act : spotGuideIndex == index}">
  29. {{ item }}
  30. </view>
  31. </view>
  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("===你点击了标记点===", e)
  191. let spot = this.spotGuideMarkers[e.markerId]
  192. uni.openLocation({
  193. latitude: spot.latitude,
  194. longitude: spot.longitude,
  195. })
  196. },
  197. openLocation(n){
  198. uni.openLocation({
  199. latitude: n.spotLatitude,
  200. longitude: n.spotLongitude,
  201. })
  202. },
  203. //地图点击事件
  204. callouttap(e) {
  205. console.log('地图点击事件', e)
  206. },
  207. toUrl(item){
  208. if(item.categoryId == 0){
  209. this.$utils.navigateTo(`/pages_order/service/articleDetail?id=${item.id}&type=Inheritance`)
  210. }
  211. },
  212. queryAreaList(){
  213. this.$api('queryAreaList', res => {
  214. if(res.code == 200){
  215. this.areaList = res.result.records
  216. this.areaList.forEach((n, i) => {
  217. if(this.areaId == n.id){
  218. this.currentArea = i
  219. }
  220. })
  221. }
  222. })
  223. },
  224. // 点击按钮将地图中心移动到指定定位点
  225. moveTolocation(latitude, longitude){
  226. let mapObjs = uni.createMapContext('mapId', this)
  227. mapObjs.moveToLocation(
  228. {
  229. latitude,
  230. longitude
  231. },
  232. {
  233. complete: res=>{
  234. console.log('移动完成:', res)
  235. }
  236. })
  237. // this.onRegionChange('',true)
  238. },
  239. }
  240. }
  241. </script>
  242. <style scoped lang="scss">
  243. .Locations{
  244. .tabs{
  245. display: flex;
  246. &>view{
  247. flex: 1;
  248. margin: 20rpx 10rpx;
  249. padding: 20rpx 10rpx;
  250. background-color: #F8E2E2;
  251. color: #C83741;
  252. border-radius: 40rpx;
  253. font-size: 24rpx;
  254. text-align: center;
  255. }
  256. .act{
  257. background-color: #C83741;
  258. color: #fff;
  259. }
  260. }
  261. .Locations-list{
  262. .main{
  263. display: flex;
  264. margin: 20rpx;
  265. .main-image{
  266. width: 150rpx;
  267. height: 150rpx;
  268. border-radius: 20rpx;
  269. }
  270. .info{
  271. margin-left: 20rpx;
  272. .title{
  273. font-size: 30rpx;
  274. font-weight: 900;
  275. }
  276. .tips{
  277. font-size: 24rpx;
  278. color: #999999;
  279. margin-top: 10rpx;
  280. }
  281. }
  282. .controls{
  283. margin-left: auto;
  284. display: flex;
  285. flex-direction: column;
  286. justify-content: center;
  287. align-items: center;
  288. .f{
  289. image{
  290. width: 50rpx;
  291. height: 50rpx;
  292. }
  293. }
  294. }
  295. .btn{
  296. padding: 10rpx;
  297. font-size: 22rpx;
  298. color: $uni-color;
  299. border: 1rpx solid $uni-color;
  300. background-color: #F4E4C4;
  301. display: flex;
  302. justify-content: center;
  303. align-items: center;
  304. margin-top: 10rpx;
  305. border-radius: 15rpx;
  306. image{
  307. width: 25rpx;
  308. height: 25rpx;
  309. }
  310. text{
  311. margin: 0 10rpx;
  312. }
  313. }
  314. }
  315. .list{
  316. padding-left: 40rpx;
  317. .main{
  318. align-items: center;
  319. .main-image{
  320. width: 140rpx;
  321. height: 140rpx;
  322. }
  323. .controls{
  324. flex-direction: row;
  325. .f{
  326. margin: 30rpx;
  327. image{
  328. width: 40rpx;
  329. height: 40rpx;
  330. }
  331. }
  332. }
  333. }
  334. }
  335. }
  336. }
  337. </style>