Commit 49bd912f by 张立顺

获取用户手机号

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