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

411 lines
9.6 KiB

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