54 lines
975 B
Vue
54 lines
975 B
Vue
<script>
|
|
import config from './config'
|
|
import store from '@/store'
|
|
import {
|
|
getToken
|
|
} from '@/utils/auth'
|
|
|
|
export default {
|
|
onLaunch: function() {
|
|
this.initApp()
|
|
//开启分享功能
|
|
this.overShare()
|
|
},
|
|
methods: {
|
|
/**
|
|
* 开启朋友圈分享功能
|
|
* 监听路由切换/自动执行
|
|
*/
|
|
overShare() {
|
|
wx.onAppRoute((res) => {
|
|
// console.log('route', res)
|
|
let pages = getCurrentPages()
|
|
let view = pages[pages.length - 1]
|
|
if (view) {
|
|
wx.showShareMenu({
|
|
menus: ['shareAppMessage', 'shareTimeline'],
|
|
success(res) {},
|
|
fail(e) {}
|
|
})
|
|
}
|
|
})
|
|
},
|
|
// 初始化应用
|
|
initApp() {
|
|
// 初始化应用配置
|
|
this.initConfig()
|
|
|
|
},
|
|
initConfig() {
|
|
this.globalData.config = config
|
|
},
|
|
checkLogin() {
|
|
if (!getToken()) {
|
|
this.$tab.reLaunch('/pages/login')
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
@import '@/static/scss/index.scss';
|
|
</style>
|