write-back.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. changeFilePaths(filePath) {
  78. this.filePath = filePath;
  79. },
  80. sure() {
  81. let requestParams = {};
  82. this.btnInfo.params.map(item => {
  83. if (item.valueKey) {
  84. requestParams[item.paramsKey] = (
  85. item.isOutvalueKey ?
  86. this.missionDetails :
  87. this.btnInfo
  88. )[item.valueKey];
  89. } else if (item.value) {
  90. requestParams[item.paramsKey] = item.value;
  91. } else {
  92. switch (item.paramsKey) {
  93. case 'imgPath': // 上传图片
  94. requestParams[item.paramsKey] = this.filePath.join(',');
  95. break;
  96. case 'textarea': // 回复内容
  97. requestParams[item.paramsKey] = this.value;
  98. break;
  99. default:
  100. requestParams[item.paramsKey] = '';
  101. break;
  102. }
  103. }
  104. });
  105. this.$emit('comRequest', requestParams);
  106. }
  107. }
  108. }
  109. </script>
  110. <style lang="less">
  111. .write-back-page {
  112. height: 100%;
  113. padding-top: 15rpx;
  114. .scroll-y {
  115. height: calc(100% - 102rpx);
  116. .item-box {
  117. display: flex;
  118. background-color: #FFFFFF;
  119. border-bottom: 0.62rpx solid #DADEE6;
  120. padding: 25rpx 0;
  121. padding-left: 25rpx;
  122. .label-view {
  123. width: 175rpx;
  124. line-height: 37.5rpx;
  125. >text {
  126. font-size: 22.5rpx;
  127. color: #666F80;
  128. }
  129. }
  130. .textarea {
  131. width: 100%;
  132. min-height: 587.5rpx;
  133. background-color: #fff;
  134. padding: 0 25rpx;
  135. line-height: 37.5rpx;
  136. font-size: 22.5rpx;
  137. color: #525866;
  138. box-sizing: border-box;
  139. }
  140. }
  141. }
  142. .bottomBtn {
  143. position: fixed;
  144. bottom: 0;
  145. width: 100%;
  146. height: 75rpx;
  147. line-height: 75rpx;
  148. text-align: center;
  149. font-size: 22.5rpx;
  150. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  151. font-weight: 400;
  152. color: #FFFFFF;
  153. background: #3377FF;
  154. }
  155. }
  156. </style>