123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- <template>
- <view class="aui-news-box">
- <!-- 公共组件-每个页面必须引入 -->
- <public-module></public-module>
- <uni-swipe-action>
- <!-- 基础用法 -->
- <uni-swipe-action-item v-for="(list, index) in lists" :key="index" :right-options="swipeOptions"
- @click="swipeClick($event, index)">
- <view class="aui-news-item">
- <view class="aui-news-item-hd">
- <image :src="list.img" mode="widthFix" lazy-load class="img" />
- </view>
- <view class="aui-news-item-bd">
- <view class="title">
- <h4>{{list.titleType}}</h4>
- <span>{{list.time}}</span>
- </view>
- <view class="content">
- <p>{{list.result.content}}</p>
- </view>
- </view>
- </view>
- </uni-swipe-action-item>
- </uni-swipe-action>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- swipeOptions: [{
- text: '删除',
- value: '1',
- style: {
- backgroundColor: '#dd524d'
- }
- }],
- lists: [{
- id: 1,
- titleType: "系统消息",
- time: "08:48",
- img: '/static/image/messageIcon/icon-item-001.png',
- result: {}
- },
- {
- id: 2,
- titleType: "服务消息",
- time: "08:48",
- img: '/static/image/messageIcon/icon-item-002.png',
- result: {}
- },
- {
- id: 3,
- titleType: "订单进度",
- time: "昨天",
- img: '/static/image/messageIcon/icon-item-003.png',
- result: {}
- },
- {
- id: 4,
- titleType: "保单提醒",
- time: "星期六",
- img: '/static/image/messageIcon/icon-item-004.png',
- result: {}
- },
- {
- id: 5,
- titleType: "佣金消息",
- time: "星期六",
- img: '/static/image/messageIcon/icon-item-005.png',
- result: {}
- }, {
- id: 6,
- titleType: "增员服务",
- time: "星期五",
- img: '/static/image/messageIcon/icon-item-001.png',
- result: {}
- }
- ],
- }
- },
- onShow() {
- this.getUserMessage();
- },
- onPullDownRefresh() {
- // 执行刷新逻辑
- this.getUserMessage();
- },
- methods: {
- async getUserMessage() {
- let res = await this.$http.get('/api/message/getUserMessage');
- if (res.code == '200') {
- res.data.map(val => {
- this.lists.map(ele => {
- if (val.msgType == ele.id) {
- ele.result = val;
- }
- })
- return val;
- })
- uni.stopPullDownRefresh();
- }
- },
- }
- }
- </script>
- <style>
- .aui-news-box {
- margin-top: 8px;
- background: #fff;
- }
- .aui-news-item {
- padding: 30upx;
- position: relative;
- display: flex;
- align-items: center;
- }
- .aui-news-item-hd {
- margin-right: 30upx;
- width: 110upx;
- display: flex;
- flex-shrink: 0;
- background: #fff;
- border-radius: 30upx;
- }
- .aui-news-item-hd .img {
- width: 100%;
- }
- .aui-news-item-bd {
- display: flex;
- flex-direction: column;
- width: 550upx;
- }
- .aui-news-item-bd .title {
- display: flex;
- justify-content: space-between;
- padding-bottom: 10upx;
- }
- .aui-news-item-bd .title h4 {
- font-weight: 400;
- font-size: 32upx;
- line-height: 50upx;
- width: 250upx;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- color: #333;
- }
- .aui-news-item-bd .title span {
- color: #848689;
- }
- .aui-news-item-bd p {
- width: 100%;
- color: #848689;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .aui-news-item:before {
- content: '';
- position: absolute;
- z-index: 2;
- bottom: 0;
- left: 0;
- width: 100%;
- height: 1px;
- border-bottom: 1px solid #d8d8d8;
- transform: scaleY(0.5);
- }
- </style>
|