homeworklist.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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">
  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" v-if="item.work.progress === 'going'"
  19. style="margin-left: auto; width: 90rpx; height: 90rpx;"></view>
  20. <view class="t-icon t-icon-daifabu" v-if="item.work.progress === 'pending'"
  21. style="margin-left: auto; width: 90rpx; height: 90rpx;"></view>
  22. </view>
  23. <!-- 正文 -->
  24. <view class="content-box">
  25. <view style="display:flex;flex-direction: column;padding: 0 20rpx;">
  26. <rich-text class="subtitle-info" style="margin-bottom: 15rpx;" :nodes="item.work.description"></rich-text>
  27. <view class="flex">
  28. <view class="subtitle">布置老师:</view>
  29. <view class="subtitle-info" style="margin-left: 10rpx;">{{item.work.creatorId}}</view>
  30. <view class="subtitle" style="margin-left: 20rpx;">截止时间:</view>
  31. <view class="subtitle-info" style="margin-left: 10rpx;">{{$timestampToTime(item.work.endTime)}}</view>
  32. </view>
  33. </view>
  34. <view class="content-detail-box">
  35. <view class="attachment-box" @click="openDocument">
  36. <view class="t-icon t-icon-WORD"></view>
  37. <view style="display: flex;flex-direction: column;margin-left: 20rpx;">
  38. <view class="content-detail">文件名: {{item.work.attachments[0].name}}</view>
  39. <view class="content-subtitle">文件大小: {{item.work.attachments[0].size/8/1024}}KB</view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. import {
  50. mapState,
  51. mapMutations
  52. } from 'vuex'
  53. export default {
  54. computed: {
  55. ...mapState('m_children', ['detailList'])
  56. },
  57. data() {
  58. return {
  59. //骨架页配置
  60. loading: true,
  61. height: ['200px', '200px', '200px', '200px', '200px', '200px', '200px', '200px', '200px', '200px'],
  62. };
  63. },
  64. onLoad(options) {
  65. uni.$u.sleep(1500).then(() => {
  66. this.loading = false
  67. })
  68. },
  69. methods: {
  70. openDocument() {
  71. //下载并打开文档
  72. uni.downloadFile({
  73. url: 'https://cdn.zhoukaiwen.com/kevin.pdf',
  74. success: function(res) {
  75. var filePath = res.tempFilePath;
  76. uni.openDocument({
  77. filePath: filePath,
  78. success: function(res) {
  79. console.log('打开文档成功');
  80. }
  81. });
  82. }
  83. })
  84. }
  85. }
  86. }
  87. </script>
  88. <style lang="scss">
  89. @import '@/subpkg/common/detailpage.scss';
  90. .attachment-box{
  91. display: flex;
  92. align-items: center;
  93. padding: 10rpx;
  94. border-radius: $card-border-radius;
  95. }
  96. </style>