write-back.vue 3.5 KB

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