Browse Source

地图插件

master
chenkainan 11 months ago
parent
commit
ba102e61d7
  1. 9
      manifest.json
  2. 2
      pages.json
  3. 12
      pages/index/index.vue
  4. 24
      pages/map/map.vue
  5. 8
      static/css/base.css
  6. 10
      static/js/exportToPlugin.js

9
manifest.json

@ -64,9 +64,14 @@
} }
}, },
"plugins": { "plugins": {
"myPlugin": { "guide": {
"version": "1.0.0", "version": "1.0.0",
"provider": "wxcb555ab174f22ec9" "provider": "wxcb555ab174f22ec9",
"export": "static/js/exportToPlugin.js"
},
"routePlan": {
"version": "1.0.19",
"provider": "wx50b5593e81dd937a"
} }
} }
}, },

2
pages.json

@ -13,7 +13,7 @@
"navigationBarTitleText": "地图", "navigationBarTitleText": "地图",
"mp-weixin": { "mp-weixin": {
"usingComponents": { "usingComponents": {
"hello-component": "plugin://myPlugin/hello-component" "hello-component": "plugin://guide/index"
} }
} }
} }

12
pages/index/index.vue

@ -38,7 +38,7 @@
<view class="subtitle">便民快捷购票入口</view> <view class="subtitle">便民快捷购票入口</view>
<image src="https://static.ticket.sz-trip.com/tongli/images/index/rightIcons1.png" mode=""></image> <image src="https://static.ticket.sz-trip.com/tongli/images/index/rightIcons1.png" mode=""></image>
</view> </view>
<view :style="{backgroundImage: 'url('+showImg(homeUi['dtdl'])+')'}" @click="gotoPath('plugin://myPlugin/index')"> <view :style="{backgroundImage: 'url('+showImg(homeUi['dtdl'])+')'}" @click="gotoMap">
<view class="title">地图导览</view> <view class="title">地图导览</view>
<view class="subtitle">随时随地发现新旅程</view> <view class="subtitle">随时随地发现新旅程</view>
<image src="https://static.ticket.sz-trip.com/tongli/images/index/rightIcons.png" mode=""></image> <image src="https://static.ticket.sz-trip.com/tongli/images/index/rightIcons.png" mode=""></image>
@ -207,6 +207,16 @@
this.getLatest() this.getLatest()
}, },
methods: { methods: {
//
gotoMap() {
//
let userInfo = (uni.getStorageSync('userInfo') && JSON.parse(uni.getStorageSync('userInfo'))) || this.$store.state.user.userInfo || {}
if(userInfo.token) {
this.gotoPath('plugin://guide/index')
}else {
this.$store.commit('changeLoginPath')
}
},
// //
swiperChange(e) { swiperChange(e) {
this.current = e.detail.current; this.current = e.detail.current;

24
pages/map/map.vue

@ -16,19 +16,23 @@
uni.setStorageSync('isFlag', false) uni.setStorageSync('isFlag', false)
}, },
onShow() { onShow() {
this.gotoPath() this.gotoMap()
}, },
methods: { methods: {
gotoPath() { gotoMap() {
this.isFlag = uni.getStorageSync('isFlag') //
if(this.isFlag) { let userInfo = (uni.getStorageSync('userInfo') && JSON.parse(uni.getStorageSync('userInfo'))) || this.$store.state.user.userInfo || {}
uni.navigateTo({ if(userInfo.token) {
url: "plugin://myPlugin/index" this.isFlag = uni.getStorageSync('isFlag')
}) if(this.isFlag) {
this.gotoPath('plugin://guide/index')
}else {
uni.switchTab({
url: '/pages/index/index'
})
}
}else { }else {
uni.switchTab({ this.$store.commit('changeLoginPath')
url: '/pages/index/index'
})
} }
} }
} }

8
static/css/base.css

@ -160,3 +160,11 @@ view {
font-size: 40rpx; font-size: 40rpx;
color: #fff; color: #fff;
} }
.index--voice {
box-sizing: content-box !important;
}
.card-action {
box-sizing: content-box !important;
}

10
static/js/exportToPlugin.js

@ -0,0 +1,10 @@
module.exports = {
getUnionId: async () => {
// ....
return JSON.parse(wx.getStorageSync('userInfo')).unionid || '';
},
getOpenId: async () => {
// ....
return JSON.parse(wx.getStorageSync('userInfo')).openid || '';
},
};
Loading…
Cancel
Save