国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

微信小程序進(jìn)階——后臺交互個(gè)人中心授權(quán)登錄

這篇具有很好參考價(jià)值的文章主要介紹了微信小程序進(jìn)階——后臺交互個(gè)人中心授權(quán)登錄。希望對大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

目錄

一、小程序登錄微信登錄接口演示

1.1 項(xiàng)目導(dǎo)入

1.2 method1?

1.3 method2

二、小程序授權(quán)登錄

2.1 登錄過程

2.1.1 詳解

2.1.2 圖解

2.2 后端代碼導(dǎo)入

2.3 前端代碼導(dǎo)入

?編輯

2.4 案例演示

前端代碼如下:

2.4.1 前端調(diào)用接口地址

2.4.2 個(gè)人中心

后端代碼如下:

2.5 效果演示?


?文章來源地址http://www.zghlxwxcb.cn/news/detail-785866.html

一、小程序登錄微信登錄接口演示

1.1 項(xiàng)目導(dǎo)入

小程序賬號后臺,微信小程序,小程序

小程序賬號后臺,微信小程序,小程序

然后選擇要上傳的文件夾,輸入appid后點(diǎn)擊確認(rèn)導(dǎo)入就可以了。

1.2 method1?

method1方法獲取用戶信息存在一定風(fēng)險(xiǎn),并不安全。

把執(zhí)行方法改成false,如下:

小程序賬號后臺,微信小程序,小程序

模擬器效果展示:

小程序賬號后臺,微信小程序,小程序

下面就是更為安全的method2方法獲取用戶信息了,即推薦使用?wx.getUserProfile?獲取用戶信息,開發(fā)者每次通過該接口獲取用戶個(gè)人信息均需用戶確認(rèn)。

1.3 method2

method2方式獲取用戶信息須經(jīng)用戶本人確認(rèn)才會(huì)獲取相應(yīng)信息,相對與method1方式來說給為安全。

把執(zhí)行方法改成true,如下:

小程序賬號后臺,微信小程序,小程序

模擬器展示效果如下:

小程序賬號后臺,微信小程序,小程序

二、小程序授權(quán)登錄

2.1 登錄過程

2.1.1 詳解

微信小程序的授權(quán)登錄過程通常包括以下幾個(gè)步驟:

  1. 小程序初始化: 在小程序初始化的時(shí)候,可以調(diào)用 wx.login 接口獲取臨時(shí)登錄憑證 code。這個(gè) code 的有效期很短,通常只有幾分鐘,所以需要在獲取到 code 后盡快使用。

  2. 將 code 發(fā)送到開發(fā)者服務(wù)器: 小程序前端通過網(wǎng)絡(luò)請求將獲取到的 code 發(fā)送到開發(fā)者服務(wù)器。

  3. 開發(fā)者服務(wù)器獲取 session_key 和 openid: 開發(fā)者服務(wù)器收到 code 后,可以將其發(fā)送到微信服務(wù)器的登錄憑證校驗(yàn)接口,換取 session_key 和 openid。session_key 是會(huì)話密鑰,用于加密數(shù)據(jù)傳輸,openid 是用戶在當(dāng)前小程序的唯一標(biāo)識。

  4. 校驗(yàn)登錄狀態(tài): 開發(fā)者服務(wù)器使用獲取到的 session_key 和 openid 創(chuàng)建一個(gè)用戶登錄態(tài),同時(shí)生成一個(gè)自定義的登錄態(tài)標(biāo)識,例如 token,并將這個(gè)標(biāo)識返回給小程序前端。

  5. 小程序前端存儲登錄態(tài): 小程序前端收到開發(fā)者服務(wù)器返回的登錄態(tài)標(biāo)識后,可以將它存儲在本地,一般存儲在緩存中。

  6. 后續(xù)請求攜帶登錄態(tài): 小程序前端在后續(xù)的網(wǎng)絡(luò)請求中,可以在請求的 header 中攜帶這個(gè)登錄態(tài)標(biāo)識,以表明當(dāng)前請求是一個(gè)已登錄用戶發(fā)起的。

