diff --git a/common/api.js b/common/api.js index 75e2798..256ba24 100644 --- a/common/api.js +++ b/common/api.js @@ -1,10 +1,10 @@ // appId: 正式 null | 测试 null export const DEV = "dev"; // dev 测试 | prod 正式 export const VERSION = '1.0.0'; // 版本号 -// export const DEVURL = 'http://192.168.3.181'; // 测试服请求地址 -export const DEVURL = 'http://192.168.3.186'; // 测试服请求地址 +export const DEVURL = 'http://192.168.111.224'; // 测试服请求地址 +// export const DEVURL = 'https://blinddate.lanzulive.com'; // 测试服请求地址 export const PRODURL = ''; // 正式服请求地址 -export const CALLBACKURL = 'http://192.168.3.183:8080'; // 重定向地址(H5授权换取code回调地址) +export const CALLBACKURL = 'http://192.168.111.220:8080'; // 重定向地址(H5授权换取code回调地址) export const APPID = 'wx98e64ab875b2553e'; // 公众号appid export const API_OFFICIAL_LOGIN = '/api/official_login'; // code 换取用户信息 @@ -15,4 +15,5 @@ export const API_MEMBERS_ALL = '/api/members/all'; // 会员列表 export const API_MEMBERS_DETAIL = '/api/members/detail'; // 会员详情 export const API_MEMBERS_PARAMS = '/api/members/params'; // 获得查询参数 export const API_UCENTER = '/api/ucenter'; // 个人中心落地页 -export const API_USER_DETAIL = '/api/user/detail'; // 个人中心,个人资料 \ No newline at end of file +export const API_USER_DETAIL = '/api/user/detail'; // 个人中心,个人资料 +export const API_USER_UPDATE_WEIXIN = '/api/user/update_weixin'; // 更新用户微信号 \ No newline at end of file diff --git a/components/lf-image/lf-image.vue b/components/lf-image/lf-image.vue index a355540..cccf9f1 100644 --- a/components/lf-image/lf-image.vue +++ b/components/lf-image/lf-image.vue @@ -43,7 +43,7 @@ if(this.is_err){ return this.errSrc; }else{ - return this.src; + return this.src || this.errSrc; } } }, diff --git a/components/lf-uploadImage/lf-uploadImage.vue b/components/lf-uploadImage/lf-uploadImage.vue index 9769c7a..cc87042 100644 --- a/components/lf-uploadImage/lf-uploadImage.vue +++ b/components/lf-uploadImage/lf-uploadImage.vue @@ -58,7 +58,7 @@ default: 10 }, drag: { - type: Boolean, // TODO 是否可拖拽排序图片 + type: Boolean, default: false }, padding: { @@ -229,7 +229,7 @@ // 拖拽中 touchMove(e) { if (!this.touch) return; - let tranX = e.touches[0].pageX - this.startX + this.tranConstX; // TODO 原作者写的逻辑,但不知道为什么计算不对??? + let tranX = e.touches[0].pageX - this.startX + this.tranConstX; let tranY = e.touches[0].pageY - this.startY + this.teanConstY; let overOnePage = this.overOnePage; @@ -378,7 +378,7 @@ let rows = Math.ceil(this.list.length / this.columns); this.item = res; this.getPosition(this.list, false); - let itemWrapHeight = rows * res.height; // TODO 有时候会报res.height undefined + let itemWrapHeight = rows * res.height; itemWrapHeight += rows * this.$props.padding - this.$props.padding; this.itemWrapHeight = itemWrapHeight; diff --git a/pages/index/index.vue b/pages/index/index.vue index 87c11e7..9975c09 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -68,15 +68,17 @@ }, onLoad(){ // #ifdef H5 - this.href_str = JSON.stringify(location.href); - let options = this.strToObj(); - if(options.code){ - this.login(options.code) - }else if(this.$isRight(uni.getStorageSync('user_info'))){ - this.getMembersWall(); - this.getMembers(); - } + // this.href_str = JSON.stringify(location.href); + // let options = this.strToObj(); + // if(options.code){ + // this.login(options.code) + // }else if(this.$isRight(uni.getStorageSync('user_info'))){ + // this.getMembersWall(); + // this.getMembers(); + // } // #endif + this.getMembersWall(); + this.getMembers(); }, methods: { strToObj(){ diff --git a/pages/login/index.vue b/pages/login/index.vue index 34b3283..45a9770 100644 --- a/pages/login/index.vue +++ b/pages/login/index.vue @@ -12,7 +12,7 @@ onLoad(options){ // #ifdef H5 const URL = this.API.CALLBACKURL; - const page = '/pages/index/index'; + const page = '/pages/my/index'; const callbackURL = encodeURIComponent(URL + page); const appId = this.API.APPID; const dataStr = '1'; @@ -20,7 +20,7 @@ location.replace(redirectURI); // #endif // #ifdef MP-WEIXIN - this.$url(page, {type: 'redirect'}); + this.$url(page, {type: 'switch'}); // #endif }, methods: { diff --git a/pages/my/addWechatNumber.vue b/pages/my/addWechatNumber.vue index 0089919..8868450 100644 --- a/pages/my/addWechatNumber.vue +++ b/pages/my/addWechatNumber.vue @@ -54,7 +54,14 @@ }, 0); // 给click事件留出时间 }, confirm(){ - this.$msg('确定') + let wechat_num = this.wechat_num; + if(!wechat_num) return this.$msg('请您先输入微信号'); + + this.$http(this.API.API_USER_UPDATE_WEIXIN, { + weixin: wechat_num + }).then(res => { + this.$msg(res.data).then(() => this.$toBack()); + }) } } } @@ -84,7 +91,8 @@ .content{ width: 630rpx; - height: 572rpx; + // height: 572rpx; + height: max-content; background: #FFFFFF; border-radius: 60rpx; position: relative; diff --git a/pages/my/index.vue b/pages/my/index.vue index cdf850e..bd64279 100644 --- a/pages/my/index.vue +++ b/pages/my/index.vue @@ -8,11 +8,11 @@ - - {{ user.number_nickname }} + + {{ user.number_nickname || '您未登录,点此登录' }} - {{ user.overall_state_text }} + {{ user.overall_state_text || '登录后以便获取更好的服务' }} @@ -94,8 +94,8 @@ data() { return { list: [ - {name: '我的红娘',icon:'github-circle-fill',path: '/pages/my/exclusiveMatch',pic: '../../static/my/red.png'}, - {name: '实名认证',icon:'email',path: '/pages/my/authentication',pic: '../../static/my/authen.png'}, + {name: '我的红娘',icon:'github-circle-fill',path: '/pages/my/exclusiveMatch',pic: '../../static/my/red.png',check: true}, + {name: '实名认证',icon:'email',path: '/pages/my/authentication',pic: '../../static/my/authen.png',check: true}, // {name: '我喜欢的',icon:'qzone',path: '/pages/my/collect',pic: '../../static/my/collect.png'}, // {name: '我的动态',icon:'moments',path:'/pages/my/qzone',pic: '../../static/my/qzone.png'}, // {name: '福利中心',icon:'red-packet',path:'/pages/my/welfare',pic: '../../static/my/welhare.png'}, @@ -107,11 +107,34 @@ } }, onLoad(){ - this.getData(); - // todo 登录逻辑改到当前页面进行 - // todo 添加微信号对接 + // #ifdef H5 + this.href_str = JSON.stringify(location.href); + let options = this.strToObj(); + if(options.code){ + this.login(options.code) + }else{ + let user_info = uni.getStorageSync('user_info'); + if(this.$isRight(user_info) && this.$isRight(user_info?.member?.weixin)){ + this.getData(); + } + } + // #endif }, methods: { + clickEnter(){ + if(this.$isRight(this.user)){ + this.$url('/pages/my/editInfo'); + }else{ + this.$url('/pages/login/index'); + } + }, + clickTab(item){ + if(item.check && !this.$isRight(this.user)){ + this.$url('/pages/login/index'); + }else{ + this.$url(item.path); + } + }, showRedthread() { uni.showModal({ title: '红线说明', @@ -145,6 +168,46 @@ this.$http(this.API.API_UCENTER).then(res => { this.user = res.data.user; }) + }, + strToObj(){ + let val = this.href_str; + let obj = {}; + if(!val) return obj; + if(val.indexOf('?') < 0) return obj; + let indexA = val.indexOf('?') + 1; + let str = val.substr(indexA); + str = str.substr(0, str.length - 1); + let indexB = str.indexOf('#'); + if(indexB >= 0){ + str = str.substr(0, indexB); + } + let arr = str.split('&'); + arr.map(item => { + let a = item.split('='); + obj[a[0]] = a[1]; + }); + return obj; + }, + login(code){ + this.$http(this.API.API_OFFICIAL_LOGIN, { + code: code, + scopes: 'snsapi_userinfo' + }).then(res => { + let user_info = res?.data?.user; + uni.setStorageSync('user_info', user_info); + var url = window.location.href; //获取当前页面的url + if(url.indexOf("?")!=-1){ //判断是否存在参数 + url = url.replace(/(\?|#)[^'"]*/, ''); //去除参数 + window.history.pushState({}, 0, url); + } + if(user_info && this.$isRight(user_info?.member?.weixin)){ + this.getData(); + }else{ + this.$url('/pages/my/addWechatNumber'); // 如果微信号为空,就跳转让用户添加 + } + }).catch(err => { + console.log(err) + }) } } } diff --git a/pages/my/memberDetails.vue b/pages/my/memberDetails.vue index b14f3f5..d00082f 100644 --- a/pages/my/memberDetails.vue +++ b/pages/my/memberDetails.vue @@ -26,12 +26,26 @@ 信息资料 - + {{item.title}} {{item.content}} - + + 家庭与房车 + + {{item.title}} + {{item.content}} + + + + 择偶要求 + + {{item.title}} + {{item.content}} + + + 家庭与房车 了解Ta的购车、住房情况和家庭成员资料 @@ -40,7 +54,7 @@ 实名认证后可查看>> - + 择偶要求 了解Ta的婚史、身高、年龄等各项择偶要求 @@ -49,6 +63,7 @@ 实名认证后可查看>> + @@ -95,7 +110,9 @@ export default { data() { return { - list: [], + basic_list: [], + family_list: [], + require_list: [], number_id: 0, member: {} } @@ -103,57 +120,100 @@ onLoad(options){ this.number_id = options.id || 0; this.getMemberDetail(); - // todo 对接实名认证后才能看的信息 }, methods: { getMemberDetail(){ this.$http(this.API.API_MEMBERS_DETAIL, { number: this.number_id }).then(res => { - let list = []; + let basic_list = []; + let family_list = []; + let require_list = []; let member = res.data.member; this.member = member; for(let i in member){ - if(i == 'number_nickname' && member[i]){ - list.push({title: '编号', content: member[i]}); + // 基本信息 + if(i == 'number' && member[i]){ + basic_list.push({title: '编号', content: member[i]}); } if(i == 'gender' && member[i]){ - list.push({title: '性别', content: member[i]}); + basic_list.push({title: '性别', content: member[i]}); } if(i == 'marital_status' && member[i]){ - list.push({title: '婚史', content: member[i]}); + basic_list.push({title: '婚史', content: member[i]}); } if(i == 'age' && member[i]){ - list.push({title: '年龄', content: member[i] +'岁'}); + basic_list.push({title: '年龄', content: member[i] +'岁'}); } if(i == 'height' && member[i]){ - list.push({title: '身高', content: member[i]}); + basic_list.push({title: '身高', content: member[i]}); } if(i == 'weight' && member[i]){ - list.push({title: '体重', content: member[i]}); + basic_list.push({title: '体重', content: member[i]}); } if(i == 'zodiac' && member[i]){ - list.push({title: '属相', content: member[i]}); + basic_list.push({title: '属相', content: member[i]}); } if(i == 'constellation' && member[i]){ - list.push({title: '星座', content: member[i]}); + basic_list.push({title: '星座', content: member[i]}); } if(i == 'education' && this.$isRight(member[i])){ - list.push({title: '学历', content: member[i].name}); + basic_list.push({title: '学历', content: member[i].name}); } if(i == 'enterprise' && this.$isRight(member[i])){ - list.push({title: '单位性质', content: member[i].name}); + basic_list.push({title: '单位性质', content: member[i].name}); } if(i == 'salary' && this.$isRight(member[i])){ - list.push({title: '年薪', content: member[i].name}); + basic_list.push({title: '年薪', content: member[i].name}); } if(i == 'area' && this.$isRight(member[i])){ - list.push({title: '居住地区', content: member[i].name}); + basic_list.push({title: '居住地区', content: member[i].name}); + } + // TODO basic_list 缺少户籍和所属行业 + + // 家庭与房车信息 + if(i == 'housing' && this.$isRight(member[i])){ + family_list.push({title: '住房情况', content: member[i].name}); + } + if(i == 'car' && this.$isRight(member[i])){ + family_list.push({title: '购车情况', content: member[i]}); + } + if(i == 'family' && this.$isRight(member[i])){ + let familys = member[i].map(item => item.name); + let str = familys.join(','); + family_list.push({title: '家庭成员', content: str}); + } + // TODO family_list 缺少现居地址 + + // 择偶要求 + if(i == 'marital_status' && this.$isRight(member[i])){ + require_list.push({title: '婚史要求', content: member[i]}); + } + if(i == 'selection' && this.$isRight(member[i].height)){ + require_list.push({title: '最低身高', content: member[i].height}); + } + if(i == 'selection' && this.$isRight(member[i].min_age)){ + require_list.push({title: '最低年龄要求', content: member[i].min_age}); + } + if(i == 'education' && this.$isRight(member[i])){ + require_list.push({title: '最低学历要求', content: member[i].name}); + } + if(i == 'salary' && this.$isRight(member[i])){ + require_list.push({title: '最低年薪要求', content: member[i].name}); + } + if(i == 'housing' && this.$isRight(member[i].selection_request)){ + require_list.push({title: '住房要求', content: member[i].selection_request}); + } + if(i == 'selection' && this.$isRight(member[i].car)){ + require_list.push({title: '购车要求', content: member[i].car}); } - // TODO 缺少户籍和所属行业 + // TODO require_list 缺少行业要求、体重要求、子女要求、户籍要求、 + // 家庭要求、外貌要求、是否喝酒、是否抽烟、性格要求、其他要求 } - this.list = list; + this.basic_list = basic_list; + this.family_list = family_list; + this.require_list = require_list; }) }, share(){ diff --git a/pages/webview/index.vue b/pages/webview/index.vue index 69760ee..d991c96 100644 --- a/pages/webview/index.vue +++ b/pages/webview/index.vue @@ -1,6 +1,6 @@ @@ -12,7 +12,7 @@ } }, onLoad(){ - + location.replace(this.src); }, methods: {