123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- <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="/static/images/comment/upload-business.png" style="width: 530rpx;height: 324rpx;"></image>
- <image class="upload_img" src="/static/images/comment/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="/static/images/comment/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="/static/images/comment/upload-back.png" style="width: 310rpx;height: 188rpx;"></image>
- <image class="upload_img2" src="/static/images/comment/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="eamil" 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="resume" 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: '',
- }
- },
- onLoad() {
- that = this
- },
- methods: {
- // 立即发布
- open() {
- 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,'email') && $api.formCheck(that.address,'required')&& $api.formCheck(that.resume,'required')&& $api.formCheck(that.speciality,'required')) {
-
- }
- },
- // 删除图片
- deletePic(event) {
- this[`fileList${event.name}`].splice(event.index, 1)
- },
- // 新增图片
- async afterRead(event) {
- console.log(event);
- // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
- 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
- }))
- fileListLen++
- }
- },
- uploadFilePromise(url) {
- return new Promise((resolve, reject) => {
- let a = uni.uploadFile({
- url: 'http://192.168.2.21:7001/upload', // 仅为示例,非真实的接口地址
- filePath: url,
- name: 'file',
- formData: {
- user: 'test'
- },
- success: (res) => {
- setTimeout(() => {
- resolve(res.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>
|