宜轩到家/服务到家第三版,换个颜色
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

343 lines
8.1 KiB

<template>
<view class="content" style="padding-bottom: 90rpx;">
<mNavbar
:leftClick="toLeft"
/>
<view class="banner"></view>
<view class="b-relative" style="width: 710rpx;height: 310rpx; margin: -174rpx auto 0;">
<image src="/static/ms/1120.jpg" style="width: 710rpx;height: 310rpx;
border-radius: 20rpx;"></image>
<view class="banner-font">
技师招募
</view>
<view class="font-3">打造专业的技术服务</view>
<view class="banner-button">立即联系我们>></view>
</view>
<view>
<view class="item-card">
<view class="item-line flex">
<view class="before"></view>
<view class="label">技师姓名</view>
<input placeholder="请输入姓名" v-model="technician.name" />
</view>
<view class="item-line flex">
<view class="before"></view>
<view class="label">技师性别</view>
<input placeholder="请选择性别" v-model="technician.sex"/>
</view>
<view class="item-line flex">
<view class="before"></view>
<view class="label">联系方式</view>
<input placeholder="请输入联系方式" v-model="technician.phone" />
</view>
<view class="item-line flex">
<view class="before"></view>
<view class="label">技师年龄</view>
<input placeholder="请输入技师年龄" type="number" v-model.number="technician.age" />
</view>
<view class="item-line flex">
<view class="before"></view>
<view class="label">意向城市</view>
<input placeholder="请输入意向工作城市" v-model="technician.city" />
</view>
<view class="item-line flex">
<view class="before"></view>
<view class="label" style="width: 100%">请上传本人近期照片</view>
</view>
<view v-if="!technician.image" @click="fileUploads" class="upload b-relative">
<uni-icons type="plusempty" size="80rpx" color="#6e3009"
style="position: absolute; top: 50rpx; left: 60rpx;" />
</view>
<view v-else @click="fileUploads" class="upload b-relative">
<image class="upload-img" :src="technician.image" mode="aspectFill"></image>
</view>
</view>
</view>
<view class="b-fiexd">
<view @click="addOrUpdateMsgTer" class="button-submit">提交</view>
</view>
</view>
</template>
<script>
import OSS from "ali-oss"
import { v4 as uuidv4 } from 'uuid';
import mNavbar from '@/components/base/m-navbar.vue'
export default {
components : {
mNavbar
},
data() {
return {
technician: {
name : '',
sex : '',
phone : '',
age : '',
city : '',
image : ''
},
ossOption: {
region : 'oss-cn-shenzhen',
accessKey: 'LTAI5tMan18fjJPUtr3Aim2W',
secretKey: 'lhALqqgYijc115wY8c1KfTYkbSnq5I',
endpoint: 'oss-cn-shenzhen.aliyuncs.com',
bucketName: 'mangoimageapplet',
staticDomain: 'https://dianpin-img.xzaiyp.top'
},
imgs : []
}
},
onShow(){
},
methods: {
getUserInfo() { //获取用户信息
this.$api('getUserInfo', {}, res => {
if (res.code == 200) {
this.userInfo = res.result;
}
})
},
addOrUpdateMsgTer() { //新增修改技师入驻信息
let isOk = this.parameterVerification()
if(!isOk.auth){
return uni.showToast({
title : isOk.title,
icon : 'none'
})
}
this.$api('addOrUpdateMsgTer', this.technician, res => {
if (res.code == 200) {
uni.showModal({
title: '技师入驻',
content: '技师入驻提交成功',
confirmText : '确认',
cancelText : '取消',
showCancel: false,//没有取消按钮的弹框
success: function (res) {
if (res.confirm) {
uni.switchTab({
url: '/pages/index/center'
})
} else if (res.cancel) {}
}
});
}
})
},
parameterVerification(){ //验证用户参数合法性
let { name , sex , phone , age , city , image } = this.technician
if(name.trim() == ''){
return { title : '请填写用户名' , auth : false }
}else if(sex.trim() == ''){
return { title : '请选择性别' , auth : false }
}else if(phone.trim() == ''){
return { title : '请填写手机号' , auth : false }
}else if(phone){
if(!/^1\d{10}$/.test(phone)){
return { title : '手机号格式不合法' , auth : false }
}
}else if(age){
return { title : '请填写手机号' , auth : false }
}else if(city.trim() == ''){
return { title : '请填写意向城市' , auth : false }
}else if(image.trim() == ''){
return { title : '请上传近期照片' , auth : false }
}
return { title : '验证通过' , auth : true }
},
fileUploads() { //上传文件
uni.chooseImage({
count: 1, // 默认9,设置为1表示单选
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success: (res) => {
let resultPromise = [];
//上传多张图片逻辑
// res.tempFiles.forEach(file => {
// resultPromise.push(this.uploadFileToOSS(file));
// })
// Promise.all(resultPromise).then(imgPathArr => {
// this.imgs = imgPathArr
// })
//上传单张图片逻辑
this.uploadFileToOSS(res.tempFiles[0]).then(imgPath => {
this.technician.image = imgPath;
})
}
});
},
toLeft(){
uni.switchTab({
url: '/pages/index/center'
})
}
}
}
</script>
<style scoped lang="scss">
body {
background-color: #f5f5f5;
}
.banner {
width: 100vw;
height: calc(392rpx - 160rpx);
background: linear-gradient(to right, #ecb978, #ffe6ed);
color: $uni-color;
}
.banner-font {
width: 692rpx;
height: 142rpx;
font-size: 72rpx;
line-height: 66rpx;
font-weight: 900;
text-align: left;
color: #ffffff;
letter-spacing: 20rpx;
position: absolute;
left: 0;
text-align: center;
top: 84rpx;
}
.font-3 {
height: 28rpx;
line-height: 28rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC-Regular;
font-weight: 400;
text-align: left;
color: #ffffff;
text-shadow: 0 4rpx 6rpx 0 rgba(0, 165, 141, 0.70);
position: absolute;
left: 52rpx;
top: 228rpx;
}
.banner-button {
width: 240rpx;
height: 56rpx;
line-height: 56rpx;
background: #ffdb75;
border-radius: 24rpx;
box-shadow: 0 6rpx 6rpx 0 rgba(17, 106, 93, 0.23);
position: absolute;
right: 52rpx;
top: 220rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC-Bold;
font-weight: 700;
text-align: center;
color: $uni-color;
}
.item-card {
width: calc(710rpx - 40rpx);
height: 840rpx;
background: #ffffff;
border-radius: 16rpx;
margin: 40rpx auto 20rpx;
padding: 1rpx 20rpx;
}
.item-line {
height: 60rpx;
font-size: 28rpx;
font-family: PingFang SC, PingFang SC-Bold;
font-weight: 700;
text-align: left;
color: #333333;
margin-top: 40rpx;
}
.item-line .before {
content: "";
width: 8rpx;
height: 30rpx;
background: $uni-color;
border-radius: 4rpx;
margin-right: 10rpx;
margin-top: 15rpx;
}
.item-line .label {
display: flex;
align-items: center;
width: 152rpx;
height: 60rpx;
}
.item-line input {
width: 456rpx;
height: 60rpx;
line-height: 60rpx;
background: #f5f5f5;
border-radius: 12rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC-Medium;
font-weight: 500;
text-align: left;
color: #939393;
padding: 0 20rpx;
}
.upload {
display: flex;
align-items: center;
justify-content: center;
width: 200rpx;
height: 200rpx;
background: rgba($uni-color, 0.22);
border: 2rpx dashed $uni-color;
border-radius: 16rpx;
margin: 10rpx 12rpx;
}
.upload-img{
width: calc(100% - 4rpx);
height: calc(100% - 4rpx);
border: 2rpx dashed #ccc;
margin: 2rpx;
}
.button-submit {
display: flex;
align-items: center;
justify-content: center;
width: 596rpx;
height: 90rpx;
border-radius: 46rpx;
margin: 20rpx auto;
font-size: 28rpx;
font-family: PingFang SC, PingFang SC-Regular;
font-weight: 400;
text-align: center;
background: $uni-bg-color;
color: $uni-color;
}
</style>