index.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <!-- 货源 -->
  2. <template>
  3. <view class="content">
  4. 找车
  5. </view>
  6. </template>
  7. <script>
  8. var that
  9. import {
  10. mapState
  11. } from 'vuex';
  12. import MescrollItem from "./mescroll-swiper-item.vue";
  13. export default {
  14. components: {
  15. MescrollItem
  16. },
  17. data() {
  18. return {
  19. src: 'https://cdn.uviewui.com/uview/album/1.jpg',
  20. height: "", // 需要固定swiper的高度
  21. tabs: [{name:'推荐'}, {name:'按时间'}, {name:'按距离'}, {name:'运费先付'}],
  22. tabIndex: 0 // 当前tab的下标
  23. }
  24. },
  25. onShow() {
  26. console.log(1212)
  27. this.$request.baseRequest('get', '/newsInfo/unreadMessage', {
  28. reCommonId: this.userInfo.id,
  29. }).then(res3 => {
  30. if (res3.data||res3.data==0) {
  31. let name = 'myTip';
  32. let value = res3.data
  33. console.log(value)
  34. if (value == 0) {
  35. uni.removeTabBarBadge({
  36. index: 2
  37. })
  38. }
  39. this.$store.commit('$uStore', {
  40. name,
  41. value
  42. });
  43. if (value != 0 && value) {
  44. uni.setTabBarBadge({
  45. index: 2,
  46. text: value + ""
  47. })
  48. }
  49. }
  50. })
  51. },
  52. onLoad() {
  53. let _isHave = this.$utils.getRoles('aaa')
  54. console.log(_isHave)
  55. // 需要固定swiper的高度 (需减去悬浮tabs的高度64rpx)
  56. this.height = uni.getSystemInfoSync().windowHeight - uni.upx2px(64) + 'px'
  57. },
  58. computed: {
  59. ...mapState(['hasLogin', 'userInfo', 'firstAuthentication'])
  60. },
  61. methods: {
  62. changeCity(type) {
  63. console.log(type)
  64. },
  65. swiperChange(e) {
  66. this.tabIndex = e.detail.current
  67. }
  68. }
  69. }
  70. </script>
  71. <style scoped lang="scss">
  72. </style>