推广小程序前端代码
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.
 
 
 

453 lines
11 KiB

<template>
<view class="page">
<view class="head-box"></view>
<uv-navbar autoBack
title="主理人认证"
leftIconColor="#fff"
:bgColor="bgColor"
height="100rpx"
:titleStyle="{color:'#fff'}"></uv-navbar>
<view class="content">
<view class="user-box">
<uv-avatar :src="userInfo.headImage" size="98rpx" shape="circle"></uv-avatar>
<view class="user-msg">
<view class="user-msg-top">
<view>{{userInfo.nickName}}</view>
<!-- <view class="level-box">普通用户</view> -->
</view>
<view class="id-box">
<text>ID:{{userInfo.id}}</text>
<text class="copy-text" @click.stop="copy">复制</text>
</view>
</view>
</view>
<view class="base-msg">
<view class="title-box">基础信息</view>
<view class="form-box">
<view class="form-box-line">
<view class="label-box">真实姓名</view>
<view class="value-box">
<uv-input placeholder="请输入真实姓名" v-model="info.name" border="none" color="#fff"></uv-input>
</view>
</view>
<view class="form-box-line">
<view class="label-box">联系方式</view>
<view class="value-box">
<uv-input placeholder="请输入联系方式" v-model="info.phone" type="number" border="none" color="#fff"></uv-input>
</view>
</view>
<view class="form-box-line">
<view class="label-box">身份证号</view>
<view class="value-box">
<uv-input placeholder="请输入身份证号" type="idcard" v-model="info.cardNo" border="none" color="#fff"></uv-input>
</view>
</view>
<view class="form-box-line">
<view class="label-box">简历附件</view>
<view class="value-box">
<!-- <uv-input placeholder=" "
v-model="info.image"
border="none"
color="#fff"></uv-input> -->
<view class="docx-title"
@click="openDocument(info.image)">
{{ info.image || '' }}
</view>
<view class="upload-btn"
@click="uploadFile">上传简历</view>
</view>
</view>
<view class="form-box-line">
<view class="label-box">微信二维码</view>
<view class="value-box">
<view style="width: 80rpx;height: 80rpx;">
<uv-image v-if="info.img" :src="info.img" width="80rpx" height="80rpx" @click="bigImg"></uv-image>
</view>
<view class="upload-btn" @click="upImg">上传图片</view>
</view>
</view>
</view>
</view>
<view class="xie-box">
<view class="title-box">个人生活照片(含全身照)</view>
<view class="xie-box-val">
<uv-upload
:fileList="fileList"
multiple
:maxCount="9"
width="180rpx"
height="180rpx"
multiple
@afterRead="afterRead"
@delete="deleteImage">
</uv-upload>
</view>
</view>
<view class="xie-box">
<view class="title-box">阅读并同意协议</view>
<view class="xie-box-val">
<view class="val-text">
<view>我已经阅读并同意</view>
<view class="xieyi-val"
@click="$utils.navigateTo('/pages_login/yinsixieyi?key=vip_text')">《主理人协议》</view>
</view>
<view class="choose-box" @click="isAgree = !isAgree">
<view class="normol-box" v-if="!isAgree"></view>
<image src="./static/choose-icon.png" mode="widthFix" v-else></image>
</view>
</view>
</view>
</view>
<view class="btn-box" v-if="info.state != 1">
<uv-button text="保存" color="#381615" shape="circle" :customStyle="btnCustomStyle" @click="confrim"></uv-button>
</view>
<view class="btn-box" v-else>
<uv-button text="已审核通过" color="#381615" shape="circle" :customStyle="btnCustomStyle"></uv-button>
</view>
</view>
</template>
<script>
export default{
data() {
return {
isAgree:false,
btnCustomStyle:{
color:'#FF5858'
},
info:{
name:'',
phone:'',
cardNo:'',
img:'',
image : '',
},
bgColor : 'transparent',
fileList : [],
}
},
onPageScroll(e) {
if(e.scrollTop > 50) {
this.bgColor = '#49070c'
}else{
this.bgColor = 'transparent'
}
},
computed: {
},
onLoad() {
this.getjoinRecruitInfo()
this.$store.commit('getUserInfo')
},
methods:{
bigImg() {
uni.previewImage({
urls:[this.info.img],
current:0
})
},
openDocument(Path){
if(!Path){
return
}
wx.openDocument({
filePath: Path,
showMenu: true,
success: function (res) {
// console.log('打开成功');
// util.hideLoading()
}
})
},
uploadFile() {
let that = this
uni.chooseMessageFile({
count: 1, //一次可以上传多少个
type: 'file',
extension: ['.doc', '.pdf', '.docx'], //文件类型
success(res) {
console.log(res);
that.$Oss.ossUpload(res.tempFiles[0].path)
.then(url => {
that.info.image = url
})
},
fail: (err) => {
console.log(err, 'err');
}
});
},
upImg() {
uni.chooseImage({
count: 1, // 默认9, 设置图片的选择数量
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success: (res) => {
// 返回选定照片的本地文件路径列表 tempFilePaths
this.$Oss.ossUpload(res.tempFilePaths[0])
.then(url => {
this.info.img = url
this.$api('updateInfo',this.info, res => {
if (res.code == 200) {
uni.showToast({
title:'保存成功',
icon:'none'
})
}
})
})
// 根据需要进行后续处理,例如上传图片等
},
fail: (err) => {
// 处理错误情况
console.log('选择图片失败', err);
}
});
},
getjoinRecruitInfo() {
this.$api('joinRecruitInfo',res=>{
if(res.code == 200 && res.result) {
this.info = res.result
this.fileList = this.info.images ?
this.info.images.split(',').map(url => {
return {
url
}
}) : []
}
})
},
copy() {
uni.setClipboardData({
data:this.userInfo.id,
success: () => {
uni.showToast({
title:'复制成功',
icon:'none'
})
}
})
},
confrim() {
if(!this.isAgree) return this.$Toast('请先阅读并同意《主理人协议》')
if(!this.info.name) return this.$Toast('请输入姓名')
if(!this.info.phone) return this.$Toast('请输入联系方式')
if(!this.$utils.verificationPhone(this.info.phone)) return this.$Toast('请输入正确的联系方式')
if(!this.info.cardNo) return this.$Toast('请输入身份证号')
if(this.info.cardNo.length != 18) return this.$Toast('请输入正确的身份证号')
let params = {
name:this.info.name,
phone:this.info.phone,
cardNo:this.info.cardNo,
img:this.info.img,
image:this.info.image,
id:this.info.id || '',
images : this.fileList.map((item) => item.url).join(",")
}
// if(!this.info.image) return this.$Toast('请输入姓名')
this.$api('joinRecruit',params,res=>{
if(res.code == 200) {
this.$Toast('提交成功')
setTimeout(uni.navigateBack, 800, -1)
}
})
},
deleteImage(e){
this.fileList.splice(e.index, 1)
},
afterRead(e){
let self = this
e.file.forEach(file => {
self.$Oss.ossUpload(file.url).then(url => {
self.fileList.push({
url
})
})
})
},
}
}
</script>
<style lang="scss">
page {
background-color: #060504;
}
</style>
<style lang="scss" scoped>
.page{
}
.head-box {
background: url('@/static/image/nav-bg.png') no-repeat;
background-size: 100% 100%;
width: 100%;
height: 534rpx;
position: absolute;
z-index: -1;
}
.content {
margin-top: 40rpx;
padding-bottom: 100rpx;
padding: 0 30rpx;
padding-top: calc(var(--status-bar-height) + 110rpx);
.user-box {
display: flex;
align-items: center;
margin-bottom: 74rpx;
.user-msg {
margin-left: 20rpx;
.user-msg-top {
font-weight: 600;
font-size: 32rpx;
color: #E6E6E6;
display: flex;
align-items: center;
.level-box {
width: 108rpx;
height: 31rpx;
background: RGBA(40, 19, 4, 1);
border-radius: 16rpx;
font-weight: 400;
font-size: 20rpx;
color: #FF9C00;
text-align: center;
margin-left: 14rpx;
}
}
.id-box {
color: #999999;
font-size: 22rpx;
margin-top: 20rpx;
.copy-text {
font-weight: 400;
font-size: 22rpx;
color: #E6E6E6;
margin-left: 18rpx;
}
}
}
}
.title-box {
display: inline-block;
font-weight: bold;
font-size: 29rpx;
color: #FFFFFF;
position: relative;
z-index: 2;
&::after{
content: "";
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 9rpx;
background: #FF2828;
border-radius: 4rpx 4rpx 4rpx 4rpx;
opacity: 0.2;
z-index: 1;
}
}
.base-msg {
.form-box {
background: #1B1713;
border-radius: 27rpx;
padding:0 40rpx;
margin-top: 20rpx;
.form-box-line {
min-height: 112rpx;
border-bottom: 1px solid #403D3A;
display: flex;
align-items: center;
&:last-child {
border: none;
}
.label-box {
font-weight: 500;
font-size: 29rpx;
color: #FFFFFF;
margin-right: 34rpx;
}
.value-box {
display: flex;
align-items: center;
justify-content: space-between;
flex:1;
.upload-btn {
font-weight: 400;
font-size: 28rpx;
color: #FF5858;
}
}
.docx-title{
font-size: 20rpx;
color: #999999;
width: 340rpx;
overflow:hidden; //超出的文本隐藏
text-overflow:ellipsis; //溢出用省略号显示
white-space:nowrap; //溢出不换行
}
}
}
}
.xie-box {
margin-top:37rpx;
.xie-box-val {
margin-top: 25rpx;
// height: 116rpx;
background: #1B1713;
border-radius: 27rpx 27rpx 27rpx 27rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding: 36rpx 36rpx;
.val-text {
font-weight: 400;
font-size: 25rpx;
color: #FFFFFF;
display: flex;
align-items: center;
.xieyi-val {
color: #FF5858;
}
}
.choose-box {
.normol-box {
width: 31rpx;
height: 31rpx;
border: 1px solid #fff;
border-radius: 5rpx;
}
image {
width: 31rpx;
height: 31rpx;
}
}
}
}
}
.btn-box {
// position: fixed;
// bottom: 70rpx;
// left: 0;
// right: 0;
padding: 0 40rpx;
margin-top: 20rpx;
height: 200rpx;
}
</style>