write-back.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <view class="write-back-page">
  3. <scroll-view class="scroll-y" scroll-y="true" >
  4. <view class="item-box">
  5. <view class="label-view">
  6. <text>回复内容</text>
  7. </view>
  8. <textarea class="textarea"
  9. placeholder="请输入"
  10. placeholder-style="color: #B8BECC"
  11. :maxlength="-1"
  12. :disabled="disabled"
  13. auto-height
  14. :value="disabled ? values['textarea'] : value"
  15. @input="changeValue"
  16. />
  17. </view>
  18. <tm-upload-img
  19. :filePaths="filePath"
  20. :isMultiple="true"
  21. :disabled="disabled"
  22. @changeFilePaths="changeFilePaths"
  23. />
  24. </scroll-view>
  25. <view class="fixed-buttom-btn"
  26. v-if="!disabled"
  27. @click="sure">
  28. <text class="btn-text">确定</text>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. // 改善回复
  34. export default {
  35. props: {
  36. // 是否禁用
  37. disabled: {
  38. type: Boolean,
  39. default: false
  40. },
  41. // 详情回显的数据
  42. values: {
  43. type: Object,
  44. default: () => {
  45. return {}
  46. }
  47. },
  48. // 按钮信息 (包过请求的key)
  49. btnInfo: {
  50. type: Object,
  51. default: () => {
  52. return {}
  53. }
  54. },
  55. // 任务详情
  56. missionDetails: {
  57. type: Object,
  58. default: () => {
  59. return {}
  60. }
  61. }
  62. },
  63. data() {
  64. return {
  65. value: '',
  66. filePath: []
  67. }
  68. },
  69. created() {
  70. uni.setNavigationBarTitle({
  71. title: '原因'
  72. });
  73. if(this.disabled) {
  74. this.value = this.values['textarea'];
  75. this.filePath = this.values['filePath'] ? this.values['filePath'].split(',') : [];
  76. }
  77. },
  78. methods: {
  79. changeValue(e) {
  80. this.value = e.detail.value;
  81. },
  82. changeFilePaths(filePath) {
  83. this.filePath = filePath;
  84. },
  85. sure() {
  86. let requestParams = {};
  87. this.btnInfo.params.map(item => {
  88. if(item.valueKey){
  89. requestParams[item.paramsKey] = (
  90. item.isOutvalueKey
  91. ? this.missionDetails
  92. : this.btnInfo
  93. )[item.valueKey];
  94. }else {
  95. switch(item.paramsKey){
  96. case 'imgPath': // 上传图片
  97. requestParams[item.paramsKey] = this.filePath.join(',');
  98. break;
  99. case 'textarea': // 回复内容
  100. requestParams[item.paramsKey] = this.value;
  101. break;
  102. default:
  103. requestParams[item.paramsKey] = '';
  104. break;
  105. }
  106. }
  107. });
  108. this.$emit('comRequest', requestParams);
  109. }
  110. }
  111. }
  112. </script>
  113. <style lang="less">
  114. .write-back-page {
  115. height: 100%;
  116. padding-top: 15rpx;
  117. .scroll-y {
  118. height: calc(100% - 102rpx);
  119. .item-box {
  120. display: flex;
  121. background-color: #FFFFFF;
  122. border-bottom: 0.62rpx solid #DADEE6;
  123. padding: 25rpx 0;
  124. padding-left: 25rpx;
  125. .label-view {
  126. width: 175rpx;
  127. line-height: 37.5rpx;
  128. >text {
  129. font-size: 22.5rpx;
  130. color: #666F80;
  131. }
  132. }
  133. .textarea {
  134. width: 100%;
  135. min-height: 587.5rpx;
  136. background-color: #fff;
  137. padding: 0 25rpx;
  138. line-height: 37.5rpx;
  139. font-size: 22.5rpx;
  140. color: #525866;
  141. box-sizing: border-box;
  142. }
  143. }
  144. }
  145. }
  146. </style>