homeworklist.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <view class="container">
  3. <!-- 返回按钮 -->
  4. <back text="详情列表"></back>
  5. <view style="margin: 20rpx;">
  6. <u-skeleton :rows="detailList.length" :rowsHeight="height" :loading="loading">
  7. </u-skeleton>
  8. </view>
  9. <view class="detail-box" v-if="!loading">
  10. <view class="detail-item" v-for="(item,index) in detailList" :key="index" @click="navSingleData(item)">
  11. <view class="flex" style="width: 100%;height: 90rpx;">
  12. <view class="flex" style="margin: -30rpx 0 0 10rpx;">
  13. <view class="index" :style="{backgroundColor: item.work.progress === 'finish'? '#23b46c': '#ff8caf' }"></view>
  14. <view class="name">{{item.work.name}}</view>
  15. </view>
  16. <view class="t-icon t-icon-yiwancheng1" v-if="item.work.progress === 'finish'"
  17. style="margin-left: auto; width: 90rpx; height: 90rpx;"></view>
  18. <view class="t-icon t-icon-jinhangzhong-copy1" v-if="item.work.progress === 'going'"
  19. style="margin-left: auto; width: 90rpx; height: 90rpx;"></view>
  20. </view>
  21. <!-- 正文 -->
  22. <view class="content-box">
  23. <view class="flex-colum" style="padding: 0 30rpx;">
  24. <rich-text class="subtitle-info" style="margin-bottom: 15rpx;" :nodes="item.work.description"></rich-text>
  25. <view class="flex">
  26. <view class="subtitle">布置老师:</view>
  27. <view class="subtitle-info" style="margin-left: 10rpx;">{{item.work.creatorId}}</view>
  28. <view class="subtitle" style="margin-left: 20rpx;">截止时间:</view>
  29. <view class="subtitle-info" style="margin-left: 10rpx;">{{$timestampToTime(item.work.endTime)}}</view>
  30. </view>
  31. </view>
  32. <view class="content-detail-box" style="padding: 0 20rpx;">
  33. <view class="title-box" :style="{backgroundColor: item.work.progress === 'finish'? '#23b46c': '#ff8caf',top: -15 +'rpx' }">
  34. <view class="content-subtitle">作业附件</view>
  35. </view>
  36. <view v-for="(attachment,i) in item.work.attachments" :key="i" style="margin-bottom: 20rpx;">
  37. <view class="attachment-box">
  38. <view v-if="attachment.type == 'word'" class="t-icon t-icon-WORD"></view>
  39. <view v-if="attachment.type == 'excel'" class="t-icon t-icon-ECEL"></view>
  40. <view v-if="attachment.type == 'pdf'" class="t-icon t-icon-PDF"></view>
  41. <view v-if="attachment.type == 'image'" class="t-icon t-icon-tupianziliao"></view>
  42. <view class="flex-colum" style="margin-left: 20rpx;">
  43. <view class="content-detail">文件名: {{attachment.name}}</view>
  44. <view class="content-subtitle" style="color: #aaa;">文件大小: {{fixNum(attachment.size/8/1024)}}KB</view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </template>
  54. <script>
  55. import {
  56. mapState,
  57. mapMutations
  58. } from 'vuex'
  59. export default {
  60. computed: {
  61. ...mapState('m_children', ['detailList'])
  62. },
  63. data() {
  64. return {
  65. //骨架页配置
  66. loading: true,
  67. height: ['200px', '200px', '200px', '200px', '200px', '200px', '200px', '200px', '200px', '200px'],
  68. };
  69. },
  70. onLoad(options) {
  71. uni.$u.sleep(1500).then(() => {
  72. this.loading = false
  73. })
  74. },
  75. methods: {
  76. ...mapMutations('m_children', ['updateDetail']),
  77. fixNum(num){
  78. return num.toFixed(2)
  79. },
  80. //导航到详情页面
  81. navSingleData(item){
  82. this.updateDetail(item)
  83. uni.navigateTo({
  84. url: `/subpkg/detail/homework`
  85. })
  86. },
  87. // openDocument(url) {
  88. // //下载并打开文档
  89. // uni.downloadFile({
  90. // url: url,
  91. // success: function(res) {
  92. // var filePath = res.tempFilePath;
  93. // uni.openDocument({
  94. // filePath: filePath,
  95. // success: function(res) {
  96. // console.log('打开文档成功');
  97. // }
  98. // });
  99. // }
  100. // })
  101. // }
  102. }
  103. }
  104. </script>
  105. <style lang="scss">
  106. @import '@/subpkg/common/detaillistpage.scss';
  107. .attachment-box{
  108. display: flex;
  109. align-items: center;
  110. padding: 15rpx 20rpx;
  111. background-color: #FFF;
  112. border-radius: 10rpx;
  113. }
  114. .flex-colum{
  115. display: flex;
  116. flex-direction: column;
  117. }
  118. </style>