需要注意的是,session_key 是敏感信息,不應(yīng)該暴露到小程序前端,而是應(yīng)該由開發(fā)者服務(wù)器進(jìn)行存儲和管理。微信小程序提供了相關(guān)的加解密 API,可以使用 session_key 對用戶數(shù)據(jù)進(jìn)行加解密,確保數(shù)據(jù)傳輸?shù)陌踩?。在?shí)際開發(fā)中,我們還需要處理登錄失敗、session 過期等異常情況,并且注意用戶隱私和數(shù)據(jù)安全。

2.1.2 圖解

小程序賬號后臺,微信小程序,小程序

2.2 后端代碼導(dǎo)入

?

小程序賬號后臺,微信小程序,小程序

2.3 前端代碼導(dǎo)入

小程序賬號后臺,微信小程序,小程序

2.4 案例演示

前端代碼如下:

2.4.1 前端調(diào)用接口地址

api.js:

// 以下是業(yè)務(wù)服務(wù)器API地址
 // 本機(jī)開發(fā)API地址
var WxApiRoot = 'http://localhost:8080/oapro/wx/';
// 測試環(huán)境部署api地址
// var WxApiRoot = 'http://192.168.191.1:8080/oapro/wx/';
// 線上平臺api地址
//var WxApiRoot = 'https://www.oa-mini.com/demo/wx/';

module.exports = {
  IndexUrl: WxApiRoot + 'home/index', //首頁數(shù)據(jù)接口
  SwiperImgs: WxApiRoot+'swiperImgs',
  MettingInfos: WxApiRoot+'meeting/list',
  AuthLoginByWeixin: WxApiRoot + 'auth/login_by_weixin', //微信登錄
  UserIndex: WxApiRoot + 'user/index', //個(gè)人頁面用戶相關(guān)信息
  AuthLogout: WxApiRoot + 'auth/logout', //賬號登出
  AuthBindPhone: WxApiRoot + 'auth/bindPhone' //綁定微信手機(jī)號
};

注意 :? ?需要對應(yīng)后臺的請求地址之后進(jìn)行數(shù)據(jù)的訪問。

2.4.2 個(gè)人中心

index.wxml:

<view class="page-container">
    <view class="user-info-container">
        <view class="user-info"  bindtap="goLogin">
            <image class="user-img" mode="scaleToFill" src="{{userInfo.avatarUrl}}" />
            <text class="user-info-name">{{userInfo.nickName}}</text>
        </view>
        <image class="user-update" src="/static/tabBar/component.png" bindtap='goPages' data-url='/pages/ucenter/user/user'/>
    </view>

    <view class="boundary" />
    <view class="cells-container">
        <view class="cell-wrap">
            <image class="cell-icon" src="/static/tabBar/sdk.png" />
            <text class="cell-text">我主持的會(huì)議</text>
            <view class="cell-right">
                <view class="cell-list-num">{{metting_pubs}}</view>
                <view class="cell-arrow"></view>
            </view>
        </view>
        <view class="cell-wrap">
            <image class="cell-icon" src="/static/tabBar/sdk.png" />
            <text class="cell-text">我參與的會(huì)議</text>
            <view class="cell-right">
                <view class="cell-list-num">{{metting_joins}}</view>
                <view class="cell-arrow"></view>
            </view>
        </view>
    </view>
    <view class="boundary" />
    <view class="cells-container">
        <view class="cell-wrap">
            <image class="cell-icon" src="/static/tabBar/sdk.png" />
            <text class="cell-text">我發(fā)布的投票</text>
            <view class="cell-right">
                <view class="cell-list-num">1</view>
                <view class="cell-arrow"></view>
            </view>
        </view>
        <view class="cell-wrap">
            <image class="cell-icon" src="/static/tabBar/sdk.png" />
            <text class="cell-text">我參與的投票</text>
            <view class="cell-right">
                <view class="cell-list-num">10</view>
                <view class="cell-arrow"></view>
            </view>
        </view>
    </view>
    <view class="boundary" />
    <view class="cells-container">
        <view class="cell-wrap">
            <image class="cell-icon" src="/static/tabBar/template.png" />
            <text class="cell-text">消息</text>
            <view class="cell-right">
                <view class="cell-list-num"></view>
                <view class="cell-arrow"></view>
            </view>
        </view>
        <view class="cell-wrap">
            <image class="cell-icon" src="/static/tabBar/component.png" />
            <text class="cell-text">設(shè)置</text>
            <view class="cell-right">
                <view class="cell-list-num"></view>
                <view class="cell-arrow"></view>
            </view>
        </view>
    </view>
