123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223 |
- <template>
- <view>
- <u-navbar back-text="发布信息" back-icon-size="28" back-icon-color="#ffffff" :background="{backgroundColor: '#2795FD',}"
- :back-text-style="{color: '#ffffff'}"></u-navbar>
- <!-- 发布标题 -->
- <view class="post-title">
- <view class="title">
- 发布标题
- </view>
- <view class="title-content">
- <input v-model="form.title" class="input" type="text" value="" placeholder="请填写标题内容" />
- </view>
- <!-- 类型选择 -->
- <view class="type">
- <view class="name">
- <text>*</text>共享类型
- </view>
- <!-- 单选框 -->
- <u-radio-group v-model="form.type">
- <u-radio v-for="(item, index) in list" :key="index" :name="item.type"
- :disabled="item.disabled">
- {{item.name}}
- </u-radio>
- </u-radio-group>
- </view>
- </view>
- <!-- 内容描述 -->
- <view class="content-description">
- <view class="title">
- 内容描述
- </view>
- <view class="content-textarea" style="padding-bottom: 20px;" >
- 请描述共享用工需求内容,并留下您的联系方式。
- <u-input v-model="form.content" type="text" value="" placeholder="请填写" />
- </view>
-
-
- </view>
- <!-- 底部按钮 -->
- <button class="btn" @click="publishInformation">发布信息</button>
- </view>
- </template>
- <script>
- import * as API_packages from '@/apis/pagejs/packages.js'
-
- export default {
- data() {
- return {
- list: [{
- name: '急需用工',
- type: '1',
- disabled: false
- },
- {
- name: '资源共享',
- type: '2',
- disabled: false
- },
- ],
- // u-radio-group的v-model绑定的值如果设置为某个radio的name,就会被默认选中
- form: {
- id: '',
- type: '1',
- title: '',
- content: ''
- },
- current: 0
- };
- },
- onLoad(op) {
- if(op.id) {
- this.form.id = op.id;
- this.getShareWorksDetail();
- }
- },
- methods: {
- getShareWorksDetail() {
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- API_packages.shareWorksDetail({id: this.form.id}).then((res) => {
- this.form = res.data.shareWorksInfo;
- uni.hideLoading();
- }).catch(error => {
- uni.showToast({icon: 'none',
- title: error,
- icon: "none"
- })
- })
- },
- publishInformation() {
- if(!this.form.title) {
- uni.showToast({icon: 'none',
- title: "请填写标题内容",
- icon: "none"
- })
- return
- }
- if(!this.form.content) {
- uni.showToast({icon: 'none',
- title: "请描述共享用工需求内容",
- icon: "none"
- })
- return
- }
-
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- API_packages.createShareWork(this.form).then((res) => {
- uni.hideLoading();
- const eventChannel = this.getOpenerEventChannel();
- eventChannel.emit('refreshData');
- uni.navigateBack()
- }).catch(error => {
- uni.showToast({icon: 'none',
- title: error,
- icon: "none"
- })
- })
- }
- }
- };
- </script>
- <style>
- page {
- background: #F0F0F2;
- padding-bottom: 50px;
- }
- </style>
- <style scoped lang="scss">
- // 发布标题
- .post-title {
- margin: 24rpx 32rpx 0;
- padding: 24rpx 32rpx;
- color: rgba(16, 16, 16, 1);
- font-size: 36rpx;
- background-color: #fff;
- border-radius: 24rpx;
- .title {
- font-family: 'PingFangSC-medium';
- }
- .title-content {
- .input {
- width: 100%;
- height: 96rpx;
- line-height: 96rpx;
- color: rgba(136, 136, 136, 1);
- font-family: Microsoft Yahei;
- }
- }
- // 类型选择
- .type {
- display: flex;
- align-items: center;
- margin-top: 16rpx;
- .name {
- font-size: 32rpx;
- color: #101010;
- margin-right: 40rpx;
- text {
- color: #EE3138
- }
- }
- }
- }
- // 内容描述
- .content-description {
- margin: 24rpx 32rpx 0;
- padding: 24rpx 32rpx;
- color: rgba(16, 16, 16, 1);
- font-size: 36rpx;
- background-color: #fff;
- border-radius: 24rpx;
- .title {
- font-family: 'PingFangSC-medium';
- }
- .content-textarea {
- margin-top: 24rpx;
- .textarea {
- width: 100%;
- height: 640rpx;
- color: rgba(136, 136, 136, 1);
- font-family: Microsoft Yahei;
- line-height: 40rpx;
- }
- }
- }
- // 底部按钮
- .btn {
- position: fixed;
- bottom: 32rpx;
- left: 0;
- right: 0;
- background-color: #F0F0F2;
- padding: 0 32rpx;
- border-radius: 50px;
- background-color: rgba(34, 149, 255, 1);
- color: rgba(241, 241, 241, 1);
- font-size: 36rpx;
- margin: 0 32rpx;
- box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.03);
- }
- </style>
|