import common from '../../utils/util'; import main from '../../utils/main'; const app = getApp(); Page({ data: { }, onLoad: function (options) { var that = this; if (options && options.type && options.type == "bebound") { if (app.globalData.userSource=="1007"){ that.setData({ ShowPanel: "bebound", ParentUserID: options.ParentUserID, NickName: options.NickName, }); that.download(options.AvatarUrl); } else{ wx.showModal({ title: '抱歉', content: '绑定功能只能用于朋友单聊', showCancel: false, confirmText: "知道了", success:function(){ wx.reLaunch({ url: '../index/index', }) } }); } } else { main.getData("GetUserBindingList?UserID=" + app.globalData.userInfo.UserID, function (data) { if (data && data.length>0){ that.setData({ List:data, ShowPanel: "unbinding", }); } else{ that.setData({ ShowPanel: "binding", }); } }); } that.setData({ Containnerheight: main.getWindowHeight(), }); }, download: function (avatarUrl){ var that=this; wx.downloadFile({ url: avatarUrl, success(res) { if (res.statusCode === 200) { that.setData({ AvatarUrl: res.tempFilePath, }); } } }); }, onShow: function () { var that = this; wx.getSetting({ success(res) { if (res.authSetting['scope.userInfo']) { } else { wx.navigateTo({ url: '../index/accredit', }); } } }); }, shareFinished: function () { wx.showModal({ title: '等待对方接受邀请', content: '请尽快与对方联系确认邀请', showCancel: false, confirmText: "知道了", }); }, gotoBinding: function () { var that = this; main.getData("UpdateUserMemberInfo?UserID=" + app.globalData.userInfo.UserID + "&ParentUserID=" + this.data.ParentUserID, function (data) { wx.reLaunch({ url: '../index/index', }) }); }, gotoUnBinding: function () { var that = this; main.getData("UpdateUserBinding?ParentUserID=" + app.globalData.userInfo.UserID, function (data) { wx.reLaunch({ url: '../index/index', }) }); }, onShareAppMessage: function () { if (this.data.ShowPanel == "binding") { var path = '/pages/index/index?type=bebound&ParentUserID=' + app.globalData.userInfo.UserID; path += "&NickName=" + app.globalData.userInfo.NickName; path += "&AvatarUrl=" + app.globalData.userInfo.AvatarUrl; return { title: app.globalData.userInfo.NickName, path: path, imageUrl: "../images/program_screenshot_bindaccount.png", } } }, })