</view>

在index.js中編寫數(shù)據(jù)請求方法,如下:

index.js:

// pages/ucenter/index/index.js
var util = require('../../../utils/util.js');
var api = require('../../../config/api.js');
const app = getApp();
Page({

    /**
     * 頁面的初始數(shù)據(jù)
     */
    data: {
        userInfo: {
            nickName: '點(diǎn)擊登錄',
            avatarUrl: '/static/images/avatar.png'
        },
        hasLogin: false,
        metting_pubs: '',
        metting_joins: ''
    },

    /**
     * 生命周期函數(shù)--監(jiān)聽頁面加載
     */
    onLoad(options) {

    },


    /**
     * 生命周期函數(shù)--監(jiān)聽頁面顯示
     */
    onShow() {
        this.getUserInfo();
    },
    getUserInfo() {
      // console.log('ucenter.index.app.globalData.hasLogin='+app.globalData.hasLogin)
        //獲取用戶的登錄信息
        if (app.globalData.hasLogin) {
            let userInfo = wx.getStorageSync('userInfo');
            this.setData({
                userInfo: userInfo,
                hasLogin: true
            });
            //查詢個(gè)人統(tǒng)計(jì)信息
            util.request(api.UserIndex).then(res => {
                if (res.errno === 0) {
                    this.setData({
                        metting_pubs: res.data.metting_pubs,
                        metting_joins: res.data.metting_joins
                    });
                }
            });
        }
    },
    goLogin() {
        if (!this.data.hasLogin) {
            wx.navigateTo({
                url: "/pages/auth/login/login"
            });
        }
    },
    /**
     * 頁面跳轉(zhuǎn)
     */
    goPages: function (e) {
        if (this.data.hasLogin) {
            wx.navigateTo({
                url: e.currentTarget.dataset.url
            });
        } else {
            wx.navigateTo({
                url: "/pages/auth/login/login"
            });
        };
    }

})

創(chuàng)建一個(gè)用戶登入后的設(shè)置頁面為 : user。其中各頁面代碼如下:

user.js:

var util = require('../../../utils/util.js');
var api = require('../../../config/api.js');
var user = require('../../../utils/user.js');
var app = getApp();
Page({

  /**
   * 頁面的初始數(shù)據(jù)
   */
  data: {
    userInfo: {},
    hasLogin: false,
    userSharedUrl: ''
  },

  /**
      * 生命周期函數(shù)--監(jiān)聽頁面加載
   */
  onLoad: function (options) {

  },
  onShow: function () {
    let that = this;
    //獲取用戶的登錄信息
    let userInfo = wx.getStorageSync('userInfo');
    this.setData({
      userInfo: userInfo,
      hasLogin: true
    });

  },
  getPhoneNumber: function (e) {
    let that = this;
    if (e.detail.errMsg !== "getPhoneNumber:ok") {
      // 拒絕授權(quán)
      return;
    }

    if (!this.data.hasLogin) {
      wx.showToast({
        title: '綁定失?。赫埾鹊卿?,
        icon: 'none',
        duration: 2000
      });
      return;
    }

    util.request(api.AuthBindPhone, {
      iv: e.detail.iv,
      encryptedData: e.detail.encryptedData
    }, 'POST').then(function (res) {
      if (res.errno === 0) {
        let userInfo = wx.getStorageSync('userInfo');
        userInfo.phone = res.data.phone;//設(shè)置手機(jī)號碼
        wx.setStorageSync('userInfo', userInfo);
        that.setData({
          userInfo: userInfo,
          hasLogin: true
        });
        wx.showToast({
          title: '綁定手機(jī)號碼成功',
          icon: 'success',
          duration: 2000
        });
      }
    });
  },
  exitLogin: function () {
    wx.showModal({
      title: '',
      confirmColor: '#b4282d',
      content: '退出登錄?',
      success: function (res) {
        if (!res.confirm) {
          return;
        }

        util.request(api.AuthLogout, {}, 'POST');
        app.globalData.hasLogin = false;
        wx.removeStorageSync('token');
        wx.removeStorageSync('userInfo');
        wx.reLaunch({
          url: '/pages/index/index'
        });
      }
    })
  }
})

