mixins.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. import {
  2. mapGetters
  3. } from "vuex"
  4. let App = getApp()
  5. export default {
  6. components: {},
  7. data() {
  8. return {
  9. appData: null,
  10. scrollTop: 0,
  11. areaMsgView: null,
  12. ywhId: ''
  13. }
  14. },
  15. computed: {
  16. ...mapGetters(["userComplete", "isLogin", "token", "userInfo", "userOrgid", "wxInfo", "financeMInfo",
  17. "financeYInfo", "userTotal"
  18. ])
  19. },
  20. watch: {
  21. userComplete: {
  22. handler(nval, oval) {
  23. if (nval) {
  24. this.loadData('rush')
  25. }
  26. },
  27. immediate: true,
  28. deep: true
  29. },
  30. userOrgid(val) {
  31. // console.log('mixins监测userOrgid', val)
  32. if (this.ywhId != val) {
  33. this.ywhId = val
  34. this.loadPageData('rush')
  35. // if (this.userInfo && this.userInfo.orgId) {
  36. // this.ywhId = this.userInfo.orgId
  37. // }
  38. }
  39. }
  40. },
  41. onShow() {
  42. this.appData = App.globalData ? App.globalData : getApp().globalData;
  43. // 关闭主导航
  44. uni.hideTabBar();
  45. },
  46. onLoad(op) {
  47. // 关闭分享
  48. uni.hideShareMenu();
  49. this.appData = App.globalData ? App.globalData : getApp().globalData;
  50. },
  51. created() {
  52. this.appData = App.globalData ? App.globalData : getApp().globalData;
  53. },
  54. onReady() {
  55. // 页面初次渲染完成
  56. },
  57. methods: {
  58. loadData(type) {
  59. // type="rush" 刷新
  60. },
  61. loadPageData(type) {
  62. },
  63. rushUserInfo() {
  64. if (this.isLogin && this.userComplete) {
  65. this.$store.dispatch('getUserInfo').then(res => {}).catch(res => {});
  66. }
  67. },
  68. openShare() {
  69. // 开启分享
  70. uni.showShareMenu();
  71. }
  72. },
  73. onPullDownRefresh() {},
  74. onReachBottom() {},
  75. onPageScroll(e) {
  76. this.scrollTop = e.scrollTop;
  77. },
  78. onShareAppMessage: function(res) {
  79. // 分享到好友
  80. if (res.from === 'button') {
  81. // 来自页面内转发按钮
  82. } else if (res.from === 'menu') {
  83. // 来自页面右上角的分享事件
  84. }
  85. },
  86. onShareTimeline() {
  87. // 分享到朋友圈
  88. // return {
  89. // title: '棱接龙',
  90. // path: '/pages/index/index',
  91. // imageUrl: 'https://cdn.uviewui.com/uview/swiper/1.jpg'
  92. // };
  93. }
  94. }