123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364 |
- <template>
- <view class="content">
- <view class="box">
- <view class="hflex acenter jbetween cell">
- <view class="label required">姓名</view>
- <u-input v-model="name" placeholder="请填写姓名" inputAlign="right" border="none"></u-input>
- </view>
- <view class="hflex acenter jbetween cell">
- <view class="label required">所在单位</view>
- <u-input v-model="work" placeholder="请填写所在单位名称" inputAlign="right" border="none"></u-input>
- </view>
- <view class="cell">
- <view class="label required">营业执照照片</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">
- <view class="" style="position: relative;">
- <image src="https://ship.shipcc.cn/common/upload-business.png" style="width: 530rpx;height: 324rpx;"></image>
- <image src="@/static/images/mine/upload_center.png" style="position: absolute;top:102rpx;left: 216rpx; width: 120rpx;height: 120rpx;"></image>
- </view>
- </u-upload>
- </view>
- </view>
- <view class="cell" style="border: none;">
- <view class="label required">身份证正反面</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">
- <view class="" style="position: relative;">
- <image src="@/static/images/index/upload-back.png" style="width: 310rpx;height: 188rpx;"></image>
- <image src="@/static/images/mine/upload_center.png" style="position: absolute;top:40rpx;left: 116rpx; width: 80rpx;height: 80rpx;"></image>
- <view style="position: absolute;bottom: 16rpx;left: 70rpx;font-size: 16rpx;color: #506DFF;">上传身份证人像面照片</view>
- </view>
- </u-upload>
- <u-upload :fileList="fileList3" @afterRead="afterRead" @delete="deletePic" :maxCount="1" name="3" multiple :previewFullImage="true" width="310rpx" height="188rpx">
- <view class="" style="position: relative;">
- <image src="https://ship.shipcc.cn/common/upload-back.png" style="width: 310rpx;height: 188rpx;"></image>
- <image src="@/static/images/mine/upload_center.png" style="position: absolute;top:40rpx;left: 116rpx; width: 80rpx;height: 80rpx;"></image>
- <view style="position: absolute;bottom: 16rpx;left: 70rpx;font-size: 16rpx;color: #506DFF;">上传身份证国徽面图片</view>
- </view>
- </u-upload>
- </view>
- </view>
- </view>
- <view class="box">
- <view class="hflex acenter jbetween cell">
- <view class="label required">手机号</view>
- <u-input v-model="phone" placeholder="请填写你的手机号" inputAlign="right" border="none"></u-input>
- </view>
- <view class="hflex acenter jbetween cell">
- <view class="label required">邮箱</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 required">地址</view>
- <u-input v-model="address" placeholder="请填写你的详细地址" inputAlign="right" border="none"></u-input>
- </view>
- </view>
- <view class="box">
- <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="box" style="margin-bottom: 186rpx;">
- <view class="hflex acenter jbetween">
- <view class="title">是否隐藏需求</view>
- <u-switch v-model="hidden" inactiveColor="rgb(230, 230, 230)" @change="changeHide1"></u-switch>
- </view>
- <view class="text">
- 说明:灰色开关为显示需求,蓝色开关为隐藏需求,默认为显示需求
- </view>
- </view>
- <view class="bottom">
- <view class="bottom_btn" @click="open" v-if="id == ''">立即发布</view>
- <view class="bottom_btn" @click="open" v-if="id != ''">立即修改</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: '',
- hidden: false
- }
- },
- onLoad() {
- that = this
- that.getData()
- },
- methods: {
- getData() {
- $api.req({
- url: '/data/api.auth.Center/myneed',
- method: 'POST',
- data: {
- type: '2'
- }
- },function(res) {
- if(res.code == 1) {
- console.log(res);
- if(res.data) {
- that.name = res.data.name
- that.work = res.data.company_name
- that.fileList1.push({
- url:res.data.business_img
- })
- that.fileList2.push({
- url:res.data.id_card_zheng
- })
- that.fileList3.push({
- url:res.data.id_card_fan
- })
- that.id = res.data.id
- // that.fileList1[0].url = res.data.business_img
- // that.fileList2[0].url = res.data.id_card_zheng
- // that.fileList3[0].url = res.data.id_card_fan
- that.phone = res.data.phone
- that.email = res.data.email
- that.address = res.data.address
- that.resume = res.data.job_resume
- that.speciality = res.data.specialty
- that.hidden = res.data.hidden == 2 ? true: false
- }
- }
- })
- },
- // 立即发布
- open() {
- if(that.name == '') {
- $api.info('请填写姓名')
- return
- }
- if(that.work == '') {
- $api.info('请填写所在单位')
- return
- }
- if(that.fileList1 == '') {
- $api.info('请上传营业执照')
- return
- }
- if(that.fileList2 == '' || that.fileList3 == '') {
- $api.info('请上传身份证照片')
- return
- }
- if(that.phone == '') {
- $api.info('请填写你的手机号')
- return
- }
- if(that.email == '') {
- $api.info('请填写你的邮箱')
- return
- }
- if(that.address == '' ) {
- $api.info('请填写你的详细地址')
- return
- }
- 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.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,
- hidden: that.hidden? '2' : '1',
- // 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)
- $api.jump(-1)
- }
- })
- }
- },
- changeHide1(e) {
- console.log(e);
- },
- // 删除图片
- 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;
- .required {
- position: relative;
- padding-left: 15rpx;
- }
- .required::after {
- content: '*';
- position: absolute;
- top: 5rpx;
- left: 0;
- font-size: 26rpx;
- font-weight: 400;
- color: #FF3232;
- }
- .text {
- font-size: 24rpx;
- font-weight: 400;
- color: #d75a59;
- margin: 16rpx 0;
- }
- .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>
|