newRelease_com.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <div class="newRelease_com">
  3. <ul class="predetermineUl">
  4. <li class="predetermineLi2" style="border-bottom: none">
  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. </ul>
  17. <ul class="predetermineUl">
  18. <li class="detailLi2" style="border-bottom: none">
  19. <span class="liName">
  20. 快捷选择
  21. </span>
  22. <div class="detailLi2Box">
  23. <div class="detailLi2BoxTop">
  24. <div class="checkItem" :class="checkedName===item.label?'checked':''" v-for="item in checkList" :key="item.id" @click="clickCheck(item)">{{item.label}}</div>
  25. </div>
  26. </div>
  27. </li>
  28. <li class="detailLi">
  29. <span class="liName">地址</span>
  30. <span >
  31. <input class="liInfo" placeholder="选择地址" disabled>
  32. <van-icon name="location" style="color: rgba(51, 51, 51, 0.90)"/>
  33. </span>
  34. </li>
  35. <li class="detailLi" style="border-bottom: none">
  36. <span class="liName">电话</span>
  37. <span >
  38. <input class="liInfo" placeholder="请填写">
  39. </span>
  40. </li>
  41. </ul>
  42. <ul class="predetermineUl">
  43. <li class="detailLi2">
  44. <div class="titleBox" style="margin-bottom: 24rpx">
  45. <span class="liName">简介</span>
  46. <span class="tips">(支持图片上传限20M内,最多1张)</span>
  47. </div>
  48. <van-uploader
  49. :max-count="12"
  50. @delete="deleteRYXXZP"
  51. :file-list="fileList"
  52. @after-read="uploadRYXXZP"
  53. :show-upload="true"
  54. />
  55. <van-field
  56. :value="postData.constant"
  57. autosize
  58. type="textarea"
  59. placeholder="请输入"
  60. class="myField"
  61. maxlength="2000"
  62. show-word-limit
  63. />
  64. </li>
  65. </ul>
  66. <div class="buttonBox">
  67. <button class="btn zcBtn">暂存</button>
  68. <button class="btn tjBtn">发布</button>
  69. </div>
  70. </div>
  71. </template>
  72. <script>
  73. import { getByCodes, peripheryAdd, getUserLocalStorageInfo} from "@/js_sdk/http";
  74. export default {
  75. name: "newRelease_com",
  76. data(){
  77. return{
  78. dc_key: ['periphery_type'],
  79. fileList:[],
  80. checkList:[],
  81. postData:{},
  82. checkedName:'干洗'
  83. }
  84. },
  85. created(){
  86. this.getByCodes()
  87. },
  88. methods:{
  89. async getByCodes() {
  90. let data = await getByCodes(JSON.stringify(this.dc_key));
  91. this.dic_SelectList = this.$common.handleDicList(data);
  92. this.checkList = this.dic_SelectList.periphery_type
  93. console.log('checkList',this.checkList)
  94. },
  95. clickCheck(item){
  96. this.checkedName = item.label
  97. },
  98. deleteRYXXZP(event) {
  99. this.fileList.splice(event.detail.index, 1);
  100. this.$forceUpdate();
  101. },
  102. uploadRYXXZP(event) {
  103. console.log(event)
  104. let that = this;
  105. const { file } = event.detail;
  106. uni.uploadFile({
  107. url: that.$constant.BASE_URI + "/wx/fileController/upload",
  108. filePath: file.url,
  109. name: "file",
  110. formData: { user: "test" },
  111. success(res) {
  112. // 上传完成需要更新 fileList
  113. let data = JSON.parse(res.data);
  114. console.log('data',data)
  115. that.fileList.push({
  116. imgUrl: "/FileController/download/" + data.data[0],
  117. id: data.data[0],
  118. url:
  119. that.$constant.BASE_URI +
  120. "/FileController/download/" +
  121. data.data[0],
  122. isImage: true,
  123. });
  124. },
  125. fail(res) {},
  126. });
  127. },
  128. }
  129. }
  130. </script>
  131. <style scoped>
  132. </style>