1234567891011121314151617181920212223242526272829303132333435 |
- const app = getApp();
- var filters = {
- getSessionKey: function () {
- wx.checkSession({
- success: (res) => {
- console.log(res.errMsg);
- app.globalData.publicUrl = res.errMsg;
- return res.errMsg;
- },
- fail() {
- wx.login({
- success(res) {
- console.log(res);
- var code = res.code
- wx.request({
- url: app.globalData.publicUrl + '/wx/user/wx7e7a46e129d6cd0f/login',
- method: "get",
- data: {
- code
- },
- success: function (res) {
- console.log(res.data.openid);
- that.setData(res.data);
- return res.data
- }
- })
- }
- })
- }
- })
- }
- }
- module.exports = {
- getSessionKey: filters.getSessionKey
- }
|