瑶都万能墙
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

399 lines
7.7 KiB

7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
  1. <template>
  2. <view class="publishPost">
  3. <navbar
  4. leftClick
  5. @leftClick="$utils.navigateBack"
  6. title="发布动态"/>
  7. <!-- <view class="title-input box">
  8. <input type="text" placeholder="取个吸引人的标题吧" v-model="form.title"/>
  9. </view> -->
  10. <view class="content-input">
  11. <uv-textarea
  12. v-model="form.title"
  13. :maxlength="200"
  14. autoHeight
  15. count
  16. style="min-height: 400rpx;"
  17. placeholder="说点什么吧"></uv-textarea>
  18. </view>
  19. <view class="images box">
  20. <uv-upload
  21. :fileList="fileList"
  22. :maxCount="imageMax"
  23. multiple
  24. width="150rpx"
  25. height="150rpx"
  26. @delete="deleteImage"
  27. @afterRead="afterRead"
  28. :previewFullImage="true"></uv-upload>
  29. </view>
  30. <view class="category">
  31. <view class="title">
  32. 选择分区
  33. </view>
  34. <view class="tagList">
  35. <view
  36. :class="{act : t.id == form.classId}"
  37. @click="clickCategory(t, i)"
  38. v-for="(t, i) in category"
  39. :key="i">
  40. {{ t.title }}
  41. </view>
  42. </view>
  43. </view>
  44. <view class="category">
  45. <view class="title">
  46. 选择地区
  47. </view>
  48. <view class="tagList">
  49. <view
  50. :class="{act : t.name == form.address}"
  51. @click="clickAddress(t, i)"
  52. v-for="(t, i) in cityList"
  53. :key="i">
  54. {{ t.name }}
  55. </view>
  56. </view>
  57. </view>
  58. <view class="title-input box">
  59. <input type="text" placeholder="手机号码(选填)" v-model="form.phone"/>
  60. </view>
  61. <!-- <view class="upTop"
  62. >
  63. <view class="title">
  64. <uv-icon name="pushpin-fill"></uv-icon>
  65. 是否置顶
  66. </view>
  67. <uv-radio-group v-model="form.topId">
  68. <view class="list">
  69. <view class="item">
  70. <view class="left">
  71. 不需要置顶
  72. </view>
  73. <view class="right">
  74. <uv-radio
  75. size="35rpx"
  76. icon-size="35rpx"
  77. :disabled="!!id"
  78. :name="0">
  79. </uv-radio>
  80. </view>
  81. </view>
  82. <view class="item"
  83. v-for="(item, index) in upTopList"
  84. :key="index">
  85. <view class="left">
  86. 置顶{{ item.day }}{{ item.money }}
  87. </view>
  88. <view class="right">
  89. <uv-radio
  90. size="35rpx"
  91. :disabled="!!id"
  92. icon-size="35rpx"
  93. :name="item.id">
  94. </uv-radio>
  95. </view>
  96. </view>
  97. </view>
  98. </uv-radio-group>
  99. </view> -->
  100. <view class="configBtn"
  101. @click="$refs.configPopup.open('getPublishPostNotice')">
  102. 发布须知
  103. </view>
  104. <view class="uni-color-btn"
  105. @click="submit">
  106. 发布
  107. </view>
  108. <configPopup
  109. ref="configPopup"
  110. />
  111. </view>
  112. </template>
  113. <script>
  114. import { mapState } from 'vuex'
  115. export default {
  116. components : {
  117. },
  118. data() {
  119. return {
  120. form : {
  121. title : '',
  122. classId : 0,
  123. address : '',
  124. },
  125. id : 0,
  126. fileList : [],
  127. imageMax : 9,
  128. };
  129. },
  130. computed : {
  131. ...mapState(['cityList', 'category']),
  132. },
  133. onLoad(args) {
  134. this.id = args.id
  135. this.form.classId = this.category[0].id
  136. this.form.address = this.cityList[0].name
  137. this.imageMax = args.imageMax || 9
  138. this.getDateil()
  139. },
  140. onShow() {
  141. this.$store.commit('getCategory')
  142. },
  143. methods : {
  144. clickCategory(item, index){
  145. this.form.classId = item.id
  146. },
  147. clickAddress(item, index){
  148. this.form.address = item.name
  149. },
  150. getDateil(){
  151. if(!this.id){
  152. return
  153. }
  154. let self = this
  155. this.$api('getPostDetail', {
  156. id : this.id
  157. }, res => {
  158. if (res.code == 200) {
  159. self.form.id = res.result.id
  160. self.form.title = res.result.title
  161. self.form.address = res.result.address || self.form.address
  162. self.form.classId = res.result.classId || self.form.classId
  163. if(res.result.image){
  164. res.result.image.split(',')
  165. .forEach(url => {
  166. self.fileList.push({
  167. url
  168. })
  169. })
  170. }
  171. }
  172. })
  173. },
  174. deleteImage(e){
  175. this.fileList.splice(e.index, 1)
  176. },
  177. afterRead(e){
  178. let self = this
  179. e.file.forEach(file => {
  180. self.$Oss.ossUpload(file.url).then(url => {
  181. self.fileList.push({
  182. url
  183. })
  184. })
  185. })
  186. },
  187. // // 发起支付
  188. // payOrder(){
  189. // let self = this
  190. // let data = {
  191. // // ...this.form,
  192. // content : this.form.content,
  193. // topId : this.form.topId,
  194. // title : this.form.title,
  195. // isCard : 'Y',
  196. // state : 0,
  197. // image : this.fileList.map((item) => item.url).join(","),
  198. // isTop : this.form.topId ? 'Y' : 'N',
  199. // }
  200. // if(this.id){
  201. // data.id = this.id
  202. // }
  203. // this.$api('infoReleaseTrends', data,
  204. // res => {
  205. // if(res.code == 200){
  206. // if(self.form.topId && !this.id){
  207. // uni.requestPayment({
  208. // provider: 'wxpay', // 服务提提供商
  209. // timeStamp: res.result.timeStamp, // 时间戳
  210. // nonceStr: res.result.nonceStr, // 随机字符串
  211. // package: res.result.packageValue,
  212. // signType: res.result.signType, // 签名算法
  213. // paySign: res.result.paySign, // 签名
  214. // success: function (res) {
  215. // console.log('支付成功',res);
  216. // self.$refs.confirmationPopupUpload.open()
  217. // // self.$refs.confirmationPopup.close()
  218. // },
  219. // fail: function (err) {
  220. // console.log('支付失败',err);
  221. // self.$refs.confirmationPopup.close()
  222. // uni.showToast({
  223. // icon:'none',
  224. // title:"支付失败"
  225. // })
  226. // }
  227. // });
  228. // }else{
  229. // self.$refs.confirmationPopupUpload.open()
  230. // }
  231. // }
  232. // })
  233. // },
  234. // 提交
  235. submit(){
  236. // if(this.fileList.length == 0){
  237. // return uni.showToast({
  238. // title: '请上传图片',
  239. // icon : 'none'
  240. // })
  241. // }
  242. if (this.$utils.verificationAll(this.form, {
  243. title: '说点什么吧',
  244. })) {
  245. return
  246. }
  247. this.form.image = this.fileList.map((item) => item.url).join(",")
  248. this.$api('publishPost', this.form, res => {
  249. if(res.code == 200){
  250. uni.showToast({
  251. title: '发布成功!',
  252. icon: 'none'
  253. })
  254. setTimeout(uni.navigateBack, 1000, -1)
  255. }
  256. })
  257. },
  258. preview(){},
  259. draft(){},
  260. }
  261. }
  262. </script>
  263. <style lang="scss" scoped>
  264. .publishPost{
  265. background-color: #fff;
  266. min-height: 100vh;
  267. font-size: 28rpx;
  268. padding-bottom: 150rpx;
  269. /deep/ .uv-textarea{
  270. background-color: transparent;
  271. border: none;
  272. }
  273. /deep/ .uv-textarea__count{
  274. background-color: transparent !important;
  275. }
  276. .box{
  277. padding: 0 20rpx;
  278. }
  279. .images{
  280. display: flex;
  281. flex-wrap: wrap;
  282. padding: 20rpx;
  283. }
  284. .title-input{
  285. border-bottom: 1px solid #00000015;
  286. padding-bottom: 25rpx;
  287. margin-bottom: 15rpx;
  288. }
  289. .content-input{
  290. min-height: 400rpx;
  291. /deep/ .uv-textarea{
  292. min-height: 400rpx;
  293. }
  294. }
  295. .upTop{
  296. .title{
  297. padding-top: 20rpx;
  298. padding-left: 20rpx;
  299. border-top: 1px solid #00000015;
  300. display: flex;
  301. align-items: center;
  302. }
  303. .list{
  304. padding-top: 30rpx;
  305. width: 100%;
  306. .item{
  307. display: flex;
  308. padding: 20rpx;
  309. padding-left: 80rpx;
  310. justify-content: space-between;
  311. width: 600rpx;
  312. border-bottom: 1px solid #00000015;
  313. align-items: center;
  314. }
  315. }
  316. }
  317. .configBtn{
  318. padding: 20rpx;
  319. color: #777;
  320. padding-top: 40rpx;
  321. font-size: 28rpx;
  322. }
  323. .confirmationPopup{
  324. display: flex;
  325. flex-direction: column;
  326. align-items: center;
  327. justify-content: center;
  328. width: 100%;
  329. height: 300rpx;
  330. image{
  331. margin-top: 40rpx;
  332. }
  333. .info{
  334. margin-top: 40rpx;
  335. font-size: 26rpx;
  336. }
  337. }
  338. }
  339. .category{
  340. padding: 20rpx;
  341. .title{
  342. // font-weight: 900;
  343. // font-size: 30rpx;
  344. }
  345. .tagList{
  346. display: flex;
  347. flex-wrap: wrap;
  348. padding: 10rpx 0;
  349. view{
  350. background: rgba($uni-color, 0.1);
  351. padding: 10rpx 20rpx;
  352. margin: 10rpx;
  353. border-radius: 10rpx;
  354. font-size: 26rpx;
  355. }
  356. .act{
  357. color: #fff;
  358. background: $uni-color;
  359. }
  360. }
  361. }
  362. </style>