Authored by 陈峰

Merge branch 'feature/offline-signup-report' into 'release/6.8.9'

Feature/offline signup report



See merge request !12
... ... @@ -120,10 +120,10 @@
},
{
"id": -1,
"name": "我的优惠券",
"pathName": "pages/myCoupon/index",
"query": "",
"scene": null
"name": "扫码登录",
"pathName": "pages/productDetail/index",
"query": "q=https%3A%2F%2Fo.yohobuy.com%2Fufo%3Fp%3D517449%2C1%26skup%3D517449%26skn%3D10003791&scancode_time=1553151155",
"scene": 1011
}
]
}
... ...
... ... @@ -474,6 +474,7 @@ export const bindAction = (phoneNumb, verifyCode, areaCode, inviteCode, callback
if (ret && ret.code === 200 && ret.data && ret.data.uid > 0) {
if (ret.data.nFlag === 'Y') {
event.emit('report-new-user-created');
event.emit('store-new-user-created', ret.data.uid);
}
let userInfo = {
ssouid: ret.data.ssouid,
... ... @@ -517,6 +518,7 @@ export const bindAction = (phoneNumb, verifyCode, areaCode, inviteCode, callback
if (ret.code === 200 && (ret.data.uid !== null) && ret.data.uid > 0 && ret.data.uid !== undefined) {//验证正确
if (ret.data.nFlag === 'Y') {
event.emit('report-new-user-created');
event.emit('store-new-user-created', ret.data.uid);
}
userInfo = {
ssouid: ret.data.ssouid,
... ...
// src/components/login/login-bg/login-bg.js
import { getLoginButtonType } from '../../../libs/login/login.js'
import event from '../../../utils/event.js'
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
loginText: '微信登录',
loginButtonType: '',
loginTips: ''
},
created() {
event.one('user-login-success', () => {
this.triggerEvent('loginSuccess', true);
});
event.one('change-login-status', params => {
this.setData({
loginText: params.text || '微信登录',
loginTips: params.tips || '',
loginButtonType: params.openType || ''
});
});
event.one('user-get-phonenumber-error', this.getPhonenumberError);
event.one('store-new-user-created', this.newUser.bind(this));
},
attached() {
const buttonType = getLoginButtonType();
console.log(buttonType);
this.setData({
loginButtonType: buttonType
});
},
detached() {
event.removeAll('user-login-success');
event.removeAll('change-login-status');
event.removeAll('user-get-phonenumber-error');
event.removeAll('store-new-user-created');
},
/**
* 组件的方法列表
*/
methods: {
newUser(id) {
this.triggerEvent('reportStoreId', id);
},
getPhonenumberError(error) {
if (error === 'getPhoneNumber:fail user deny') {
error = '获取手机号失败, 请使用验证码登录';
}
let timeOut = 1000;
if (error === 'getUserInfo:fail auth deny') {
timeOut = 0;
}
setTimeout(() => {
wx.navigateTo({
url: `../login/index`,
})
}, timeOut);
wx.showToast({
title: error,
duration: 3000,
icon: 'none'
});
},
}
})
... ...
{
"component": true,
"usingComponents": {
"login-button": "../button"
}
}
\ No newline at end of file
... ...
<!--src/components/login/login-bg/login-bg.wxml-->
<view class="login-container">
<image class="logo" src="../../../assets/images/home-logo.png"></image>
<view class="login-buttons">
<view class="to-login">{{loginText}}</view>
<login-button class="login-area auto-btn" openType="{{loginButtonType}}"></login-button>
</view>
<view class="login-tips">{{loginTips}}</view>
</view>
... ...
/* src/components/login/login-bg/login-bg.wxss */
.login-container {
position: fixed;
top: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
background-color: white;
}
.logo {
position: relative;
width: 366rpx;
height: 312rpx;
margin-top: 244rpx;
}
.login-buttons {
position: relative;
width: 540rpx;
height: 88rpx;
margin-top: 202rpx;
}
.login-area {
position: absolute;
top: 0;
left: 0;
width: 540rpx;
height: 88rpx;
}
.login-area.auto-btn {
background-color: transparent;
border: none;
}
.login-area.auto-btn:after {
border: none;
}
.login-tips {
width: 540rpx;
height: 60rpx;
line-height: 60rpx;
font-size: 24rpx;
color: #b0b0b0;
margin-top: 16rpx;
text-align: center;
}
.to-login {
height: 100%;
line-height: 88rpx;
color: #fff;
font-size: 32rpx;
letter-spacing: 8rpx;
text-align: center;
background-color: #000;
border-radius: 50rpx;
}
... ...
... ... @@ -362,6 +362,7 @@ export const getPhoneNumber = (e) => {
}).then(result => {
if(result.nFlag === 'Y') {
event.emit('report-new-user-created');
event.emit('store-new-user-created', result.uid);
}
if (result.is_register !== undefined && result.is_register === 0) {
const newUserInfo = {
... ...
... ... @@ -59,5 +59,16 @@ export default {
store_id
}
})
},
storeIdLoginReport(storeId, fromPage, uid) {
return api.get({
api: 'yohoApi',
data: {
method: 'app.passport.recordRegisterSource',
storeId: storeId,
fromPage: fromPage,
uid
}
})
}
}
\ No newline at end of file
... ...
... ... @@ -68,6 +68,7 @@ Page({
goReferer() {
console.log('执行返回');
// 隐藏登录
wx.navigateBack({
delta: 1
});
... ...
import Taro, {Component} from '@tarojs/taro';
import Taro, {Component, login} from '@tarojs/taro';
import {View, Swiper, SwiperItem, Image} from '@tarojs/components';
import {productDetail as productDetailModel} from '../../models';
import {getImgUrl} from '../../utils';
... ... @@ -56,6 +56,7 @@ export default class ProductDetail extends Component {
snapshootShareData: {},
skup: '',
storeId: -1,
isLogin: false,
productDec: {
color: {
text: '颜色',
... ... @@ -84,7 +85,8 @@ export default class ProductDetail extends Component {
config = {
usingComponents: {
'share-sheet' : '../../components/shareSheet/shareSheet',
'snapshoot-share' : '../../components/shareSheet/snapshootShare/snapshootShare'
'snapshoot-share' : '../../components/shareSheet/snapshootShare/snapshootShare',
'login-bg': '../../components/login/login-bg/login-bg'
}
}
... ... @@ -109,29 +111,18 @@ export default class ProductDetail extends Component {
const storeArr = p.split(',') || [];
const storeId = storeArr[1];
if (queryObj.skup) {
wx.hideShareMenu();
this.setState({
skup: queryObj.skup,
storeId
})
this.loadStoreProductInfo(queryObj.skup, storeId);
this.skupMustLogin(queryObj.skup, storeId);
} else {
this.loadElement({ id: queryObj.productId || queryObj.skn });
}
}
} else {
if (options && options.scene) {
console.log(options.scene);
let code = options.scene;
getQRCodeSource(code).then(json => {
if (json) {
if (json.skup) {
wx.hideShareMenu();
this.setState({
skup: json.skup,
storeId: json.storeId
});
this.loadStoreProductInfo(json.skup, json.storeId);
this.skupMustLogin(json.skup, json.storeId);
} else {
this.loadElement(json);
}
... ... @@ -139,11 +130,47 @@ export default class ProductDetail extends Component {
})
.catch(error => {
});
} else {
} else if(options.storeId && options.skup) {
this.skupMustLogin(options.skup, options.storeId);
}
else {
this.loadElement(options);
}
}
}
skupMustLogin(skup, storeId) {
wx.hideShareMenu();
this.setState({
skup,
storeId
});
// event.emit('user-is-login', () => {
// this.loadStoreProductInfo(skup, storeId);
// }, () => {
// Taro.redirectTo({
// url: `/pages/productDetail/index?skup=${skup}&storeId=${storeId}`,
// });
// });
event.emit('judge-user-is-login', this.isLogined.bind(this), this.isLoginCallBack.bind(this, skup, storeId));
}
isLogined(isLogin) {
this.setState({
isLogin
})
}
isLoginCallBack(skup, storeId) {
this.loadStoreProductInfo(skup, storeId);
}
loginSuccess(isLogin) {
this.setState({
isLogin
})
let { skup, storeId } = this.state;
this.loadStoreProductInfo(skup, storeId);
}
async loadStoreProductInfo(skup, storeId) {
await getPrivateKey();
... ... @@ -356,6 +383,13 @@ export default class ProductDetail extends Component {
}
}
reportStoreId(storeId, e) {
debugger
console.log(storeId);
console.log(e);
productDetailModel.storeIdLoginReport(storeId, 'OfflineStore', e.detail).then(ret => {});
}
onShareAppMessage(res) {
console.log(res);
... ... @@ -490,12 +524,14 @@ export default class ProductDetail extends Component {
}
render() {
let {productInfo, recommendList, goodsList, productDec, id, skup} = this.state;
let {productInfo, recommendList, goodsList, productDec, id, skup, isLogin, storeId} = this.state;
let imageList = goodsList.image_list || [];
let status = productInfo.status;
let isShowLogin = !isLogin && storeId !== -1;
return (
<View className="product-page">
<View>
{ !isShowLogin && (<View className="product-page">
<View className="swiperNum">{this.swiperNum}</View>
<Swiper className='product-swiper' autoplay onChange={this.onChangeSwiper}>
{
... ... @@ -609,7 +645,12 @@ export default class ProductDetail extends Component {
{
skup ? <Image className="goYohoBuy" onClick={this.goOnLineProuduct.bind(this, id)} src={goOnLine} mode="aspectFill" /> : <Image className="goYohoBuy" onClick={this.goYohoBuyMinApp.bind(this)} src={goYohoBuy} mode="aspectFill" />
}
</View>
</View>)
}
{
isShowLogin && (<login-bg catchtouchmove='true' onReportStoreId={this.reportStoreId.bind(this, storeId)} onLoginSuccess={this.loginSuccess}></login-bg>)
}
</View>
)
}
}
... ...
... ... @@ -351,6 +351,7 @@ function checkVerifyCode(phoneNumb, verifyCode, areaCode, inviteCode, callbackFu
if (data.code === 200 && (data.data.uid !== null) && data.data.uid > 0 && data.data.uid !== undefined) {//验证正确
if(data.data.nFlag === 'Y') {
event.emit('report-new-user-created');
event.emit('store-new-user-created', data.data.uid);
}
let userInfo = {}
userInfo.ssouid = data.data.ssouid;
... ... @@ -458,6 +459,7 @@ function autoSignin(mobile, verifyCode, areaCode, inviteCode, callbackFunc) {
if(data.data.nFlag === 'Y') {
event.emit('report-new-user-created');
event.emit('store-new-user-created', data.data.uid);
}
let userInfo = {}
... ... @@ -565,6 +567,7 @@ function BindMiniAppByAuto(mobile, countryCode, inviteCode, callbackFunc){
if(data.data && data.data.nFlag === 'Y') {
event.emit('report-new-user-created');
event.emit('store-new-user-created', data.data.uid);
}
if (data.data.is_register !== undefined && data.data.is_register !== null && data.data.is_register === 0) {
... ...