123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <template>
- <view class="message-list">
- <!-- 消息提示 -->
- <view class="message-item" @click="$navigateTo('/pages/messageList/messageList?type=2')">
- <uni-badge class="uni-badge-left-margin" :text="testCount[2]" absolute="rightTop" size="small">
- <view class="message-system-icon">
- <uni-icons type="icon-jigoukehudaishenheshuliang" custom-prefix="iconfont" size="30" color="#fff">
- </uni-icons>
- </view>
- </uni-badge>
- <view class="message-content">
- <view class="message-title">项目邀请通知</view>
- <view class="message-sub-content">
- {{!testCount[2] ?'暂无消息通知' : `您有${testCount[2]}条未读消息,请查看~`}}
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- getMessageTest
- } from '@/request/api/message.js'
- export default {
- data() {
- return {
- testCount: {}
- }
- },
- onShow() {
- this.init();
- },
- methods: {
- init() {
- getMessageTest(this.$store.getters.user.userId).then(res => {
- if (res.code == 200) {
- let obj = {};
- for (var i = 0; i < res.data.length; i++) {
- obj[res.data[i].messageType] = res.data[i].count;
- }
- this.testCount = obj;
- }
- })
- }
- }
- }
- </script>
- <style lang="scss">
- .message-list {
- margin-top: 30rpx;
- .message-item {
- background: #fff;
- display: flex;
- padding: 24rpx 30rpx;
- position: relative;
- &::before {
- content: '';
- position: absolute;
- bottom: 0;
- right: 0;
- left: 150rpx;
- height: 2rpx;
- background: $uni-border-1;
- }
- }
- .message-system-icon {
- width: 100rpx;
- height: 100rpx;
- border-radius: 16rpx;
- text-align: center;
- line-height: 100rpx;
- background: $uni-primary;
- }
- .message-image {
- width: 100rpx;
- height: 100rpx;
- border-radius: 16rpx;
- overflow: hidden;
- }
- .message-content {
- flex: 1;
- width: 0;
- margin-left: 20rpx;
- display: flex;
- flex-direction: column;
- justify-content: center;
- }
- .message-title {
- font-size: 32rpx;
- font-weight: 600;
- margin-bottom: 10rpx;
- }
- .message-sub-content {
- font-weight: 300;
- color: $uni-secondary-color;
- }
- .message-date {
- position: absolute;
- top: 34rpx;
- right: 30rpx;
- font-size: 24rpx;
- font-weight: 300;
- color: $uni-secondary-color;
- }
- }
- </style>
|