软测宝小程序
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.
 
 
 

184 lines
4.7 KiB

<template>
<view class="navTab">
<u-form :model="projectobj" ref="projectobj" label-position='left' label-width='150'>
<u-form-item label="公司名称:" prop="name" required='true'>
<u-input style="width:100%;" v-model="projectobj.name" placeholder='请输入公司名称' />
</u-form-item>
<u-form-item label="开始时间:" prop="startTime" required='true'>
<u-input class="seleclas" v-model="projectobj.startTime" type="select" @click="Periodshow = true"
placeholder='请选择' />
<u-picker mode="time" v-model="Periodshow" :params="{year: true,month:true}"
@confirm="startTimeChange"></u-picker>
</u-form-item>
<u-form-item label="结束时间:" prop="endTime" required='true'>
<u-input class="seleclas" v-model="projectobj.endTime" type="select" @click="Periodshow1 = true"
placeholder='请选择' />
<u-picker mode="time" v-model="Periodshow1" :params="{year: true,month:true}"
@confirm="startTimeChange1"></u-picker>
</u-form-item>
<u-form-item label="职位名称:" prop="title" required='true'>
<u-input style="width:100%;" v-model="projectobj.title" placeholder='请输入职位名称' />
</u-form-item>
<u-form-item label="工作内容:" prop="intro" required='true' class="textare">
<u-input style="width:100%;height: 100px;" border='true' type='textarea'
v-model="projectobj.intro" placeholder='请输入工作内容' />
</u-form-item>
</u-form>
<view class="bottbtn" @click="resource">保存</view>
<!-- <view class="bottbtn" @click="delpro">删除</view> -->
<u-toast ref="uToast" />
</view>
</template>
<script>
export default {
data() {
return {
projectobj: {
type: 1,
},
projectRules: {
name: [{
required: true,
message: '请输入公司名称',
trigger: 'blur',
}],
startTime: [{
required: true,
message: '请选择开始时间',
trigger: 'change',
}],
endTime: [{
required: true,
message: '请选择结束时间',
trigger: 'change',
}],
title: [{
required: true,
message: '请输入职位名称',
trigger: 'blur',
}],
intro: [{
required: true,
message: '请输入工作内容',
trigger: 'blur',
}],
},
Periodshow: false,
Periodshow1: false,
}
},
onReady() {
this.$refs.projectobj.setRules(this.projectRules);
},
onLoad(option) {
let type = option.type;
if (type && type == 1) {
uni.setNavigationBarTitle({
title: '添加工作经历'
});
} else {
uni.setNavigationBarTitle({
title: '编辑工作经历'
});
let caseId = option.caseId
if (caseId) {
this.http.quickGet(`/personal/case/${caseId}`, true).then(res => {
this.projectobj = res.data
})
}
}
},
methods: {
startTimeChange(e) {
this.projectobj.startTime = e.year + '-' + e.month
},
startTimeChange1(e) {
this.projectobj.endTime = e.year + '-' + e.month
},
resource() {
this.$refs.projectobj.validate(valid => {
if (valid) {
if (this.projectobj.caseId) {
this.http.quickPost(`/personal/case/update`, this.projectobj, true).then(res => {
if (res.data.code == 200) {
this.$refs.uToast.show({
title: '编辑工作成功',
type: 'success',
url: 'pages/personal/personalresume/personalresume'
})
}
})
} else {
console.log( this.projectobj);
this.http.quickPost(`/personal/case/add`, this.projectobj, true).then(res => {
if (res.data.code == 200) {
this.$refs.uToast.show({
title: '添加工作成功',
type: 'success',
url: 'pages/personal/personalresume/personalresume'
})
}
})
}
}
})
},
// 删除
delpro() {
this.http.quickDelete(`/personal/case/${this.projectobj.caseId}`, true).then(res => {
console.log('res---', res)
this.$refs.uToast.show({
title: '删除工作成功',
type: 'success',
url: 'pages/personal/personalresume/personalresume'
})
})
}
}
}
</script>
<style>
.navTab {
background-color: #ffffff;
width: 96vw;
margin: 2vh auto;
padding: 10px 15px 30px 25px;
border-radius: 5px;
}
.u-form-left__content__label {
color: #808080 !important;
}
.navTab .u-input {
/* height:35px; */
border-bottom: 1px solid #EBEBEB !important;
}
.textare .u-input {
min-height: 100px;
}
.bottbtn {
/* width:94vw; */
margin: 30px 3vw 15px 3vw;
height: 75rpx;
background: linear-gradient(90deg, #5EA6FD, #1A81F9);
border-radius: 15rpx;
text-align: center;
line-height: 75rpx;
color: #FFFFFF;
font-size: 33rpx;
}
.title {
color: #1A81F9;
text-align: center;
padding: 20rpx 0 0 0;
}
</style>