add-circle.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <view class="add-circle-box iPhone-bottom flex-common-css box-border-box">
  3. <page-meta :page-style="'overflow:'+(show?'hidden':'visible')"></page-meta>
  4. <Nav title='发圈子' bgckgroundBox='#fff'></Nav>
  5. <view class="scroll-view-css box-border-box ptp-24">
  6. <view class="bgc-f box-border-box p-32">
  7. <view class="fs-34 fw-600 mb-20">内容描述 <span class='fs-34 fc-9 fw-400'>(必填)</span></view>
  8. <textarea v-model="fromData.content" class="textarea-class fs-24" :maxlength='500'
  9. placeholder='这一刻说些什么'></textarea>
  10. </view>
  11. <view class="bgc-f mb-20">
  12. <EnUpload v-model="fromData.image" number='9'></EnUpload>
  13. </view>
  14. <view class="bgc-f box-border-box p-32 flex-justify-space align-items-center" @click="openPop()">
  15. <view class="fs-34 fw-600">{{typeName}}</view>
  16. <image class="right-icon" src="@/static/img/toRight.png" mode=""></image>
  17. </view>
  18. </view>
  19. <view class="box-border-box p-32" @click="save()">
  20. <view class="b-bottom text-align-center fs-32 fw-600 fc-f">发布</view>
  21. </view>
  22. <uni-popup ref="popup" type="bottom" background-color="#fff" @change="change">
  23. <view class="pop-box box-border-box p-24">
  24. <view class="head-pop flex-justify-space align-items-center mb-24">
  25. <uni-icons @click.stop="closePop(1)" type="closeempty" size="24"></uni-icons>
  26. <view class="fs-36 fc-0 fw-600">选发布类型</view>
  27. <view class="fs-28 fw-600 fc-41ABF5" @click.stop="closePop(2)">确定</view>
  28. </view>
  29. <view class="scroll-view-css">
  30. <view class="item-box fs-32 " :class="fromData.topic_id==item.id?'fc-41ABF5 bgc-D5EDFB':'bgc-F3F4F6'"
  31. v-for="(item,i) in classList" :key="i" @click="selectPopAddEditType(item)">{{item.name}}</view>
  32. </view>
  33. </view>
  34. </uni-popup>
  35. </view>
  36. </template>
  37. <script>
  38. import {
  39. getTopic
  40. } from '@/api/category.js';
  41. import {
  42. alumniSave
  43. } from '@/api/alumni.js';
  44. import tools from '@/service/tools';
  45. import EnUpload from '@/components/en-from/en-upload/en-upload.vue';
  46. export default {
  47. components: {
  48. EnUpload
  49. },
  50. data() {
  51. return {
  52. fromData: {
  53. news_id: '',
  54. content: '',
  55. image: [],
  56. school_id: '',
  57. topic_id: '',
  58. },
  59. isAJAX: false,
  60. classList: [],
  61. typeName: '请选择发布类型',
  62. show: 'false'
  63. }
  64. },
  65. onLoad(e) {
  66. if (e.news_id) {
  67. this.fromData.news_id = e.news_id;
  68. } else {
  69. this.fromData.news_id = '';
  70. }
  71. },
  72. methods: {
  73. change(e) {
  74. this.show = e.show
  75. },
  76. selectPopAddEditType(item) {
  77. if (this.fromData.topic_id != item.id) {
  78. this.fromData.topic_id = item.id;
  79. this.typeName = item.name;
  80. }
  81. },
  82. openPop() {
  83. getTopic().then((res) => {
  84. if (res.code === 1) {
  85. this.classList = res.data;
  86. this.$refs.popup.open();
  87. }
  88. })
  89. },
  90. closePop(type) {
  91. if (type === 1) {
  92. this.fromData.topic_id = '';
  93. this.typeName = '请选择发布类型';
  94. }
  95. this.$refs.popup.close();
  96. },
  97. save() {
  98. if (this.isAJAX) {
  99. return
  100. }
  101. this.isAJAX = true;
  102. let circleSchoolId = uni.getStorageSync('circleSchoolId');
  103. let school_id = uni.getStorageSync('school_id');
  104. this.fromData.school_id = circleSchoolId ? circleSchoolId : school_id;
  105. alumniSave(this.fromData).then((res) => {
  106. if (res.code === 1) {
  107. tools.success(res.msg)
  108. setTimeout(() => {
  109. this.isAJAX = false;
  110. uni.reLaunch({
  111. url: '/pages-school/school-circle'
  112. })
  113. }, 1500)
  114. } else {
  115. tools.error(res.msg)
  116. this.isAJAX = false;
  117. }
  118. })
  119. },
  120. }
  121. }
  122. </script>
  123. <style scoped lang="scss">
  124. .textarea-class {
  125. width: 100%;
  126. }
  127. .add-circle-box {
  128. .b-bottom {
  129. width: 686rpx;
  130. height: 88rpx;
  131. line-height: 88rpx;
  132. background: linear-gradient(105deg, #57CAFF 0%, #41ABF5 100%);
  133. border-radius: 200rpx;
  134. }
  135. .right-icon {
  136. width: 32rpx;
  137. height: 32rpx;
  138. }
  139. .head-pop {
  140. padding-bottom: 34rpx !important;
  141. border-bottom: 1rpx solid #F2F2F2;
  142. }
  143. .pop-box {
  144. width: 100%;
  145. height: 50vh;
  146. // background-color: #fff;
  147. border-radius: 24rpx 24rpx 0rpx 0rpx;
  148. display: flex;
  149. flex-direction: column;
  150. .item-box {
  151. width: 100%;
  152. height: 92rpx;
  153. border-radius: 200rpx;
  154. line-height: 92rpx;
  155. text-align: center;
  156. margin-bottom: 24rpx;
  157. }
  158. }
  159. }
  160. </style>