| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- import common from '../../utils/util';
- import main from '../../utils/main';
- const app = getApp();
- Page({
- data: {
- },
- onLoad: function (options) {
- var that = this;
- that.setData({
- Containnerheight: main.getWindowHeight(),
- });
- that.getUserInfo();
- },
- //得到用户信息
- getUserInfo: function () {
- var that = this
- //调用登录接口
- wx.login({
- success: function (res0) {
- app.globalData.userInfo = {};
- app.globalData.userInfo.Code = res0.code;
- console.log("Time2:" + new Date().getTime());
- app.globalData.userInfo.nickName = "陌生用户";
- app.globalData.userInfo.language = "";
- app.globalData.userInfo.gender = "0";
- app.globalData.userInfo.city = "";
- app.globalData.userInfo.province = "";
- app.globalData.userInfo.country = "";
- app.globalData.userInfo.avatarUrl = "../../pages/images/universalpic_face_default_blue_120x120.png";
- that.login(app.globalData.userInfo);
- },
- fail: function () {}
- });
- },
- login: function (param) {
- var that = this;
- main.getLocalHost(function () {
- main.postData('MiaoguoLogin?IsPromotion=true', {
- Code: param.Code,
- NickName: param.nickName,
- Language: param.language,
- Gender: param.gender,
- City: param.city,
- Province: param.province,
- Country: param.country,
- AvatarUrl: param.avatarUrl,
- Introducer: app.globalData.introducer,
- UserSource: app.globalData.userSource,
- SourceID: app.globalData.SourceID,
- LastUserSource: app.globalData.userSource,
- Brand: app.globalData.systemInfo.brand,
- Model: app.globalData.systemInfo.model,
- PixelRatio: app.globalData.systemInfo.pixelRatio,
- ScreenWidth: app.globalData.systemInfo.screenWidth,
- ScreenHeight: app.globalData.systemInfo.screenHeight,
- WindowWidth: app.globalData.systemInfo.windowWidth,
- WindowHeight: app.globalData.systemInfo.windowHeight,
- WXLanguage: app.globalData.systemInfo.language,
- WXVersion: app.globalData.systemInfo.version,
- System: app.globalData.systemInfo.system,
- Platform: app.globalData.systemInfo.platform,
- SDKVersion: app.globalData.systemInfo.SDKVersion,
- ProgramVersion: app.globalData.Version,
- }, function (data) {
- console.log("Time4:" + new Date().getTime());
- if (!data) {
- timeout3 = setTimeout(function () {
- that.getUserInfo();
- console.log("reboot:" + new Date().getTime());
- }, 2000);
- } else {
- app.globalData.userInfo = data;
- //console.log(data);
- }
- });
- });
- },
- goto: function (e) {
- var url = e.currentTarget.dataset.url;
- wx.navigateTo({
- url: url,
- });
- },
- onShareAppMessage: function () {
- return {
- title: app.globalData.ShareTitle,
- path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
- imageUrl: app.globalData.ShareImage,
- }
- },
- })
|