第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

小程序 Promise執(zhí)行問題

小程序 Promise執(zhí)行問題

暮色呼如 2019-03-30 15:19:15
App({  onLaunch: function () {    var logs = wx.getStorageSync('logs') || []    logs.unshift(Date.now())    wx.setStorageSync('logs', logs)    var that = this    this.getOpenid().then(()=>{        return that.setAdmin()        //為什么這里沒有任何console啊,沒有執(zhí)行    })  },  getOpenid: function () {      var that = this      return new Promise(function (resolve, reject) {          console.log(resolve)          wx.getStorage({              key: 'openid',              success: function (res) {                 that.globalData.openId = res.data                 console.log(that.globalData.openId)              },              fail: function () {                  wx.login({                      success: res => {                          var code = res.code; //返回code                          var appId = '';                          var secret = '';                          wx.request({                              url: 'https://api.weixin.qq.com/sns/jscode2session?appid=' + appId + '&secret=' + secret + '&js_code=' + code + '&grant_type=authorization_code',                              data: {},                              header: {                                  'content-type': 'json'                              },                              success: function (res) {                                  wx.setStorage({                                      key: "openid",                                      data: res.data.openid                                  })                                  that.globalData.openId = res.data.openid                              }                          })                      }                  })              }          })      })  },目的是要先 設(shè)置openid到data后,再傳給服務(wù)器驗(yàn)證,但是wxrequst異步要promise來規(guī)定執(zhí)行順序啊,但是這里為什么then后不執(zhí)行呢,求大大解答
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 602 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)