index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <template>
  2. <div class="surrounding">
  3. <van-tabs :active="active" @change="onChange">
  4. <van-tab title="新增发布" :name="0">
  5. <div class="newRelease_com">
  6. <ul class="predetermineUl">
  7. <li class="predetermineLi2" style="border-bottom: none">
  8. <div class="liName">标题</div>
  9. <van-field
  10. :value="postData.constant"
  11. autosize
  12. type="textarea"
  13. placeholder="请输入"
  14. class="myField"
  15. maxlength="50"
  16. show-word-limit
  17. />
  18. </li>
  19. </ul>
  20. <ul class="predetermineUl">
  21. <li class="detailLi2" style="border-bottom: none">
  22. <span class="liName">
  23. 快捷选择
  24. </span>
  25. <div class="detailLi2Box">
  26. <div class="detailLi2BoxTop">
  27. <div class="checkItem" :class="checkedName===item.label?'checked':''" v-for="item in checkList" :key="item.id" @click="clickCheck(item)">{{item.label}}</div>
  28. </div>
  29. </div>
  30. </li>
  31. <li class="detailLi">
  32. <span class="liName">地址</span>
  33. <span >
  34. <input class="liInfo" placeholder="选择地址" disabled>
  35. <van-icon name="location" style="color: rgba(51, 51, 51, 0.90)"/>
  36. </span>
  37. </li>
  38. <li class="detailLi" style="border-bottom: none">
  39. <span class="liName">电话</span>
  40. <span >
  41. <input class="liInfo" placeholder="请填写">
  42. </span>
  43. </li>
  44. </ul>
  45. <ul class="predetermineUl">
  46. <li class="detailLi2">
  47. <div class="titleBox" style="margin-bottom: 24rpx">
  48. <span class="liName">简介</span>
  49. <span class="tips">(支持图片上传限20M内,最多1张)</span>
  50. </div>
  51. <van-uploader
  52. :max-count="12"
  53. @delete="deleteRYXXZP"
  54. :file-list="fileList"
  55. @after-read="uploadRYXXZP"
  56. :show-upload="true"
  57. />
  58. <van-field
  59. :value="postData.constant"
  60. autosize
  61. type="textarea"
  62. placeholder="请输入"
  63. class="myField"
  64. maxlength="2000"
  65. show-word-limit
  66. />
  67. </li>
  68. </ul>
  69. <div class="buttonBox">
  70. <button class="btn zcBtn">暂存</button>
  71. <button class="btn tjBtn">发布</button>
  72. </div>
  73. </div>
  74. </van-tab>
  75. <van-tab title="发布记录" :name="1">
  76. <releaseRecord_com/>
  77. </van-tab>
  78. </van-tabs>
  79. </div>
  80. </template>
  81. <script>
  82. import releaseRecord_com from "./components/releaseRecord_com.vue";
  83. export default {
  84. name: "index",
  85. components:{
  86. releaseRecord_com
  87. },
  88. data(){
  89. return{
  90. active:0,
  91. dc_key: ['periphery_type'],
  92. fileList:[],
  93. checkList:[],
  94. postData:{},
  95. checkedName:'干洗'
  96. }
  97. },
  98. created(){
  99. this.getByCodes()
  100. },
  101. methods:{
  102. async getByCodes() {
  103. let data = await getByCodes(JSON.stringify(this.dc_key));
  104. this.dic_SelectList = this.$common.handleDicList(data);
  105. this.checkList = this.dic_SelectList.periphery_type
  106. console.log('checkList',this.checkList)
  107. },
  108. clickCheck(item){
  109. this.checkedName = item.label
  110. },
  111. onChange(e){
  112. },
  113. deleteRYXXZP(event) {
  114. this.fileList.splice(event.detail.index, 1);
  115. this.$forceUpdate();
  116. },
  117. uploadRYXXZP(event) {
  118. console.log(event)
  119. let that = this;
  120. const { file } = event.detail;
  121. uni.uploadFile({
  122. url: that.$constant.BASE_URI + "/wx/fileController/upload",
  123. filePath: file.url,
  124. name: "file",
  125. formData: { user: "test" },
  126. success(res) {
  127. // 上传完成需要更新 fileList
  128. let data = JSON.parse(res.data);
  129. console.log('data',data)
  130. that.fileList.push({
  131. imgUrl: "/FileController/download/" + data.data[0],
  132. id: data.data[0],
  133. url:
  134. that.$constant.BASE_URI +
  135. "/FileController/download/" +
  136. data.data[0],
  137. isImage: true,
  138. });
  139. },
  140. fail(res) {},
  141. });
  142. },
  143. }
  144. }
  145. </script>
  146. <style lang="scss">
  147. .surrounding{
  148. .newRelease_com{
  149. .predetermineUl{
  150. margin: 24rpx 0;
  151. background: white;
  152. box-sizing: border-box;
  153. padding: 0 32rpx;
  154. .predetermineLi{
  155. padding: 32rpx 0;
  156. border-bottom: 1px solid rgba(230, 230, 230, 1);
  157. display: flex;
  158. justify-content: space-between;
  159. }
  160. .predetermineLi2{
  161. padding: 32rpx 0;
  162. border-bottom: 1px solid rgba(230, 230, 230, 1);
  163. display: flex;
  164. flex-direction: column;
  165. }
  166. .van-cell {
  167. background: #F5F7FA !important;
  168. border-radius: 8rpx;
  169. font-size: 28rpx;
  170. margin-top: 16rpx;
  171. }
  172. .liName{
  173. color: rgba(51, 51, 51, 1);
  174. font-size: 32rpx;
  175. }
  176. .liIpt{
  177. color: rgba(102, 102, 102, 1);
  178. font-size: 32rpx;
  179. text-align: right;
  180. }
  181. .detailLi{
  182. display: flex;
  183. justify-content: space-between;
  184. align-items: center;
  185. padding: 32rpx 0;
  186. border-bottom: 2rpx solid #E6E6E6;
  187. .liInfo{
  188. display: inline-block;
  189. text-align: right;
  190. max-width: 428rpx;
  191. color: rgba(102, 102, 102, 1);
  192. font-size: 32rpx;
  193. line-height: 38rpx;
  194. .radio{
  195. margin-left: 64rpx;
  196. }
  197. }
  198. }
  199. .detailLi2{
  200. display: flex;
  201. flex-direction: column;
  202. padding: 32rpx 0;
  203. border-bottom: 2rpx solid #E6E6E6;
  204. .detailLi2BoxTop{
  205. display: flex;
  206. flex-wrap: wrap;
  207. justify-content: space-between;
  208. margin: 12rpx 0;
  209. .checkItem{
  210. width: 128rpx;
  211. height: 64rpx;
  212. font-size: 28rpx;
  213. color: #666666;
  214. display: flex;
  215. align-items: center;
  216. justify-content: center;
  217. background: #F5F7FA;
  218. border-radius: 8rpx;
  219. margin: 12rpx 0;
  220. }
  221. .checked{
  222. background: #0365F9;
  223. color: white;
  224. }
  225. }
  226. }
  227. }
  228. .titleBox{
  229. display: flex;
  230. align-items: center;
  231. .titleName{
  232. color: rgba(24, 23, 42, 1);
  233. font-size: 32rpx;
  234. font-weight: 600;
  235. margin-right: 16rpx;
  236. }
  237. .tips{
  238. font-size: 28rpx;
  239. color: rgba(179, 179, 179, 1);
  240. }
  241. }
  242. .buttonBox{
  243. display: flex;
  244. justify-content: center;
  245. .btn{
  246. width: 240rpx;
  247. height: 80rpx;
  248. display: flex;
  249. border-radius: 8rpx;
  250. align-items: center;
  251. justify-content: center;
  252. margin: 48rpx 16rpx 150rpx 16rpx;
  253. color: white;
  254. letter-spacing: 2rpx;
  255. text-indent: 2rpx;
  256. }
  257. .zcBtn{
  258. background: #FE8643;
  259. }
  260. .tjBtn{
  261. background: #0365F9;
  262. }
  263. }
  264. }
  265. }
  266. </style>