news.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <template>
  2. <view class="zaiui-news-box" :class="show?'show':''">
  3. <!--标题栏-->
  4. <bar-title bgColor="bg-white" :isBack="false" @rightTap="barTitleRightTap">
  5. <block slot="content">消息中心</block>
  6. <block slot="right">
  7. <text class="cuIcon-info"/>
  8. </block>
  9. </bar-title>
  10. <!--关注-->
  11. <view class="cu-bar bg-white zaiui-follow-box">
  12. <view class="action action-text-cut">
  13. <view class="text-cut-2 text-sm">
  14. 关注微信公众号,通过微信随时接收用户咨询、订单状态
  15. </view>
  16. </view>
  17. <view class="action">
  18. <button class="cu-btn sm bg-red">立即关注</button>
  19. </view>
  20. </view>
  21. <!--宫格菜单-->
  22. <view class="margin-bottom zaiui-grid-menu">
  23. <view class="bg-white cu-list grid col-3 no-border">
  24. <view class="cu-item">
  25. <view class="cu-avatar lg round" style="background-image:url(/static/images/news/1.png);"/>
  26. <view class="margin-top-sm text-sm">交易信息</view>
  27. </view>
  28. <view class="cu-item">
  29. <view class="cu-avatar lg round" style="background-image:url(/static/images/news/2.png);"/>
  30. <view class="margin-top-sm text-sm">留言信息</view>
  31. </view>
  32. <view class="cu-item">
  33. <view class="cu-avatar lg round" style="background-image:url(/static/images/news/3.png);"/>
  34. <view class="margin-top-sm text-sm">互动信息</view>
  35. </view>
  36. </view>
  37. </view>
  38. <!--消息列表-->
  39. <view class="bg-white zaiui-news-list-box">
  40. <view class="margin-bottom cu-list menu-avatar">
  41. <view class="cu-item" :class="modalName=='move-box-'+ 0?'move-cur':''" @touchstart="ListTouchStart" @touchmove="ListTouchMove"
  42. @touchend="ListTouchEnd" :data-target="'move-box-' + 0" @tap="tapNews(0)">
  43. <view class="cu-avatar round" style="background-image:url(/static/images/news/4.png);">
  44. <view class="cu-tag badge"/>
  45. </view>
  46. <view class="content">
  47. <view class="text-black">通知助手</view>
  48. <view class="text-gray text-sm text-cut">小米:“我忍你很久了!”</view>
  49. <view class="text-gray text-sm">3小时前</view>
  50. </view>
  51. <view class="move">
  52. <view class="bg-grey">置顶</view>
  53. <view class="bg-red">删除</view>
  54. </view>
  55. </view>
  56. <view class="cu-item goods" :class="modalName=='move-box-'+ 1?'move-cur':''" @touchstart="ListTouchStart" @touchmove="ListTouchMove"
  57. @touchend="ListTouchEnd" :data-target="'move-box-' + 1" @tap="tapNews(1)">
  58. <view class="cu-avatar round" style="background-image:url(/static/images/avatar/1.jpg);">
  59. <view class="cu-tag badge"/>
  60. </view>
  61. <view class="content">
  62. <view class="text-black">
  63. <text class="margin-right-xs">仔仔</text>
  64. <text class="cu-tag bg-blue sm radius">
  65. <text class="cuIcon-male"></text>
  66. </text>
  67. </view>
  68. <view class="text-gray text-sm text-cut">欢迎使用本模板</view>
  69. <view class="text-gray text-sm">4小时前</view>
  70. </view>
  71. <view class="action">
  72. <view class="cu-avatar radius" style="background-image:url(/static/images/home/goods/11.png);"/>
  73. </view>
  74. <view class="move">
  75. <view class="bg-grey">置顶</view>
  76. <view class="bg-red">删除</view>
  77. </view>
  78. </view>
  79. <view class="cu-item goods" :class="modalName=='move-box-'+ 2?'move-cur':''" @touchstart="ListTouchStart" @touchmove="ListTouchMove"
  80. @touchend="ListTouchEnd" :data-target="'move-box-' + 2" @tap="tapNews(2)">
  81. <view class="cu-avatar round" style="background-image:url(/static/images/avatar/2.jpg);">
  82. <view class="cu-tag badge"/>
  83. </view>
  84. <view class="content">
  85. <view class="text-black">
  86. <text class="margin-right-xs">仔仔22</text>
  87. <text class="cu-tag bg-pink sm radius">
  88. <text class="cuIcon-female"></text>
  89. </text>
  90. </view>
  91. <view class="text-gray text-sm text-cut">希望打个赏哦~</view>
  92. <view class="text-gray text-sm">6小时前</view>
  93. </view>
  94. <view class="action">
  95. <view class="cu-avatar radius" style="background-image:url(/static/images/home/goods/10.png);"/>
  96. </view>
  97. <view class="move">
  98. <view class="bg-grey">置顶</view>
  99. <view class="bg-red">删除</view>
  100. </view>
  101. </view>
  102. </view>
  103. </view>
  104. <!--占位底部距离-->
  105. <view class="cu-tabbar-height"/>
  106. </view>
  107. </template>
  108. <script>
  109. import barTitle from '@/components/zaiui-common/basics/bar-title';
  110. import _tool from '@/static/zaiui/util/tools.js'; //工具函数
  111. export default {
  112. name: 'news',
  113. components: {
  114. barTitle
  115. },
  116. data() {
  117. return {
  118. modalName: null, listTouchStart: 0, listTouchDirection: null,
  119. }
  120. },
  121. props: {
  122. show: {
  123. type: Boolean,
  124. default: true
  125. },
  126. scrollY: {
  127. type: Number,
  128. default: 0
  129. },
  130. scrollBottom: {
  131. type: Number,
  132. default: 0
  133. }
  134. },
  135. watch: {
  136. scrollY() {
  137. //通知他妈的滚动了。
  138. this.setPageScroll(this.scrollY);
  139. },
  140. scrollBottom() {
  141. if(this.scrollBottom != 0) {
  142. //通知他妈的触底了
  143. this.setReachBottom();
  144. }
  145. },
  146. },
  147. created() {
  148. //加载虚拟数据
  149. },
  150. mounted() {
  151. _tool.setBarColor(true);
  152. uni.pageScrollTo({
  153. scrollTop: 0,
  154. duration: 0
  155. });
  156. },
  157. methods: {
  158. //页面被滚动
  159. setPageScroll(scrollTop) {
  160. //console.log(scrollTop);
  161. },
  162. //触底了
  163. setReachBottom() {
  164. console.log('触底了');
  165. },
  166. barTitleRightTap() {
  167. console.log('标题栏右边被点击');
  168. },
  169. // ListTouch触摸开始
  170. ListTouchStart(e) {
  171. this.listTouchStart = e.touches[0].pageX
  172. },
  173. // ListTouch计算方向
  174. ListTouchMove(e) {
  175. this.listTouchDirection = e.touches[0].pageX - this.listTouchStart > 0 ? 'right' : 'left'
  176. },
  177. // ListTouch计算滚动
  178. ListTouchEnd(e) {
  179. if (this.listTouchDirection == 'left') {
  180. this.modalName = e.currentTarget.dataset.target
  181. } else {
  182. this.modalName = null
  183. }
  184. this.listTouchDirection = null
  185. },
  186. //被点击
  187. tapNews(index) {
  188. console.log(index);
  189. if(index == 0) {
  190. uni.navigateTo({
  191. url: '/pages/news/notice',
  192. });
  193. } else if (index == 1) {
  194. uni.navigateTo({
  195. url: '/pages/news/chat',
  196. });
  197. }
  198. }
  199. }
  200. }
  201. </script>
  202. <style lang="scss" scoped>
  203. .zaiui-news-box {
  204. width: 100%;
  205. display: none;
  206. .zaiui-follow-box {
  207. .action-text-cut {
  208. width: 70%;
  209. }
  210. }
  211. .zaiui-grid-menu {
  212. .cu-list.grid.no-border>.cu-item {
  213. .cu-avatar {
  214. margin: 0 auto;
  215. }
  216. }
  217. }
  218. .zaiui-news-list-box {
  219. padding: 0 9.09upx;
  220. .cu-list.menu-avatar>.cu-item>.cu-avatar {
  221. width: 81.81upx;
  222. height: 81.81upx;
  223. }
  224. .cu-list.menu-avatar>.cu-item {
  225. height: 163.63upx;
  226. align-items: inherit;
  227. .cu-avatar {
  228. margin-top: 25.45upx;
  229. .cu-tag.badge {
  230. width: 21.81upx;
  231. height: 21.81upx;
  232. top: 0;
  233. right: 0;
  234. border: 1.81upx solid #fff;
  235. }
  236. }
  237. .content {
  238. left: 136.36upx;
  239. margin-top: 18.18upx;
  240. width: calc(100% - 90.9upx - 54.54upx - 18.18upx);
  241. line-height: 1.7em;
  242. .cu-tag {
  243. padding: 0 3.63upx;
  244. text {
  245. position: relative;
  246. top: -2upx;
  247. }
  248. }
  249. }
  250. &:after {
  251. width: 0;
  252. height: 0;
  253. border-bottom: 0;
  254. }
  255. }
  256. .cu-list.menu-avatar>.cu-item.goods {
  257. .content {
  258. width: calc(100% - 309.09upx);
  259. }
  260. .action {
  261. position: absolute;
  262. right: 23.63upx;
  263. width: 127.27upx;
  264. .cu-avatar {
  265. width: 127.27upx;
  266. height: 127.27upx;
  267. margin-top: 18.18upx;
  268. }
  269. }
  270. }
  271. }
  272. }
  273. .zaiui-news-box.show {
  274. display: block;
  275. }
  276. </style>