index.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. <template>
  2. <!-- #ifdef H5 -->
  3. <view class="message_view_page">
  4. <!-- 横幅 -->
  5. <view class="gonggao" @click="goFpzn">
  6. <view>防骗手册,为您保驾护航</view>
  7. <text class="iconfont icon-jinru"></text>
  8. </view>
  9. <!-- 聊天内容 -->
  10. <view class="message_view">
  11. <scroll-view class="message_view_scroll" :scroll-y="true" :scroll-top="scrollTop" :enhanced="true"
  12. :bounces="false" :show-scrollbar="false" @scrolltoupper="upper" @scrolltolower="lower" @scroll="scroll">
  13. <view class="message_user_aview" v-for="(item,index) in list" :key="index" @click="goMsgView(item)">
  14. <view class="message_user_a">
  15. <view class="message_user_info">
  16. <!-- 头像 -->
  17. <view class="user_head">
  18. <image v-if="item.userPic" style="width: 100%; height: 100%;" mode="aspectFill"
  19. :src="imageUrl + item.userPic"></image>
  20. <image v-else style="width: 100%; height: 100%;" mode="aspectFill" src="@/static/common/logo.png">
  21. </view>
  22. <view class="user_info">
  23. <!-- 姓名 -->
  24. <view class="user_name">{{item.userName}}</view>
  25. <!-- 聊天信息最后一条 -->
  26. <view class="user_goods">{{item.message}}</view>
  27. <!-- 聊天信息最后一条的时间 -->
  28. <view class="user_time">{{item.createTime}}</view>
  29. </view>
  30. <!-- 商品图片 -->
  31. <view class="goods_img">
  32. <image style="width: 100%; height: 100%;" mode="aspectFill" :src="imageUrl + item.goodsImg"></image>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <Loading v-if="!list.length" :loadStatus="2" :dataList="list" />
  38. </scroll-view>
  39. </view>
  40. </view>
  41. <!-- #endif -->
  42. <!-- #ifndef H5 -->
  43. <web-view :src="webViewHref('/pages/message/index')"></web-view>
  44. <!-- #endif -->
  45. </template>
  46. <script>
  47. import api from '@/common/http/'
  48. export default {
  49. // #ifdef H5
  50. data() {
  51. return {
  52. imageUrl: this.$imageUrl,
  53. scrollTop: 0,
  54. list: []
  55. }
  56. },
  57. onShow() {
  58. var getList = () => {
  59. if (this.timeId) {
  60. clearTimeout(this.timeId)
  61. }
  62. api.postJson('/user/talk/list2', {
  63. userId: this.$store.state.user.userId,
  64. pageNum: 1,
  65. pageSize: -1
  66. }, false).then(res => {
  67. this.list = res.data.records
  68. this.timeId = setTimeout(getList, 3000)
  69. })
  70. }
  71. getList()
  72. },
  73. onHide() {
  74. if (this.timeId) {
  75. clearTimeout(this.timeId)
  76. }
  77. },
  78. methods: {
  79. upper() {
  80. console.log("顶")
  81. },
  82. lower() {
  83. console.log("底")
  84. },
  85. scroll(e) {
  86. this.scrollTop = e.detail.scrollTop
  87. },
  88. goMsgView(item) {
  89. this.$navToPage({
  90. url: '/pages/message/msgView?goodsId=' + item.goodsId || '' + "&groupId=" + item.groupId || ''
  91. })
  92. },
  93. goFpzn(item) {
  94. this.$navToPage({
  95. url: '/pages/mine/parse?type=1'
  96. })
  97. },
  98. },
  99. // #endif
  100. // #ifndef H5
  101. // #endif
  102. }
  103. </script>
  104. <style lang="scss" scoped>
  105. page {
  106. height: 100%;
  107. overflow: hidden;
  108. }
  109. .message_view_page {
  110. overflow: hidden;
  111. width: 100%;
  112. /* #ifdef H5 */
  113. height: 100%;
  114. /* #endif */
  115. /* #ifndef H5 */
  116. height: 100vh;
  117. /* #endif */
  118. display: flex;
  119. flex-direction: column;
  120. .message_user_aview {
  121. width: 100%;
  122. height: auto;
  123. box-sizing: border-box;
  124. padding: 0 20rpx;
  125. background: #fff;
  126. .message_user_a {
  127. width: 100%;
  128. height: auto;
  129. box-sizing: border-box;
  130. padding: 20rpx 0;
  131. }
  132. &:not(:last-child) {
  133. .message_user_a {
  134. border-bottom: 1rpx solid #ddd;
  135. }
  136. }
  137. .message_user_info {
  138. width: 100%;
  139. display: flex;
  140. justify-content: space-between;
  141. align-items: flex-start;
  142. .user_head {
  143. width: 80rpx;
  144. height: 80rpx;
  145. }
  146. .user_info {
  147. width: 500rpx;
  148. min-height: 100rpx;
  149. box-sizing: border-box;
  150. padding: 0 16rpx;
  151. .user_name {
  152. width: 100%;
  153. font-size: 28rpx;
  154. font-weight: bold;
  155. overflow: hidden;
  156. /*超出部分隐藏*/
  157. white-space: nowrap;
  158. /*禁止换行*/
  159. text-overflow: ellipsis;
  160. /*省略号*/
  161. }
  162. .user_goods {
  163. width: 100%;
  164. font-size: 24rpx;
  165. overflow: hidden;
  166. /*超出部分隐藏*/
  167. white-space: nowrap;
  168. /*禁止换行*/
  169. text-overflow: ellipsis;
  170. /*省略号*/
  171. margin: 10rpx 0;
  172. }
  173. .user_time {
  174. width: 100%;
  175. font-size: 20rpx;
  176. color: #aaa;
  177. overflow: hidden;
  178. /*超出部分隐藏*/
  179. white-space: nowrap;
  180. /*禁止换行*/
  181. text-overflow: ellipsis;
  182. /*省略号*/
  183. }
  184. }
  185. .goods_img {
  186. width: 100rpx;
  187. height: 100rpx;
  188. }
  189. }
  190. }
  191. .goods_info {
  192. width: 100%;
  193. height: auto;
  194. padding: 20rpx;
  195. box-sizing: border-box;
  196. background: #fff;
  197. display: flex;
  198. .goods_img {
  199. width: 100rpx;
  200. height: 100rpx;
  201. }
  202. .goods_text {
  203. flex: 1;
  204. min-height: 100rpx;
  205. height: auto;
  206. box-sizing: border-box;
  207. padding-left: 16rpx;
  208. .goods_name {
  209. width: 100%;
  210. margin-bottom: 10rpx;
  211. font-size: 28rpx;
  212. font-weight: bold;
  213. overflow: hidden;
  214. /*超出部分隐藏*/
  215. white-space: nowrap;
  216. /*禁止换行*/
  217. text-overflow: ellipsis;
  218. /*省略号*/
  219. }
  220. .goods_jiag {
  221. font-size: 26rpx;
  222. color: red;
  223. }
  224. .goods_fuwu {
  225. font-size: 24rpx;
  226. color: #aaa;
  227. }
  228. .goods_pon {
  229. width: 100%;
  230. display: flex;
  231. justify-content: space-between;
  232. align-items: center;
  233. .go_goods_btn {
  234. width: auto;
  235. height: auto;
  236. box-sizing: border-box;
  237. padding: 14rpx 28rpx;
  238. border-radius: 10rpx;
  239. font-size: 24rpx;
  240. font-weight: bold;
  241. color: #fff;
  242. background: rgb(250, 42, 42);
  243. }
  244. }
  245. }
  246. }
  247. .message_view {
  248. width: 100%;
  249. flex: 1;
  250. position: relative;
  251. .message_view_scroll {
  252. position: absolute;
  253. top: 0;
  254. bottom: 0;
  255. left: 0;
  256. right: 0;
  257. }
  258. }
  259. .gonggao {
  260. width: 100%;
  261. height: 80rpx;
  262. background: #fff2d4;
  263. box-sizing: border-box;
  264. padding: 0 20rpx;
  265. display: flex;
  266. align-items: center;
  267. justify-content: space-between;
  268. font-size: 24rpx;
  269. color: rgb(230, 138, 19);
  270. view {
  271. color: rgb(230, 138, 19);
  272. }
  273. }
  274. }
  275. </style>