postMessage.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <view>
  3. <u-navbar back-text="发布信息" back-icon-size="28" back-icon-color="#ffffff" :background="{backgroundColor: '#2795FD',}"
  4. :back-text-style="{color: '#ffffff'}"></u-navbar>
  5. <!-- 发布标题 -->
  6. <view class="post-title">
  7. <view class="title">
  8. 发布标题
  9. </view>
  10. <view class="title-content">
  11. <input v-model="form.title" class="input" type="text" value="" placeholder="请填写标题内容" />
  12. </view>
  13. <!-- 类型选择 -->
  14. <view class="type">
  15. <view class="name">
  16. <text>*</text>共享类型
  17. </view>
  18. <!-- 单选框 -->
  19. <u-radio-group v-model="form.type">
  20. <u-radio v-for="(item, index) in list" :key="index" :name="item.type"
  21. :disabled="item.disabled">
  22. {{item.name}}
  23. </u-radio>
  24. </u-radio-group>
  25. </view>
  26. </view>
  27. <!-- 内容描述 -->
  28. <view class="content-description">
  29. <view class="title">
  30. 内容描述
  31. </view>
  32. <view class="content-textarea" style="padding-bottom: 20px;" >
  33. 请描述共享用工需求内容,并留下您的联系方式。
  34. <u-input v-model="form.content" type="text" value="" placeholder="请填写" />
  35. </view>
  36. </view>
  37. <!-- 底部按钮 -->
  38. <button class="btn" @click="publishInformation">发布信息</button>
  39. </view>
  40. </template>
  41. <script>
  42. import * as API_packages from '@/apis/pagejs/packages.js'
  43. export default {
  44. data() {
  45. return {
  46. list: [{
  47. name: '急需用工',
  48. type: '1',
  49. disabled: false
  50. },
  51. {
  52. name: '资源共享',
  53. type: '2',
  54. disabled: false
  55. },
  56. ],
  57. // u-radio-group的v-model绑定的值如果设置为某个radio的name,就会被默认选中
  58. form: {
  59. id: '',
  60. type: '1',
  61. title: '',
  62. content: ''
  63. },
  64. current: 0
  65. };
  66. },
  67. onLoad(op) {
  68. if(op.id) {
  69. this.form.id = op.id;
  70. this.getShareWorksDetail();
  71. }
  72. },
  73. methods: {
  74. getShareWorksDetail() {
  75. uni.showLoading({
  76. title: "加载中",
  77. mask: true,
  78. })
  79. API_packages.shareWorksDetail({id: this.form.id}).then((res) => {
  80. this.form = res.data.shareWorksInfo;
  81. uni.hideLoading();
  82. }).catch(error => {
  83. uni.showToast({icon: 'none',
  84. title: error,
  85. icon: "none"
  86. })
  87. })
  88. },
  89. publishInformation() {
  90. if(!this.form.title) {
  91. uni.showToast({icon: 'none',
  92. title: "请填写标题内容",
  93. icon: "none"
  94. })
  95. return
  96. }
  97. if(!this.form.content) {
  98. uni.showToast({icon: 'none',
  99. title: "请描述共享用工需求内容",
  100. icon: "none"
  101. })
  102. return
  103. }
  104. uni.showLoading({
  105. title: "加载中",
  106. mask: true,
  107. })
  108. API_packages.createShareWork(this.form).then((res) => {
  109. uni.hideLoading();
  110. const eventChannel = this.getOpenerEventChannel();
  111. eventChannel.emit('refreshData');
  112. uni.navigateBack()
  113. }).catch(error => {
  114. uni.showToast({icon: 'none',
  115. title: error,
  116. icon: "none"
  117. })
  118. })
  119. }
  120. }
  121. };
  122. </script>
  123. <style>
  124. page {
  125. background: #F0F0F2;
  126. padding-bottom: 50px;
  127. }
  128. </style>
  129. <style scoped lang="scss">
  130. // 发布标题
  131. .post-title {
  132. margin: 24rpx 32rpx 0;
  133. padding: 24rpx 32rpx;
  134. color: rgba(16, 16, 16, 1);
  135. font-size: 36rpx;
  136. background-color: #fff;
  137. border-radius: 24rpx;
  138. .title {
  139. font-family: 'PingFangSC-medium';
  140. }
  141. .title-content {
  142. .input {
  143. width: 100%;
  144. height: 96rpx;
  145. line-height: 96rpx;
  146. color: rgba(136, 136, 136, 1);
  147. font-family: Microsoft Yahei;
  148. }
  149. }
  150. // 类型选择
  151. .type {
  152. display: flex;
  153. align-items: center;
  154. margin-top: 16rpx;
  155. .name {
  156. font-size: 32rpx;
  157. color: #101010;
  158. margin-right: 40rpx;
  159. text {
  160. color: #EE3138
  161. }
  162. }
  163. }
  164. }
  165. // 内容描述
  166. .content-description {
  167. margin: 24rpx 32rpx 0;
  168. padding: 24rpx 32rpx;
  169. color: rgba(16, 16, 16, 1);
  170. font-size: 36rpx;
  171. background-color: #fff;
  172. border-radius: 24rpx;
  173. .title {
  174. font-family: 'PingFangSC-medium';
  175. }
  176. .content-textarea {
  177. margin-top: 24rpx;
  178. .textarea {
  179. width: 100%;
  180. height: 640rpx;
  181. color: rgba(136, 136, 136, 1);
  182. font-family: Microsoft Yahei;
  183. line-height: 40rpx;
  184. }
  185. }
  186. }
  187. // 底部按钮
  188. .btn {
  189. position: fixed;
  190. bottom: 32rpx;
  191. left: 0;
  192. right: 0;
  193. background-color: #F0F0F2;
  194. padding: 0 32rpx;
  195. border-radius: 50px;
  196. background-color: rgba(34, 149, 255, 1);
  197. color: rgba(241, 241, 241, 1);
  198. font-size: 36rpx;
  199. margin: 0 32rpx;
  200. box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.03);
  201. }
  202. </style>