index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <template>
  2. <div class="tips">
  3. <!-- 顶部面板 -->
  4. <div class="top-panel" v-if="ifShowTop">
  5. <!-- 顶部导航菜单 -->
  6. <div class="top-navs">
  7. <div class="btns">
  8. <div class="btn" :class="{ 'clicked': item.code === currentBtn.code }" v-for="(item, index) in navBtns"
  9. :key="index" @click="handleBtnClick(item)">{{ item.name }}</div>
  10. </div>
  11. <div class="close-btn" @click="ifShowTop = false"></div>
  12. </div>
  13. <!-- 下方列表 -->
  14. <div class="tips-list">
  15. <!-- 消息列表 -->
  16. <div class="tips-item" v-if="currentBtn.code !== 'todo'">
  17. <div class="msg-list list" v-for="(item, index) in msgData" :key="index">
  18. <div class="list-header">
  19. <div class="msg-icon"></div>
  20. <div class="title"></div>
  21. </div>
  22. </div>
  23. </div>
  24. <!-- 待处理 -->
  25. <div class="tips-item" v-else>
  26. <div class="todo-list list" v-for="(item, index) in todoData" :key="index">
  27. <div class="list-header">
  28. <div class="title"></div>
  29. <div class="more-btn"></div>
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. <!-- 底部图标 -->
  36. <div class="bottom-panel" @click="ifShowTop = !ifShowTop">
  37. <div class="icon"></div>
  38. <div class="msg-num">{{ totalTipsNum }}</div>
  39. </div>
  40. </div>
  41. </template>
  42. <script>
  43. import { defineComponent, reactive, ref, toRefs, computed, onMounted, watch } from 'vue';
  44. export default defineComponent({
  45. name: 'tips',
  46. components: {},
  47. setup() {
  48. const navBtns = reactive([
  49. {
  50. name: "待办信息",
  51. code: "todo"
  52. },
  53. {
  54. name: "通知消息",
  55. code: "message"
  56. }
  57. ])
  58. const currentBtn = reactive({
  59. name: "待办信息",
  60. code: "todo"
  61. })
  62. const ifShowTop = ref(false)
  63. const handleBtnClick = (item) => {
  64. currentBtn.code = item.code
  65. currentBtn.name = item.name
  66. }
  67. const todoData = reactive([1,2,3])
  68. const msgData = reactive([1,2,3,4,5,6])
  69. const totalTipsNum = computed(() => {
  70. let totalNum = todoData.length + msgData.length
  71. return totalNum <= 10 ? totalNum === 0 ? '' : totalNum : `10+`
  72. })
  73. return {
  74. navBtns,
  75. currentBtn,
  76. ifShowTop,
  77. todoData,
  78. msgData,
  79. totalTipsNum,
  80. //func
  81. handleBtnClick
  82. };
  83. },
  84. });
  85. </script>
  86. <style lang="less" scoped>
  87. .tips {
  88. position: fixed;
  89. right: 46px;
  90. bottom: 20px;
  91. display: flex;
  92. flex-direction: column;
  93. align-items: flex-end;
  94. .top-panel {
  95. margin-bottom: 24px;
  96. width: 430px;
  97. height: 820px;
  98. padding: 0 16px 20px;
  99. background: #FFFFFF;
  100. box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2);
  101. border-radius: 6px;
  102. .top-navs {
  103. width: 100%;
  104. height: 50px;
  105. border-bottom: 1px solid #DEDEDE;
  106. display: flex;
  107. justify-content: space-between;
  108. align-items: center;
  109. .btns {
  110. display: flex;
  111. .btn {
  112. margin-right: 32px;
  113. width: 100px;
  114. height: 50px;
  115. font-family: Source Han Sans CN;
  116. font-size: 16px;
  117. font-weight: 500;
  118. line-height: 50px;
  119. color: #333333;
  120. user-select: none;
  121. text-align: center;
  122. &:hover {
  123. cursor: pointer;
  124. color: #0671DD;
  125. border-bottom: 2px solid #0671DD;
  126. }
  127. }
  128. .clicked {
  129. color: #0671DD;
  130. border-bottom: 2px solid #0671DD;
  131. }
  132. }
  133. .close-btn {
  134. width: 20px;
  135. height: 20px;
  136. margin-right: 10px;
  137. user-select: none;
  138. cursor: pointer;
  139. border-radius: 50%;
  140. text-align: center;
  141. line-height: 20px;
  142. background: url('/@/assets/images/close.png') no-repeat;
  143. background-size: 100% 100%;
  144. }
  145. }
  146. .tips-list {
  147. padding-top: 18px;
  148. width: 100%;
  149. height: calc(100% - 50px);
  150. overflow: auto;
  151. &::-webkit-scrollbar{
  152. width: 3px;
  153. }
  154. &::-webkit-scrollbar-thumb{
  155. border-radius: 2px;
  156. background: #ccd5df;
  157. }
  158. &::-webkit-scrollbar-track{
  159. display: none;
  160. }
  161. .tips-item {
  162. .list {
  163. width: 100%;
  164. height: 130px;
  165. border-radius: 6px;
  166. background: linear-gradient(252deg, rgba(238, 247, 255, 0.76) 0%, #EDEDED 100%);
  167. margin-bottom: 10px;
  168. .list-header{
  169. width: 100%;
  170. height: 40px;
  171. border-bottom: 1px solid #dedede;
  172. }
  173. }
  174. }
  175. }
  176. }
  177. .bottom-panel {
  178. position: relative;
  179. width: 60px;
  180. height: 60px;
  181. border-radius: 6px;
  182. background: #FFFFFF;
  183. box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2);
  184. cursor: pointer;
  185. .icon {
  186. position: absolute;
  187. left: 14px;
  188. top: 15px;
  189. width: 33px;
  190. height: 31px;
  191. background: url('/@/assets/images/tips.png') no-repeat;
  192. background-size: 100% 100%;
  193. }
  194. .msg-num {
  195. position: absolute;
  196. top: 5px;
  197. right: 5px;
  198. color: #F8252C;
  199. font-family: Source Han Sans CN;
  200. font-size: 14px;
  201. font-weight: bold;
  202. line-height: 18.72px;
  203. }
  204. }
  205. }
  206. </style>