index.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // index.js
  2. // 获取应用实例
  3. const app = getApp()
  4. import fetchutil from '../../utils/http'
  5. var mixins = require('../../utils/mixins')
  6. var {
  7. CDN_URL
  8. } = require('../../utils/util')
  9. Page({
  10. mixins: [mixins],
  11. data: {
  12. CDN_URL,
  13. isShowVideo: false,
  14. isShowAuthorize: false
  15. },
  16. onLoad() {
  17. },
  18. onShow(){
  19. this.getUserInfo()
  20. },
  21. tapAuthclose() {
  22. this.setData({
  23. isShowAuthorize: false
  24. })
  25. },
  26. tapAuthComfirm() {
  27. this.setData({
  28. isShowAuthorize: false,
  29. isShowVideo: true
  30. })
  31. },
  32. onSkipButtonTap() {
  33. this.setData({
  34. isShowVideo: false
  35. })
  36. wx.navigateTo({
  37. url: '/pages/webview/index',
  38. })
  39. },
  40. onStart() {
  41. console.log(app.globalData.userInfo);
  42. let {
  43. userInfo
  44. } = app.globalData
  45. if (!userInfo.avatarUrl || !userInfo.nickName) {
  46. this.setData({
  47. isShowAuthorize: true
  48. })
  49. } else {
  50. this.setData({
  51. isShowVideo: true
  52. })
  53. }
  54. },
  55. getUserInfo() {
  56. fetchutil.get(`api/cms/wxUser/getUserInfo`, {}, {}).then((res) => {
  57. app.globalData.userInfo = res.data
  58. }).catch(() => {})
  59. },
  60. })