bottomSuspensionFrame.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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 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. name: "我的"
  48. }],
  49. cloud: [{
  50. name: "工作台"
  51. }, {
  52. name: "资料库"
  53. }, {
  54. name: "商学院"
  55. }, {
  56. name: "单品"
  57. }, {
  58. name: "首页"
  59. }],
  60. countDown: null,
  61. }
  62. },
  63. props: {
  64. onChange: {
  65. type: Function
  66. }
  67. },
  68. mounted() {
  69. this.init();
  70. // #ifdef !MP-WEIXIN
  71. this.onClick(this.$parent.$parent.swiperItemID, this.$parent.$parent.page)
  72. // #endif
  73. },
  74. methods: {
  75. init() {
  76. const systemInitIsComplete = this.$Http.systemInitIsComplete;
  77. if (!systemInitIsComplete || typeof systemInitIsComplete == 'object') {
  78. this.$Http.HomePageStartRendering = render(this)
  79. } else {
  80. render(this)
  81. }
  82. function render(that) {
  83. let sightseer = uni.getStorageSync('userMsg').usertype == 99;
  84. if (!that.sightseer) that.index.pop();
  85. that.sightseer = sightseer
  86. console.log("是否游客", that.sightseer)
  87. console.log(that.index)
  88. }
  89. },
  90. onClick(current, name, update = false, params = null) {
  91. if (name == '首页') current = 'index';
  92. const item = this[current].find(v => v.name == name),
  93. that = this;
  94. if (typeof item.loading != 'boolean' || update) {
  95. item.loading = true;
  96. update = true;
  97. }
  98. this[current + 'LastPage'] = name;
  99. this.current = current;
  100. this.showPageName = name;
  101. this.$emit("onChange", {
  102. current, name, update, callBack, params
  103. })
  104. function callBack(loading = false) {
  105. item.loading = loading;
  106. that[current] = JSON.parse(JSON.stringify(that[current]));
  107. }
  108. },
  109. update() {
  110. if (this.countDown) {
  111. this.onClick(this.current, this.showPageName, true)
  112. } else {
  113. this.countDown = setTimeout(() => {
  114. clearTimeout(this.countDown)
  115. this.countDown = null;
  116. }, 300)
  117. }
  118. },
  119. },
  120. }
  121. </script>
  122. <style lang="scss">
  123. .box {
  124. position: fixed;
  125. width: 355px;
  126. height: 50px;
  127. background: rgba(255, 255, 255, 0.95);
  128. box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.16);
  129. border-radius: 50px;
  130. left: 10px;
  131. bottom: 20px;
  132. z-index: 3;
  133. .swiper-item {
  134. display: flex;
  135. align-items: center;
  136. justify-content: space-between;
  137. width: 355px;
  138. height: 50px;
  139. padding: 0 30px;
  140. box-sizing: border-box;
  141. .item {
  142. font-family: Source Han Sans SC, Source Han Sans SC;
  143. font-size: 16px;
  144. color: #666666;
  145. padding: 10px;
  146. }
  147. .image {
  148. width: 40px;
  149. padding: 4px;
  150. }
  151. }
  152. }
  153. </style>