about.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <view class="pages">
  3. <u-navbar
  4. :title="navbarTitle"
  5. :autoBack="true"
  6. :safeAreaInsetTop="true"
  7. >
  8. </u-navbar>
  9. <view class="page-wrap">
  10. <u-subsection
  11. class="subsection"
  12. :customStyle="{height: '66rpx'}"
  13. :list="typeList"
  14. mode="subsection"
  15. activeColor="#00A447"
  16. @change="sectionChange"
  17. :current="curNow"></u-subsection>
  18. <view class="content">
  19. <view class="" v-if="curNow==0">
  20. <!-- <view class="name">贵州旭烁食品有限公司简介</view> -->
  21. <view class="u-content" style="margin-top: 40rpx;">
  22. <u-parse :content="pageData.xsIntro"></u-parse>
  23. </view>
  24. <view class="contact">
  25. <view class="item">联系电话:{{pageData.xsMobile}}</view>
  26. <view class="item">营业世间:{{pageData.xsServiceTime}}</view>
  27. <view class="item">旭烁地址:{{pageData.xsAddress}}</view>
  28. </view>
  29. </view>
  30. <view class="" v-if="curNow==1">
  31. <view class="u-content" style="margin-top: 40rpx;">
  32. <u-parse :content="pageData.shopIntro"></u-parse>
  33. </view>
  34. <view class="contact">
  35. <view class="item">联系电话:{{pageData.shopMobile}}</view>
  36. <view class="item">营业世间:{{pageData.shopServiceTime}}</view>
  37. <view class="item">商行地址:{{pageData.shopAddress}}</view>
  38. </view>
  39. </view>
  40. <!-- <img :src="pageData.uxImg" style="width: 100%;" alt=""> -->
  41. <view class="map-wrap">
  42. <map style="width: 100%; height: 340rpx;"
  43. @tap="mapClick"
  44. :latitude="curNow==0?xsLatitude:shopLatitude"
  45. :longitude="curNow==0?xsLongitude:shopLongitude" :markers="covers">
  46. </map>
  47. <u-button text="导航" @click="mapClick"></u-button>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. export default {
  55. components:{
  56. },
  57. data() {
  58. return {
  59. staticUrl:this.$commonConfig.staticUrl,
  60. shopLatitude: 30.659462,
  61. shopLongitude: 104.065735,
  62. xsLatitude: 30.659462,
  63. xsLongitude: 104.065735,
  64. covers: [], //存放标记点数组
  65. navbarTitle:'',
  66. typeList:['旭烁简介','商行简介'],
  67. curNow:0,
  68. pageData:{}
  69. }
  70. },
  71. watch:{
  72. curNow: {
  73. handler(newVal, oldVal){
  74. console.log('newVal',newVal);
  75. this.navbarTitle = this.typeList[newVal];
  76. this.getIntro();
  77. },
  78. immediate: true
  79. }
  80. },
  81. onLoad() {
  82. },
  83. methods: {
  84. sectionChange(index){
  85. this.curNow = index;
  86. },
  87. getIntro(){
  88. let type = this.curNow + 1;
  89. this.$u.api.xsGetIntro({type:type}).then(res=>{
  90. this.pageData = res.data;
  91. this.shopLatitude = res.data.shopLatitude;
  92. this.shopLongitude = res.data.shopLongitude;
  93. this.xsLatitude = res.data.xsLatitude;
  94. this.xsLongitude = res.data.xsLongitude;
  95. if(this.curNow==0){
  96. this.setCovers(this.xsLatitude,this.xsLongitude);
  97. }else{
  98. this.setCovers(this.shopLatitude,this.shopLongitude);
  99. }
  100. // console.log('res',res);
  101. }).catch(err=>{
  102. console.log('xsGetIntro',err.data);
  103. })
  104. },
  105. //设置点位
  106. setCovers(latitude, longitude) {
  107. let location = {
  108. id: 0,
  109. latitude: Number(latitude),
  110. longitude: Number(longitude),
  111. width: uni.upx2px(50),
  112. height: uni.upx2px(55),
  113. iconPath:this.$commonConfig.staticUrl+ '/img/mapicon.png'
  114. // iconPath: './../../static/location.png'
  115. }
  116. this.covers = [location]
  117. },
  118. mapClick(){
  119. if(this.curNow==0){
  120. uni.openLocation({
  121. latitude:this.xsLatitude, //维度
  122. longitude: this.xsLongitude, //经度
  123. name: "旭烁地址", //目的地定位名称
  124. scale: 15, //缩放比例
  125. address: this.pageData.xsAddress //导航详细地址
  126. })
  127. }else{
  128. uni.openLocation({
  129. latitude:this.shopLatitude, //维度
  130. longitude: this.shopLongitude, //经度
  131. name: "商行地址", //目的地定位名称
  132. scale: 15, //缩放比例
  133. address: this.pageData.shopAddress //导航详细地址
  134. })
  135. }
  136. }
  137. }
  138. }
  139. </script>
  140. <style>
  141. page{
  142. background-color: #F9F9F9;
  143. }
  144. </style>
  145. <style lang="scss" scoped>
  146. .content{
  147. font-size: 26rpx;
  148. font-weight: 400;
  149. color: #666666;
  150. line-height: 44rpx;
  151. .name{
  152. font-size: 32rpx;
  153. font-weight: 600;
  154. color: #333333;
  155. line-height: 45rpx;
  156. text-align: center;
  157. margin-top: 34rpx;
  158. margin-bottom: 30rpx;
  159. }
  160. .title{
  161. font-size: 30rpx;
  162. font-weight: 400;
  163. color: #333333;
  164. line-height: 50rpx;
  165. margin: 30rpx auto 15rpx;
  166. }
  167. .xsIntro{
  168. font-size: 24rpx;
  169. font-weight: 400;
  170. color: #999999;
  171. line-height: 33rpx;
  172. margin: 20rpx auto 50rpx;
  173. }
  174. .contact{
  175. margin: 30rpx 0;
  176. font-size: 32rpx;
  177. font-weight: 400;
  178. color: #333333;
  179. line-height: 50rpx;
  180. .item{
  181. margin-bottom: 10rpx;
  182. }
  183. }
  184. }
  185. .map-wrap{
  186. margin: 20rpx 0;
  187. }
  188. </style>