write-back.vue 3.7 KB

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