123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 |
- <template>
- <view class="content">
- <view class="box">
- <view class="hflex acenter jbetween cell">
- <view class="label">姓名</view>
- <u-input v-model="name" placeholder="请填写姓名" inputAlign="right" border="none"></u-input>
- </view>
- <view class="hflex acenter jbetween cell">
- <view class="label">所在单位</view>
- <u-input v-model="work" placeholder="请填写所在单位名称" inputAlign="right" border="none"></u-input>
- </view>
- <view class="cell">
- <view class="label">营业执照照片</view>
- <view class="upload hflex acenter jcenter">
- <u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" :maxCount="1" name="1" multiple :previewFullImage="true" width="530rpx" height="324rpx">
- <image src="https://ship-expert.zhousi.hdlkeji.com/common/upload-business.png" style="width: 530rpx;height: 324rpx;"></image>
- <image class="upload_img" src="https://ship-expert.zhousi.hdlkeji.com/common/upload-top.png"></image>
- </u-upload>
- </view>
- </view>
- <view class="cell" style="border: none;">
- <view class="label">身份证正反面</view>
- <view class="hflex acenter jbetween" style="margin-top: 28rpx;">
- <u-upload :fileList="fileList2" @afterRead="afterRead" @delete="deletePic" :maxCount="1" name="2" multiple :previewFullImage="true" width="310rpx" height="188rpx">
- <image src="https://ship-expert.zhousi.hdlkeji.com/common/upload-just.png" style="width: 310rpx;height: 188rpx;"></image>
- </u-upload>
- <view class="upload2">
- <u-upload :fileList="fileList3" @afterRead="afterRead" @delete="deletePic" :maxCount="1" name="3" multiple :previewFullImage="true" width="310rpx" height="188rpx">
- <image src="https://ship-expert.zhousi.hdlkeji.com/common/upload-back.png" style="width: 310rpx;height: 188rpx;"></image>
- <image class="upload_img2" src="https://ship-expert.zhousi.hdlkeji.com/common/upload-top.png"></image>
- </u-upload>
- </view>
- </view>
- </view>
- </view>
- <view class="box">
- <view class="hflex acenter jbetween cell">
- <view class="label">手机号</view>
- <u-input v-model="phone" placeholder="请填写你的手机号" inputAlign="right" border="none"></u-input>
- </view>
- <view class="hflex acenter jbetween cell">
- <view class="label">邮箱</view>
- <u-input v-model="email" placeholder="请填写你的邮箱" inputAlign="right" border="none"></u-input>
- </view>
- <view class="hflex acenter jbetween cell" style="border: none;">
- <view class="label">地址</view>
- <u-input v-model="address" placeholder="请填写你的详细地址" inputAlign="right" border="none"></u-input>
- </view>
- </view>
- <view class="box" style="margin-bottom: 186rpx;">
- <view class="cell vflex jbetween">
- <view class="label">工作简历</view>
- <u-input v-model="resume" placeholder="请详细描述你的工作经历" border="none"></u-input>
- </view>
- <view class="cell vflex jbetween" style="border: none;">
- <view class="label">特长</view>
- <u-input v-model="speciality" placeholder="请简单叙述一下你的优点及特长" border="none"></u-input>
- </view>
- </view>
- <view class="bottom">
- <view class="bottom_btn" @click="open">立即发布</view>
- </view>
- </view>
- </template>
- <script>
- import $api from '@/static/js/api.js'
- var that = ''
- export default {
- data() {
- return {
- name: '',
- work: '',
- fileList1: [],
- fileList2: [],
- fileList3: [],
- phone: '',
- email: '',
- address: '',
- resume: '',
- speciality: '',
- id: ''
- }
- },
- onLoad() {
- that = this
- },
- methods: {
- // 立即发布
- open() {
- uni.showLoading({
- title: '发布中',
- mask: true
- })
- if($api.formCheck(that.name,'required') && $api.formCheck(that.work,'required') && $api.formCheck(that.fileList1,'required') && $api.formCheck(that.fileList2,'required') && $api.formCheck(that.fileList3,'required')
- && $api.formCheck(that.phone,'mobile') && $api.formCheck(that.email,'required') && $api.formCheck(that.address,'required')&& $api.formCheck(that.resume,'required')&& $api.formCheck(that.speciality,'required')) {
- $api.req({
- url: '/data/api.auth.ShipEngineMaintenance/subacceptance',
- method: 'POST',
- data: {
- name: that.name,
- company_name: that.work,
- business_img: that.fileList1[0].url,
- id_card_zheng: that.fileList2[0].url,
- id_card_fan: that.fileList3[0].url,
- phone: that.phone,
- email: that.email,
- address: that.address,
- job_resume: that.resume,
- specialty: that.speciality,
- province: uni.getStorageSync('location').province,
- city: uni.getStorageSync('location').city,
- area: uni.getStorageSync('location').district,
- id: that.id
- }
- }, function(res) {
- uni.hideLoading()
- if(res.code == 1) {
- $api.info(res.info)
- }
- })
- }
- },
- // 删除图片
- deletePic(event) {
- this[`fileList${event.name}`].splice(event.index, 1)
- },
- // 新增图片
- async afterRead(event) {
- uni.showLoading({
- title: '上传中',
- mask: true
- })
- let lists = [].concat(event.file)
- let fileListLen = this[`fileList${event.name}`].length
- lists.map((item) => {
- this[`fileList${event.name}`].push({
- ...item,
- status: 'uploading',
- message: '上传中'
- })
- })
- for (let i = 0; i < lists.length; i++) {
- const result = await this.uploadFilePromise(lists[i].url)
- let item = this[`fileList${event.name}`][fileListLen]
- this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
- status: 'success',
- message: '',
- url: result.url
- }))
- fileListLen++
- if(lists.length - 1 == i) {
- uni.hideLoading()
- }
- }
- },
- uploadFilePromise(url) {
- return new Promise((resolve, reject) => {
- let a = uni.uploadFile({
- url: $api.config.baseUrl + '/data/api.auth.Center/upload',
- filePath: url,
- name: 'file',
- header: {
- 'content-type': 'application/x-www-form-urlencoded',
- 'api-token': uni.getStorageSync('token').token?uni.getStorageSync('token').token:'',
- 'api-name': 'wxapp'
- },
- formData: {
- user: 'test'
- },
- success: (res) => {
- setTimeout(() => {
- var data = JSON.parse(res.data)
- resolve(data.data)
- }, 1000)
- }
- });
- })
- },
- },
- }
- </script>
- <style lang="scss" scoped>
- .content::v-deep {
- background: #F4F4F4;
- .box {
- width: 690rpx;
- margin: 20rpx 30rpx 0;
- background: #FFFFFF;
- border-radius: 10px;
- box-sizing: border-box;
- padding: 20rpx;
- .cell {
- width: 100%;
- padding: 32rpx 0 24rpx;
- border-bottom: 1rpx solid #F4F4F4;
- .label {
- font-size: 28rpx;
- font-weight: 400;
- color: #222222;
- line-height: 40rpx;
- }
- .upload {
- box-sizing: border-box;
- padding: 40rpx 60rpx;
- position: relative;
- width: 100%;
- height: 400rpx;
- background: #F4F4F4;
- border-radius: 16rpx;
- margin-top: 24rpx;
- .upload_img {
- position: absolute;
- width: 120rpx;
- height: 120rpx;
- top: 142rpx;
- left: 266rpx;
- }
- }
- .upload2 {
- position: relative;
- .upload_img2 {
- position: absolute;
- width: 80rpx;
- height: 80rpx;
- top: 40rpx;
- left: 116rpx;
- }
- }
- }
- }
- .bottom {
- width: 100%;
- z-index: 9;
- position: fixed;
- bottom: 0;
- height: 166rpx;
- background: #FFFFFF;
- box-sizing: border-box;
- padding: 8rpx 40rpx 74rpx;
- .bottom_btn {
- width: 100%;
- height: 84rpx;
- background: #506DFF;
- border-radius: 42rpx;
- font-size: 36rpx;
- font-weight: 500;
- color: #FFFFFF;
- text-align: center;
- line-height: 84rpx;
- }
-
- }
- }
- </style>
|