index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <template>
  2. <!-- #ifdef H5 -->
  3. <view class="message_view_page">
  4. <!-- 横幅 -->
  5. <view class="gonggao">
  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" @scrolltoupper="upper"
  12. @scrolltolower="lower" @scroll="scroll">
  13. <view class="message_user_aview" v-for="(item,index) in 15" :key="index" @click="goMsgView">
  14. <view class="message_user_a">
  15. <view class="message_user_info">
  16. <!-- 头像 -->
  17. <view class="user_head">
  18. </view>
  19. <view class="user_info">
  20. <!-- 姓名 -->
  21. <view class="user_name">{{item}}张锋</view>
  22. <!-- 聊天信息最后一条 -->
  23. <view class="user_goods">商品很nice</view>
  24. <!-- 聊天信息最后一条的时间 -->
  25. <view class="user_time">2023-10-21 12:20:21</view>
  26. </view>
  27. <!-- 商品图片 -->
  28. <view class="goods_img">
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </scroll-view>
  34. </view>
  35. </view>
  36. <!-- #endif -->
  37. <!-- #ifndef H5 -->
  38. <web-view :src="webViewHref('/pages/message/index')"></web-view>
  39. <!-- #endif -->
  40. </template>
  41. <script>
  42. export default {
  43. // #ifdef H5
  44. data() {
  45. return {
  46. scrollTop: 0,
  47. }
  48. },
  49. methods: {
  50. upper() {
  51. console.log("顶")
  52. },
  53. lower() {
  54. console.log("底")
  55. },
  56. scroll(e) {
  57. this.scrollTop = e.detail.scrollTop
  58. },
  59. goMsgView() {
  60. this.$navToPage({
  61. url: '/pages/message/msgView'
  62. })
  63. }
  64. },
  65. // #endif
  66. // #ifndef H5
  67. // #endif
  68. }
  69. </script>
  70. <style lang="scss" scoped>
  71. page {
  72. height: 100%;
  73. overflow: hidden;
  74. }
  75. .message_view_page {
  76. overflow: hidden;
  77. width: 100%;
  78. /* #ifdef H5 */
  79. height: 100%;
  80. /* #endif */
  81. /* #ifndef H5 */
  82. height: 100vh;
  83. /* #endif */
  84. display: flex;
  85. flex-direction: column;
  86. .message_user_aview {
  87. width: 100%;
  88. height: auto;
  89. box-sizing: border-box;
  90. padding: 0 20rpx;
  91. background: #fff;
  92. .message_user_a {
  93. width: 100%;
  94. height: auto;
  95. box-sizing: border-box;
  96. padding: 20rpx 0;
  97. }
  98. &:not(:last-child) {
  99. .message_user_a {
  100. border-bottom: 1rpx solid #ddd;
  101. }
  102. }
  103. .message_user_info {
  104. width: 100%;
  105. display: flex;
  106. justify-content: space-between;
  107. align-items: flex-start;
  108. .user_head {
  109. width: 80rpx;
  110. height: 80rpx;
  111. }
  112. .user_info {
  113. width: 500rpx;
  114. min-height: 100rpx;
  115. box-sizing: border-box;
  116. padding: 0 16rpx;
  117. .user_name {
  118. width: 100%;
  119. font-size: 28rpx;
  120. font-weight: bold;
  121. overflow: hidden;
  122. /*超出部分隐藏*/
  123. white-space: nowrap;
  124. /*禁止换行*/
  125. text-overflow: ellipsis;
  126. /*省略号*/
  127. }
  128. .user_goods {
  129. width: 100%;
  130. font-size: 24rpx;
  131. overflow: hidden;
  132. /*超出部分隐藏*/
  133. white-space: nowrap;
  134. /*禁止换行*/
  135. text-overflow: ellipsis;
  136. /*省略号*/
  137. margin: 10rpx 0;
  138. }
  139. .user_time {
  140. width: 100%;
  141. font-size: 20rpx;
  142. color: #aaa;
  143. overflow: hidden;
  144. /*超出部分隐藏*/
  145. white-space: nowrap;
  146. /*禁止换行*/
  147. text-overflow: ellipsis;
  148. /*省略号*/
  149. }
  150. }
  151. .goods_img {
  152. width: 100rpx;
  153. height: 100rpx;
  154. }
  155. }
  156. }
  157. .goods_info {
  158. width: 100%;
  159. height: auto;
  160. padding: 20rpx;
  161. box-sizing: border-box;
  162. background: #fff;
  163. display: flex;
  164. .goods_img {
  165. width: 100rpx;
  166. height: 100rpx;
  167. }
  168. .goods_text {
  169. flex: 1;
  170. min-height: 100rpx;
  171. height: auto;
  172. box-sizing: border-box;
  173. padding-left: 16rpx;
  174. .goods_name {
  175. width: 100%;
  176. margin-bottom: 10rpx;
  177. font-size: 28rpx;
  178. font-weight: bold;
  179. overflow: hidden;
  180. /*超出部分隐藏*/
  181. white-space: nowrap;
  182. /*禁止换行*/
  183. text-overflow: ellipsis;
  184. /*省略号*/
  185. }
  186. .goods_jiag {
  187. font-size: 26rpx;
  188. color: red;
  189. }
  190. .goods_fuwu {
  191. font-size: 24rpx;
  192. color: #aaa;
  193. }
  194. .goods_pon {
  195. width: 100%;
  196. display: flex;
  197. justify-content: space-between;
  198. align-items: center;
  199. .go_goods_btn {
  200. width: auto;
  201. height: auto;
  202. box-sizing: border-box;
  203. padding: 14rpx 28rpx;
  204. border-radius: 10rpx;
  205. font-size: 24rpx;
  206. font-weight: bold;
  207. color: #fff;
  208. background: rgb(250, 42, 42);
  209. }
  210. }
  211. }
  212. }
  213. .message_view {
  214. width: 100%;
  215. flex: 1;
  216. position: relative;
  217. .message_view_scroll {
  218. position: absolute;
  219. top: 0;
  220. bottom: 0;
  221. left: 0;
  222. right: 0;
  223. }
  224. }
  225. .gonggao {
  226. width: 100%;
  227. height: 80rpx;
  228. background: #fff2d4;
  229. box-sizing: border-box;
  230. padding: 0 20rpx;
  231. display: flex;
  232. align-items: center;
  233. justify-content: space-between;
  234. font-size: 24rpx;
  235. color: rgb(230, 138, 19);
  236. view {
  237. color: rgb(230, 138, 19);
  238. }
  239. }
  240. }
  241. </style>