index.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <template>
  2. <view class="content main-bg">
  3. <news ref="news" v-if="type === '2'"></news>
  4. <news ref="news" v-if="type === '3'"></news>
  5. <news ref="news" v-else-if="type === '1'"></news>
  6. <goods ref="goods" v-else-if="type === '4'"></goods>
  7. </view>
  8. </template>
  9. <script>
  10. import news from '@/pages/soldier/news/index'
  11. import goods from '@/pages/manage/goods/index'
  12. export default {
  13. components:{
  14. news,
  15. goods,
  16. },
  17. data() {
  18. return {
  19. type: ''
  20. }
  21. },
  22. onLoad() {
  23. let role = uni.getStorageSync('role');
  24. this.type = role;
  25. if(this.type === '4'){
  26. uni.setNavigationBarTitle({
  27. title: '商品审核'
  28. })
  29. };
  30. setTimeout(function () {
  31. console.log('start pulldown');
  32. }, 1000);
  33. uni.startPullDownRefresh();
  34. },
  35. onPullDownRefresh() {
  36. let role = uni.getStorageSync('role');
  37. this.type = role;
  38. if(this.type === '4'){
  39. this.handleShow();
  40. }else{
  41. this.handleMain();
  42. }
  43. setTimeout(function () {
  44. uni.stopPullDownRefresh();
  45. }, 1000);
  46. },
  47. onShow() {
  48. let role = uni.getStorageSync('role');
  49. this.type = role
  50. if(this.type === '4'){
  51. this.handleShow();
  52. }else{
  53. this.handleMain();
  54. }
  55. },
  56. methods: {
  57. handleShow(){
  58. this.$refs.goods.show("qwe")
  59. },
  60. handleMain(){
  61. this.$refs.news.show("qwe")
  62. }
  63. },
  64. }
  65. </script>
  66. <style>
  67. </style>