瑶都万能墙
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.

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