// pages/mine/wxml/allthesellers/allthesellers.js const app = getApp(); Page({ /** * 页面的初始数据 */ data: { userInfo: {}, hasUserInfo: false, canIUse: wx.canIUse('button.open-type.getUserInfo'), Auctioneer: true, wxUserInfo: true, bangding: false, dataObjs: [], operating:false }, establish: function () { var _this = this wx.request({ url: app.globalData.prodUrl + 'web-pm/wx/pm/check_live_room', data: { shop_id: _this.data.shop_id }, header: { 'ydw-token': wx.getStorageSync('key').ydw_token }, success: function (data) { if (data.data.success == true) { wx.navigateTo({ url: '../establish/establish' }) } else { wx.showModal({ title: '提示', content: '一个店铺只能有一个拍卖会, 您已有拍卖会', success: function (res) { if (res.confirm) { } else if (res.cancel) { } } }) } }, }); }, onLoad: function (options) { var _this = this _this.userAuthorize(); var mobile = wx.getStorageSync('persion').persion.mobile; var kid = wx.getStorageSync('persion').persion.kid; if (kid === "1086544357139550208" || kid === "1086539898040750080" || kid === "1065422099365105664") { _this.setData({ operating: true }) }; if (mobile) { _this.setData({ bangding: false }) } else { _this.setData({ bangding: true }) } if (app.globalData.userInfo) { _this.setData({ userInfo: app.globalData.userInfo, hasUserInfo: true }) } else if (_this.data.canIUse) { // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 // 所以此处加入 callback 以防止这种情况 app.userInfoReadyCallback = res => { _this.setData({ userInfo: res.userInfo, hasUserInfo: true }) } } else { // 在没有 open-type=getUserInfo 版本的兼容处理 wx.getUserInfo({ success: res => { app.globalData.userInfo = res.userInfo _this.setData({ userInfo: res.userInfo, hasUserInfo: true }) } }) } // this.data.dataObjs = JSON.parse(options.dataObjs); if (options.shopkid){ _this.setData({ shop_id: options.shopkid }) } _this.setData({ name: options.name }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, imgClickShow: function () { var imgUrl = this.data.userInfo.avatarUrl; wx.previewImage({ urls: [imgUrl], success: function () { } }) }, userAuthorize: function () { wx.getSetting({ success: res => { if (!res.authSetting['scope.userInfo']) { this.setData({ wxUserInfo: false }); } else { this.setData({ wxUserInfo: true }); wx.getUserInfo({ success: res => { this.setData({ userInfo: res.userInfo, hasUserInfo: true }) } }) } } }) }, bindGetUserInfo: function (e) { var that = this; if (e.detail.userInfo) { //用户按了允许授权按钮 wx.showModal({ content: "授权成功,第一次登陆请先修改个人信息", showCancel: false, confirmText: '知道了', success: function (res) { that.onLoad() } }) } else { wx.showModal({ content: "您已拒绝授权", showCancel: false, confirmText: '知道了', success: function (res) { that.setData({ showModal2: false }); } }) } } })