subscribe.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <view class="container">
  3. <!-- 头部区域 -->
  4. <top-box v-bind:timeStamp="timeStamp"></top-box>
  5. <!-- 列表区域 -->
  6. <view class="card-box">
  7. <view class="card-item"></view>
  8. <view class="card-item"></view>
  9. <view class="card-item"></view>
  10. <view class="card-item"></view>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. import {
  16. mapState
  17. } from 'vuex'
  18. export default {
  19. computed: {
  20. ...mapState('m_parent', ['parentinfo'])
  21. },
  22. data() {
  23. return {
  24. //时间戳
  25. timeStamp: '',
  26. }
  27. },
  28. methods:{
  29. //更新时间戳
  30. getTimeStamp() {
  31. var date = new Date(),
  32. hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(),
  33. minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
  34. this.timeStamp = (hour + ':' + minute).toString();
  35. }
  36. },
  37. onLoad() {
  38. this.getTimeStamp()
  39. },
  40. //刷新页面
  41. onPullDownRefresh() {
  42. this.getTimeStamp()
  43. console.log('refresh');
  44. setTimeout(function() {
  45. uni.stopPullDownRefresh();
  46. }, 1000);
  47. }
  48. }
  49. </script>
  50. <style lang="scss">
  51. .container {
  52. width: 100%;
  53. height: 100%;
  54. overflow-x: hidden; //隐藏多余的页面
  55. .home-topinfo {
  56. background: linear-gradient(#ffd200, #f1f3f5);
  57. }
  58. .card-box {
  59. display: flex;
  60. flex-direction: row;
  61. flex-wrap: wrap;
  62. margin: -50rpx 20rpx 0 20rpx;
  63. justify-content: space-between;
  64. .card-item{
  65. margin: 10rpx 0;
  66. display: flex;
  67. flex-direction: column;
  68. justify-content: space-between;
  69. background-color: #FFFFFF;
  70. box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.05);
  71. border-radius: 16rpx;
  72. width: 100%;
  73. height: 250rpx;
  74. }
  75. }
  76. }
  77. </style>