123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <template>
- <view class="app-layout">
- <scroll-view scroll-y="true" class="scroll-view">
- <slot></slot>
- </scroll-view>
- </view>
- </template>
- <script>
- export default {
- name: "app-layout",
- data() {
- return {}
- },
- methods: {
- login(){
- uni.login({
- provider: 'weixin',
- success: res => {
- console.log('-->data',res)
- uni.getUserInfo({
- provider: 'weixin',
- success: data => {
- let params = {
- code: res.code,
- encryptedData: data.encryptedData,
- iv:data.iv,
- signature:data.signature
- }
- this.$u.api.login(params).then(loginRes => {
- this.$u.vuex(this.$const.USER_TOKEN,loginRes.token)
- this.$u.vuex(this.$const.USER_DATA,loginRes.user)
- })
- }
- });
- }
- });
- }
- },
- created(){
- if(!this.vuex_user_token){
- this.login()
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .app-layout{
- .scroll-view{
- padding-bottom: calc(var(--window-bottom) + 20px);
- /*height: calc(100vh - var(--window-top));*/
- width: 100%;
- overflow: hidden;
- }
- }
- </style>
|