|
|
- <template>
- <view class="content">
-
- <view class="banner"></view>
-
- <view class="b-relative" style="width: 710rpx;height: 310rpx; margin: -174rpx auto 0;">
- <image src="/static/ms/settled.png" style="width: 710rpx;height: 310rpx;"></image>
- <view class="banner-font">
- <image style="width: 380rpx;height: 98rpx;" src="/static/ms/fontjszm.png"></image>
- </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>
- <van-radio-group v-model="technician.sex" direction="horizontal">
- <van-radio name="男">男</van-radio>
- <van-radio name="女">女</van-radio>
- </van-radio-group>
- </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">
- <uni-icons type="plusempty" size="80rpx" color="#37bea7"/>
- </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 { showDialog } from 'vant';
-
- export default {
- data() {
- return {
- technician: {
- id : '',
- name : '',
- sex : '男',
- phone : '',
- age : '',
- city : '',
- image : '',
- phone : ''
- },
- imgs : []
- }
- },
- onShow(){
- this.getTenFans()
- },
- 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) {
- showDialog({
- title: this.technician.id ? '修改入驻' : '技师入驻',
- message: this.technician.id ? '技师入驻修改成功' : '技师入驻提交成功',
- }).then(() => {
- uni.switchTab({
- url: '/pages/index/index'
- })
- });
- }
- })
- },
- 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(!age){
- return { title : '请填写年龄' , auth : false }
- }else if(city.trim() == ''){
- return { title : '请填写意向城市' , auth : false }
- }else if(image.trim() == ''){
- return { title : '请上传近期照片' , auth : false }
- }else if(phone.trim() != ''){
- if(!this.$utils.verificationPhone(phone)){
- 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 = [];
-
- //上传单张图片逻辑
- this.uploadFileToOSS(res.tempFiles[0]).then(imgPath => {
- this.technician.image = imgPath;
- })
- }
- });
- },
- getTenFans(){ //获取我推荐的技师记录
- this.$api('getTenFans', {}, res => {
- if (res.code == 200) {
- if(res.result.length > 0){
- let { id , name , sex , age , city , image , phone } = res.result[0];
- this.technician = { id ,name , sex , age , city , image , phone }
- }
- }
- })
- }
- }
- }
- </script>
-
- <style>
- body {
- background-color: #f5f5f5;
- }
-
- .banner {
- width: 100vw;
- height: calc(392rpx - 160rpx);
- background: linear-gradient(38deg, #4899a6 44%, #60bda2 100%);
- }
-
-
- .banner-font {
- width: 292rpx;
- height: 142rpx;
- font-size: 72rpx;
- line-height: 66rpx;
- font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
- font-weight: 400;
- text-align: left;
- color: #ffffff;
- letter-spacing: -1;
- text-shadow: 0px 6px 6px 0px rgba(0, 165, 141, 0.70);
-
- position: absolute;
- left: 52rpx;
- top: 34rpx;
- }
-
- .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: 138rpx;
- }
-
- .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;
- left: 52rpx;
- top: 220rpx;
-
- font-size: 24rpx;
- font-family: PingFang SC, PingFang SC-Bold;
- font-weight: 700;
- text-align: center;
- color: #26c591;
- }
-
-
- .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: #4fd3bc;
- 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(245, 245, 245, 0.82);
- border: 2rpx dashed #99dcd0;
- 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;
- background: linear-gradient(180deg, #6fdfbe, #5ac796);
- border-radius: 46rpx;
-
- margin: 20rpx auto;
-
- font-size: 28rpx;
- font-family: PingFang SC, PingFang SC-Regular;
- font-weight: 400;
- text-align: center;
- color: #ffffff;
- }
- </style>
|