| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- <template>
- <div class="tips">
- <!-- 顶部面板 -->
- <div class="top-panel" v-if="ifShowTop">
- <!-- 顶部导航菜单 -->
- <div class="top-navs">
- <div class="btns">
- <div class="btn" :class="{ 'clicked': item.code === currentBtn.code }" v-for="(item, index) in navBtns"
- :key="index" @click="handleBtnClick(item)">{{ item.name }}</div>
- </div>
- <div class="close-btn" @click="ifShowTop = false"></div>
- </div>
- <!-- 下方列表 -->
- <div class="tips-list">
- <!-- 消息列表 -->
- <div class="tips-item" v-if="currentBtn.code !== 'todo'">
- <div class="msg-list list" v-for="(item, index) in msgData" :key="index">
- <div class="list-header">
- <div class="msg-icon"></div>
- <div class="title"></div>
- </div>
- </div>
- </div>
- <!-- 待处理 -->
- <div class="tips-item" v-else>
- <div class="todo-list list" v-for="(item, index) in todoData" :key="index">
- <div class="list-header">
- <div class="title"></div>
- <div class="more-btn"></div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <!-- 底部图标 -->
- <div class="bottom-panel" @click="ifShowTop = !ifShowTop">
- <div class="icon"></div>
- <div class="msg-num">{{ totalTipsNum }}</div>
- </div>
- </div>
- </template>
- <script>
- import { defineComponent, reactive, ref, toRefs, computed, onMounted, watch } from 'vue';
- export default defineComponent({
- name: 'tips',
- components: {},
- setup() {
- const navBtns = reactive([
- {
- name: "待办信息",
- code: "todo"
- },
- {
- name: "通知消息",
- code: "message"
- }
- ])
- const currentBtn = reactive({
- name: "待办信息",
- code: "todo"
- })
- const ifShowTop = ref(false)
- const handleBtnClick = (item) => {
- currentBtn.code = item.code
- currentBtn.name = item.name
- }
- const todoData = reactive([1,2,3])
- const msgData = reactive([1,2,3,4,5,6])
- const totalTipsNum = computed(() => {
- let totalNum = todoData.length + msgData.length
- return totalNum <= 10 ? totalNum === 0 ? '' : totalNum : `10+`
- })
- return {
- navBtns,
- currentBtn,
- ifShowTop,
- todoData,
- msgData,
- totalTipsNum,
- //func
- handleBtnClick
- };
- },
- });
- </script>
- <style lang="less" scoped>
- .tips {
- position: fixed;
- right: 46px;
- bottom: 20px;
- display: flex;
- flex-direction: column;
- align-items: flex-end;
- .top-panel {
- margin-bottom: 24px;
- width: 430px;
- height: 820px;
- padding: 0 16px 20px;
- background: #FFFFFF;
- box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2);
- border-radius: 6px;
- .top-navs {
- width: 100%;
- height: 50px;
- border-bottom: 1px solid #DEDEDE;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .btns {
- display: flex;
- .btn {
- margin-right: 32px;
- width: 100px;
- height: 50px;
- font-family: Source Han Sans CN;
- font-size: 16px;
- font-weight: 500;
- line-height: 50px;
- color: #333333;
- user-select: none;
- text-align: center;
- &:hover {
- cursor: pointer;
- color: #0671DD;
- border-bottom: 2px solid #0671DD;
- }
- }
- .clicked {
- color: #0671DD;
- border-bottom: 2px solid #0671DD;
- }
- }
- .close-btn {
- width: 20px;
- height: 20px;
- margin-right: 10px;
- user-select: none;
- cursor: pointer;
- border-radius: 50%;
- text-align: center;
- line-height: 20px;
- background: url('/@/assets/images/close.png') no-repeat;
- background-size: 100% 100%;
- }
- }
- .tips-list {
- padding-top: 18px;
- width: 100%;
- height: calc(100% - 50px);
- overflow: auto;
- &::-webkit-scrollbar{
- width: 3px;
- }
- &::-webkit-scrollbar-thumb{
- border-radius: 2px;
- background: #ccd5df;
- }
- &::-webkit-scrollbar-track{
- display: none;
- }
- .tips-item {
- .list {
- width: 100%;
- height: 130px;
- border-radius: 6px;
- background: linear-gradient(252deg, rgba(238, 247, 255, 0.76) 0%, #EDEDED 100%);
- margin-bottom: 10px;
- .list-header{
- width: 100%;
- height: 40px;
- border-bottom: 1px solid #dedede;
- }
- }
- }
- }
- }
- .bottom-panel {
- position: relative;
- width: 60px;
- height: 60px;
- border-radius: 6px;
- background: #FFFFFF;
- box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2);
- cursor: pointer;
- .icon {
- position: absolute;
- left: 14px;
- top: 15px;
- width: 33px;
- height: 31px;
- background: url('/@/assets/images/tips.png') no-repeat;
- background-size: 100% 100%;
- }
- .msg-num {
- position: absolute;
- top: 5px;
- right: 5px;
- color: #F8252C;
- font-family: Source Han Sans CN;
- font-size: 14px;
- font-weight: bold;
- line-height: 18.72px;
- }
- }
- }
- </style>
|