123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- // pages/mine/index.js
- const app = getApp()
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- wxLength: 0
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- // if(wx.getStorageSync('isLogin')) {
- // this.getList();
- // }
- },
- onShow() {
- if(this.data.wxLength==0&&wx.getStorageSync('isLogin')) {
- this.getList();
- }
- },
- // 获取授权公众号的数量
- getList(e) {
- e&&(this.setData({
- wxList: []
- }))
- app.func.req('/api/account/index', 'get',{
- page: 1,
- page_size:20
- }, (res) => {
- wx.hideLoading()
- if(res && res.errno == 0){
- //成功
- this.setData({
- wxLength: res.rst.pageInfo.total
- })
- }else if(res.errno != '4001'){
- wx.showToast({
- title: res.err,
- icon: 'none',
- duration: 2000
- })
- }
- },()=>{
- wx.hideLoading()
- })
- },
- getUserInfo(e) {
- if(wx.getStorageSync('isLogin')){
- wx.navigateTo({
- url: e.currentTarget.dataset.page,
- })
- }else{
- wx.setStorageSync('encryptedData',e.detail.encryptedData)
- wx.setStorageSync('iv',e.detail.iv)
- app.login(()=>{
- wx.navigateTo({
- url: e.currentTarget.dataset.page,
- })
- },(err)=>{
- wx.showToast({
- title: '服务繁忙,请稍后重试!',
- icon: 'none',
- duration: 2000
- })
- })
- }
-
- },
- goPage(e){//去其他页面
- wx.navigateTo({
- url: e.currentTarget.dataset.page,
- })
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function (res) {
- return app.shareEvent(res,'/pages/index/index')
- },
- })
|