视频模块

This commit is contained in:
张文涛 2024-10-28 23:40:53 +08:00
parent cfc0150419
commit 2dfa821ffb
2 changed files with 142 additions and 90 deletions

View File

@ -3,24 +3,24 @@
<view class="edit-info"> <view class="edit-info">
<view style="padding-bottom: 200rpx;"> <view style="padding-bottom: 200rpx;">
<u-cell-group :border='false'> <u-cell-group :border='false'>
<u-cell title="姓名" size="large" :border='false' :titleStyle="{fontSize:'32rpx',color:'#9CA3AF'}" <!-- @click="handleName" -->
@click="handleName"> <u-cell title="姓名" size="large" :border='false' :titleStyle="{fontSize:'32rpx',color:'#9CA3AF'}">
<view class="input-val" style="width: 400rpx;" slot="value"> <view class="input-val" style="width: 400rpx;" slot="value">
{{userInfo.name}} <input type="text" v-model="userInfo.name" />
</view> </view>
<u-icon slot="right-icon" name="edit-pen" size="26" color="#9CA3AF"></u-icon> <u-icon slot="right-icon" name="edit-pen" size="26" color="#9CA3AF"></u-icon>
</u-cell> </u-cell>
<u-cell title="身份证号" size="large" :border='false' :titleStyle="{fontSize:'32rpx',color:'#9CA3AF'}" <!-- @click="handleIdcard" -->
@click="handleIdcard"> <u-cell title="身份证号" size="large" :border='false' :titleStyle="{fontSize:'32rpx',color:'#9CA3AF'}">
<view class="input-val" style="width: 350rpx;" slot="value"> <view class="input-val" style="width: 350rpx;" slot="value">
{{userInfo.idcard}} <input type="text" v-model="userInfo.idcard" />
</view> </view>
<u-icon slot="right-icon" name="edit-pen" size="26" color="#9CA3AF"></u-icon> <u-icon slot="right-icon" name="edit-pen" size="26" color="#9CA3AF"></u-icon>
</u-cell> </u-cell>
<u-cell title="手机号" size="large" :border='false' :titleStyle="{fontSize:'32rpx',color:'#9CA3AF'}" <!-- @click="handleMobile" -->
@click="handleMobile"> <u-cell title="手机号" size="large" :border='false' :titleStyle="{fontSize:'32rpx',color:'#9CA3AF'}">
<view class="input-val" style="width: 350rpx;" slot="value"> <view class="input-val" style="width: 350rpx;" slot="value">
{{userInfo.contact_mobile}} <input type="number" v-model="userInfo.contact_mobile" />
</view> </view>
<u-icon slot="right-icon" name="edit-pen" size="26" color="#9CA3AF"></u-icon> <u-icon slot="right-icon" name="edit-pen" size="26" color="#9CA3AF"></u-icon>
</u-cell> </u-cell>
@ -31,13 +31,12 @@
</view> </view>
<u-icon slot="right-icon" name="edit-pen" size="26" color="#9CA3AF"></u-icon> <u-icon slot="right-icon" name="edit-pen" size="26" color="#9CA3AF"></u-icon>
</u-cell> </u-cell>
<u-cell title="生日" size="large" :border='false' :titleStyle="{fontSize:'32rpx',color:'#9CA3AF'}"> <u-cell @click="handleBirth" title="生日" size="large" :border='false'
:titleStyle="{fontSize:'32rpx',color:'#9CA3AF'}">
<view class="input-val" style="width: 350rpx;" slot="value"> <view class="input-val" style="width: 350rpx;" slot="value">
<uni-datetime-picker ref="birth" type="date" :clear-icon="false" {{userInfo.birthday}}
v-model="userInfo.birthday">{{userInfo.birthday}}
</uni-datetime-picker>
</view> </view>
<u-icon slot="right-icon" name="edit-pen" size="26" color="#9CA3AF" @click="handleBirth"></u-icon> <u-icon slot="right-icon" name="edit-pen" size="26" color="#9CA3AF"></u-icon>
</u-cell> </u-cell>
<u-cell title="学历" size="large" :border='false' :titleStyle="{fontSize:'32rpx',color:'#9CA3AF'}" <u-cell title="学历" size="large" :border='false' :titleStyle="{fontSize:'32rpx',color:'#9CA3AF'}"
@click="handleEmotion"> @click="handleEmotion">
@ -55,40 +54,39 @@
</u-cell> </u-cell>
<u-cell title="安置地" size="large" :border='false' :titleStyle="{fontSize:'32rpx',color:'#9CA3AF'}" <u-cell title="安置地" size="large" :border='false' :titleStyle="{fontSize:'32rpx',color:'#9CA3AF'}"
@click="showCity"> @click="showCity">
<view class="input-val" style="width: 450rpx;" slot="value">
{{userInfo.to_province_name}}-{{userInfo.to_city_name}}-{{userInfo.to_area_name}}
</view>
<u-icon slot="right-icon" name="edit-pen" size="26" color="#9CA3AF"></u-icon>
</u-cell>
<u-cell v-if="userInfo.reside_province_name" title="现居住地" size="large" :border='false'
:titleStyle="{fontSize:'32rpx',color:'#9CA3AF'}" @click="showReside">
<view class="input-val" style="width: 450rpx;" slot="value"> <view class="input-val" style="width: 450rpx;" slot="value">
{{userInfo.reside_province_name}}-{{userInfo.reside_city_name}}-{{userInfo.reside_area_name}} {{userInfo.to_province_name}}{{userInfo.to_city_name}}{{userInfo.to_area_name}}
</view> </view>
<u-icon slot="right-icon" name="edit-pen" size="26" color="#9CA3AF"></u-icon> <u-icon slot="right-icon" name="edit-pen" size="26" color="#9CA3AF"></u-icon>
</u-cell> </u-cell>
<u-cell title="详细地址" size="large" :border='false' :titleStyle="{fontSize:'32rpx',color:'#9CA3AF'}"
@click="handleDetail"> <u-cell title="现居住地" size="large" :border='false' :titleStyle="{fontSize:'32rpx',color:'#9CA3AF'}"
@click="showReside">
<view class="input-val" style="width: 450rpx;" slot="value"> <view class="input-val" style="width: 450rpx;" slot="value">
{{userInfo.detail}} {{userInfo.reside_province_name}}{{userInfo.reside_city_name}}{{userInfo.reside_area_name}}
</view> </view>
<u-icon slot="right-icon" name="edit-pen" size="26" color="#9CA3AF"></u-icon> <u-icon slot="right-icon" name="edit-pen" size="26" color="#9CA3AF"></u-icon>
</u-cell> </u-cell>
<u-cell title="入伍时间" size="large" :border='false' :titleStyle="{fontSize:'32rpx',color:'#9CA3AF'}"> <!-- @click="handleDetail" -->
<view class="input-val" style="width: 350rpx;" slot="value"> <u-cell title="详细地址" size="large" :border='false' :titleStyle="{fontSize:'32rpx',color:'#9CA3AF'}">
<uni-datetime-picker ref="birth" type="date" :clear-icon="false" <view class="input-val" style="width: 450rpx;" slot="value">
v-model="userInfo.join_time">{{userInfo.join_time}} <input type="text" v-model="userInfo.detail" />
</uni-datetime-picker>
</view> </view>
<u-icon slot="right-icon" name="edit-pen" size="26" color="#9CA3AF" @click="handleBirth"></u-icon> <u-icon slot="right-icon" name="edit-pen" size="26" color="#9CA3AF"></u-icon>
</u-cell> </u-cell>
<u-cell title="退役时间" size="large" :border='false' :titleStyle="{fontSize:'32rpx',color:'#9CA3AF'}"> <u-cell @click="handlejoinTime" title="入伍时间" size="large" :border='false'
:titleStyle="{fontSize:'32rpx',color:'#9CA3AF'}">
<view class="input-val" style="width: 350rpx;" slot="value"> <view class="input-val" style="width: 350rpx;" slot="value">
<uni-datetime-picker ref="birth" type="date" :clear-icon="false" {{userInfo.join_time}}
v-model="userInfo.retire_time">{{userInfo.retire_time}}
</uni-datetime-picker>
</view> </view>
<u-icon slot="right-icon" name="edit-pen" size="26" color="#9CA3AF" @click="handleBirth"></u-icon> <u-icon slot="right-icon" name="edit-pen" size="26" color="#9CA3AF"></u-icon>
</u-cell>
<u-cell @click="handleretireTime" title="退役时间" size="large" :border='false'
:titleStyle="{fontSize:'32rpx',color:'#9CA3AF'}">
<view class="input-val" style="width: 350rpx;" slot="value">
{{userInfo.retire_time}}
</view>
<u-icon slot="right-icon" name="edit-pen" size="26" color="#9CA3AF"></u-icon>
</u-cell> </u-cell>
<u-cell title="人员类别" size="large" :border='false' :titleStyle="{fontSize:'32rpx',color:'#9CA3AF'}" <u-cell title="人员类别" size="large" :border='false' :titleStyle="{fontSize:'32rpx',color:'#9CA3AF'}"
@click="handleCategory"> @click="handleCategory">
@ -104,10 +102,10 @@
</view> </view>
<u-icon slot="right-icon" name="edit-pen" size="26" color="#9CA3AF"></u-icon> <u-icon slot="right-icon" name="edit-pen" size="26" color="#9CA3AF"></u-icon>
</u-cell> </u-cell>
<u-cell title="职业技能培训意向" size="large" :border='false' :titleStyle="{fontSize:'32rpx',color:'#9CA3AF'}" <!-- @click="handlePurpose" -->
@click="handlePurpose"> <u-cell title="职业技能培训意向" size="large" :border='false' :titleStyle="{fontSize:'32rpx',color:'#9CA3AF'}">
<view class="input-val" style="width: 350rpx;" slot="value"> <view class="input-val" style="width: 350rpx;" slot="value">
{{userInfo.purpose}} <input type="text" v-model="userInfo.purpose" />
</view> </view>
<u-icon slot="right-icon" name="edit-pen" size="26" color="#9CA3AF"></u-icon> <u-icon slot="right-icon" name="edit-pen" size="26" color="#9CA3AF"></u-icon>
</u-cell> </u-cell>
@ -119,36 +117,23 @@
<button @click="submit" class="button">确认</button> <button @click="submit" class="button">确认</button>
</view> </view>
</view> </view>
<!-- 昵称 -->
<uni-popup ref="inputDialog" type="dialog">
<uni-popup-dialog ref="inputClose" mode="input" title="输入昵称" :value="userInfo.name" placeholder="请输入内容"
@confirm="nameConfirm"></uni-popup-dialog>
</uni-popup>
<!-- 身份证号 -->
<uni-popup ref="idcardDialog" type="dialog">
<uni-popup-dialog :before-close='true' ref="inputClose" mode="input" title="输入身份证" :value="userInfo.idcard"
placeholder="请输入内容" @close="idcardClose" @confirm="idcardConfirm"></uni-popup-dialog>
</uni-popup>
<!-- 手机号码 -->
<uni-popup ref="mobileDialog" type="dialog">
<uni-popup-dialog :before-close='true' ref="inputClose" mode="input" title="输入手机号"
:value="userInfo.contact_mobile" placeholder="请输入内容" @close="mobileClose"
@confirm="mobileConfirm"></uni-popup-dialog>
</uni-popup>
<!-- 详细地址 -->
<uni-popup ref="detailDialog" type="dialog">
<uni-popup-dialog ref="inputClose" mode="input" title="输入详细地址" :value="userInfo.detail" placeholder="请输入内容"
@confirm="detailConfirm"></uni-popup-dialog>
</uni-popup>
<!-- 意向 -->
<uni-popup ref="purposeDialog" type="dialog">
<uni-popup-dialog ref="inputClose" mode="input" title="输入职业技能培训意向" :value="userInfo.purpose"
placeholder="请输入内容" @confirm="purposeConfirm"></uni-popup-dialog>
</uni-popup>
<!-- 安置地城市选择 --> <!-- 安置地城市选择 -->
<liuChooseAddress ref="scroll" @change='chooseSuccess'></liuChooseAddress> <liuChooseAddress ref="scroll" @change='chooseSuccess'></liuChooseAddress>
<!-- 现居地城市选择 --> <!-- 现居地城市选择 -->
<liuChooseAddress ref="scrolls" @change='chooseSuccesss'></liuChooseAddress> <liuChooseAddress ref="scrolls" @change='chooseSuccesss'></liuChooseAddress>
<!-- 生日 -->
<u-datetime-picker @cancel="birth=false" :minDate="Number(new Date('1950-01-01'))"
:maxDate='new Date().getTime()' ref="datetimePicker" :show="birth" v-model="value1" mode="date"
:formatter="formatter" @confirm="birthConfirm"></u-datetime-picker>
<!-- 入伍时间 -->
<u-datetime-picker @cancel="joinTime=false" :minDate="Number(new Date('1950-01-01'))"
:maxDate='new Date().getTime()' ref="datetimePicker" :show="joinTime" v-model="value1" mode="date"
:formatter="formatter" @confirm="joinTimeConfirm"></u-datetime-picker>
<!-- 退伍时间 -->
<u-datetime-picker @cancel="retireTime=false" :minDate="Number(new Date('1950-01-01'))"
:maxDate='new Date().getTime()' ref="datetimePicker" :show="retireTime" v-model="value1" mode="date"
:formatter="formatter" @confirm="retireTimeConfirm"></u-datetime-picker>
</view> </view>
</template> </template>
@ -170,6 +155,10 @@
}, },
data() { data() {
return { return {
birth: false,
joinTime: false,
retireTime: false,
value1: Number(new Date()),
userInfo: { userInfo: {
code: "", //code code: "", //code
org_id: "", //ID 1 org_id: "", //ID 1
@ -226,11 +215,11 @@
}, },
isPickerVisible: false, // isPickerVisible: false, //
selectedAddress: '', // selectedAddress: '', //
pageType: 'edit' pageType: 'edit',
} }
}, },
onLoad(options) { onLoad(options) {
console.log(options,''); console.log(options, '');
if (options.type && options.type == 'register') { if (options.type && options.type == 'register') {
this.userInfo.org_id = 1 this.userInfo.org_id = 1
this.userInfo.code = options.code this.userInfo.code = options.code
@ -247,7 +236,25 @@
} }
}, },
onReady() {
//
this.$refs.datetimePicker.setFormatter(this.formatter)
},
methods: { methods: {
formatter(type, value) {
if (type === 'year') {
return `${value}`
}
if (type === 'month') {
return `${value}`
}
if (type === 'day') {
return `${value}`
}
return value
},
getPreInfo() { getPreInfo() {
uni.showLoading({ uni.showLoading({
title: '加载中...' title: '加载中...'
@ -356,9 +363,36 @@
} }
}) })
}, },
formatDate(timestamp) {
const date = new Date(timestamp);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); // 01
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
},
// //
handleBirth() { handleBirth() {
this.$refs.birth.show() this.birth = true
},
birthConfirm(e) {
this.birth = false
this.userInfo.birthday = this.formatDate(e.value)
},
handlejoinTime() {
this.joinTime = true
},
joinTimeConfirm(e) {
this.joinTime = false
this.userInfo.join_time = this.formatDate(e.value)
},
handleretireTime() {
this.retireTime = true
},
retireTimeConfirm(e) {
this.retireTime = false
this.userInfo.retire_time = this.formatDate(e.value)
}, },
// //
handleEmotion() { handleEmotion() {
@ -456,9 +490,9 @@
}) })
return return
} }
if (!that.userInfo.contact_mobile) { if (!that.isValidIDCard(that.userInfo.idcard)) {
uni.showToast({ uni.showToast({
title: '请输入手机号', title: '身份证格式错误',
icon: 'none' icon: 'none'
}) })
return return
@ -470,6 +504,13 @@
}) })
return return
} }
if (!that.isValidPhoneNumber(that.userInfo.contact_mobile)) {
uni.showToast({
title: '手机号格式错误',
icon: 'none'
})
return
}
if (!that.userInfo.sex) { if (!that.userInfo.sex) {
uni.showToast({ uni.showToast({
title: '请选择性别', title: '请选择性别',
@ -560,37 +601,47 @@
that.userInfo.name = rsaEncrypt(that.userInfo.name); that.userInfo.name = rsaEncrypt(that.userInfo.name);
that.userInfo.idcard = rsaEncrypt(that.userInfo.idcard); that.userInfo.idcard = rsaEncrypt(that.userInfo.idcard);
that.userInfo.contact_mobile = rsaEncrypt(that.userInfo.contact_mobile); that.userInfo.contact_mobile = rsaEncrypt(that.userInfo.contact_mobile);
infoEdit(that.userInfo).then(res => { if (that.pageType == 'edit') {
uni.hideLoading() infoEdit(that.userInfo).then(res => {
if (res.code == 0) { uni.hideLoading()
uni.showLoading({ if (res.code == 0) {
title: '提交成功', uni.showToast({
icon: 'none' title: '提交成功',
}) icon: 'none'
if (that.pageType == 'edit') { })
setTimeout(() => { setTimeout(() => {
uni.navigateBack({ uni.navigateBack({
delta: 1 delta: 1
}) })
}, 400) }, 400)
} else { } else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
})
} else {
register(that.userInfo).then(res => {
uni.hideLoading()
if (res.code == 0) {
uni.showToast({
title: '提交成功',
icon: 'none'
})
setTimeout(() => { setTimeout(() => {
uni.reLaunch({ uni.reLaunch({
url: '/pages/home/home' url: '/pages/home/home'
}) })
}, 400) }, 400)
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
} }
})
} else { }
uni.showLoading({
title: res.msg,
icon: 'none'
})
}
})
} }
} }

View File

@ -18,7 +18,8 @@ function codes() {
uni.reLaunch({ uni.reLaunch({
url: '/pages/home/home' url: '/pages/home/home'
}) })
} else { }
else {
uni.reLaunch({ uni.reLaunch({
url: '/pages/mine/edit-info?type=register' + '&code=' + res.code url: '/pages/mine/edit-info?type=register' + '&code=' + res.code
}) })