123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- // pages/components/auth/auth.js
- const api = require('../../../config');
- let app = getApp();
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- },
- /**
- * 组件的初始数据
- */
- data: {
- },
- /**
- * 组件的方法列表
- */
- methods: {
- userInfoHandler(e) {
- let self = this
- if (e.detail.errMsg == "getUserInfo:ok") {
- app.globalData.userInfo = e.detail.userInfo;
- app.globalData.userInfo.nickname = e.detail.userInfo.nickName;
- let userInfo = Object.assign({}, app.globalData.userId, app.globalData.userInfo);
- wx.request({
- url: api.host,
- method: 'GET',
- data: {
- user_info: userInfo,
- act: "login",
- op: "wxauthen",
- client_type: "mini"
- },
- success: function (res) {
- wx.setStorageSync('session_id', res.data.datas.HPHPSESSID);
- if (res.statusCode == 200) {
- self.triggerEvent('getAuth', {
- userInfo
- })
- }
- else {
- wx.showToast({
- icon: 'none',
- title: '登陆失败',
- duration: 2000
- })
- }
- }
- })
- }
- }
- }
- })
|