| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- import common from '../../utils/util';
- import main from '../../utils/main';
- const app = getApp();
- Page({
- data: {
- Version:app.globalData.Version,
- },
- 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 {
- if (!data.IdentityCard)
- data.IdentityCard="";
- if (!data.Phone)
- data.Phone="";
- if (!data.WXAccount)
- data.WXAccount="";
- if (!data.RealName)
- data.RealName="";
-
- app.globalData.userInfo = data;
- that.setData({
- IsPromoter:app.globalData.userInfo.IsPromoter,
- });
- that.getUserList();
- }
- });
- });
- },
- getUserList:function(){
- var that = this;
- var url="GetAgentUserList";
- main.getData(url, function (data) {
- if (data) {
- that.setData({
- UserList:data,
- });
- }
- });
- },
- goto: function (e) {
- var url = e.currentTarget.dataset.url;
- wx.navigateTo({
- url: url,
- });
- },
- setSelectUser: function (e) {
- var that = this;
- var userid = e.currentTarget.dataset.userid;
- wx.setStorageSync("UserID", userid);
-
- app.globalData.userInfo.UserID = userid;
- that.getUserInfo2(userid,"",function(data){
- wx.setNavigationBarTitle({
- title: data.NickName
- });
- if (!data.WXAccount)
- data.WXAccount="";
- if (!data.RealName)
- data.RealName="";
- app.globalData.userInfo=data;
- that.setData({
- IsPromoter:app.globalData.userInfo.IsPromoter,
- });
- });
- },
- getUserInfo2:function(userID,fieldStr,callback){
- var url = "GetMiaoguoWXUserInfo?UserID=" + userID + fieldStr;
- main.getData(url, function (data) {
- if (data) {
- callback(data);
- }
- });
- },
- onShareAppMessage: function () {
- return {
- title: app.globalData.ShareTitle,
- path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
- imageUrl: app.globalData.ShareImage,
- }
- },
- })
|