detail.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <view class="wrap">
  3. <div class="preview-conatiner">
  4. <view class="title">{{viewData.taskTitle}}</view>
  5. </div>
  6. <view class="content">
  7. <view class="result">
  8. <view class="title">
  9. <text>内容</text>
  10. </view>
  11. <view class="result-conatiner">
  12. <span class="tag" v-for="(item,key) in viewData.taskContent" :key="key" >{{item.text}}</span>
  13. </view>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. import {updateMemory} from '@/api/user.js'
  20. export default{
  21. data(){
  22. return{
  23. readSrc:"",
  24. viewData:{
  25. taskTitle:"",
  26. taskContent:[]
  27. },
  28. formData:{}
  29. }
  30. },
  31. onShow() {
  32. let info=uni.getStorageSync('detail-info')
  33. this.viewData=info
  34. let taskContentNew=[]
  35. let items=info.taskContent.split(/[\s\n]/).filter(item=>item!=="");
  36. items=items.map((item,index)=>{
  37. return {
  38. text: item,
  39. value: index,
  40. checked:0
  41. }
  42. })
  43. if(!this.isEmpty(info.taskContentNew)){
  44. taskContentNew=info.taskContentNew.split(/[\s\n]/).filter(item=>item!=="");
  45. taskContentNew=taskContentNew.map((item,index)=>{
  46. return {
  47. text: item,
  48. value: index,
  49. checked:1
  50. }
  51. })
  52. }
  53. this.viewData.taskContent=items.concat(taskContentNew)
  54. },
  55. onUnload() {
  56. uni.removeStorageSync('detail-info')
  57. },
  58. methods:{
  59. isEmpty(val){
  60. if(val!=="undefined"&&val!==undefined&&val!==""&&val!==null){
  61. return false
  62. }
  63. return true
  64. }
  65. }
  66. }
  67. </script>
  68. <style lang="scss" scoped>
  69. *{
  70. padding: 0;
  71. margin: 0;
  72. }
  73. .wrap{
  74. padding:20rpx;
  75. .title{
  76. height: 40rpx;
  77. font-size: 28rpx;
  78. font-family: PingFang SC;
  79. font-weight: bold;
  80. line-height: 40rpx;
  81. color: #333333;
  82. opacity: 1;
  83. padding:0 0 36rpx 20rpx;
  84. position: relative;
  85. &::after{
  86. width: 12rpx;
  87. height: 28rpx;
  88. background:#2A83EF;
  89. opacity: 1;
  90. border-radius: 6px;
  91. content: "";
  92. display: block;
  93. position: absolute;
  94. left: 0;
  95. top: 8rpx;
  96. }
  97. }
  98. .content{
  99. padding: 10rpx;
  100. margin-top: 24rpx;
  101. ::v-deep .uni-forms-item__content{
  102. display: flex;
  103. align-items: center;
  104. flex-wrap: wrap;
  105. }
  106. .title{
  107. display: flex;
  108. justify-content: space-between;
  109. align-items: center;
  110. }
  111. .tag{
  112. padding: 8rpx 20rpx;
  113. margin:8rpx ;
  114. background-color: #2A83EF;
  115. color: #fff;
  116. border-radius: 5rpx;
  117. display: inline-block;
  118. }
  119. }
  120. }
  121. </style>