chenkainan 11 months ago
parent
commit
3c2e3927f2
  1. 8
      store/modules/user.js
  2. 343
      subPackages/user/infoFilling.vue
  3. 19
      subPackages/user/register.vue

8
store/modules/user.js

@ -69,11 +69,11 @@ export default {
state.meetRoomReserve = data
},
changeLingoIds(state, date) {
state.groupIds = data
changeLingoIds(state, data) {
state.lingoIds = data
},
changeScenicIds(state, date) {
state.groupIds = data
changeScenicIds(state, data) {
state.scenicIds = data
},
}
}

343
subPackages/user/infoFilling.vue

@ -2,8 +2,34 @@
<view class="bg">
<view class="user-other-info">
<view class="nickname-box">
<!-- // -->
<view class="scenic-container" v-if="valueType=='scenic_ids'">
<view class="userinfo-item" v-for="(item,i) in scenicIds" :key="i" @click="changeSelection(item)">
<span>{{item.name}}</span>
<view v-if="item.value.length>0" class="text-overflow" >{{item.valueStr}}</view>
<view v-else class="empty-value" >请选择</view>
</view>
</view>
<view class="lingo-container" v-else-if="valueType=='lingo_ids'">
<view class="userinfo-item">
<span>语言能力</span>
<view v-if="inputValueStr" class="text-overflow" >{{inputValueStr}}</view>
<view v-else class="empty-value" >请选择</view>
</view>
<view class="language-doc-container">
<span>证明材料</span>
<view class="img-container">
<image :src="file.img" class="doc-image" v-for="(file,i) in fileList" :key="i"></image>
<view class="doc-image" @click="uploadImg">
<!-- <image class="upload-image" src=""></image> -->
111
</view>
</view>
</view>
</view>
<view class="nickname-box" v-else>
<input v-model="inputValue" type="text" placeholder="请输入内容" />
</view>
@ -11,6 +37,30 @@
<view class="btn-tao" @click="submit">保存</view>
</view>
<!-- 弹框 -->
<uni-popup ref="popup" type="bottom">
<view class="popup-box">
<view class="btn-top flex flex-between w-full">
<view @click="$refs.popup.close()">取消</view>
<view @click="selectAll">全选</view>
</view>
<view class="popup-content">
<view :class="['popup-item','flex-center',selection.value.includes(item.id)?'active':'']"
v-for="(item,index) in selection.arr" :key="index" @click="changeItemSelect(item)">
{{item.name}}
<uni-icons v-show="selection.value.includes(item.id)" class="active-img" type="checkmarkempty" size="23" color="#96684F"></uni-icons>
</view>
</view>
<view class="popup-btns flex-center" @click="popSubmit">
<view>确定</view>
</view>
</view>
</uni-popup>
</view>
</template>
@ -22,11 +72,7 @@
return {
valueType: '',
inputValue: '',
lingo_ids: null, lingo_idsStr:'',
scenic_ids: null, scenic_idsStr:'',
inputValueStr: '',
keyNames: [
{key: 'nickname', value:'姓名'},{key: 'mobile', value:'手机号'},
{key: 'certificate_number', value: '导游证号码'},
@ -34,14 +80,16 @@
{key: 'bio',value: '个性签名'},
{key: 'scenic_ids',value: '擅长景区'},
{key: 'lingo_ids',value: '语言能力'},
]
],
lingoIds: [],
scenicIds: [],
selectionItem: null, //
selection: {arr: [], value: [], valueStr: ''}, //
fileList: []
}
},
computed: {
...mapState(['lingoIds','scenicIds'])
},
onLoad(options) {
this.initData(options)
},
@ -52,12 +100,19 @@
uni.setNavigationBarTitle({title: ''});
this.valueType = ''
this.inputValue = ''
this.inputValueStr = ''
if (options.valueType) {
this.valueType = options.valueType
let titleData = this.keyNames.find(v=>v.key == this.valueType)
if (titleData) {
uni.setNavigationBarTitle({title: titleData.value});
}
if (this.valueType == 'lingo_ids') {
this.initLingoList()
}
if (this.valueType == 'scenic_ids') {
this.initScenicList()
}
} else {
this.goBack()
@ -66,80 +121,112 @@
if (options.inputValue && options.inputValue!='null' && options.inputValue!='undefined') {
this.inputValue = options.inputValue
}
console.log(this.lingoIds, this.scenicIds)
},
async initLingoList() {
//
let res = await this.Post({},'/api/guide/getGuideLingoList').then(res =>{
this.lingoIds = res.data
})
this.lingoIds = (this.$store.state.user.lingoIds || []).map(v=>{
return {...v, value: [], valueStr: ""}
})
},
async initScenicList() {
//
let res = await this.Post({},'/api/guide/getGuideScenicList')
let valueArr = []
try {
valueArr = (this.inputValue || '').split(',').map(v=>{return Number(v)})
} catch(e) {}
console.log(valueArr)
this.scenicIds = (res.data || []).map(v=>{
let valueHave = v.arr.filter(x=>valueArr.includes(x.id))
return {...v, value: valueHave.map(x=>x.id), valueStr: valueHave.map(x=>x.name).join(',')}
})
},
changeSelection (item) {
this.selectionItem = item
this.selection = {arr: item.arr, value: JSON.parse(JSON.stringify(item.value)), valueStr: ''}
this.$refs.popup.open()
},
//
changeItemSelect (item) {
let index = this.selection.value.findIndex(x=>x==item.id)
if (index>=0) {
this.selection.value.splice(index,1)
} else {
this.selection.value.push(item.id)
}
},
selectAll() {
this.selection.value = this.selection.arr.map(x=>x.id)
},
popSubmit () {
let tempSelect = JSON.parse(JSON.stringify(this.selection))
let valueHave = tempSelect.arr.filter(x=>tempSelect.value.includes(x.id))
this.selectionItem.value = tempSelect.value
this.selectionItem.valueStr = valueHave.map(x=>x.name).join(',')
this.$refs.popup.close()
},
uploadImg() {
uni.chooseImage({
success: (chooseImageRes) => {
const tempFilePaths = chooseImageRes.tempFilePaths;
success: (res) => {
for(let i =0 ;i<res.tempFilePaths.length;i++) {
let param = {img:res.tempFilePaths[i], tempFile:res.tempFiles[i] }
this.fileList.push(param)
}
console.log(this.fileList)
// // #ifdef MP-WEIXIN
// uni.getFileSystemManager().readFile({
// filePath: tempFilePaths[0],
// encoding: 'base64',
// success: res => {
// this.Post({
// method: 'POST',
// base64: 'data:image/png;base64,' + res.data
// }, '/api/common/base64').then(res => {
// if (res.data) {
// this.Post({
// avatar: res.data
// }, '/api/user/profile').then(res => {
// uni.showModal({
// title: '',
// content: res.msg,
// showCancel: false,
// success: res => {
// if (res.confirm) {
// this.getList()
// }
// }
// })
// })
// }
// })
// }
// })
// // #endif
pathToBase64(tempFilePaths[0]).then(base64 => {
this.Post({
method: 'POST',
base64: base64
}, '/api/common/base64').then(res => {
if (res.data) {
this.Post({
avatar: res.data
}, '/api/user/profile').then(res => {
uni.showModal({
title: '提示',
content: res.msg,
showCancel: false,
success: res => {
if (res.confirm) {
this.getList()
}
}
})
})
}
})
},
fail:()=> {
uni.showToast({
title:'上传失败',
icon:'none'
})
}
});
},
//
handleSubmitData() {
let data = []
if (this.valueType == 'lingo_ids') {
data = this.lingoIds
}
if (this.valueType == 'scenic_ids') {
data = this.scenicIds
}
let value = []
data.forEach(v=>{
if(Array.isArray(v.value) && v.value.length>0) {
value.push(v)
}
})
this.inputValue = value.map(v=>v.value.join(',')).join(',')
this.inputValueStr = value.map(v=>v.valueStr).join(',')
console.log(this.inputValue,this.inputValueStr)
},
submit() {
this.handleSubmitData()
uni.$emit("updateInfo", {
msgType: 'registerInfo',
data: {
valueType: this.valueType,
inputValue: this.inputValue
inputValue: this.inputValue,
inputValueStr: this.inputValueStr
}
})
this.goBack()
@ -186,25 +273,26 @@
.user-other-info {
padding: 30rpx;
padding:30rpx;
}
.userinfo-item {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 28rpx;
border-bottom: 1rpx solid #D8D8D8;
padding: 40rpx 30rpx 40rpx 0;
height: 48rpx;
color: #333;
position: relative;
span{
flex-shrink: 0;
width: 120rpx;
}
&>view{
flex: 1;
padding: 40rpx 10rpx 40rpx 0;
margin-left: 30rpx;
border-bottom: 1px solid #D8D8D8;
}
}
.btn-tao {
width: 333rpx;
height: 80rpx;
@ -216,4 +304,97 @@
color: #FFFFFF;
margin: 68rpx auto 0;
}
.popup-box {
border-radius: 0rpx;
background: #fff;
overflow: hidden;
.btn-top{
padding: 26rpx 26rpx 0 26rpx;
color: #999999;
font-size: 31rpx;
box-sizing: border-box;
}
.popup-content{
max-height: 900rpx;
width: 100%;
overflow-x: hidden;
overflow-y: auto;
}
.popup-item {
width: 697rpx;
height: 99rpx;
font-weight: 500;
font-size: 31rpx;
color: #12293C;
margin: auto;
border-bottom: 1rpx solid #D8D8D8;
position: relative;
}
.popup-item.active{
color: #96684F;
}
.popup-item:last-of-type {
border: none;
}
.active-img{
position: absolute;
right: 10rpx;
}
.popup-btns {
width: 100%;
height: 153rpx;
background: #FFFFFF;
color: #12293C;
border-top: 13rpx solid #F2F2F2;
box-shadow: 0rpx 0rpx 13rpx 0rpx rgba(82,82,82,0.25);
padding: 40rpx 26rpx;
box-sizing: border-box;
view{
box-sizing: border-box;
width: 100%;
height: 73.33rpx;
line-height: 73.33rpx;
background: #DC2525;
border-radius: 11rpx;
font-weight: bold;
font-size: 32rpx;
color: #FFFFFF;
text-align: center;
}
}
}
.language-doc-container{
display: flex;
align-items: flex-start;
padding-top: 40rpx;
span{
flex-shrink: 0;
width: 120rpx;
}
.img-container{
flex:1;
flex-shrink: 0;
display: flex;
flex-wrap: wrap;
padding-left: 20rpx;
.doc-image{
width: 141rpx;
height: 151rpx;
border-radius: 13rpx;
margin: 0 20rpx 20rpx 0;
background: #F1F1F1;
}
.upload-image{
width: 43rpx;
height: 41rpx;
}
}
}
</style>

19
subPackages/user/register.vue

@ -95,8 +95,7 @@
},
groupIds: [], //
lingoIds: [],//
scenicIds: [], //
}
},
mounted() {
@ -122,22 +121,14 @@
this.Post({}, '/api/guide/getGuideGroupList').then(res => {
this.groupIds = res.data
})
//
this.Post({},'/api/guide/getGuideLingoList').then(res =>{
this.lingoIds = res.data
this.$store.commit('changeLingoIds', res.data)
})
//
this.Post({},'/api/guide/getGuideScenicList').then(res =>{
this.scenicIds = res
this.$store.commit('changeScenicIds', res.data)
})
},
//
uploadAvator () {
let _this = this
uni.chooseImage({
count: 1,
success: (chooseImageRes) => {
const tempFilePaths = chooseImageRes.tempFilePaths;
pathToBase64(tempFilePaths[0]).then(base64 => {
@ -166,8 +157,8 @@
},
selectRank () {
let _this = this
let itemList = this.lingoIds.map(v=>v.name)
let valueList = this.lingoIds.map(v=>v.id)
let itemList = this.groupIds.map(v=>v.name)
let valueList = this.groupIds.map(v=>v.id)
uni.showActionSheet({
itemList: itemList,
success: function (res) {

Loading…
Cancel
Save