| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- import common from '../../utils/util';
- import main from '../../utils/main';
- const app = getApp();
- Page({
- data: {
- },
- onLoad: function (options) {
- const that = this;
- if (options) {
- if (options.UserID) {
- console.log("UserID:" + options.UserID);
- app.globalData.introducer = options.UserID;
- }
- if (options.goto) {
- console.log("goto:" + options.goto);
- app.globalData.goto = options.goto;
- }
- if (options.SourceID) {
- console.log("SourceID:" + options.SourceID);
- app.globalData.SourceID = options.SourceID;
- }
- // 扫码介绍人
- if (options.scene) {
- var scene = decodeURIComponent(options.scene);
- console.log("scene:" + scene);
- var introducer = 0;
- if (scene.indexOf("UserID") >= 0)
- introducer = scene.substr(scene.indexOf("UserID") + 7);
- console.log("introducer:" + introducer);
- app.globalData.introducer = scene;
- }
- if (options.ProductID) {
- this.setData({
- ProductID: options.ProductID,
- ProductUserID: options.ProductUserID,
- });
- }
- }
- that.setData({
- Containnerheight: main.getWindowHeight(),
- });
- this.getUserInfo();
- },
- //得到用户信息
- getUserInfo: function (cb) {
- var that = this
- //调用登录接口
- wx.login({
- success: function (res0) {
- app.globalData.userInfo = {};
- app.globalData.userInfo.Code = res0.code;
- //console.log("Code:" + res0.code);app.globalData.userInfo.nickName = "陌生用户";
- that.login(app.globalData.userInfo);
-
- },
- fail: function () {
- setTimeout(function () {
- that.getUserInfo();
- console.log("reboot:" + new Date().getTime());
- }, 2000);
- }
- });
- },
- login: function (param) {
- var that = this;
- main.getLocalHost(function () {
- main.postData('YJBDCLogin', {
- Code: param.Code,
- 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("UserInfo:" + data);
- if (!data) {
- setTimeout(function () {
- that.getUserInfo();
- console.log("reboot:" + new Date().getTime());
- }, 2000);
- }
- else {
- app.globalData.userInfo = data;
- app.globalData.userInfo.IsShow = data.IsShow;
-
- app.globalData.IsLocked = data.IsLocked;
- //app.globalData.userInfo.AvatarUrl = param.avatarUrl;
- //setTimeout(function () {
- wx.redirectTo({
- url: '../main/index'
- })
- //}, 2000);
- }
- });
- });
- },
-
- onShareAppMessage: function () {
- return {
- title: app.globalData.ShareTitle,
- path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
- imageUrl: app.globalData.ShareImage,
- }
- },
- })
|