allthesellers.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. // pages/mine/wxml/allthesellers/allthesellers.js
  2. const app = getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. userInfo: {},
  9. hasUserInfo: false,
  10. canIUse: wx.canIUse('button.open-type.getUserInfo'),
  11. Auctioneer: true,
  12. wxUserInfo: true,
  13. bangding: false,
  14. dataObjs: [],
  15. operating:false
  16. },
  17. establish: function () {
  18. var _this = this
  19. wx.request({
  20. url: app.globalData.prodUrl + 'web-pm/wx/pm/check_live_room',
  21. data: {
  22. shop_id: _this.data.shop_id
  23. },
  24. header: {
  25. 'ydw-token': wx.getStorageSync('key').ydw_token
  26. },
  27. success: function (data) {
  28. if (data.data.success == true) {
  29. wx.navigateTo({
  30. url: '../establish/establish'
  31. })
  32. } else {
  33. wx.showModal({
  34. title: '提示',
  35. content: '一个店铺只能有一个拍卖会, 您已有拍卖会',
  36. success: function (res) {
  37. if (res.confirm) {
  38. } else if (res.cancel) {
  39. }
  40. }
  41. })
  42. }
  43. },
  44. });
  45. },
  46. onLoad: function (options) {
  47. var _this = this
  48. _this.userAuthorize();
  49. var mobile = wx.getStorageSync('persion').persion.mobile;
  50. var kid = wx.getStorageSync('persion').persion.kid;
  51. if (kid === "1086544357139550208" || kid === "1086539898040750080" || kid === "1065422099365105664") {
  52. _this.setData({
  53. operating: true
  54. })
  55. };
  56. if (mobile) {
  57. _this.setData({
  58. bangding: false
  59. })
  60. } else {
  61. _this.setData({
  62. bangding: true
  63. })
  64. }
  65. if (app.globalData.userInfo) {
  66. _this.setData({
  67. userInfo: app.globalData.userInfo,
  68. hasUserInfo: true
  69. })
  70. } else if (_this.data.canIUse) {
  71. // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
  72. // 所以此处加入 callback 以防止这种情况
  73. app.userInfoReadyCallback = res => {
  74. _this.setData({
  75. userInfo: res.userInfo,
  76. hasUserInfo: true
  77. })
  78. }
  79. } else {
  80. // 在没有 open-type=getUserInfo 版本的兼容处理
  81. wx.getUserInfo({
  82. success: res => {
  83. app.globalData.userInfo = res.userInfo
  84. _this.setData({
  85. userInfo: res.userInfo,
  86. hasUserInfo: true
  87. })
  88. }
  89. })
  90. }
  91. // this.data.dataObjs = JSON.parse(options.dataObjs);
  92. if (options.shopkid){
  93. _this.setData({
  94. shop_id: options.shopkid
  95. })
  96. }
  97. _this.setData({
  98. name: options.name
  99. })
  100. },
  101. /**
  102. * 生命周期函数--监听页面初次渲染完成
  103. */
  104. onReady: function () {
  105. },
  106. /**
  107. * 生命周期函数--监听页面显示
  108. */
  109. onShow: function () {
  110. },
  111. /**
  112. * 生命周期函数--监听页面隐藏
  113. */
  114. onHide: function () {
  115. },
  116. /**
  117. * 生命周期函数--监听页面卸载
  118. */
  119. onUnload: function () {
  120. },
  121. /**
  122. * 页面相关事件处理函数--监听用户下拉动作
  123. */
  124. onPullDownRefresh: function () {
  125. },
  126. /**
  127. * 页面上拉触底事件的处理函数
  128. */
  129. onReachBottom: function () {
  130. },
  131. imgClickShow: function () {
  132. var imgUrl = this.data.userInfo.avatarUrl;
  133. wx.previewImage({
  134. urls: [imgUrl],
  135. success: function () {
  136. }
  137. })
  138. },
  139. userAuthorize: function () {
  140. wx.getSetting({
  141. success: res => {
  142. if (!res.authSetting['scope.userInfo']) {
  143. this.setData({
  144. wxUserInfo: false
  145. });
  146. } else {
  147. this.setData({
  148. wxUserInfo: true
  149. });
  150. wx.getUserInfo({
  151. success: res => {
  152. this.setData({
  153. userInfo: res.userInfo,
  154. hasUserInfo: true
  155. })
  156. }
  157. })
  158. }
  159. }
  160. })
  161. },
  162. bindGetUserInfo: function (e) {
  163. var that = this;
  164. if (e.detail.userInfo) {
  165. //用户按了允许授权按钮
  166. wx.showModal({
  167. content: "授权成功,第一次登陆请先修改个人信息",
  168. showCancel: false,
  169. confirmText: '知道了',
  170. success: function (res) {
  171. that.onLoad()
  172. }
  173. })
  174. } else {
  175. wx.showModal({
  176. content: "您已拒绝授权",
  177. showCancel: false,
  178. confirmText: '知道了',
  179. success: function (res) {
  180. that.setData({
  181. showModal2: false
  182. });
  183. }
  184. })
  185. }
  186. }
  187. })