newRelease.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <div class="newRelease">
  3. <ul class="predetermineUl">
  4. <li class="predetermineLi2">
  5. <div class="liName">标题</div>
  6. <van-field
  7. :value="postData.constant"
  8. autosize
  9. type="textarea"
  10. placeholder="请输入"
  11. class="myField"
  12. maxlength="50"
  13. show-word-limit
  14. />
  15. </li>
  16. <li class="predetermineLi2" style="border-bottom: none">
  17. <div class="titleBox" style="margin-bottom: 24rpx">
  18. <span class="liName">上传图片</span>
  19. <span class="tips">(支持图片上传限20M内,最多6张)</span>
  20. </div>
  21. <van-uploader
  22. :max-count="12"
  23. @delete="deleteRYXXZP"
  24. :file-list="fileList"
  25. @after-read="uploadRYXXZP"
  26. :show-upload="true"
  27. />
  28. </li>
  29. <li class="predetermineLi2" style="border-bottom: none">
  30. <div class="titleBox" style="margin-bottom: 24rpx">
  31. <span class="liName">内容</span>
  32. </div>
  33. <van-field
  34. :value="postData.constant"
  35. autosize
  36. type="textarea"
  37. placeholder="请输入"
  38. class="myField"
  39. maxlength="1000"
  40. show-word-limit
  41. />
  42. </li>
  43. </ul>
  44. <div class="buttonBox">
  45. <button class="btn zcBtn">暂存</button>
  46. <button class="btn tjBtn">发布</button>
  47. </div>
  48. </div>
  49. </template>
  50. <script>
  51. export default {
  52. name: "newRelease",
  53. data(){
  54. return{
  55. postData:{},
  56. fileList:[],
  57. }
  58. },
  59. methods:{
  60. deleteRYXXZP(event) {
  61. this.fileList.splice(event.detail.index, 1);
  62. this.$forceUpdate();
  63. },
  64. uploadRYXXZP(event) {
  65. console.log(event)
  66. let that = this;
  67. const { file } = event.detail;
  68. uni.uploadFile({
  69. url: that.$constant.BASE_URI + "/wx/fileController/upload",
  70. filePath: file.url,
  71. name: "file",
  72. formData: { user: "test" },
  73. success(res) {
  74. // 上传完成需要更新 fileList
  75. let data = JSON.parse(res.data);
  76. that.fileList.push({
  77. imgUrl: "/FileController/download/" + data.data[0],
  78. id: data.data[0],
  79. url:
  80. that.$constant.BASE_URI +
  81. "/FileController/download/" +
  82. data.data[0],
  83. isImage: true,
  84. });
  85. },
  86. fail(res) {},
  87. });
  88. },
  89. }
  90. }
  91. </script>
  92. <style lang="scss">
  93. .newRelease{
  94. .predetermineUl{
  95. margin: 24rpx 0;
  96. background: white;
  97. box-sizing: border-box;
  98. padding: 0 32rpx;
  99. .predetermineLi{
  100. padding: 32rpx 0;
  101. border-bottom: 1px solid rgba(230, 230, 230, 1);
  102. display: flex;
  103. justify-content: space-between;
  104. }
  105. .predetermineLi2{
  106. padding: 32rpx 0;
  107. border-bottom: 1px solid rgba(230, 230, 230, 1);
  108. display: flex;
  109. flex-direction: column;
  110. }
  111. .van-cell {
  112. background: #F5F7FA !important;
  113. border-radius: 8rpx;
  114. font-size: 28rpx;
  115. margin-top: 16rpx;
  116. }
  117. .liName{
  118. color: rgba(51, 51, 51, 1);
  119. font-size: 32rpx;
  120. }
  121. .liIpt{
  122. color: rgba(102, 102, 102, 1);
  123. font-size: 32rpx;
  124. text-align: right;
  125. }
  126. }
  127. .titleBox{
  128. display: flex;
  129. align-items: center;
  130. .titleName{
  131. color: rgba(24, 23, 42, 1);
  132. font-size: 32rpx;
  133. font-weight: 600;
  134. margin-right: 16rpx;
  135. }
  136. .tips{
  137. font-size: 28rpx;
  138. color: rgba(179, 179, 179, 1);
  139. }
  140. }
  141. .buttonBox{
  142. display: flex;
  143. justify-content: center;
  144. .btn{
  145. width: 240rpx;
  146. height: 80rpx;
  147. display: flex;
  148. border-radius: 8rpx;
  149. align-items: center;
  150. justify-content: center;
  151. margin: 48rpx 16rpx 150rpx 16rpx;
  152. color: white;
  153. letter-spacing: 2rpx;
  154. text-indent: 2rpx;
  155. }
  156. .zcBtn{
  157. background: #FE8643;
  158. }
  159. .tjBtn{
  160. background: #0365F9;
  161. }
  162. }
  163. }
  164. </style>