帧视界壹通告,付费看视频的微信小程序
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.

374 lines
7.4 KiB

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