index.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 userInfo = app.globalData.userInfo || {}
  43. if (!userInfo.avatarUrl || !userInfo.nickName) {
  44. this.setData({
  45. isShowAuthorize: true
  46. })
  47. } else {
  48. this.setData({
  49. isShowVideo: true
  50. })
  51. }
  52. },
  53. getUserInfo() {
  54. fetchutil.get(`api/cms/wxUser/getUserInfo`, {}, {}).then((res) => {
  55. app.globalData.userInfo = res.data
  56. }).catch(() => { })
  57. },
  58. })