123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- <template>
- <view class="msg">
- <MyNav title="消息" bgColor="" :backIcon="false"></MyNav>
- <!-- <!自定义导航栏
- <u-navbar title='消息' fixed safeAreaInsetTop :placeholder='true' :bgColor="bgColor" >
- </u-navbar> -->
- <!-- 搜索框 -->
- <view class="search">
- <u-input placeholder="搜索" border='none' v-model="search" @input="searchText">
- <template slot="suffix" style='margin-right:40rpx;'>
- <u-image :showLoading="true" :showError='true' src="/static/icon/search.png" width="40rpx"
- height="32rpx"></u-image>
- </template>
- </u-input>
- </view>
- <!-- 消息列表 -->
- <view class="msgListBox">
- <view class="childBox" v-for="(item,index) in messageList" :key="index" @click="jumpPage(item.type,item.relation_id)" >
- <view class="childBox-top" >{{item.title}}</view>
- <view class="childBox-content" >
- <text>{{item.content}}</text>
- <image style="width: 12rpx;height: 20rpx;" src="/static/icon/right.png" ></image>
- </view>
- <view class="childBox-bom">{{item.created_at}}</view>
- </view>
- <uni-swipe-action v-if="false">
- <uni-swipe-action-item :right-options="options" v-for="(item,index) in messageList" :key="index">
- <template v-slot:right>
- <view style="display: flex;align-items: center;justify-content: center;">
- <image src="/static/icon//data.png" style="width: 60rpx; height: 54rpx;"></image>
- <text class="slot-button-text">删除</text>
- </view>
- </template>
- <view class="childBox">
- <view class="childBox-top">{{item.title}}</view>
- <view class="childBox-content">
- <text>{{item.content}}</text>
- <image style="width: 12rpx;height: 20rpx;" src="/static/icon/right.png"></image>
- </view>
- <view class="childBox-bom">{{item.created_at}}</view>
- </view>
- </uni-swipe-action-item>
- </uni-swipe-action>
- </view>
- <!-- 触底 -->
- <view class="home-bottom">
- <uni-load-more :status="status" color="#CCCCCC" :content-text="contentText" />
- </view>
- <!-- 底部导航栏 -->
- <view style="height: 140rpx; width: 100%;"></view>
- <tab-bar checked="msg"></tab-bar>
- </view>
- </template>
- <script>
- import util from '@/utils/util.js'
- import TabBar from '../../components/TabBar/tabbar.vue'
- import MyNav from "@/components/my-nav/my-nav.vue"
- export default {
- components: {
- TabBar,
- MyNav
- },
- data() {
- return {
- //自定义导航栏
- bgColor: '#fff',
- //搜索文字
- search:'',
- //删除按钮
- options: [{
- text: '删除',
- style: {
- backgroundColor: '#dd524d'
- }
- }],
- //消息列表
- messageList: '',
- status: 'noMore',
- contentText: {
- contentdown: '查看更多',
- contentrefresh: '加载中',
- contentnomore: '—— 已经到底啦 ——'
- },
- };
- },
- onLoad() {
- //获取消息列表
- this.getMessageList()
- },
- methods: {
-
- //跳转消息详情页面
- jumpPage(type,id){
- if(type>2){
- uni.navigateTo({
- url:'/pages/my/prize/prize'
- })
- }else{
- uni.navigateTo({
- url:'/pages/index/active-detail/index?id='+id
- })
- }
- },
-
- // 搜索防抖
- searchText:util.debounce(function(){
- if(this.search !=''){
- this.goSearch()
- }else{
- this.getMessageList()
- }
- },500),
- //搜索
- goSearch(){
- uni.showLoading({
- title:'加载中'
- })
- this.$api.my.messageList({
- page: 0,
- keyword:this.search,
- }).then(res=>{
- if(res.code==0){
- uni.hideLoading()
- this.messageList = res.data.data
- }
- })
- },
- //获取消息列表
- getMessageList() {
- this.$api.my.messageList({
- page: 0
- }).then(res => {
- this.messageList = res.data.data
- console.log(this.messageList, '------>this.messageList');
- })
- },
- },
- }
- </script>
- <style lang="scss" scoped>
- $pageColor:#F9F9F9;
- $bgColor:#FFFFFF;
- // flex布局居中对齐
- @mixin flexlayout {
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .msg {
- height: 100%;
- background-color: $pageColor;
- }
- .home-bottom {
- background-color: #f9f9f9;
- padding-top: 120rpx;
- }
- // 搜索
- .search {
- // position: fixed;
- // top: 0;
- // width: 100%;
- padding: 0 30rpx;
- height: 124rpx;
- background-color: $bgColor;
- box-shadow: 0px 4rpx 8rpx 0px rgba(0, 0, 0, 0.04);
- @include flexlayout;
- ::v-deep .u-input {
- width: 690rpx !important;
- height: 68rpx !important;
- background: #F1F1F1;
- border-radius: 74rpx;
- }
- ::v-deep .u-input__content__field-wrapper {
- padding-left: 36rpx;
- }
- ::v-deep .u-input__content__field-wrapper__field {
- color: #999999 !important;
- font-size: 28rpx !important;
- }
- }
- // 消息列表
- .msgListBox {
- padding: 48rpx 30rpx;
- padding-top: 0;
- margin-top: 24rpx;
- background: $bgColor;
- box-shadow: 0rpx 4rpx 24rpx -10rpx rgba(101, 95, 90, 0.3);
- border-radius: 12rpx;
- .childBox {
- padding-top: 40rpx;
- padding-bottom: 40rpx;
- border-bottom: 2rpx solid rgba(240, 240, 240, .7);
-
- &:last-child {
- padding-bottom: 0;
- border-bottom: none;
- }
-
- &:first-child {
- padding-top: 48rpx;
- }
-
- .childBox-top {
- font-weight: bold;
- color: #333333;
- font-size: 32rpx;
- }
-
- .childBox-content {
- padding-right: 24rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- color: #333333;
- font-size: 28rpx;
- margin: 24rpx 0 12rpx;
- }
-
- .childBox-bom {
- color: #999999;
- font-size: 26rpx;
- }
- }
- }
- ::v-deep .uni-swipe_text--center {
- padding-bottom: 40rpx;
- border-bottom: 2rpx solid rgba(240, 240, 240, 0.7);
- &:last-child {
- padding-bottom: 0;
- border-bottom: none;
- }
- }
- </style>
|