about.vue 4.7 KB

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