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

356 lines
6.5 KiB

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