Browse Source

对接接口

master
邓平艺 5 years ago
parent
commit
85b09423f6
  1. 9
      common/api.js
  2. 2
      components/lf-image/lf-image.vue
  3. 6
      components/lf-uploadImage/lf-uploadImage.vue
  4. 18
      pages/index/index.vue
  5. 4
      pages/login/index.vue
  6. 12
      pages/my/addWechatNumber.vue
  7. 83
      pages/my/index.vue
  8. 102
      pages/my/memberDetails.vue
  9. 4
      pages/webview/index.vue

9
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'; // 个人中心,个人资料
export const API_USER_DETAIL = '/api/user/detail'; // 个人中心,个人资料
export const API_USER_UPDATE_WEIXIN = '/api/user/update_weixin'; // 更新用户微信号

2
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;
}
}
},

6
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;

18
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(){

4
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: {

12
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;

83
pages/my/index.vue

@ -8,11 +8,11 @@
<lf-image :src="user.avatar" mode="widthFix" class="head-pic"></lf-image>
</view>
<view class="head-left">
<view class="head-name" @click="$url('/pages/my/editInfo')">
<text>{{ user.number_nickname }}</text>
<view class="head-name" @click="clickEnter">
<text>{{ user.number_nickname || '您未登录,点此登录' }}</text>
<u-icon name="arrow-right lf-m-l-20"></u-icon>
</view>
<view class="head-text">{{ user.overall_state_text }}</view>
<view class="head-text">{{ user.overall_state_text || '登录后以便获取更好的服务' }}</view>
</view>
</view>
<!-- <view class="lf-bg-white span-btn1" @click="$url('/pages/my/bindPhone')">
@ -35,7 +35,7 @@
</view>
</view>
<view class="lf-color-primary lf-font-32">
{{ user.red_rope }}
{{ user.red_rope || 0 }}
</view>
</view>
<!-- <view class="lf-row-between" style="height: 98rpx;padding: 0 32rpx;">
@ -75,7 +75,7 @@
</view>
<view class="classify">
<view class="card" v-for="(item,index) in list" :key="index" @click="$url(item.path)">
<view class="card" v-for="(item,index) in list" :key="index" @click="clickTab(item)">
<view class="lf-row-center" style="align-content: center;">
<!-- <u-icon class="classify-icon" :name="item.icon"></u-icon> -->
<image class="classify-icon" :src="item.pic" mode="aspectFill"></image>
@ -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)
})
}
}
}

102
pages/my/memberDetails.vue

@ -26,12 +26,26 @@
</view>
<view class="info-content">
<view class="lf-color-222 lf-font-32 authen-title lf-p-l-20">信息资料</view>
<view class="lf-row-between lf-m-t-30" v-for="(item, index) in list" :key="index">
<view class="lf-row-between lf-m-t-30" v-for="(item, index) in basic_list" :key="index">
<view class="lf-color-333 lf-font-28">{{item.title}}</view>
<view class="lf-color-333 lf-font-28">{{item.content}}</view>
</view>
</view>
<view class="lf-p-l-32 lf-p-r-32 info-tag">
<view class="info-content lf-m-t-30" v-if="member.is_auth">
<view class="lf-color-222 lf-font-32 authen-title lf-p-l-20">家庭与房车</view>
<view class="lf-row-between lf-m-t-30" v-for="(item, index) in family_list" :key="index">
<view class="lf-color-333 lf-font-28">{{item.title}}</view>
<view class="lf-color-333 lf-font-28">{{item.content}}</view>
</view>
</view>
<view class="info-content lf-m-t-30" v-if="member.is_auth">
<view class="lf-color-222 lf-font-32 authen-title lf-p-l-20">择偶要求</view>
<view class="lf-row-between lf-m-t-30" v-for="(item, index) in require_list" :key="index">
<view class="lf-color-333 lf-font-28">{{item.title}}</view>
<view class="lf-color-333 lf-font-28">{{item.content}}</view>
</view>
</view>
<view class="lf-p-l-32 lf-p-r-32 info-tag" v-if="!member.is_auth">
<view class="lf-color-222 lf-font-32 lf-m-b-30 authen-title lf-p-l-20">家庭与房车</view>
<view class="lf-color-333 lf-font-28">
了解Ta的购车住房情况和家庭成员资料
@ -40,7 +54,7 @@
实名认证后可查看>>
</view>
</view>
<view class="lf-p-l-32 lf-p-r-32 info-tag" style="margin-bottom: 130rpx;">
<view class="lf-p-l-32 lf-p-r-32 info-tag" v-if="!member.is_auth">
<view class="lf-color-222 lf-font-32 lf-m-b-30 authen-title lf-p-l-20">择偶要求</view>
<view class="lf-color-333 lf-font-28">
了解Ta的婚史身高年龄等各项择偶要求
@ -49,6 +63,7 @@
实名认证后可查看>>
</view>
</view>
<view style="height: 130rpx;"></view>
<view class="tabbar-bottom">
<view class="lf-row-between">
<view class="lf-flex-column" style="align-items: center;" @click="$url('/pages/my/service')">
@ -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(){

4
pages/webview/index.vue

@ -1,6 +1,6 @@
<template>
<view>
<web-view :src="src"></web-view>
<!-- <web-view :src="src"></web-view> -->
</view>
</template>
@ -12,7 +12,7 @@
}
},
onLoad(){
location.replace(this.src);
},
methods: {

Loading…
Cancel
Save