user.wxml:

<!--pages/ucenter/user/user.wxml-->
<form bindsubmit="formSubmit">
    <view class='personal-data'>
        <view class='list'>
            <view class='item acea-row row-between-wrapper'>
                <view>頭像</view>
                <view class='pictrue'>
                    <image src='{{userInfo.avatarUrl}}'></image>
                </view>
            </view>
            <view class='item acea-row row-between-wrapper'>
                <view>名字</view>
                <view class='input'><input type='text' disabled='true' name='nickname' value='{{userInfo.nickName}}'></input></view>
            </view>
            <view class='item acea-row row-between-wrapper'>
                <view>手機(jī)號碼</view>
                <button name='phone' class='phone' value='{{userInfo.phone}}' wx:if="{{!userInfo.phone}}" bindgetphonenumber="getPhoneNumber" hover-class='none' open-type='getPhoneNumber'>
                    點(diǎn)擊獲取
                </button>
                <view class='input acea-row row-between-wrapper' wx:else>
                    <input type='text' disabled='true' name='phone' value='{{userInfo.phone}}' class='id'></input>
                    <text class='iconfont icon-suozi'></text>
                </view>
            </view>

            <view class='item acea-row row-between-wrapper'>
                <view>ID號</view>
                <view class='input acea-row row-between-wrapper'>
                    <input type='text' value='1000{{userInfo.userId}}' disabled='true' class='id'></input>
                    <text class='iconfont icon-suozi'></text>
                </view>
            </view>
        </view>
        <button class='modifyBnt' bindtap="exitLogin">退 出</button>
    </view>
</form>

user.wxss:

@import '/static/font/iconfont.wxss';
.personal-data .list {
    margin-top: 15rpx;
    background-color: #fff;
}

.personal-data .list .item {
    padding: 30rpx 30rpx 30rpx 0;
    border-bottom: 1rpx solid #f2f2f2;
    margin-left: 30rpx;
    font-size: 32rpx;
    color: #282828;
}

.personal-data .list .item .phone {
    background-color: #85c43f;
    width: 160rpx;
    height: 56rpx;
    font-size: 24rpx;
    color: #fff;
    line-height: 56rpx;
    border-radius: 32rpx
}

.personal-data .list .item .pictrue {
    width: 88rpx;
    height: 88rpx;
}

