bottomSuspensionFrame.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <swiper class="box" :current-item-id="current" circular vertical disable-touch>
  3. <swiper-item class="swiper-item" item-id="index">
  4. <view class="item" v-for="item in index" :key="item.name"
  5. @click="item.name == showPageName ? update() : onClick('index', item.name)">
  6. <u-loading-icon v-if="item.loading" mode="circle" />
  7. <text v-else :style="{ fontWeight: item.name == showPageName ? 'bold' : 'normal' }">
  8. {{ item.name }}
  9. </text>
  10. </view>
  11. <image v-if="!sightseer" class="image" src="/static/c+selected.svg" mode="widthFix"
  12. @click="onClick('cloud', '工作台')" />
  13. </swiper-item>
  14. <swiper-item v-if="!sightseer" class="swiper-item" item-id="cloud">
  15. <image class="image" :src="showPageName == '工作台' ? '/static/c+unselected.svg' : '/static/c+selected.svg'"
  16. mode="widthFix" @click="onClick('cloud', '工作台')" />
  17. <block v-for="item in cloud" :key="item.name">
  18. <block v-if="item.name == '工作台'" />
  19. <view v-else class="item" @click="item.name == showPageName ? update() : onClick('cloud', item.name)">
  20. <u-loading-icon v-if="item.loading" mode="circle" />
  21. <text v-else :style="{ fontWeight: item.name == showPageName ? 'bold' : 'normal' }">
  22. {{ item.name }}
  23. </text>
  24. </view>
  25. </block>
  26. </swiper-item>
  27. </swiper>
  28. </template>
  29. <script>
  30. export default {
  31. data() {
  32. return {
  33. sightseer: true,
  34. current: "index",
  35. showPageName: "",
  36. indexLastPage: '',
  37. cloudLastPage: '',
  38. index: [{
  39. name: "首页"
  40. }, {
  41. name: "活动"
  42. }, {
  43. name: "案例"
  44. }, {
  45. name: "视频"
  46. }],
  47. cloud: [{
  48. name: "工作台"
  49. }, {
  50. name: "资料库"
  51. }, {
  52. name: "商学院"
  53. }, {
  54. name: "单品"
  55. }, {
  56. name: "首页"
  57. }],
  58. countDown: null,
  59. }
  60. },
  61. props: {
  62. onChange: {
  63. type: Function
  64. }
  65. },
  66. mounted() {
  67. this.init();
  68. // #ifdef !MP-WEIXIN
  69. this.onClick(this.$parent.$parent.swiperItemID, this.$parent.$parent.page)
  70. // #endif
  71. },
  72. methods: {
  73. init() {
  74. const systemInitIsComplete = this.$Http.systemInitIsComplete;
  75. if (!systemInitIsComplete || typeof systemInitIsComplete == 'object') {
  76. this.$Http.HomePageStartRendering = render(this)
  77. } else {
  78. render(this)
  79. }
  80. function render(that) {
  81. let sightseer = uni.getStorageSync('userMsg').usertype == 99;
  82. that.sightseer = sightseer;
  83. console.log('是否游客', sightseer)
  84. if (sightseer) that.index = that.index.concat({ name: "我的" })
  85. }
  86. },
  87. onClick(current, name, update = false, params = null) {
  88. if (name == '首页') current = 'index';
  89. const item = this[current].find(v => v.name == name),
  90. that = this;
  91. if (typeof item.loading != 'boolean' || update) {
  92. item.loading = true;
  93. update = true;
  94. }
  95. this[current + 'LastPage'] = name;
  96. this.current = current;
  97. this.showPageName = name;
  98. this.$emit("onChange", {
  99. current, name, update, callBack, params
  100. })
  101. function callBack(loading = false) {
  102. item.loading = loading;
  103. that[current] = JSON.parse(JSON.stringify(that[current]));
  104. }
  105. },
  106. update() {
  107. if (this.countDown) {
  108. this.onClick(this.current, this.showPageName, true)
  109. } else {
  110. this.countDown = setTimeout(() => {
  111. clearTimeout(this.countDown)
  112. this.countDown = null;
  113. }, 300)
  114. }
  115. },
  116. },
  117. }
  118. </script>
  119. <style lang="scss">
  120. .box {
  121. position: fixed;
  122. width: 355px;
  123. height: 50px;
  124. background: rgba(255, 255, 255, 0.95);
  125. box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.16);
  126. border-radius: 50px;
  127. left: 10px;
  128. bottom: 20px;
  129. z-index: 3;
  130. .swiper-item {
  131. display: flex;
  132. align-items: center;
  133. justify-content: space-between;
  134. width: 355px;
  135. height: 50px;
  136. padding: 0 30px;
  137. box-sizing: border-box;
  138. .item {
  139. font-family: Source Han Sans SC, Source Han Sans SC;
  140. font-size: 16px;
  141. color: #666666;
  142. padding: 10px;
  143. }
  144. .image {
  145. width: 40px;
  146. padding: 4px;
  147. }
  148. }
  149. }
  150. </style>