index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <!-- 自定义Tabbar组件 -->
  2. <template>
  3. <view class="custom-tabbar" :class="isIPad ? 'ipad' : ''">
  4. <view class="cu-bar tabbar bg-white">
  5. <view class="action" @click="onChange(0, '/patient/views/home/index')"
  6. :class="activeIndex == 0 ? ' text-blue' : 'text-gray'">
  7. <view class="cuIcon-home"></view> 首页
  8. </view>
  9. <view class="flex justify-center align-center">
  10. <view class="action" @click="onChange(0, '/patient/views/home/index')"
  11. :class="activeIndex == 1 ? ' text-blue' : 'text-gray'">
  12. <view class="cuIcon-group_fill"></view> 群组
  13. </view>
  14. </view>
  15. <view class="action" @click="onChange(0, '/patient/views/user-center/index')"
  16. :class="activeIndex == 2 ? ' text-blue' : 'text-gray'">
  17. <view class="cuIcon-friendfavor"></view> 我的
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. let app = getApp();
  24. import api from '@/utils/api'
  25. import util from '@/utils/util'
  26. import __config from '@/config/env';
  27. export default {
  28. props: {
  29. active: {
  30. type: Number,
  31. default: 0
  32. }
  33. },
  34. data() {
  35. return {
  36. isIPad: app.globalData.isIPad,
  37. activeIndex: this.active,
  38. tabbarImg: util.spliceBgImgUrl('/tabbar-btn.png'),
  39. };
  40. },
  41. methods: {
  42. onChange(index, url) {
  43. util.reLaunchToPage(url)
  44. },
  45. /* 跳转到预约页面 */
  46. goToSubscribePage(){
  47. let _this = this
  48. let params = {
  49. pageNum: 1,
  50. pageSize: 1
  51. }
  52. api.getPatientPageList(params).then(res => {
  53. if(res.data.total > 0){
  54. util.navigateToPage('/patient/views/subscribe/index')
  55. }else{
  56. uni.showModal({
  57. title: '提示',
  58. content: '查询到您还没有添加就诊人, 是否前去添加就诊人?',
  59. showCancel: true,
  60. confimrText: '前往添加',
  61. confirmColor: '#1857EA',
  62. success: function(res) {
  63. if (res.confirm) {
  64. console.log('用户点击确定');
  65. util.navigateToPage('/patient/views/user-center/patient-manage/index')
  66. } else if (res.cancel) {
  67. console.log('用户点击取消');
  68. }
  69. }
  70. });
  71. }
  72. })
  73. }
  74. }
  75. };
  76. </script>
  77. <style lang="scss">
  78. .custom-tabbar {
  79. position: fixed;
  80. bottom: 0;
  81. left: 0;
  82. right: 0;
  83. z-index: 1;
  84. clear: both;
  85. .tabbar-icon-btn{
  86. background-repeat: no-repeat;
  87. background-size: 100%;
  88. width: 110upx;
  89. height: 70rpx;
  90. text-align: center;
  91. }
  92. }
  93. .custom-tabbar.ipad {
  94. position: fixed;
  95. bottom: 0;
  96. left: 0;
  97. right: 0;
  98. z-index: 1;
  99. clear: both;
  100. .tabbar-icon-btn{
  101. background-repeat: no-repeat;
  102. background-size: 100%;
  103. width: 110upx;
  104. height: 40rpx;
  105. text-align: center;
  106. }
  107. }
  108. </style>