123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- const app = getApp()
- Page({
- data: {
- currentIndex:0,
- height:0,
- login: false,
- content: [
- {text: "我的收藏"},
- {text: "我的已购"},
- {text: "收听历史"},
- {text: "我的礼包"}
- ]
- },
- onLoad() {
- const that = this;
- wx.getSystemInfo({
- success (res) {
- that.setData({
- height :res.windowHeight
- })
- }
- })
- },
- onShow() {
- const that = this
- if (!that.login) {
- wx.getStorage({
- key: 'userinfo',
- success(res){
- that.setData({
- login: res.data ? true : false,
- })
- }
- })
- }
- },
- // 点击获取头像和昵称
- bindGetUserInfo(e) {
- const that = this;
- wx.getUserInfo({
- success: function (res) {
- wx.setStorage({
- key: "userinfo",
- data: JSON.stringify(res.userInfo)
- })
- that.setData({
- login: true
- })
- }
- })
- },
- checkItem(e) {
- const that = this;
- if (this.data.currentIndex === e.target.dataset.current) {
- return false;
- } else {
- that.setData({
- currentIndex: e.target.dataset.index
- })
- }
- },
- // 滑动切换tab
- changeTab(e) {
- const that = this;
- that.setData({
- currentIndex:e.detail.current
- })
- }
- })
|