app-layout.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <view class="app-layout">
  3. <scroll-view scroll-y="true" class="scroll-view">
  4. <slot></slot>
  5. </scroll-view>
  6. </view>
  7. </template>
  8. <script>
  9. export default {
  10. name: "app-layout",
  11. data() {
  12. return {
  13. }
  14. },
  15. methods: {
  16. login(){
  17. uni.login({
  18. provider: 'weixin',
  19. success: res => {
  20. console.log('-->data',res)
  21. uni.getUserInfo({
  22. provider: 'weixin',
  23. success: data => {
  24. let params = {
  25. code: res.code,
  26. encryptedData: data.encryptedData,
  27. iv:data.iv,
  28. signature:data.signature
  29. }
  30. this.$u.api.login(params).then(loginRes => {
  31. this.$u.vuex(this.$const.USER_TOKEN,loginRes.token)
  32. this.$u.vuex(this.$const.USER_DATA,loginRes.user)
  33. })
  34. }
  35. });
  36. }
  37. });
  38. },
  39. handleConfirmBuy(){
  40. this.$jump({url:'/pages/my/member',type:'to'})
  41. }
  42. },
  43. created(){
  44. if(!this.vuex_user_token){
  45. this.login()
  46. }
  47. },
  48. computed:{
  49. }
  50. }
  51. </script>
  52. <style lang="scss" scoped>
  53. .app-layout{
  54. .scroll-view{
  55. padding-bottom: calc(var(--window-bottom) + 20px);
  56. /*height: calc(100vh - var(--window-top));*/
  57. width: 100%;
  58. overflow: hidden;
  59. }
  60. }
  61. </style>