最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊

黑馬程序員前端微信小程序開發(fā)教程,微信小程序從基礎(chǔ)到發(fā)布全流程_企業(yè)級(jí)商城實(shí)戰(zhàn)(

2023-06-28 17:02 作者:sen668899  | 我要投稿

p156 chooseAddress()方法顯示張三頁面解決方法

在manifest.json文件中,找到mp-weixin節(jié)點(diǎn),添加上:

"requiredPrivateInfos":[

?????"chooseLocation",

?????"getLocation",

?????"chooseAddress"

????]


p176 獲取登錄的Token并存儲(chǔ)

// 獲取微信用戶的基本信息

???getUserInfo(e){

????// console.log(e)

????uni.getUserProfile({

?????// 推薦使用wx.getUserProfile獲取用戶信息,

?????//開發(fā)者每次通過該接口獲取用戶個(gè)人信息均需用戶確認(rèn)

?????// 開發(fā)者妥善保管用戶快速填寫的頭像昵稱,避免重復(fù)彈窗

?????desc: '獲取頭像,昵稱,手機(jī)號(hào)驗(yàn)證信息', // 聲明獲取用戶個(gè)人信息后的用途,后續(xù)會(huì)展示在彈窗中,請(qǐng)謹(jǐn)慎填寫

?????lang:'zh_CN',

?????success: (res) => {

?????????console.log(res)

?????????// 獲取用戶信息成功,res.userInfo 就是用戶的基本信息

?????????// console.log(res.userInfo)

?????????// 將用戶的基本信息存入 vuex 中

?????????this.updateUserInfo(res.userInfo)

?????????// 獲取登錄成功后的 Token 字符串

?????????this.getToken(res)

????????},

?????fail(err) {

??????// console.log(err)

??????if(err.errMsg === 'getUserProfile:fail auth deny') return uni.$showMsg('取消了授權(quán)!')

?????}

????})

??},

??// 調(diào)用登錄接口,換取永久的token

???getToken(info){

???uni.login({

????provider:'weixin',

????success: async (res) => {

?????// console.log('login-res',res)

?????if(res && res.errMsg === 'login:ok') {

??????// 準(zhǔn)備參數(shù)對(duì)象

??????const query = {

????????code: res.code,

????????encryptedData: info.encryptedData,

????????iv: info.iv,

????????rawData: info.rawData,

????????signature: info.signature

???????}

??????// console.log('query',query)

??????// 換取token

??????const { data: loginResult } = await uni.$http.post('/api/public/v1/users/wxlogin', query)

??????// console.log('loginResult',loginResult)

??????if(loginResult.meta.status !== 200) {

???????// 接口獲取失敗,自己賦值

???????const loginResult={

????????"message": {

?????????"user_id": 12,

?????????"user_email_code": null,

?????????"is_active": null,

?????????"user_sex": "男",

?????????"user_qq": "",

?????????"user_tel": "",

?????????"user_xueli": "本科",

?????????"user_hobby": "",

?????????"user_introduce": null,

?????????"create_time": 1525402223,

?????????"update_time": 1525402223,

?????????"token":

??????????"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjEyLCJpYXQiOjE1MjU0MDIyMjMsImV4cCI6MTUyNTQ4ODYyM30.g-4GtEQNPwT_Xs0Pq7Lrco_9DfHQQsBiOKZerkO-O-o"

????????},

????????"meta": { "msg": "登錄成功", "status": 200 }

???????}

???????this.updateToken(loginResult.message.token)

???????uni.$showMsg('登錄失敗-成功!')

??????}?

??????uni.$showMsg('登錄成功!')

?????}

????},

????fail(err) {

?????uni.$showMsg(err)

????}

???})

??}


黑馬程序員前端微信小程序開發(fā)教程,微信小程序從基礎(chǔ)到發(fā)布全流程_企業(yè)級(jí)商城實(shí)戰(zhàn)(的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國家法律
平阴县| 海林市| 建昌县| 都昌县| 平阴县| 乌兰察布市| 平顶山市| 云龙县| 辽宁省| 墨江| 漾濞| 禄丰县| 阿克| 贵阳市| 彰武县| 连云港市| 平安县| 湟源县| 额尔古纳市| 封丘县| 华宁县| 秦皇岛市| 柯坪县| 阿尔山市| 天台县| 阜新| 沙河市| 福建省| 本溪市| 新乡县| 十堰市| 莎车县| 新闻| 轮台县| 莱州市| 西畴县| 滦南县| 巴林右旗| 东乡| 山东省| 当阳市|