Commit 49bd912f by 张立顺

获取用户手机号

1 parent 914b5c5a
/* pages/mineDetail/messageBox/messageBox.wxss */
::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
}
.layout {
position: relative;
// padding: 400rpx 16rpx 0;
......
// pages/tab/discovery/components/product/product.js
// import {imgUrlMixin} from '~/mixins/index'
import { IMG_URL } from "~/utils/constantData.js";
const videoBaseUrl =
"https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/";
import { IMG_URL } from '~/utils/constantData.js'
import USERAPI from '~/api/usersApi/index'
const videoBaseUrl = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/'
Component({
// behaviors: [imgUrlMixin],
......@@ -13,7 +13,7 @@ Component({
stickyTop: Number,
actNum: Number,
senceData: Object,
isShare:{
isShare: {
type: Boolean,
value: false
}
......@@ -23,158 +23,198 @@ Component({
* 组件的初始数据
*/
data: {
navList: ["360全景导航", "AR实景导航", "座椅通风", "氛围灯", "数字化美容"],
navList: ['360全景导航', 'AR实景导航', '座椅通风', '氛围灯', '数字化美容'],
activeNavIdx: 0,
tab: [
"场景说明",
"营销链路",
"项目亮点",
"转化漏斗",
"合作流程",
'场景说明',
'营销链路',
'项目亮点',
'转化漏斗',
'合作流程'
// "合作案例",
],
heightArr: [],
allHeight: 0,
curTabIdx: 0,
intoViewId: "to-0",
intoViewId: 'to-0',
IMGURL: `${IMG_URL}index/`,
videoBaseUrl,
videoBaseUrl
},
lifetimes: {
ready: function () {
this.init()
// console.log('stickyTop',this.data.stickyTop)
this.getImgHeight();
this.getImgHeight()
//如果不是分享,初始化的时候调用函数
if(!this.data.isShare){
if (!this.data.isShare) {
// console.log(131546)
this.getMoreFn()
}
},
}
},
observers: {
actNum: function () {
let navList;
let navList
let tab = [
"场景说明",
"营销链路",
"项目亮点",
"转化漏斗",
"合作流程",
'场景说明',
'营销链路',
'项目亮点',
'转化漏斗',
'合作流程'
// "合作案例",
];
let num = this.data.actNum;
]
let num = this.data.actNum
switch (num) {
case 0:
navList = ["数字无忧权益卡"];
break;
navList = ['数字无忧权益卡']
break
case 1:
navList = ["汽车太阳膜"];
break;
navList = ['汽车太阳膜']
break
case 2:
navList = ["漆面保护膜", "改色膜"];
break;
navList = ['漆面保护膜', '改色膜']
break
case 3:
navList = [
"数字化美容",
"座椅通风",
"AR导航",
"氛围灯",
"360全景导航",
];
break;
navList = ['数字化美容', '座椅通风', 'AR导航', '氛围灯', '360全景导航']
break
}
this.setData({
navList,
tab,
intoViewId: `to-0`,
activeNavIdx: 0,
});
activeNavIdx: 0
})
// 每次切换场景,重新获取流程图高度
this.getImgHeight();
this.getImgHeight()
this.getMoreFn()
},
}
},
/**
* 组件的方法列表
*/
methods: {
async init() {
try {
const { data, code, message } = await USERAPI.wxCodeLogin()
if (code == '0') {
this.loginToken = data
} else this.reLogin(message)
wx.hideLoading()
} catch ({ errMsg }) {
console.error(errMsg)
this.reLogin()
}
},
/**获取loginToken */
reLogin(message) {
wx.showModal({
content: message || '获取loginToken失败',
confirmText: '重试',
confirmColor: '#3666FE'
}).then(({ confirm }) => {
if (confirm) this.init()
})
},
saleTextChange(e) {},
changeTab(e) {
let idx = e.detail;
let idx = e.detail
this.setData({
intoViewId: `to-${idx}`,
});
intoViewId: `to-${idx}`
})
},
changeNav(event) {
this.setData({
activeNavIdx: event.target.dataset.index,
});
activeNavIdx: event.target.dataset.index
})
},
scrolltoupper(event) {
const idx = this.data.heightArr.findIndex(
(item) => item > event.detail.scrollTop
);
const idx = this.data.heightArr.findIndex(item => item > event.detail.scrollTop)
this.setData({
curTabIdx: idx,
});
curTabIdx: idx
})
// console.log(this.data.curTabIdx1)
},
getImgHeight() {
let query = wx.createSelectorQuery().in(this);
let heightArr = [];
let s = 0;
let query = wx.createSelectorQuery().in(this)
let heightArr = []
let s = 0
query
.selectAll(".img-item")
.boundingClientRect((react) => {
react.forEach((item) => {
s += item.height;
heightArr.push(s);
});
this.data.heightArr = heightArr;
.selectAll('.img-item')
.boundingClientRect(react => {
react.forEach(item => {
s += item.height
heightArr.push(s)
})
this.data.heightArr = heightArr
// console.log(heightArr[heightArr.length-1])
this.data.allHeight = heightArr[heightArr.length - 1];
this.data.allHeight = heightArr[heightArr.length - 1]
})
.exec();
.exec()
},
// 图片流程5 点击往下获取更多
// 没登陆用户(登陆后解锁全部)
getMoreFn(e) {
let { actNum } = this.data;
getMoreFn({ detail }) {
console.log(detail)
if (!detail.code) return
// this.setBtnLoading()
USERAPI.getUserProfile(this.loginToken, detail)
.then(result => {
// console.log(result)
let { phone } = result
// let {
wx.$storage.set('userPhone', phone)
// }
this.triggerEvent('authorized', {
phone,
isShare: false
})
// this.
})
.catch(({ errMsg }) => {
wx.$api.showToast(errMsg || '系统异常')
// this.setBtnLoading(false)
})
let { actNum } = this.data
// console.log("inactNumdex: ", actNum);
let tab = [
"场景说明",
"营销链路",
"项目亮点",
"转化漏斗",
"合作流程",
'场景说明',
'营销链路',
'项目亮点',
'转化漏斗',
'合作流程'
// "合作案例",
];
]
switch (actNum) {
case 0:
tab.push("合作案例");
break;
tab.push('合作案例')
break
case 1:
tab.push("合作案例");
break;
tab.push('合作案例')
break
case 2:
break;
break
case 3:
tab.push("合作案例");
break;
tab.push('合作案例')
break
}
this.setData({
tab,
});
tab
})
},
onShareFn() {
// this.triggerEvent('sharehandle')
// wx.$router.go('apply',1235)
let { actNum, activeNavIdx } = this.data;
wx.$router.go("checkProduct", { actNum, activeNavIdx});
},
},
});
let { actNum, activeNavIdx } = this.data
wx.$router.go('checkProduct', {
actNum,
activeNavIdx
})
}
}
})
......@@ -11,5 +11,6 @@ export const STORAGE_OBJECTkEY = {
system_info: 'systemInfo',
app_title: 'appTitle',
auto_login_object: 'auto_login_object',
wx_user_info: 'wx_user_info'
}
\ No newline at end of file
wx_user_info: 'wx_user_info',
userPhone: 'userPhone'
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!