.personal-data .list .item .pictrue image {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.personal-data .list .item .input {
    width: 415rpx;
    text-align: right;
    color: #868686;
}

.personal-data .list .item .input .id {
    width: 365rpx;
}

.personal-data .list .item .input .iconfont {
    font-size: 35rpx;
}

.personal-data .modifyBnt {
    /* background-color: #85c43f; */
    /* background: linear-gradient(to left right, #85c43f, #fefefd); */
    background: radial-gradient(circle at 50%,#85c43f,#CDDC39);
    font-size: 32rpx;
    color: #fff;
    width: 690rpx;
    height: 90rpx;
    border-radius: 50rpx;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 90rpx;
    margin: 76rpx auto 0 auto;
}


.acea-row{display:flex;flex-wrap:wrap;}
.acea-row.row-top{align-items:flex-start;}
.acea-row.row-middle{align-items:center;}
.acea-row.row-bottom{align-items:flex-end;}
.acea-row.row-left{justify-content:flex-start;}
.acea-row.row-center{justify-content:center;}
.acea-row.row-right{justify-content:flex-end;}
.acea-row.row-between{justify-content:space-between;}
.acea-row.row-around{justify-content:space-around;}
.acea-row.row-column{flex-direction:column;}
.acea-row.row-column-between{flex-direction:column;justify-content:space-between;}
.acea-row.row-column-around{flex-direction:column;justify-content:space-around;}
.acea-row.row-center-wrapper{align-items:center;justify-content:center;}
.acea-row.row-between-wrapper{align-items:center;justify-content:space-between;}
view, image, text, navigator {
    box-sizing: border-box;
    padding: 0;
    margin: 0;
}

后端代碼如下:

在后臺編寫的控制器,來進(jìn)行出來前端的請求及數(shù)據(jù)處理并且反饋帶前端

WxAuthController :?

package com.zking.ssm.wxcontroller;

/**
 * @Autho donkee
 * @Since 2022/6/27
 */

import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
import com.alibaba.fastjson.JSONObject;
import com.zking.ssm.annotation.LoginUser;
import com.zking.ssm.model.UserInfo;
import com.zking.ssm.model.WxLoginInfo;
import com.zking.ssm.model.WxUser;
import com.zking.ssm.service.UserToken;
import com.zking.ssm.service.UserTokenManager;
import com.zking.ssm.service.WxUserService;
import com.zking.ssm.util.JacksonUtil;
import com.zking.ssm.util.ResponseUtil;
import com.zking.ssm.util.UserTypeEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
import javax.servlet.http.HttpServletRequest;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * 鑒權(quán)服務(wù)
 */
@Slf4j
@RestController
@RequestMapping("/wx/auth")
public class WxAuthController {
    @Autowired
    private WxMaService wxService;
    @Autowired
    private WxUserService userService;
    /**
     * 微信登錄
     *
     * @param wxLoginInfo
     *            請求內(nèi)容,{ code: xxx, userInfo: xxx }
     * @param request
     *            請求對象
     * @return 登錄結(jié)果
     */
    @PostMapping("login_by_weixin")
    public Object loginByWeixin(@RequestBody WxLoginInfo wxLoginInfo, HttpServletRequest request) {

        //客戶端需攜帶code與userInfo信息
        String code = wxLoginInfo.getCode();
        UserInfo userInfo = wxLoginInfo.getUserInfo();
        if (code == null || userInfo == null) {
            return ResponseUtil.badArgument();
        }
        //調(diào)用微信sdk獲取openId及sessionKey
        String sessionKey = null;
        String openId = null;
        try {
            long beginTime = System.currentTimeMillis();
            //
            WxMaJscode2SessionResult result = this.wxService.getUserService().getSessionInfo(code);
//            Thread.sleep(6000);
            long endTime = System.currentTimeMillis();
            log.info("響應(yīng)時(shí)間:{}",(endTime-beginTime));
            sessionKey = result.getSessionKey();//session id
            openId = result.getOpenid();//用戶唯一標(biāo)識 OpenID
        } catch (Exception e) {
            e.printStackTrace();
        }

        if (sessionKey == null || openId == null) {
            log.error("微信登錄,調(diào)用官方接口失?。簕}", code);
            return ResponseUtil.fail();
        }else{
            log.info("openId={},sessionKey={}",openId,sessionKey);
        }
        //根據(jù)openId查詢wx_user表
        //如果不存在,初始化wx_user,并保存到數(shù)據(jù)庫中
        //如果存在,更新最后登錄時(shí)間
        WxUser user = userService.queryByOid(openId);

        if (user == null) {
            user = new WxUser();
            user.setUsername(openId);
            user.setPassword(openId);
            user.setWeixinOpenid(openId);
            user.setAvatar(userInfo.getAvatarUrl());
            user.setNickname(userInfo.getNickName());
            user.setGender(userInfo.getGender());
            user.setUserLevel((byte) 0);
            user.setStatus((byte) 0);
            user.setLastLoginTime(new Date());
            user.setLastLoginIp(IpUtil.client(request));
            user.setShareUserId(1);

            userService.add(user);

        } else {
            user.setLastLoginTime(new Date());
            user.setLastLoginIp(IpUtil.client(request));
            if (userService.updateById(user) == 0) {
                log.error("修改失?。簕}", user);
                return ResponseUtil.updatedDataFailed();
            }
        }
        // token
        UserToken userToken = null;
        try {
            userToken = UserTokenManager.generateToken(user.getId());
        } catch (Exception e) {
            log.error("微信登錄失敗,生成token失敗:{}", user.getId());
            e.printStackTrace();
            return ResponseUtil.fail();
        }
        userToken.setSessionKey(sessionKey);
        log.info("SessionKey={}",UserTokenManager.getSessionKey(user.getId()));
        Map<Object, Object> result = new HashMap<Object, Object>();
        result.put("token", userToken.getToken());
        result.put("tokenExpire", userToken.getExpireTime().toString());
        userInfo.setUserId(user.getId());
        if (!StringUtils.isEmpty(user.getMobile())) {// 手機(jī)號存在則設(shè)置
            userInfo.setPhone(user.getMobile());
        }
        try {
            DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
            String registerDate = df.format(user.getAddTime() != null ? user.getAddTime() : new Date());
            userInfo.setRegisterDate(registerDate);
            userInfo.setStatus(user.getStatus());
            userInfo.setUserLevel(user.getUserLevel());// 用戶層級
            userInfo.setUserLevelDesc(UserTypeEnum.getInstance(user.getUserLevel()).getDesc());// 用戶層級描述
        } catch (Exception e) {
            log.error("微信登錄:設(shè)置用戶指定信息出錯(cuò):"+e.getMessage());
            e.printStackTrace();
        }
        result.put("userInfo", userInfo);


        log.info("【請求結(jié)束】微信登錄,響應(yīng)結(jié)果:{}", JSONObject.toJSONString(result));

        return ResponseUtil.ok(result);
    }
    /**
     * 綁定手機(jī)號碼
     *
     * @param userId
     * @param body
     * @return
     */
    @PostMapping("bindPhone")
    public Object bindPhone(@LoginUser Integer userId, @RequestBody String body) {
        log.info("【請求開始】綁定手機(jī)號碼,請求參數(shù),body:{}", body);

        String sessionKey = UserTokenManager.getSessionKey(userId);
        String encryptedData = JacksonUtil.parseString(body, "encryptedData");
        String iv = JacksonUtil.parseString(body, "iv");
        WxMaPhoneNumberInfo phoneNumberInfo = null;
        try {
            phoneNumberInfo = this.wxService.getUserService().getPhoneNoInfo(sessionKey, encryptedData, iv);
        } catch (Exception e) {
            log.error("綁定手機(jī)號碼失敗,獲取微信綁定的手機(jī)號碼出錯(cuò):{}", body);
            e.printStackTrace();
            return ResponseUtil.fail();
        }
        String phone = phoneNumberInfo.getPhoneNumber();
        WxUser user = userService.selectByPrimaryKey(userId);
        user.setMobile(phone);
        if (userService.updateById(user) == 0) {
            log.error("綁定手機(jī)號碼,更新用戶信息出錯(cuò),id:{}", user.getId());
            return ResponseUtil.updatedDataFailed();
        }
        Map<Object, Object> data = new HashMap<Object, Object>();
        data.put("phone", phone);

        log.info("【請求結(jié)束】綁定手機(jī)號碼,響應(yīng)結(jié)果:{}", JSONObject.toJSONString(data));
        return ResponseUtil.ok(data);
    }
    /**
     * 注銷登錄
     */
    @PostMapping("logout")
    public Object logout(@LoginUser Integer userId) {
        log.info("【請求開始】注銷登錄,請求參數(shù),userId:{}", userId);
        if (userId == null) {
            return ResponseUtil.unlogin();
        }
        try {
            UserTokenManager.removeToken(userId);
        } catch (Exception e) {
            log.error("注銷登錄出錯(cuò):userId:{}", userId);
            e.printStackTrace();
            return ResponseUtil.fail();
        }

        log.info("【請求結(jié)束】注銷登錄成功!");
        return ResponseUtil.ok();
    }
}

在?application.yml?文件中進(jìn)行配置后臺的數(shù)據(jù)庫及微信小程序的AppID(小程序ID)及AppSecret(小程序密鑰),來幫助訪問微信的接口服務(wù)。

小程序賬號后臺,微信小程序,小程序

2.5 效果演示?

最后后臺開啟服務(wù),在前端進(jìn)行數(shù)據(jù)訪問及微信授權(quán)登入,如下:

小程序賬號后臺,微信小程序,小程序


?最后微信小程序進(jìn)階——后臺交互個(gè)人中心授權(quán)登錄就到這里,祝大家在敲代碼的路上一路通暢!

感謝大家的觀看 !

小程序賬號后臺,微信小程序,小程序

?

到了這里,關(guān)于微信小程序進(jìn)階——后臺交互個(gè)人中心授權(quán)登錄的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • 微信小程序 - 商城項(xiàng)目 - 個(gè)人中心
  • 微信小程序之后臺首頁交互

    微信小程序之后臺首頁交互

    目錄 一.與后臺數(shù)據(jù)進(jìn)行交互request封裝 后臺準(zhǔn)備 測試結(jié)果 ?編輯? ?前端 ?測試結(jié)果 ?二.wxs的介紹以及入門? 測試結(jié)果 后臺準(zhǔn)備 pom.xml文件編寫 建立數(shù)據(jù)表 建立數(shù)據(jù)請求地址類? 定義接口類? 測試結(jié)果 ? ?前端 先關(guān)閉mock ? ?先編寫url地址 ?編寫utils.js 編寫index.js? ?編寫

    2024年02月08日
    瀏覽(22)
  • 微信小程序個(gè)人中心、我的界面(示例一)

    微信小程序個(gè)人中心、我的界面(示例一)

    微信小程序個(gè)人中心、我的界面,使用button按鈕實(shí)現(xiàn)界面布局,更好的將分享好友、獲取頭像等功能展現(xiàn)出來,更多示例界面,請前往我的主頁哦。 1、js代碼: 2、wxml代碼 3、wxss代碼 4、json代碼

    2024年02月11日
    瀏覽(18)
  • 微信小程序個(gè)人中心、我的界面(示例三)

    微信小程序個(gè)人中心、我的界面(示例三)

    微信小程序個(gè)人中心、我的界面,超簡潔界面,代碼粘貼即用。更多微信小程序界面示例,請進(jìn)入我的主頁哦! 1、js代碼 2、wxml代碼 3、wxss代碼 4、json代碼 更多微信小程序示例的分享,請進(jìn)入我的主頁查看哦。。。

    2024年01月24日
    瀏覽(17)
  • 微信小程序個(gè)人中心、我的界面(示例二)

    微信小程序個(gè)人中心、我的界面(示例二)

    微信小程序個(gè)人中心、我的界面,自定義頂部狀態(tài)欄,實(shí)現(xiàn)滾動(dòng)隱藏顯示狀態(tài)信息,界面簡單,代碼粘貼即用。更多微信小程序界面示例,請進(jìn)入我的主頁哦! 1、js代碼 2、wxml代碼 3、wxss代碼 4、json代碼 更多微信小程序示例的分享,請進(jìn)入我的主頁查看哦。。。

    2024年02月11日
    瀏覽(26)
  • 微信小程序之會(huì)議OA首頁后臺交互

    springboot+mybatis appliation.yml 生成mapper接口,model實(shí)體類,mapper映射文件 application.yml 在啟動(dòng)類 Promise 是異步編程的一種解決方案,比傳統(tǒng)的解決方案——回調(diào)函數(shù)和事件——更合理和更強(qiáng)大。它由社區(qū)最早提出和實(shí)現(xiàn),ES6 將其寫進(jìn)了語言標(biāo)準(zhǔn),統(tǒng)一了用法,原生提供了Promise對象

    2024年02月20日
    瀏覽(36)
  • “編輯微信小程序與后臺數(shù)據(jù)交互與微信小程序wxs的使用“

    “編輯微信小程序與后臺數(shù)據(jù)交互與微信小程序wxs的使用“

    在現(xiàn)代移動(dòng)應(yīng)用開發(fā)中,微信小程序已經(jīng)成為了一個(gè)非常流行和廣泛使用的平臺。為了使小程序能夠展示豐富的內(nèi)容和實(shí)現(xiàn)復(fù)雜的功能,與后臺數(shù)據(jù)的交互是至關(guān)重要的。同時(shí),微信小程序還提供了一種特殊的腳本語言——wxs,用于增強(qiáng)小程序的業(yè)務(wù)邏輯處理能力。本篇博客

    2024年02月08日
    瀏覽(25)
  • 【微信小程序】后臺數(shù)據(jù)交互于WX文件使用

    【微信小程序】后臺數(shù)據(jù)交互于WX文件使用

    目錄 一、前期準(zhǔn)備 1.1 數(shù)據(jù)庫準(zhǔn)備 1.2 后端數(shù)據(jù)獲取接口編寫 1.3 前端配置接口 1.4?封裝微信的request請求 ? 二、WXS文件的使用 2.1 WXS簡介 2.2 WXS使用 ? 三、后臺數(shù)據(jù)交互完整代碼 3.1 WXML 3.2 JS 3.3 WXSS 效果圖? 創(chuàng)建數(shù)據(jù)庫: 注意: 字符集選擇 utf8mb4 ,因?yàn)榭赡苡么鎯τ脩粜畔ⅲ?/p>

    2024年02月08日
    瀏覽(27)
  • 微信小程序之首頁-后臺交互及WXS的使用

    微信小程序之首頁-后臺交互及WXS的使用

    目錄 前言? 一.?前后臺數(shù)據(jù)交互及封裝request 1.準(zhǔn)備后臺 1.1 配置數(shù)據(jù)源 ?1.2 部分后臺獲取數(shù)據(jù)方法編寫 2.準(zhǔn)備前端 2.1封裝Request 2.2?前端JS方法編寫 2.3 前端頁面展示index.wxml 二.WXS的使用 1.簡介 2.WXS優(yōu)化OA系統(tǒng) ?2.1 使用及定義 2.2 導(dǎo)入要使用的項(xiàng)目 2.3 優(yōu)化會(huì)議狀態(tài) 2.4 優(yōu)化人

    2024年02月08日
    瀏覽(20)
  • 【小白專用】微信小程序個(gè)人中心、我的界面(示例一)23.11.04

    【小白專用】微信小程序個(gè)人中心、我的界面(示例一)23.11.04

    微信小程序使用button按鈕實(shí)現(xiàn)個(gè)人中心、我的界面(示例一) 微信小程序個(gè)人中心、我的界面,使用button按鈕實(shí)現(xiàn)界面布局,更好的將分享好友、獲取頭像等功能展現(xiàn)出來,更多示例界面,請前往我的主頁哦。 1、js代碼: 2、wxml代碼 3、wxss代碼 4、json代碼

    2024年02月05日
    瀏覽(25)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包