123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301 |
- <template>
- <!-- #ifdef H5 -->
- <view class="message_view_page">
- <!-- 横幅 -->
- <view class="gonggao" @click="goFpzn">
- <view>防骗手册,为您保驾护航</view>
- <text class="iconfont icon-jinru"></text>
- </view>
- <!-- 聊天内容 -->
- <view class="message_view">
- <scroll-view class="message_view_scroll" :scroll-y="true" :scroll-top="scrollTop" :enhanced="true"
- :bounces="false" :show-scrollbar="false" @scrolltoupper="upper" @scrolltolower="lower" @scroll="scroll">
- <view class="message_user_aview" v-for="(item,index) in list" :key="index" @click="goMsgView(item)">
- <view class="message_user_a">
- <view class="message_user_info">
- <!-- 头像 -->
- <view class="user_head">
- <image v-if="item.userPic" style="width: 100%; height: 100%;" mode="aspectFill"
- :src="imageUrl + item.userPic"></image>
- <image v-else style="width: 100%; height: 100%;" mode="aspectFill" src="@/static/common/logo.png">
- </view>
- <view class="user_info">
- <!-- 姓名 -->
- <view class="user_name">{{item.userName}}</view>
- <!-- 聊天信息最后一条 -->
- <view class="user_goods">{{item.message}}</view>
- <!-- 聊天信息最后一条的时间 -->
- <view class="user_time">{{item.createTime}}</view>
- </view>
- <!-- 商品图片 -->
- <view class="goods_img">
- <image style="width: 100%; height: 100%;" mode="aspectFill" :src="imageUrl + item.goodsImg"></image>
- </view>
- </view>
- </view>
- </view>
- <Loading v-if="!list.length" :loadStatus="2" :dataList="list" />
- </scroll-view>
- </view>
- </view>
- <!-- #endif -->
- <!-- #ifndef H5 -->
- <web-view :src="webViewHref('/pages/message/index')"></web-view>
- <!-- #endif -->
- </template>
- <script>
- import api from '@/common/http/'
- export default {
- // #ifdef H5
- data() {
- return {
- imageUrl: this.$imageUrl,
- scrollTop: 0,
- list: []
- }
- },
- onShow() {
- var getList = () => {
- if (this.timeId) {
- clearTimeout(this.timeId)
- }
- api.postJson('/user/talk/list2', {
- userId: this.$store.state.user.userId,
- pageNum: 1,
- pageSize: -1
- }, false).then(res => {
- this.list = res.data.records
- this.timeId = setTimeout(getList, 3000)
- })
- }
- getList()
- },
- onHide() {
- if (this.timeId) {
- clearTimeout(this.timeId)
- }
- },
- methods: {
- upper() {
- console.log("顶")
- },
- lower() {
- console.log("底")
- },
- scroll(e) {
- this.scrollTop = e.detail.scrollTop
- },
- goMsgView(item) {
- this.$navToPage({
- url: '/pages/message/msgView?goodsId=' + item.goodsId || '' + "&groupId=" + item.groupId || ''
- })
- },
- goFpzn(item) {
- this.$navToPage({
- url: '/pages/mine/parse?type=1'
- })
- },
- },
- // #endif
- // #ifndef H5
- // #endif
- }
- </script>
- <style lang="scss" scoped>
- page {
- height: 100%;
- overflow: hidden;
- }
- .message_view_page {
- overflow: hidden;
- width: 100%;
- /* #ifdef H5 */
- height: 100%;
- /* #endif */
- /* #ifndef H5 */
- height: 100vh;
- /* #endif */
- display: flex;
- flex-direction: column;
- .message_user_aview {
- width: 100%;
- height: auto;
- box-sizing: border-box;
- padding: 0 20rpx;
- background: #fff;
- .message_user_a {
- width: 100%;
- height: auto;
- box-sizing: border-box;
- padding: 20rpx 0;
- }
- &:not(:last-child) {
- .message_user_a {
- border-bottom: 1rpx solid #ddd;
- }
- }
- .message_user_info {
- width: 100%;
- display: flex;
- justify-content: space-between;
- align-items: flex-start;
- .user_head {
- width: 80rpx;
- height: 80rpx;
- }
- .user_info {
- width: 500rpx;
- min-height: 100rpx;
- box-sizing: border-box;
- padding: 0 16rpx;
- .user_name {
- width: 100%;
- font-size: 28rpx;
- font-weight: bold;
- overflow: hidden;
- /*超出部分隐藏*/
- white-space: nowrap;
- /*禁止换行*/
- text-overflow: ellipsis;
- /*省略号*/
- }
- .user_goods {
- width: 100%;
- font-size: 24rpx;
- overflow: hidden;
- /*超出部分隐藏*/
- white-space: nowrap;
- /*禁止换行*/
- text-overflow: ellipsis;
- /*省略号*/
- margin: 10rpx 0;
- }
- .user_time {
- width: 100%;
- font-size: 20rpx;
- color: #aaa;
- overflow: hidden;
- /*超出部分隐藏*/
- white-space: nowrap;
- /*禁止换行*/
- text-overflow: ellipsis;
- /*省略号*/
- }
- }
- .goods_img {
- width: 100rpx;
- height: 100rpx;
- }
- }
- }
- .goods_info {
- width: 100%;
- height: auto;
- padding: 20rpx;
- box-sizing: border-box;
- background: #fff;
- display: flex;
- .goods_img {
- width: 100rpx;
- height: 100rpx;
- }
- .goods_text {
- flex: 1;
- min-height: 100rpx;
- height: auto;
- box-sizing: border-box;
- padding-left: 16rpx;
- .goods_name {
- width: 100%;
- margin-bottom: 10rpx;
- font-size: 28rpx;
- font-weight: bold;
- overflow: hidden;
- /*超出部分隐藏*/
- white-space: nowrap;
- /*禁止换行*/
- text-overflow: ellipsis;
- /*省略号*/
- }
- .goods_jiag {
- font-size: 26rpx;
- color: red;
- }
- .goods_fuwu {
- font-size: 24rpx;
- color: #aaa;
- }
- .goods_pon {
- width: 100%;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .go_goods_btn {
- width: auto;
- height: auto;
- box-sizing: border-box;
- padding: 14rpx 28rpx;
- border-radius: 10rpx;
- font-size: 24rpx;
- font-weight: bold;
- color: #fff;
- background: rgb(250, 42, 42);
- }
- }
- }
- }
- .message_view {
- width: 100%;
- flex: 1;
- position: relative;
- .message_view_scroll {
- position: absolute;
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
- }
- }
- .gonggao {
- width: 100%;
- height: 80rpx;
- background: #fff2d4;
- box-sizing: border-box;
- padding: 0 20rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- font-size: 24rpx;
- color: rgb(230, 138, 19);
- view {
- color: rgb(230, 138, 19);
- }
- }
- }
- </style>
|