diff --git a/store/modules/user.js b/store/modules/user.js index 5fd7217..8e2b3d1 100644 --- a/store/modules/user.js +++ b/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 }, } } diff --git a/subPackages/user/infoFilling.vue b/subPackages/user/infoFilling.vue index b510575..52fd396 100644 --- a/subPackages/user/infoFilling.vue +++ b/subPackages/user/infoFilling.vue @@ -2,8 +2,34 @@ - - + + + + {{item.name}} + {{item.valueStr}} + 请选择 + + + + + + 语言能力 + {{inputValueStr}} + 请选择 + + + 证明材料 + + + + + + 111 + + + + + @@ -11,6 +37,30 @@ 保存 + + + + + + 取消 + 全选 + + + + {{item.name}} + + + + + + + + + 确定 + + + @@ -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 { - // 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; + } + } + } diff --git a/subPackages/user/register.vue b/subPackages/user/register.vue index 4606dc0..8b8a5c2 100644 --- a/subPackages/user/register.vue +++ b/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) {