| | |
| | | <view class="tc d-b-c header" |
| | | :style="topBarHeight() == 0 ? '': 'height:'+topBarHeight()+'px;padding-top:'+(topBarTop() + 5)+'px'"> |
| | | <view class="reg180" :style="topBarHeight() == 0 ? '': 'height:'+topBarHeight()+'px;'"> |
| | | <text v-if="hasPage()" @click="goback" class="icon iconfont icon-jiantou"></text> |
| | | <text v-if="hasPage()" @click="goback" class="icon iconfont icon-jiantou"></text> |
| | | </view> |
| | | <view class="gray3 f28">{{page_info.params.name}}</view> |
| | | <view class="gray3 m20" @click="showShare()"><text class="icon iconfont icon-share1"></text></view> |
| | |
| | | data() { |
| | | return { |
| | | /*页面ID*/ |
| | | page_id:null, |
| | | page_id: null, |
| | | /*diy类别*/ |
| | | items:{}, |
| | | items: {}, |
| | | /*页面信息*/ |
| | | page_info:{}, |
| | | page_info: {}, |
| | | /*分享*/ |
| | | isMpShare: false, |
| | | /*app分享*/ |
| | | isAppShare: false, |
| | | index_open_city:0, |
| | | index_open_city: 0, |
| | | appParams: { |
| | | title: '', |
| | | summary: '', |
| | | path: '' |
| | | }, |
| | | url: '', |
| | | longitude: 0, |
| | | latitude: 0, |
| | | } |
| | | }, |
| | | onLoad(e) { |
| | | this.page_id=e.page_id; |
| | | this.getData(); |
| | | this.page_id = e.page_id; |
| | | this.getAdds(); |
| | | //#ifdef H5 |
| | | this.url = window.location.href; |
| | | //#endif |
| | | }, |
| | | methods: { |
| | | hasPage(){ |
| | | hasPage() { |
| | | var pages = getCurrentPages(); |
| | | return pages.length > 1; |
| | | }, |
| | | goback() { |
| | | uni.navigateBack(); |
| | | }, |
| | | getAdds() { |
| | | let self = this; |
| | | uni.getLocation({ |
| | | type: 'wgs84', |
| | | success: function(res) { |
| | | console.log('当前位置的经度:' + res.longitude); |
| | | console.log('当前位置的纬度:' + res.latitude); |
| | | uni.setStorageSync('longitude',res.longitude) |
| | | uni.setStorageSync('latitude',res.latitude) |
| | | self.longitude = res.longitude; |
| | | self.latitude = res.latitude; |
| | | self.getData(); |
| | | },fetch() { |
| | | self.getData(); |
| | | } |
| | | }) |
| | | }, |
| | | /*获取数据*/ |
| | | getData(page_id) { |
| | | let self = this; |
| | | self._get('index/diy', { |
| | | page_id: self.page_id, |
| | | url: self.url |
| | | url: self.url, |
| | | longitude: self.longitude, |
| | | latitude: self.latitude |
| | | }, function(res) { |
| | | self.page_info = res.data.page; |
| | | self.items = res.data.items; |
| | |
| | | //#endif |
| | | }); |
| | | }, |
| | | |
| | | |
| | | /*设置页面*/ |
| | | setPage(page){ |
| | | |
| | | setPage(page) { |
| | | |
| | | uni.setNavigationBarTitle({ |
| | | title: page.params.name |
| | | title: page.params.name |
| | | }); |
| | | |
| | | let colors='#000000'; |
| | | if(page.style.titleTextColor=='white'){ |
| | | |
| | | let colors = '#000000'; |
| | | if (page.style.titleTextColor == 'white') { |
| | | //字母要小写 |
| | | colors='#ffffff' |
| | | colors = '#ffffff' |
| | | } |
| | | uni.setNavigationBarColor({ |
| | | frontColor: colors, |
| | | backgroundColor: page.style.titleBackgroundColor |
| | | frontColor: colors, |
| | | backgroundColor: page.style.titleBackgroundColor |
| | | }) |
| | | |
| | | |
| | | }, |
| | | /*分享当前页面*/ |
| | | onShareAppMessage() { |
| | |
| | | showShare() { |
| | | let self = this; |
| | | //#ifdef MP-WEIXIN |
| | | return; |
| | | return; |
| | | //#endif |
| | | //#ifndef APP-PLUS |
| | | self.isMpShare = true; |
| | |
| | | |
| | | <style> |
| | | |
| | | </style> |
| | | </style> |