personalSettle.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. // pages/user/personalSettle/personalSettle.js
  2. const app = getApp();
  3. const api = app.api;
  4. import regeneratorRuntime from '../../..//utils/runtime'
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. userInfo:undefined,
  11. isLogin:false,
  12. isShowPop:false,
  13. isAdmin: true
  14. },
  15. /**
  16. * 生命周期函数--监听页面加载
  17. */
  18. onLoad: function (options) {
  19. // this.getData();
  20. },
  21. /**
  22. * 生命周期函数--监听页面初次渲染完成
  23. */
  24. onReady: function () {
  25. },
  26. /**
  27. * 生命周期函数--监听页面显示
  28. */
  29. onShow: async function () {
  30. this.getData();
  31. },
  32. async hasLogins(){
  33. if(!this.data.isLogin){
  34. if(await app.authorization()){
  35. this.notLoginGo();
  36. }
  37. this.setData({
  38. isLogin:true
  39. });
  40. return
  41. }else {
  42. this.notLoginGo();
  43. }
  44. },
  45. getData(){
  46. app.post(api.getBaseInfo,{},{noLogin:true,showLoading:false, needToken:false}).then(res=>{
  47. this.setData({
  48. userInfo:res.data
  49. })
  50. })
  51. },
  52. notLoginGo: async function(){
  53. const userInfo = await app.getToken();
  54. if (!userInfo.auth) {
  55. wx.switchTab({
  56. url:"/pages/index/index",
  57. success:(res)=>{
  58. this.setData({
  59. isLogin:false
  60. });
  61. }
  62. })
  63. return false
  64. }else{
  65. this.getData();
  66. }
  67. },
  68. /**
  69. * 生命周期函数--监听页面隐藏
  70. */
  71. onHide: function () {
  72. },
  73. /**
  74. * 生命周期函数--监听页面卸载
  75. */
  76. onUnload: function () {
  77. },
  78. /**
  79. * 页面相关事件处理函数--监听用户下拉动作
  80. */
  81. onPullDownRefresh: function () {
  82. },
  83. /**
  84. * 页面上拉触底事件的处理函数
  85. */
  86. onReachBottom: function () {
  87. },
  88. /**
  89. * 用户点击右上角分享
  90. */
  91. onShareAppMessage: function () {
  92. },
  93. artUpload: function(){
  94. const that = this;
  95. app.post(api.getUserSettleInfo,{},{
  96. needToken:false
  97. }).then(res => {
  98. const settleInfo = res.data;
  99. if(settleInfo.isVerification==0){
  100. that.showPop()
  101. }else{
  102. wx.navigateTo({
  103. url: '/pages/user/artUpload/artUpload'
  104. })
  105. }
  106. })
  107. },
  108. goMall(){
  109. wx.navigateToMiniProgram({
  110. appId: 'wx7e1594d8fd280a80'
  111. });
  112. // wx.showToast({
  113. // title: '敬请期待',
  114. // icon: 'none',
  115. // duration: 2000
  116. // })
  117. },
  118. showPop(){
  119. this.setData({
  120. isShowPop:true
  121. });
  122. },
  123. hidePop(){
  124. this.setData({
  125. isShowPop:false
  126. });
  127. },
  128. // 邀请码核销
  129. openScan(){
  130. wx.scanCode({
  131. onlyFromCamera: true, // 仅允许从相机扫码
  132. scanType: ['qrCode'], // 仅支持二维码
  133. success (res) {
  134. wx.navigateTo({
  135. url: '../../invitation/verify/index?id=' + res.result,
  136. })
  137. },
  138. fail () {
  139. wx.showToast({
  140. title: '相机调用失败,请检查微信是否开启相机的使用权限'
  141. })
  142. }
  143. })
  144. }
  145. })