Authored by 李奇

Merge branch 'feature/code-style' into 'master'

Feature/code style



See merge request !7
Showing 84 changed files with 1040 additions and 1938 deletions

Too many changes to show.

To preserve performance only 84 of 84+ files are displayed.

.DS_Store
.idea
.vscode
... ...
{
"wxpath": "/Applications/wechatwebdevtools.app/Contents/Resources/app.nw/bin",
"mode": "yoho"
}
\ No newline at end of file
//app.js
import promisify from './libs/promisify';
import objectAssign from './vendors/object-assign';
import {WeToast} from './vendors/toast/wetoast';
import { API_HOST, SERVICE_HOST, MINI_APP_TYPE} from './libs/config';
import {GET, POST} from './libs/request';
import {Encrypt,Decrypt} from './libs/aes.js';
let crypto = require('./libs/cryptojs/cryptojs.js').Crypto
import md5 from './vendors/md5';
var mta = require('./vendors/mta_analysis.js')
import { wechatLoginAction } from './utils/login';
import regeneratorRuntime from '/login/libs/regenerator-runtime/index.js';
import { isStringEmpty, getYHStorageSync} from './utils/util';
import { Event } from '/login/utils/index.js';
import { wxLogin } from '/login/utils/login/login.js';
import { appReport } from './libs/appReport.js';
import {GET} from './libs/request';
import {WeToast} from './vendors/toast/wetoast';
import objectAssign from './vendors/object-assign';
import {API_HOST, MINI_APP_TYPE} from './libs/config';
import mta from './vendors/mta_analysis';
import {Event} from '/login/utils/index.js';
import {wxLogin} from '/login/utils/login/login';
import {appReport} from './libs/appReport.js';
import {isStringEmpty, getYHStorageSync} from './utils/util';
import regeneratorRuntime from '/login/libs/regenerator-runtime/index';
import {
yasReport,
YB_LAUNCH_APP,
YB_ENTER_FOREGROUND,
YB_ENTER_BACKGROUND,
YB_AWAKE_MP,
YB_MY_LOGIN
} from './libs/yas';
import router from './pages/zeroSell/router/router';
const event = new Event();
global.event = event;
import { logEvent,
YB_LAUNCH_APP,
YB_EXIT_APP,
YB_ENTER_FOREGROUND,
YB_ENTER_BACKGROUND,
YB_PAGE_OPEN_L,
YB_AWAKE_MP,
YB_SERVICE_PUSH
} from './libs/analytics.js';
import router from './pages/zeroSell/router/router';
App({
async onLaunch(options) {
... ... @@ -44,8 +37,8 @@ App({
this.globalData.systemInfo = res;
this.checkUDID();
that.getSimplePise()
this.checkNetworkType()
that.getSimplePise();
this.checkNetworkType();
if (options && options.scene){
this.globalData.ch = options.scene
... ... @@ -57,49 +50,42 @@ App({
wx.checkSession({
success: function () {
//登录态未过期
that.getWechatThirdSession();
that.getUserInfo();
that.getUnionID();
that.getUser_union_type();
},
fail: function () {
//登录态过期
wx.setStorage({
key: "WXThird_session",
key: 'WXThird_session',
data: ''
});
wx.setStorage({
key: "userInfo",
key: 'userInfo',
data: {}
});
wx.setStorage({
key: "unionID",
data: ""
key: 'unionID',
data: ''
});
wx.setStorage({
key: "user_union_type",
data: ""
key: 'user_union_type',
data: ''
});
}
})
});
this.getSessionkey();
let timestamp = new Date().getTime() + ''
let timestamp = new Date().getTime() + '';
this.globalData.sid = md5(timestamp);
if (options){
let channel = options.query.channel;
let channelType = options.query.type;
let params = { 'CHANNEL': channel, 'TYPE': channelType };
logEvent(YB_LAUNCH_APP, params, this);
yasReport(YB_LAUNCH_APP, params, this);
}
setTimeout(function () {
// wechatLoginAction(function (response) {
// that.getShareInfo();
// });
}, 1000);
this.mtainit(options);
await wxLogin();
event.on('wechat-login-error', () => {
... ... @@ -115,6 +101,7 @@ App({
}
} else {
event.once('user-login-success', (userInfo) => {
yasReport(YB_MY_LOGIN, {LOGIN_TYPE: 4});
if (loginSuccess) {
loginSuccess(userInfo);
}
... ... @@ -130,8 +117,8 @@ App({
onShow(options) {
let that = this
let params = {};
logEvent(YB_ENTER_FOREGROUND, params, that)
if (that.globalData.hasReportAwakeAction==='false'){
yasReport(YB_ENTER_FOREGROUND, params, that)
if (!that.globalData.hasReportAwakeAction){
let pathParam = ""
if(options && options.query) {
for (var Key in options.query) {
... ... @@ -152,22 +139,14 @@ App({
params = {
PAGE_PATH: path
};
logEvent(YB_AWAKE_MP, params, this);
that.globalData.hasReportAwakeAction = 'true'
yasReport(YB_AWAKE_MP, params, this);
that.globalData.hasReportAwakeAction = true;
}
if (options && options.scene){
appReport('start', "LIFECYCLE", "RESUME", {
'activeWay': options.scene + ""
}, this)
if (+options.scene === 1014 && options.query.msg_id) {
let param = {
MSG_ID: options.query.msg_id
}
logEvent(YB_SERVICE_PUSH, param,that);
}
}else{
appReport('start', "LIFECYCLE", "RESUME", {}, this)
}
... ... @@ -179,7 +158,7 @@ App({
//当应用程序进入后台状态时触发
onHide () {
let params = {};
logEvent(YB_ENTER_BACKGROUND,params)
yasReport(YB_ENTER_BACKGROUND,params);
appReport('start', "LIFECYCLE", "STOP", {},this)
},
... ... @@ -331,7 +310,7 @@ App({
udid:'',
cid:'1',
mobileRegisterState:'',
hasReportAwakeAction: 'false',
hasReportAwakeAction: false,
defraudurl:'https://activity.yoho.cn/feature/45.html?title=防诈骗提醒',
miniapp_type: MINI_APP_TYPE,
union_type:'',//渠道号,大数据上传用
... ... @@ -348,7 +327,8 @@ App({
},
isLogin: function () {
return this.globalData.userInfo.uid > 0;
let uid = this.getUid();
return uid > 0;
},
getUid: function () {
... ... @@ -392,7 +372,6 @@ App({
},
fail: function (err) {
// console.log("err:",err)
}
});
},
... ... @@ -417,13 +396,9 @@ App({
}
})
.catch(error => {
// console.log(error)
});
},
/*
获取分享信息
*/
getShareInfo: function () {
// console.log('getShareInfo');
let param = {
... ... @@ -432,13 +407,11 @@ App({
let that = this;
GET(API_HOST + '/operations/api/v5/webshare/getShare', param)
.then(data => {
// console.log(data)
if (data && data.code == 200) {
that.globalData.shareInfo = data.data;
}
})
.catch(error => {
// console.log(error)
});
},
... ... @@ -449,19 +422,7 @@ App({
};
GET(API_HOST, param)
.then(json => {
// if (!json || !json.code || json.code != 200 || !json.data) return;
// if (!json.data || !json.data.sk) return;
// let p2SecretKey = json.data.sk;
// if (!p2SecretKey) return;
// that.globalData.p2SecretKey = p2SecretKey;
// wx.setStorage({
// key: "p2SecretKey",
// data: p2SecretKey
// });
})
.catch(error => {
});
},
... ... @@ -522,32 +483,13 @@ App({
},
loginCallBack: function (response) {
// console.log(response)
// if (response.code === 10001) {
// this.showRelaunchModal();
// }
},
showRelaunchModal: function () {
wx.showModal({
title: '提示',
content: '使用微信小程序需要微信授权,您已经拒绝了该请求,请删除小程序重新进入。',
showCancel: false,
success: function (res) {
if (res.confirm) {
wx.navigateBack({
delta: 1
})
}
}
})
},
getSessionkey: function () {
if (this.isLogin) {
var value = getYHStorageSync('sessionkey','app')
var value = getYHStorageSync('sessionkey','app');
if (value) {
// console.log(value)
this.globalData.sessionkey = value;
}
}
... ... @@ -570,15 +512,16 @@ App({
});
}
},
mtainit(e) {
getPvid() {
return md5(`${new Date().getTime()}${this.globalData.udid}`);
},
mtainit() {
mta.App.init({
"appID": "500570715",
"eventID": "500570797",
});
// console.log("init mta");
},
WeToast
})
});
... ...
... ... @@ -2,7 +2,6 @@
"pages": [
"pages/zeroSell/index",
"pages/zeroSell/detail",
"pages/zeroSell/myList",
"pages/zeroSell/snapshootShare",
"pages/zeroSell/h5Page",
"pages/bindPhoneNumber/bindPhoneNumber",
... ...
Component({
options: {
},
properties: {
isShow:{
type: Boolean,
value: true
},
},
data: {
},
methods: {
_backhome(e){
wx.switchTab({
url: '/pages/index/index',
})
},
},
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<block wx:if="{{isShow}}">
<view class='homeContainer'>
<image class='homeIcon' src='images/yoho@3x.png' style='mode: aspectFit;' bindtap='_backhome'></image>
</view>
</block>
\ No newline at end of file
.homeContainer {
position: fixed;
width: 90rpx;
height: 90rpx;
bottom: 140rpx;
right: 30rpx;
z-index: 1300;
}
.homeIcon {
width: 100%;
height: 100%;
}
\ No newline at end of file
// component/productListCell.js
import { shouldDiscardTap} from '../utils/util';
import {
logEvent,
YB_MAIN_EVENT
} from '../libs/analytics.js'
//获取应用实例
let app = getApp();
const screenHeight = app.globalData.systemInfo.screenHeight;
const windowWidth = app.globalData.systemInfo.windowWidth;
const windowHeight = app.globalData.systemInfo.windowHeight;
const DEVICE_WIDTH_RATIO = windowWidth / 320;
let listWidth = Math.ceil(137.5 * DEVICE_WIDTH_RATIO);
let listHeight = Math.ceil(254 * DEVICE_WIDTH_RATIO);
const IMAGE_WIDTH = 145;
const IMAGE_HEIGHT = 193;
const IMAGE_RATIO = IMAGE_HEIGHT / IMAGE_WIDTH;
let listImageTop = 31;
let listImageWidth = listWidth;
let listImageHeight = Math.ceil(listWidth * IMAGE_RATIO);
let listMarginHorizontal = (windowWidth - listWidth * 2) / 3;
let PV_ID = new Date().getTime() + '';
Component({
/**
* 组件的属性列表
*/
properties: {
item:{
type: Object
},
pageName: {
type: String,
value: ""
},
animationType: {
type: String,
value: ""
},
logEvenName: {
type: String,
value: ""
},
index: {
type: Number,
value: 0
},
fIndex: {
type: Number,
value: 0
},
fName: {
type: String,
value: ""
},
pageParam: {
type: String,
value: ""
}
},
/**
* 组件的初始数据
*/
data: {
lastTapTimeStamp: 0,
screenHeight,
windowHeight,
listWidth,
listHeight,
listImageWidth,
listImageHeight,
listImageTop,
listMarginHorizontal,
},
/**
* 组件的方法列表
*/
methods: {
productCellTapped(event) {
if (shouldDiscardTap(event.timeStamp, this.data.lastTapTimeStamp)) {
return;
}
this.setData({ lastTapTimeStamp: event.timeStamp });
let data = event.currentTarget.dataset;
let productSkn = data.productSkn;
// 以下是埋点代码,如果需要埋点请传入相应参数
if (this.properties.logEvenName && this.properties.logEvenName != "") {
let params = {
F_ID: this.properties.fIndex,
F_NAME: this.properties.fName,
F_URL: '/pages/goodsDetail/goodsDetail?productSkn=' + productSkn,
F_INDEX: this.properties.fIndex,
I_INDEX: this.properties.index + 1,
PV_ID: PV_ID,
};
logEvent(this.properties.logEvenName, params);
}
// 根据动画类型来选择动画效果
if (this.properties.animationType && this.properties.animationType == "redirectTo") {
wx.redirectTo({
url: '/pages/goodsDetail/goodsDetail?productSkn=' + productSkn + '&page_name=' + this.properties.pageName + '&page_param=' + this.properties.pageParam
})
} else {
wx.navigateTo({
url: '/pages/goodsDetail/goodsDetail?productSkn=' + productSkn + '&page_name=' + this.properties.pageName + '&page_param=' + this.properties.pageParam
});
}
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!--component/productListCell.wxml-->
<view class="product" style="width:{{listWidth}}px;margin-left:{{listMarginHorizontal}}px" bindtap="productCellTapped" data-product-skn="{{item.product_skn}}">
<image class="productImage" mode="aspectFit" src="{{item.default_images}}" style="width:{{listImageWidth}}px;height:{{listImageHeight}}px;margin-top:{{listImageTop}}px;" />
<text class="productTitle">{{item.product_name}}</text>
<view class='bottomContainerView'>
<view class="priceContainer">
<text class="price1" style="color:{{item.showOriginPrice ? '#d0021b' : '#444444'}}">{{item.salePriceStr}}</text>
<text class="price2">{{item.showOriginPrice ? item.originPriceStr : ''}}</text>
</view>
<!-- 加入购物车按钮需要上层传入是否展示 部分商品由于特殊性 在商品列表不展示购物车按钮 -->
<image wx:if="{{showAddShopCartBtn && (item.is_shop_cart_add == 'Y')}}" class='addToShopCartImage' src='images/jrgwc@2x.png' catchtap='addToShopCartAction' data-item='{{item}}'></image>
</view>
</view>
\ No newline at end of file
/* component/productListCell.wxss */
.product {
display: flex;
flex-direction: column;
background-color: white;
}
.productImage {
display: block;
}
.productTitle {
margin-top: 21rpx;
margin-bottom: 1rpx;
color: #444444;
font-family: PingFang SC;
font-size: 24rpx;
/*font-weight: bold;*/
line-height: 30rpx;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
height: 60rpx;
}
.bottomContainerView {
display: flex;
flex-direction: row;
align-items: flex-end;
/* margin-bottom: 20rpx; */
justify-content: space-between;
}
.priceContainer {
display: flex;
flex-direction: row;
width: 236rpx;
display:-webkit-box;
-webkit-line-clamp:1;
-webkit-box-orient:vertical;
overflow:hidden;
}
.price1 {
font-size: 24rpx;
color: #d0021b;
}
.price2 {
margin-left: 10rpx;
font-size: 24rpx;
color: #b0b0b0;
text-decoration: line-through;
}
.addToShopCartImage {
width: 80rpx;
height: 46rpx;
}
\ No newline at end of file
import { jumpByUrl } from '../../libs/urlRoute';
import { postFormId } from '../../libs/formIdCollectRequest.js';
import {
logEvent,
YB_MAIN_POP_UP_C,
} from '../../libs/analytics.js'
Component({
options: {
multipleSlots: true
},
properties: {
src: {
type: String,
value: ""
},
url: {
type: String,
value: ""
}
},
dada: {
isShow: false,
},
methods: {
hideDialog(){
this.setData({
isShow: false,
});
},
showDialog(){
this.setData({
isShow: true,
});
},
jumpByRule(){
let that = this;
if (that.properties.url == null){
return;
}
let params = {
TO_PATH: that.properties.url
};
logEvent(YB_MAIN_POP_UP_C, params);
jumpByUrl(that.properties.url,'home');
that.hideDialog();
},
//formId上报
formSubmit(e) {
// console.log('----formSubmit---', e);
let formId = e.detail.formId;
postFormId(formId,'1');
}
}
import { jumpByUrl } from '../../libs/urlRoute';
import { postFormId } from '../../libs/formIdCollectRequest.js';
import {
yasReport,
YB_MAIN_POP_UP_C,
} from '../../libs/yas.js'
Component({
options: {
multipleSlots: true
},
properties: {
src: {
type: String,
value: ""
},
url: {
type: String,
value: ""
}
},
data: {
isShow: false,
},
methods: {
hideDialog(){
this.setData({
isShow: false,
});
},
showDialog(){
this.setData({
isShow: true,
});
},
jumpByRule(){
let that = this;
if (that.properties.url == null){
return;
}
let params = {
TO_PATH: that.properties.url
};
yasReport(YB_MAIN_POP_UP_C, params);
jumpByUrl(that.properties.url,'home');
that.hideDialog();
},
//formId上报
formSubmit(e) {
// console.log('----formSubmit---', e);
let formId = e.detail.formId;
postFormId(formId,'1');
}
}
})
\ No newline at end of file
... ...
{
"component": true,
"usingComponents": {}
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
... ...
<view class='container' hidden="{{!isShow}}" catchtouchmove="true">
<view class='dialog-mask'>
<view class='dialog'>
<form bindsubmit='formSubmit' report-submit='true'>
<image src="{{src}}" class='dialog-image' mode='aspecdtFit' bindtap='jumpByRule'></image>
<button class='image-btn' form-type='submit' bindtap='jumpByRule'></button>
</form>
<form bindsubmit='formSubmit' report-submit='true'>
<view class='dialog-close' bindtap='hideDialog'>
<image class='close' src="./images/close.png" ></image>
<button class='dialog-btn' form-type='submit'></button>
</view>
</form>
</view>
</view>
<view class='container' hidden="{{!isShow}}" catchtouchmove="true">
<view class='dialog-mask'>
<view class='dialog'>
<form bindsubmit='formSubmit' report-submit='true'>
<image src="{{src}}" class='dialog-image' mode='aspecdtFit' bindtap='jumpByRule'></image>
<button class='image-btn' form-type='submit' bindtap='jumpByRule'></button>
</form>
<form bindsubmit='formSubmit' report-submit='true'>
<view class='dialog-close' bindtap='hideDialog'>
<image class='close' src="./images/close.png" ></image>
<button class='dialog-btn' form-type='submit'></button>
</view>
</form>
</view>
</view>
</view>
\ No newline at end of file
... ...
.dialog-mask{
position: fixed;
z-index: 4999;
width: 100%;
height: 100%;
top: 0;
right: 0;
left: 0;
bottom: 0;
display: flex;
flex-direction: column;
align-items: center;
background: rgba(0, 0, 0, 0.6);
}
.dialog{
position: fixed;
z-index: 5000;
top: 110rpx;
display: flex;
flex-direction: column;
align-items: center;
height: wrap;
width: 100%;
}
.dialog-image{
height: 680rpx;
width: 680rpx;
display: flex;
flex-direction: column;
align-items: center;
}
.dialog-close{
height: 110rpx;
width: 100rpx;
margin-top: 30rpx;
display: flex;
align-items: center;
justify-content: center;
}
.close {
width: 80rpx;
height: 80rpx;
}
.dialog-btn {
height: 110rpx;
width: 100rpx;
background-color: red;
position: absolute;
opacity: 0;
}
.image-btn {
height: 680rpx;
width: 680rpx;
background-color: red;
position: absolute;
top: 0rpx;
opacity: 0;
}
.dialog-mask{
position: fixed;
z-index: 4999;
width: 100%;
height: 100%;
top: 0;
right: 0;
left: 0;
bottom: 0;
display: flex;
flex-direction: column;
align-items: center;
background: rgba(0, 0, 0, 0.6);
}
.dialog{
position: fixed;
z-index: 5000;
top: 110rpx;
display: flex;
flex-direction: column;
align-items: center;
height: wrap;
width: 100%;
}
.dialog-image{
height: 680rpx;
width: 680rpx;
display: flex;
flex-direction: column;
align-items: center;
}
.dialog-close{
height: 110rpx;
width: 100rpx;
margin-top: 30rpx;
display: flex;
align-items: center;
justify-content: center;
}
.close {
width: 80rpx;
height: 80rpx;
}
.dialog-btn {
height: 110rpx;
width: 100rpx;
background-color: red;
position: absolute;
opacity: 0;
}
.image-btn {
height: 680rpx;
width: 680rpx;
background-color: red;
position: absolute;
top: 0rpx;
opacity: 0;
}
... ...
/* eslint-disable */
export default {
"domains": {
"api": "https://api.yoho.cn",
// "api": 'http://api-test2.dev.yohocorp.com',
"service": "https://api.yoho.cn",
"yas": "https://analysis.yohobuy.com/yas_mobile",
"report": "https://app.yoho.cn/collect/v3"
},
"appid": "wx7678b61d1e6702fe",
"payment_code": "45",
"private_key": "b43890b0a296ff3c7b8c260ca763980b",
"jump": {
"brand": "go.brand",
"detail": "go.detail",
"productpool": "go.poollist"
},
"mini_app_type": "29",
"client_type": "miniapp",
"business_line": "minappLuck",
"os_version": "yohobuy:h5",
"app_version": "2.8.3",
"app_build": "1032",
"mini_qr_type": 16
}
\ No newline at end of file
'use strict'
import {LOG_EVENT_HOST, API_HOST, SERVICE_HOST } from '../libs/config';
import { UPLOAD_LOG} from '../libs/request';
import { getYHStorageSync } from '../utils/util';
const YB_ENTER_FOREGROUND = 'YB_ENTER_FOREGROUND'; //程序切换置前台
const YB_ENTER_BACKGROUND = 'YB_ENTER_BACKGROUND'; //系统-程序切换置后台
const YB_LAUNCH_APP = 'YB_LAUNCH_APP'; //系统-启动小程序
const YB_EXIT_APP = 'YB_EXIT_APP'; //系统-退出小程序
const YB_PAGE_OPEN_L = 'YB_PAGE_OPEN_L'; //页面加载/刷新/返回时
const YB_MAIN_TAB_C = 'YB_MAIN_TAB_C'; //点击页面底部的功能按钮时,点击时才上报,默认载入时不上报;
const YB_CATEGORY_FL = 'YB_CATEGORY_FLR_C';//品类页楼层
const YB_MAIN_EVENT = 'YB_MAIN_EVENT'; //首页-楼层事件点击
const YB_MY_LOGIN = 'YB_MY_LOGIN'; //当用户使用该登录方式登录成功时
const YB_GDS_DT_BILL = 'YB_GDS_DT_BILL'; //点击商品详情页底部的立即购买按钮,选择完颜色/尺寸后上报
const YB_SC_ORD = 'YB_SC_ORD'; //生成订单
const YB_SC_PAY_RES = 'YB_SC_PAY_RES'; //购物车-付款结果
const YB_GDS_ADD_TO_CART_C = 'YB_GDS_ADD_TO_CART_C'; //商品详情页-加入购物车
const YB_REGISTER_SUCCESS = 'YB_REGISTER_SUCCESS'; //注册成功
const YB_INVITE_C = 'YB_INVITE_C'; //邀请好友
const YB_INVITE_PICTURE_C = 'YB_INVITE_PICTURE_C'; //点击邀请好友参团“生成图片发朋友圈”
const YB_INVITE_PICTURE_SAVE_C = 'YB_INVITE_PICTURE_SAVE_C'; //点击“保存图片分享到朋友圈”
const YB_SHARE_PICTURE_RESULT_L = 'YB_SHARE_PICTURE_RESULT_L'; //选择生成图片发朋友圈成功时
const YB_INVITE_FRIEND_C = 'YB_INVITE_FRIEND_C'; //邀请好友参团“分享给微信好友”
const YB_ASSIST_C = 'YB_ASSIST_C';//点击红包助力页面中的助力按钮时
const YB_ASSIST_LAUNCH_C = 'YB_ASSIST_LAUNCH_C';//点击红包助力页面中的发起成功时
const YB_SHARE_RESULT_L = 'YB_SHARE_RESULT_L'; //分享
const YB_AWAKE_MP = 'YB_AWAKE_MP'; //渠道落地页
const YB_MY_GRP_BUY_INV_C = 'YB_MY_GRP_BUY_INV_C'; //订单列表点击“拼团详情”
const YB_MY_GRP_BUY ='YB_MY_GRP_BUY'; //个人中心中我的拼团
const YB_SERVICE_PUSH = 'YB_SERVICE_PUSH'; //推送服务
const YB_GRP_BUY_OPEN_C = 'YB_GRP_BUY_OPEN_C'; //去开团
const YB_GRP_BUY_REOPEN_C = 'YB_GRP_BUY_REOPEN_C'; //重新开团
const YB_GRP_BUY_DT_TOG_C = 'YB_GRP_BUY_DT_TOG_C'; //立即购买
const YB_GRP_BUY_DT_SEP_C = 'YB_GRP_BUY_DT_SEP_C'; //单独购买
const YB_COLLECTION_C = 'YB_COLLECTION_C';//点击商品详情页中的收藏按钮时
const YB_MY_FAV = 'YB_MY_FAV';//点击我的页面中的"商品收藏"时
const YB_GDS_BRAND_SHOP_C = 'YB_GDS_BRAND_SHOP_C';//商品详情点击店铺
const YB_BRAND_TAB_C = 'YB_BRAND_TAB_C';//点击品牌分类页的TAB时
const YB_BRAND_FLR_C = 'YB_BRAND_FLR_C';//点击品牌分类页各楼层时
const YB_SEARCH_C = 'YB_SEARCH_C';//点击搜索框时
const YB_SCAN_CODE_SUCCESS = 'YB_SCAN_CODE_SUCCESS';//扫描成功时
const YB_SCAN_CODE_C = 'YB_SCAN_CODE_C';//首页点击扫一扫图标
const YB_MAIN_STROLL_TAB_C = 'YB_MAIN_STROLL_TAB_C';//点击逛楼层tab时
const YB_TO_OPEN_APP_C = 'YB_TO_OPEN_APP_C';//商品详情页&店铺页
const YB_OPEN_APP_RESULT_L = 'YB_OPEN_APP_RESULT_L';//唤起app结果
const YB_SHARE_PROMOTION_C = 'YB_SHARE_PROMOTION_C';//点击创建推广页“分享链接/生成图片/复制口令”时
const YB_MAIN_POP_UP_C = 'YB_MAIN_POP_UP_C';//点击首页弹框
const YB_GROUP_BUY_BANNER_C = 'YB_GROUP_BUY_BANNER_C';//拼团购列表页banner位
let logEvent = function(eventId, data,appData) {
let app = appData ? appData : getApp();
let ln;//语言
let os;//系统类型
let dm;//设备型号
let re;//屏幕大小
let osv;//系统版本
let ak = 'yohobuy_mp';//
let net = '0';
let ts = new Date().getTime() + '';
//用户id
let uid = app && app.globalData && app.globalData.userInfo && app.globalData.userInfo.uid ? app.globalData.userInfo.uid : '';
//设备id
let udid = app && app.globalData && app.globalData.udid ? app.globalData.udid : '';
//会话id
let sid = app && app.globalData && app.globalData.sid ? app.globalData.sid : '';
let cid = app && app.globalData && app.globalData.cid ? app.globalData.cid : '';
let open_id = app && app.globalData && app.globalData.openID ? app.globalData.openID : getYHStorageSync('openID','analytics');
let union_id = app && app.globalData && app.globalData.WXUnion_ID ? app.globalData.WXUnion_ID : getYHStorageSync('unionID','analytics');
let ch = app && app.globalData && app.globalData.ch ? app.globalData.ch : '';
wx.getSystemInfo({
success: function (res) {
//返回设备信息
dm = res.model;
ln = res.language;
os = res.platform;
osv = res.system;
re = res.screenWidth+'*'+res.screenHeight;
},
complete: function () {
wx.getNetworkType({
success: function (res) {
// 返回网络类型, 有效值:
// wifi/2g/3g/4g/unknown(Android下不常见的网络类型)/none(无网络)
var networkType = res.networkType
if (networkType === 'wifi') {
net = '1';
} else if (networkType === '2g') {
net = '2';
} else if (networkType === '3g') {
net = '3';
} else if (networkType === '4g') {
net = '4';
} else {
net = '0';
}
},
complete: function () {
let union_type = app.getUnion_type();
let statusParam = { 'net': net, 'ln': ln };
let deviceParam = { 'res': re, 'osv': osv, 'os': os, 'ak': ak, 'dm': dm, 'udid': udid, 'ch': union_type != '' ? union_type+"" : ch+""};
let userParam = data;
userParam.C_ID = cid;
userParam.UNION_ID = union_id;
let eventParam = [{ 'param': userParam, 'ts': ts, 'op': eventId, 'uid': uid, 'sid': sid}]
let parameters = { 'status': statusParam, 'device': deviceParam, 'events': eventParam }
// console.log(parameters)
UPLOAD_LOG(LOG_EVENT_HOST, parameters)
.then(function (data) {
// console.log(data)
})
.catch(function (error) {
// console.log(error)
});
}
})
}
})
}
module.exports = {
logEvent,
YB_ENTER_FOREGROUND,
YB_ENTER_BACKGROUND,
YB_LAUNCH_APP,
YB_EXIT_APP,
YB_PAGE_OPEN_L,
YB_MAIN_TAB_C,
YB_MAIN_EVENT,
YB_MY_LOGIN,
YB_GDS_DT_BILL,
YB_SC_ORD,
YB_SC_PAY_RES,
YB_GDS_ADD_TO_CART_C,
YB_CATEGORY_FL,
YB_REGISTER_SUCCESS,
YB_INVITE_C,
YB_INVITE_PICTURE_C,
YB_INVITE_PICTURE_SAVE_C,
YB_SHARE_PICTURE_RESULT_L,
YB_INVITE_FRIEND_C,
YB_ASSIST_C,
YB_ASSIST_LAUNCH_C,
YB_SHARE_RESULT_L,
YB_AWAKE_MP,
YB_MY_GRP_BUY_INV_C,
YB_MY_GRP_BUY,
YB_SERVICE_PUSH,
YB_GRP_BUY_OPEN_C,
YB_GRP_BUY_REOPEN_C,
YB_GRP_BUY_DT_TOG_C,
YB_GRP_BUY_DT_SEP_C,
YB_COLLECTION_C,
YB_MY_FAV,
YB_BRAND_TAB_C,
YB_BRAND_FLR_C,
YB_SEARCH_C,
YB_SCAN_CODE_SUCCESS,
YB_GDS_BRAND_SHOP_C,
YB_SCAN_CODE_C,
YB_MAIN_STROLL_TAB_C,
YB_TO_OPEN_APP_C,
YB_OPEN_APP_RESULT_L,
YB_SHARE_PROMOTION_C,
YB_MAIN_POP_UP_C,
YB_GROUP_BUY_BANNER_C
}
\ No newline at end of file
... ... @@ -4,7 +4,7 @@ import { APP_REPORT } from '../libs/request';
import md5 from '../vendors/md5';
let getDeviceInfo = function (app) {
let ak = 'yohobuy_mp';//
let ak = 'yoholuck_mp';//
let systemInfo = app.globalData.systemInfo
let device = {}
... ...
// 线上环境
export const API_HOST = 'https://api.yoho.cn';
export const SERVICE_HOST = 'https://api.yoho.cn';
export const APP_REPORT_HOST = 'https://app.yoho.cn/collect/v3';
export const LOG_EVENT_HOST = 'https://analysis.yohobuy.com/yas_mobile';
export const ACTIVITY_HOST = 'https://action.yoho.cn';
// export const ACTIVITY_HOST = 'http://192.168.102.49:6006';
// export const ACTIVITY_HOST = 'http://172.16.10.53:6006'
// 测试环境
// export const API_HOST = 'http://api-test3.dev.yohocorp.com';
// export const SERVICE_HOST = 'http://api-test3.dev.yohocorp.com';
// export const ACTIVITY_HOST = 'http://yoho-activity-platform.test3.ingress.dev.yohocorp.com';
export const ACTIVITY_HOST = 'https://action.yoho.cn';
// export const ACTIVITY_HOST = 'http://192.168.102.49:6006';
// export const API_HOST = 'http://dev-api.yohops.com:9999';
// export const SERVICE_HOST = 'http://dev-api.yohops.com:9999/';
... ... @@ -14,8 +15,6 @@ export const ACTIVITY_HOST = 'https://action.yoho.cn';
// export const API_HOST = 'http://api-test1.yohops.com:9999';
// export const SERVICE_HOST = 'http://api-test1.yohops.com:9999/';
// export const API_HOST = 'http://api-test3.dev.yohocorp.com';
// export const SERVICE_HOST = 'http://api-test3.dev.yohocorp.com';
// export const API_HOST = 'http://api-test2.dev.yohocorp.com';
// export const SERVICE_HOST = 'http://api-test2.dev.yohocorp.com';
... ... @@ -24,9 +23,11 @@ export const ACTIVITY_HOST = 'https://action.yoho.cn';
// export const API_HOST = 'https://apigray.yoho.cn';
// export const SERVICE_HOST = 'https://apigray.yoho.cn';
export const APP_REPORT_HOST = 'https://app.yoho.cn/collect/v3';
export const LOG_EVENT_HOST = 'https://analysis.yohobuy.com/yas_mobile';
export const MINI_APP_TYPE = 29;
export const MINI_QR_TYPE = 16;
export const PAYMENT_CODE = '45';
export const OS_VERSION = 'yohobuy:h5';
... ... @@ -35,8 +36,3 @@ export const APP_BUILD = '1041';
export const PRIVATE_KEY = 'b43890b0a296ff3c7b8c260ca763980b';
export const CLIENT_TYPE = 'miniapp';
export const JUMP_BRAND = 'go.brand';
export const JUMP_DETAIL = 'go.detail';
export const JUMP_PRODUCTPOOL = 'go.poollist';
... ...
... ... @@ -52,7 +52,7 @@ function getPrivateKey(){
fail: function (err) {
let code = err.code ? err.code : 800;
let message = err.message ? err.message : '';
let isPrivatekeyError = true
let isPrivatekeyError = true
reject({ code, message, isPrivatekeyError});
// console.log("err:",err)
}
... ... @@ -132,13 +132,27 @@ function request(method = 'GET') {
} else {
let code = statusCode;
let message = res.errMsg ? res.errMsg : '';
if(statusCode === 503) {
wx.showToast({
title: '目前参与人数过多请下拉刷新',
icon: 'none',
duration: 2000
});
}
reject({ code, message });
}
},
fail: function (err) {
let code = err.code ? err.code : 800;
let message = err.message ? err.message : '';
reject({ code, message });
if(code === 503) {
wx.showToast({
title: '目前参与人数过多请下拉刷新',
icon: 'none',
duration: 2000
});
}
reject({code, message});
}
});
})
... ... @@ -209,12 +223,26 @@ function request(method = 'GET') {
} else {
let code = statusCode;
let message = res.errMsg ? res.errMsg : '';
if(statusCode === 503) {
wx.showToast({
title: '目前参与人数过多请下拉刷新',
icon: 'none',
duration: 2000
});
}
reject({ code, message });
}
},
fail: function (err) {
let code = err.code ? err.code : 800;
let message = err.message ? err.message : '';
if(code === 503){
wx.showToast({
title: '目前参与人数过多请下拉刷新',
icon: 'none',
duration: 2000
});
}
reject({ code, message });
}
});
... ...
import {LOG_EVENT_HOST} from '../libs/config';
import {UPLOAD_LOG} from '../libs/request';
import {getYHStorageSync} from '../utils/util';
import path2Name from '../router/path-to-name';
import {stringify} from '../vendors/query-string'
const YB_ENTER_FOREGROUND = 'YB_ENTER_FOREGROUND'; // 系统-程序切换置前台
const YB_ENTER_BACKGROUND = 'YB_ENTER_BACKGROUND'; // 系统-程序切换置后台
const YB_LAUNCH_APP = 'YB_LAUNCH_APP'; // 系统-启动小程序
const YB_AWAKE_MP = 'YB_AWAKE_MP'; // 唤起事件,每次启动时,上报原始的页面路径,以对推广渠道数据进行监测
const YB_MAIN_TAB_C = 'YB_MAIN_TAB_C'; // 点击页面的tab时,点击时才上报,默认载入时不上报
const YB_PAGE_OPEN_L = 'YB_PAGE_OPEN_L'; // 小程序(所有)页面加载时
const YB_MY_LOGIN = 'YB_MY_LOGIN'; // 当用户使用该登录方式登录成功时
const YB_REGISTER_SUCCESS = 'YB_REGISTER_SUCCESS'; // 用户注册成功
const YB_LUCK_DT_GDS_C = 'YB_LUCK_DT_GDS_C'; // 点击抽奖详情页底部的商品时
const YB_LUCK_DT_JOIN_C = 'YB_LUCK_DT_JOIN_C'; // 点击抽奖详情页底部的"0元参加抽奖"成功时
const pageOpen = data => {
const _pageName = function(options, path) {
let hasConf = path2Name[path];
// 多入口页面依据参数设定上报页面名称
if (hasConf && hasConf.multiEntry) {
let pathName = '';
Object.keys((hasConf.multiName || {})).forEach(key => {
if (options[key]) {
pathName = hasConf.multiName[key];
return false;
}
});
return pathName;
}
return hasConf ? hasConf.pathName : '';
};
const _pageParam = function(options = {}, fromPath) {
if (!options) return '';
let hasConf = path2Name[fromPath];
if (hasConf && hasConf.multiEntry) {
let param = '';
Object.keys((hasConf.multiName || {})).forEach(key => {
if (options[key]) {
param = options[key] || '';
return false;
}
});
return param;
}
if (path2Name[fromPath] && path2Name[fromPath].paramKey) {
return `${decodeURIComponent(options[path2Name[fromPath].paramKey])}` || '';
}
return stringify(options, '');
};
let pages = getCurrentPages();
let currentPage = pages[pages.length - 1];
let path = `${currentPage.route}`,
options = currentPage.options || {}; // 拷贝options对象,用于获取当前页面参数
// from page relevant
let fromPage, fromPath, fromOptions;
if (pages.length > 1) {
fromPage = pages[pages.length - 2];
fromPath = `${fromPage.route}`;
fromOptions = fromPage.options || {};
}
return Object.assign(data, {
PAGE_PATH: path,
PAGE_PARAM: _pageParam(options, path),
PAGE_NAME: _pageName(options, path),
FROM_PAGE_NAME: _pageName(options, fromPath),
FROM_PAGE_PARAM: options.fromPageParam || _pageParam(fromOptions, fromPath)
});
};
const yasReport = function (eventId, data = {}, app) {
if (eventId === YB_PAGE_OPEN_L) {
data = pageOpen(data);
}
app = app || getApp();
let ln; // 语言
let os; // 系统类型
let dm; // 设备型号
let re; // 屏幕大小
let osv;//系统版本
let ak = 'yoholuck_mp';//
let net = '0';
let ts = new Date().getTime() + '';
let uid = app && app.globalData && app.globalData.userInfo && app.globalData.userInfo.uid ? app.globalData.userInfo.uid : (getYHStorageSync('openID', 'analytics') || '');
let udid = app && app.globalData && app.globalData.udid ? app.globalData.udid : '';
let sid = app && app.globalData && app.globalData.sid ? app.globalData.sid : '';
let cid = app && app.globalData && app.globalData.cid ? app.globalData.cid : '';
let open_id = app && app.globalData && app.globalData.openID ? app.globalData.openID : getYHStorageSync('openID', 'analytics');
let union_id = app && app.globalData && app.globalData.WXUnion_ID ? app.globalData.WXUnion_ID : getYHStorageSync('union_id', 'analytics');
let ch = app && app.globalData && app.globalData.ch ? app.globalData.ch : '';
wx.getSystemInfo({
success: function (res) {
//返回设备信息
dm = res.model;
ln = res.language;
os = res.platform;
osv = res.system;
re = res.screenWidth + '*' + res.screenHeight;
},
complete: function () {
wx.getNetworkType({
success: function (res) {
var networkType = res.networkType
if (networkType === 'wifi') {
net = '1';
} else if (networkType === '2g') {
net = '2';
} else if (networkType === '3g') {
net = '3';
} else if (networkType === '4g') {
net = '4';
} else {
net = '0';
}
},
complete: function () {
let union_type = app.getUnion_type();
let statusParam = {'net': net, 'ln': ln};
let deviceParam = {
'res': re,
'osv': osv,
'os': os,
'ak': ak,
'dm': dm,
'udid': udid,
'ch': union_type !== '' ? union_type + "" : ch + ""
};
let userParam = data;
userParam.C_ID = cid;
userParam.UNION_ID = union_id;
userParam.PV_ID = app.getPvid();
let eventParam = [{'param': userParam, 'ts': ts, 'op': eventId, 'uid': uid, 'sid': sid}]
let parameters = {'status': statusParam, 'device': deviceParam, 'events': eventParam}
UPLOAD_LOG(LOG_EVENT_HOST, parameters)
.then(function (data) {
})
.catch(function (error) {
});
}
})
}
})
};
export {
yasReport,
YB_ENTER_FOREGROUND,
YB_ENTER_BACKGROUND,
YB_LAUNCH_APP,
YB_PAGE_OPEN_L,
YB_MAIN_TAB_C,
YB_MY_LOGIN,
YB_REGISTER_SUCCESS,
YB_AWAKE_MP,
YB_LUCK_DT_GDS_C,
YB_LUCK_DT_JOIN_C
};
\ No newline at end of file
... ...
// pages/login-page/login-page.js
import regeneratorRuntime from '../libs/regenerator-runtime/index.js';
import { getSettingPromise } from '../utils/index.js'
import {
yasReport,
YB_PAGE_OPEN_L
} from '../../libs/yas';
const event = global.event;
Page({
/**
* 页面的初始数据
*/
data: {
openType: 'getUserInfo'
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
onLoad: function () {
this.checkUnionId();
event.on('wechat-login-success', this.loginSuccess);
event.on('wechat-login-callback', this.loginCallback);
event.on('wechat-login-change-status', this.loginChangeStatus);
event.on('wechat-login-error', this.loginError);
yasReport(YB_PAGE_OPEN_L);
},
async checkUnionId() {
... ... @@ -57,7 +55,6 @@ Page({
},
loginSuccess(params) {
console.log(params);
this.goReferer();
},
... ...
// component/login/login.js
import { getUserInfo, getPhoneNumber, checkUnionIdIsBind } from '../utils/login/login.js';
Component({
/**
... ...
... ... @@ -58,6 +58,23 @@ export default class EventEmitter {
return true;
}
one(type, listener) {
let events;
if (typeof listener !== 'function')
throw new Error('"listener" argument must be a function');
events = this._events;
console.log(events);
if (typeof events === 'undefined') {
events = this._events = Object.create(null);
this._eventsCount = 0;
}
events[type] = listener;
++this._eventsCount;
return this;
}
_addListener(type, listener, prepend) {
let events;
let existing;
... ...
... ... @@ -6,10 +6,12 @@ const login = new LoginService();
const loginPromise = toPromiseWX('login');
const saveLoginData = (loginData) => {
const app = getApp();
setStorageValueForKey('open_id', loginData.openid);
setStorageValueForKey('srd_session', loginData.srd_session);
if (loginData && loginData.unionid) {
setStorageValueForKey('union_id', loginData.unionid);
app && app.setWXUnionID(loginData.unionid);
}
}
... ... @@ -60,7 +62,6 @@ export const getPhoneNumber = async (e) => {
throw new Error('手机号获取失败,请使用手机号登录');
}
const bindResult = await login.bindMiniAppByAuto(union_id, phoneNumber, countryCode);
console.log(bindResult);
if (bindResult && bindResult.is_register === 0) {
const newUserInfo = {
is_bind: bindResult.is_bind,
... ...
... ... @@ -5,12 +5,12 @@
*
*/
import { GET } from '../../../libs/request';
import config from '../../../config.js';
import {API_HOST} from '../../../libs/config.js';
import regeneratorRuntime from '../../libs/regenerator-runtime/index.js';
export default class BaseService {
constructor() {
this.url = config.domains.service;
this.url = API_HOST;
}
async GET(params, options) {
... ...
import BaseService from './base-service.js';
import config from '../../../config.js';
import {MINI_APP_TYPE} from '../../../libs/config.js';
import regeneratorRuntime from '../../libs/regenerator-runtime/index.js';
const WECHAT_SMALLPROGRAM_ONLOGIN = 'wechat.smallProgram.onLogin';
... ... @@ -16,7 +16,7 @@ export default class LoginService extends BaseService {
return await this.GET({
method: WECHAT_SMALLPROGRAM_ONLOGIN,
jsCode: code,
miniapp_type: config.mini_app_type
miniapp_type: MINI_APP_TYPE
}, {
path: WechatPath
})
... ...
// pages/choosecountry/choosecountry.js
'use strict';
import { API_HOST, SERVICE_HOST } from '../../libs/config';
import { GET, POST } from '../../libs/request';
import { API_HOST } from '../../libs/config';
import { GET } from '../../libs/request';
import { getVerifyKey, bindAction, decodePhoneNumber, getUnionID, decodeUnionId, openAuthorizeSettings} from '../../utils/login';
import {
yasReport,
YB_PAGE_OPEN_L
} from '../../libs/yas';
let CHOOSED_COUNTRY_ID = 'CHOOSED_COUNTRY_ID'
let CHOOSED_COUNTRY_NAME = 'CHOOSED_COUNTRY_NAME'
... ... @@ -58,6 +60,7 @@ Page(extend({},Toast,{
new app.WeToast();
this.fetchImageCheck_SwitchOn();
yasReport(YB_PAGE_OPEN_L);
},
onShow: function () {
... ... @@ -107,23 +110,11 @@ Page(extend({},Toast,{
});
},
// calcPosition: function (i, dataVal) {
// let positionX, positionY;
// let index = i;
// let count = parseInt(dataVal, 10) + 1;
// let unit = 'px';
// positionX = -index * 80 + unit;
// positionY = -count * 80 + unit;
// return [positionX, positionY].join(' ');
// },
didSelectImage: function (e) {
let index = e.currentTarget.dataset.itemindex;
let graphicsCodeElement = this.data.graphicsCodeElement;
let elem = graphicsCodeElement[index];
let dataVal = (parseInt(elem.dataVal)) % 4 + 1;
// let position = this.calcPosition(index, elem.dataVal);
// elem.position = position;
elem.dataVal = dataVal;
this.setData({graphicsCodeElement});
},
... ... @@ -392,7 +383,6 @@ verifyBtnAction:function(){
bindBtnAction:function (needBind, callBackFun) {
let that = this
// console.log('phoneNumber,verifyCode', that.data.phoneNum, that.data.verifyCode)
if (!that.data.phoneNum) {
that.wetoast.toast({
title: '请输入有效手机号',
... ... @@ -413,7 +403,6 @@ bindBtnAction:function (needBind, callBackFun) {
}
bindAction(that.data.phoneNum, that.data.verifyCode, that.data.country_area, that.data.inviteCode, function (result) {
// console.log("result:",result)
if (result.message)
that.wetoast.toast({
title: result.message,
... ... @@ -422,7 +411,6 @@ bindBtnAction:function (needBind, callBackFun) {
});
if (result.succeed) {
//新人toast提示
if (result.is_register) {
that.showZanToast({ title:'欢迎加入Yoho!Family!新人礼包已发放到个人中心-优惠券,请注意查收',success: function(){
that.redirectAction();
... ... @@ -430,7 +418,7 @@ bindBtnAction:function (needBind, callBackFun) {
} else {
that.redirectAction();
}
event.emit('wechat-login-success');
event.emit('user-login-success', result);
}
})
},
... ... @@ -448,13 +436,6 @@ redirectAction: function() {
url: '../webview/webview?url=' + that.data.h5back
})
} else {
// let prePage = getCurrentPages();
// that.newCustomerStorage();
// if (prePage.length > 1 && prePage[prePage.length - 2].bindPhoneNumComplete != undefined) {
// prePage[prePage.length - 2].bindPhoneNumComplete();
// }
// console.log("currentPage:", getCurrentPages())
wx.navigateBack({
delta: 2,
})
... ...
// pages/choosecountry/choosecountry.js
import { API_HOST, SERVICE_HOST } from '../../libs/config';
import { GET, POST } from '../../libs/request';
import { getYHStorageSync } from '../../utils/util';
import {
yasReport,
YB_PAGE_OPEN_L
} from '../../libs/yas';
let CACH_KEY = 'country_cach';
let CHOOSED_COUNTRY_ID = 'CHOOSED_COUNTRY_ID'
... ... @@ -73,6 +76,7 @@ Page({
*/
onLoad: function (options) {
this.getArea();
yasReport(YB_PAGE_OPEN_L);
},
/**
... ...
// components/Dialog/dialog.js
import {
logEvent,
YB_TO_OPEN_APP_C,
YB_OPEN_APP_RESULT_L
} from '../../libs/analytics.js'
import { API_HOST, SERVICE_HOST } from '../../libs/config';
import { GET, POST } from '../../libs/request';
import { postFormId } from '../../libs/formIdCollectRequest';
... ... @@ -78,7 +70,6 @@ Component({
methods: {
//上报formid
formSubmit: function (e) {
// console.log('####formID:', e.detail.formId)
let formId = e.detail.formId;
postFormId(formId)
},
... ... @@ -196,20 +187,9 @@ Component({
let params = {
PAGE_PATH: url,
};
logEvent(YB_TO_OPEN_APP_C, params);
},
launchAppError: function (e) {
var pages = getCurrentPages()
var currentPage = pages[pages.length - 1]
var url = currentPage.route
let params = {
PAGE_PATH: url,
OPEN_RESULT: 2
};
logEvent(YB_OPEN_APP_RESULT_L, params);
wx.showToast({
title: '打开失败!您可能未安装Yoho!Buy官方APP,请下载后再尝试。',
icon: 'none',
... ...
... ... @@ -28,6 +28,18 @@ Component({
actPrizeId: {
type: Number,
value: 0
},
copyText: {
type: String,
value: ''
},
text: {
type: String,
value: ''
},
type:{
type: Number,
value:0
}
},
... ... @@ -54,7 +66,10 @@ Component({
wx.showLoading({
mask: true
});
event.emit('user-is-login', {logged: this.logged.bind(this), loginSuccess: function(){}});
event.emit('user-is-login', {
logged: this.logged.bind(this), loginSuccess: function () {
}
});
},
logged(userInfo) {
this.service.fetchCode({
... ... @@ -70,7 +85,7 @@ Component({
show: true,
code: result.data.prizeCode
});
this.triggerEvent('gaincodesuccess', this.properties.actPrizeId);
} else {
this.setData({
error: true,
... ... @@ -102,11 +117,16 @@ Component({
},
cancelFellow(){
this.setData({
fellow: false
})
},
cancelAlert() {
this.setData({
show: false,
error: false,
fellow: false
error: false
});
this.triggerEvent('getcode');
... ... @@ -124,11 +144,10 @@ Component({
error: false,
fellow: false
});
console.log('隐藏');
this.triggerEvent('getcode');
},
submitFormId(e) {
console.log(e.detail);
return this.commonService.addWechatFormId({
formId: e.detail.formId,
uid: app.getUid() || 0,
... ...
... ... @@ -16,10 +16,6 @@
</block>
<block wx:elif="{{status === 3}}">
<!-- <view class="action-item confirm" bindtap="goMyList">
我的抽奖码({{num}})
</view> -->
<view class="action-item ok" bindtap="goShare">
分享得更多抽奖码,增加中奖率
</view>
... ... @@ -81,4 +77,4 @@
</view>
</zero-alert>
<fellow-alert show="{{fellow}}" bindok="cancelAlert"></fellow-alert>
\ No newline at end of file
<fellow-alert show="{{fellow}}" bindok="cancelFellow" copyText="{{copyText}}" type="{{type}}" text="{{text}}"></fellow-alert>
\ No newline at end of file
... ...
<swiper wx:if="{{list.length !== 0}}" indicator-dots="{{indicatorDots}}"
autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" vertical="{{true}}" class="swiper" circular="{{true}}">
<block wx:for="{{list}}">
<block wx:for="{{list}}" wx:key="{{index}}">
<swiper-item>
<view class="avatar-item">
<image src="{{item.user_thumb || 'http://img12.static.yhbimg.com/sns/2018/08/02/15/0237a5305f921865764e8409fcffbd3299.png'}}" class="avatar-image"/>
... ...
... ... @@ -8,7 +8,7 @@
<view class="banner" bindtap="jumpUrl" wx:if="{{bannerSrc != null && bannerSrc !== ''}}">
<image class="banner-img" src="{{bannerSrc}}" mode="widthFix"></image>
</view>
<block wx:for="{{list}}">
<block wx:for="{{list}}" wx:key="{{index}}">
<block wx:if="{{item.floor_type === 1}}">
<view >{{item.content}}</view>
</block>
... ...
... ... @@ -8,6 +8,27 @@ Component({
type: Boolean,
value: false,
observer: '_propertyChange'
},
text: {
type: String,
value: "",
observer: function (value) {
this.setData({_text: value })
}
},
copyText: {
type: String,
value: '',
observer: function (value) {
this.setData({_copyText: value })
}
},
type: {
type: Number,
value: 0,
observer: function (value) {
this.setData({_type: value })
}
}
},
... ... @@ -15,6 +36,9 @@ Component({
* 组件的初始数据
*/
data: {
_type: "",
_copyText: '',
_text: '',
_show: false
},
... ... @@ -23,6 +47,17 @@ Component({
*/
methods: {
onConfirm() {
if (this.data._copyText) {
wx.setClipboardData({
data: this.data._copyText,
success() {
},
fail() {
},
complete() {
}
})
}
this.triggerEvent('ok')
},
... ...
<zero-alert wx:if="{{_show}}">
<view class="content">
<view class="content" wx:if="{{_type !== 1}}">
<view>微信搜索公众号</view>
<view><text style="font-weight: bolder;">“潮流有货”</text>并关注,发送</view>
<view>关键词<text style="font-weight: bolder;">“开奖”</text>查询中奖信息</view>
</view>
<view wx:else class="text">{{_text}}</view>
<view class="foot" bindtap="onConfirm">确定</view>
</zero-alert>
... ...
... ... @@ -21,4 +21,12 @@
font-weight: bolder;
text-align: center;
border-top: 1rpx solid #E0E0E0;
}
.text {
font-size: 28rpx;
display:flex;
align-items:center;/*垂直居中*/
justify-content: center;/*水平居中*/
height: 290rpx;
margin: 0 75rpx;
}
\ No newline at end of file
... ...
// page/subPackage/pages/zeroSell/components/fellow-bar.js
const router = global.router;
Component({
/**
* 组件的属性列表
*/
properties: {
notice: {
type: Object,
value: {
"miniappCopy": "潮流有货"
}
},
},
/**
... ...
... ... @@ -2,8 +2,8 @@
<view class="fellow-bar">
<view class="title">关注公众号"潮流有货",发送"开奖"查看中奖结果</view>
<view class="btn" bindtap="onClick">去关注</view>
<view class="title">{{notice.content || '关注公众号"潮流有货",发送"开奖"查看中奖结果'}}</view>
<view class="btn" bindtap="onClick">{{notice.miniappBtnName || '去关注'}}</view>
</view>
<fellow-alert show="{{show}}" bindok="onOk"></fellow-alert>
\ No newline at end of file
<fellow-alert show="{{show}}" bindok="onOk" copyText="{{notice.miniappCopy}}" text="{{notice.miniappTip}}"></fellow-alert>
\ No newline at end of file
... ...
... ... @@ -8,6 +8,24 @@ Component({
type: Boolean,
value: false,
observer: '_propertyChange'
},
text: {
type: String,
value: "",
observer: function (value) {
if (value) {
this.setData({_text: value })
}
}
},
copyText: {
type: String,
value: '',
observer: function (value) {
if (value) {
this.setData({_copyText: value })
}
}
}
},
... ... @@ -15,6 +33,8 @@ Component({
* 组件的初始数据
*/
data: {
_text: '',
_copyText: '潮流有货',
_show: false
},
... ... @@ -38,7 +58,7 @@ Component({
_setClipboard() {
wx.setClipboardData({
data: '潮流有货',
data: this.data._copyText,
success() {
},
fail() {
... ...
<zero-alert wx:if="{{_show}}">
<view class="content" style="margin-top: 110rpx;">
<view>公众号<text style="font-weight: bolder">“潮流有货”</text>已经复制成功,</view>
<view>打开微信搜索去添加吧~</view>
</view>
<view class="content" wx:if="{{!_text}}">
<view>公众号<text style="font-weight: bolder">“{{_copyText}}”</text>已经复制成功,</view>
<view>打开微信搜索去添加吧~</view>
</view>
<view wx:else class="text">{{_text}}</view>
<view class="foot" bindtap="onConfirm">确定</view>
</zero-alert>
\ No newline at end of file
... ...
... ... @@ -6,10 +6,9 @@
color: #444444;
line-height: 40rpx;
text-align: center;
margin-top: 60rpx;
margin-top: 110rpx;
}
.foot {
position: absolute;
box-sizing: border-box;
... ... @@ -21,4 +20,12 @@
font-weight: bolder;
text-align: center;
border-top: 1rpx solid #E0E0E0;
}
.text {
font-size: 28rpx;
display:flex;
align-items:center;/*垂直居中*/
justify-content: center;/*水平居中*/
height: 290rpx;
margin: 0 75rpx;
}
\ No newline at end of file
... ...
... ... @@ -4,7 +4,7 @@
<text class="title">邀新团</text>
</view>
<view class="group-list">
<block wx:for="{{groupRecommendList}}">
<block wx:for="{{groupRecommendList}}" wx:key="{{index}}">
<group-recommend-cell product="{{item}}" bindhandlegroupdetail="groupDetail"></group-recommend-cell>
</block>
</view>
\ No newline at end of file
... ...
... ... @@ -13,23 +13,31 @@ Component({
properties: {
item: {
type: Object
}
},
tabIdx: String
},
/**
* 组件的初始数据
*/
data: {
show: false
show: false,
text: '',
copyText: '',
type: 0
},
/**
* 组件的方法列表
*/
methods: {
goFellow() {
goFellow(e) {
let text = JSON.parse(e.target.dataset.text || "{}");
this.setData({
show: true
show: true,
text: text.miniappTip || '',
copyText: text.miniappCopy || '',
type: text.miniappType || 0
})
},
goShare() {
... ... @@ -49,6 +57,8 @@ Component({
});
} else {
router.go('detail', {
tabIdx: +this.data.tabIdx + 1,
fromPageParam: +this.data.tabIdx + 1,
actPrizeId: this.properties.item.act_prize_id
});
}
... ...
... ... @@ -9,7 +9,7 @@
<view class="product-name" >{{item.name}}</view>
<block wx:if="{{item.status === 4}}">
<view class="btn" catchtap="goFellow">查看中奖信息</view>
<view class="btn" catchtap="goFellow" data-text="{{item.lottery_info}}">查看中奖信息</view>
</block>
<block wx:elif="{{item.status === 3}}">
... ... @@ -21,11 +21,11 @@
</block>
<block wx:else>
<view class="btn" catchtap="goShare">获得更多抽奖码</view>
<view class="btn">获得更多抽奖码</view>
</block>
</view>
</view>
<fellow-alert show="{{show}}" bindok="onOk"></fellow-alert>
\ No newline at end of file
<fellow-alert show="{{show}}" text="{{text}}" copyText="{{copyText}}" type="{{type}}" bindok="onOk"></fellow-alert>
\ No newline at end of file
... ...
... ... @@ -7,9 +7,19 @@ Component({
},
avatars: {
type: Array
},
shareFlag: {
type: Boolean,
value: false,
observer(value) {
this.setData({show: value})
}
}
},
ready:function() {
data: {
show: false
},
ready: function () {
// console.log(`productdetail: ${this.properties.avatars}`)
}
});
... ...
<wxs src="./helper.wxs" module="helper" />
<view wx:if="{{product.status === 2}}">
<wxs src="./helper.wxs" module="helper"/>
<view wx:if="{{product.status === 2}}" hidden="{{ show }}">
<view class="countdown_label">
<text class="countdown_labeltext">抽奖</text>
<text class="countdown_labeltext">倒计时</text>
</view>
<time-countdown class="product_countdown" wx:if="{{product.status === 2}}" endTime="{{product.end_time}}"></time-countdown>
<text class="countdown_labeltext">抽奖</text>
<text class="countdown_labeltext">倒计时</text>
</view>
<time-countdown class="product_countdown" wx:if="{{product.status === 2}}"
endTime="{{product.end_time}}"></time-countdown>
</view>
<view class="avatarcontainer">
<view class="avatars" wx:if="{{product.status === 2 && avatars.length > 0}}">
<view class="avatarcontainer">
<view class="avatars" wx:if="{{product.status === 2 && avatars.length > 0 && !show}}">
<avatars list="{{avatars}}"></avatars>
</view>
<image class="product_image" src="{{product.cover_img}}"></image>
</view>
<view class="product_name">{{product.name}}</view>
<view class="product_lucky_bg">
<view class="product_lucky">
抽奖价 ¥
<text class="lucky">0</text>
</view>
<view class="product_name" >{{product.name}}</view>
<view class="product_lucky_bg">
<view class="product_lucky"><text>抽奖价 ¥ <text class="lucky">0</text></text></view>
<view class="product_price" >{{product.price}}</view>
</view>
<view wx:if="{{product.status !== 2}}" class="product_time">{{helper.formatTime(product.start_time, product.end_time)}}</view>
<view class="product_margin"></view>
\ No newline at end of file
<view class="product_price">原价:<text class="line">{{product.price}}</text></view>
</view>
<view wx:if="{{product.status !== 2}}" class="product_time">{{helper.formatTime(product.start_time,
product.end_time)}}
</view>
... ...
.product_image {
width: 750rpx;
height: 470rpx;
width: 690rpx;
height: 434rpx;
}
.product_name {
display: inline-block;
margin-top: 30rpx;
margin-top: 10rpx;
letter-spacing: -0.34px;
width: 686rpx;
font-size: 28rpx;
... ... @@ -20,7 +20,7 @@
display: flex;
flex-direction: row;
align-items: baseline;
justify-content: center;
justify-content: space-between;
margin-left: 32rpx;
margin-right: 32rpx;
}
... ... @@ -30,6 +30,10 @@
font-size: 24rpx;
font-weight: bold;
margin-left: 20rpx;
}
.line {
text-decoration: line-through;
}
... ... @@ -113,4 +117,5 @@
.lucky {
font-size: 52rpx;
margin-left: 6rpx;
}
\ No newline at end of file
... ...
... ... @@ -4,11 +4,14 @@ Component({
properties: {
product: {
type: Object
}
},
tabIdx: String
},
methods: {
onClick() {
router.go('detail', {
tabIdx: +this.data.tabIdx + 1,
fromPageParam: +this.data.tabIdx + 1,
actPrizeId: this.properties.product.id
});
}
... ...
... ... @@ -5,12 +5,15 @@ Component({
properties: {
product: {
type: Object
}
},
tabIdx: String
},
methods: {
goDetail() {
router.go('detail', {
tabIdx: +this.data.tabIdx + 1,
fromPageParam: +this.data.tabIdx + 1,
actPrizeId: this.properties.product.id
});
}
... ...
<view class="product-item" bindtap="goDetail">
<product-item-header product="{{product}}"></product-item-header>
<product-item-status product="{{product}}"></product-item-status>
<product-item-status product="{{product}}" tab-idx="{{tabIdx}}"></product-item-status>
</view>
\ No newline at end of file
... ...
// page/subPackage/pages/zeroSell/components/tabs.js
import CommonService from '../service/common'
const app = getApp();
Component({
/**
* 组件的属性列表
... ... @@ -73,11 +77,22 @@ Component({
this.setData({
tabs
});
},
submitFormId(e) {
if (app.getUid()) {
this.commonService.addWechatFormId({
formId: e.detail.formId,
uid: app.getUid() || 0,
openId: app.getOpenID() || '',
miniapp_type: app.getMiniappType()
})
}
}
},
ready() {
let nodes = this._getAllPane();
this.commonService = new CommonService();
this.setData({
nodes,
... ...
<!--page/subPackage/pages/zeroSell/components/tabs.wxml-->
<form bindsubmit='submitFormId' report-submit='true'>
<view class="tabs tabs-class">
<block wx:for="{{tabs}}" wx:key="{{index}}">
<block wx:if="{{item.active}}">
<button form-type="submit" class="tab active" data-index="{{index}}" bindtap="_onTap">{{item.name}}</button>
</block>
<view class="tabs tabs-class">
<block wx:for="{{tabs}}">
<block wx:if="{{item.active}}">
<view class="tab active" data-index="{{index}}" bindtap="_onTap">{{item.name}}</view>
<block wx:else>
<button form-type="submit" class="tab" data-index="{{index}}" bindtap="_onTap">{{item.name}}</button>
</block>
</block>
<block wx:else>
<view class="tab" data-index="{{index}}" bindtap="_onTap">{{item.name}}</view>
</block>
</block>
</view>
</view>
</form>
<slot></slot>
\ No newline at end of file
... ...
... ... @@ -23,4 +23,7 @@
.active {
color: black;
}
button::after {
border: 0;
}
\ No newline at end of file
... ...
... ... @@ -17,8 +17,14 @@ import {
} from '../../vendors/zanui/index';
import router from './router/router'
import {wrapperName} from './helper'
import { formatImageUrl } from '../../utils/util'
import { jumpByUrl } from '../../libs/urlRoute';
import {formatImageUrl} from '../../utils/util'
import {jumpByUrl} from '../../libs/urlRoute';
import {
yasReport,
YB_PAGE_OPEN_L,
YB_LUCK_DT_GDS_C,
YB_LUCK_DT_JOIN_C
} from '../../libs/yas';
const ACTIVITY = {
UNKNOWN: 0,
... ... @@ -55,6 +61,7 @@ Page(Object.assign({
* 页面的初始数据
*/
data: {
tabIdx: '',
show: false,
showAuth: false,
actPrizeId: '',
... ... @@ -71,11 +78,11 @@ Page(Object.assign({
hasUnionID: false,
uid: 0,
isLogin: false,
bannerSrc:null,
bannerSrc: null,
bannerUrl: null,
loading: false,
page: 1,
codeList: [],
actionsheet: {
componentId: 'shareActionSheet',
show: false,
... ... @@ -84,12 +91,12 @@ Page(Object.assign({
isNewShareStyle: true,
unionUserImageUrl: 'http://img12.static.yhbimg.com/sns/2018/08/02/15/029b6acc4f8bc0620ecd7ec2133fcf900c.png',
actions: [{
name: '分享给好友',
className: 'action-class',
loading: false,
openType: 'share',
image_src: '../../images/share_wechat@2x.png',
},
name: '分享给好友',
className: 'action-class',
loading: false,
openType: 'share',
image_src: '../../images/share_wechat@2x.png',
},
{
name: '生成海报分享',
className: 'action-class',
... ... @@ -98,12 +105,18 @@ Page(Object.assign({
}
]
},
animation: null,
shareFlag: false,
notice: {},
lottery: {}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
onLoad: function (options) {
app = getApp();
wx.hideShareMenu();
this.service = new ZeroSellService();
this.commonService = new CommonService();
... ... @@ -114,11 +127,14 @@ Page(Object.assign({
data.shareUid = options.shareUid;
}
if (options.tabIdx) {
data.tabIdx = options.tabIdx;
}
if (options.actPrizeId) {
data.actPrizeId = options.actPrizeId;
}
console.log('options=>', options);
if (options.scene && options.scene.length === 32) {
data.scene = options.scene;
... ... @@ -128,18 +144,20 @@ Page(Object.assign({
new app.WeToast();
this._getDetailBanner()
this._getDetailBanner();
yasReport(YB_PAGE_OPEN_L);
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {},
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
onShow: function () {
wx.showLoading({
mask: true
});
... ... @@ -151,7 +169,7 @@ Page(Object.assign({
isLogin: app.isLogin(),
uid
})
this._getMineCode();
this._getUser();
this._getGroupList();
... ... @@ -170,33 +188,34 @@ Page(Object.assign({
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
onPullDownRefresh: function () {
wx.showLoading({
mask: true
});
this._init().then(() => {
wx.stopPullDownRefresh();
})
this._getMineCode()
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
onReachBottom: function () {
if (this.data.loading) return;
let page = this.data.page || 1;
page = page + 1;
... ... @@ -208,30 +227,20 @@ Page(Object.assign({
},
goToGroupMiniApp(e) {
console.log(e);
console.log(e.detail);
yasReport(YB_LUCK_DT_GDS_C, {
ACTIVITY_ID: this.data.actPrizeId,
PRD_SKN: e.detail.product_skn,
TAB_ID: this.data.tabIdx
});
wx.navigateToMiniProgram({
appId: 'wx207f18be42db9028',
path: `pages/group/detail?productSkn=${e.detail.product_skn}&activityId=${e.detail.activity_id}&page_param=${e.detail.activity_id}`,
success(res) {
},
fail(error) {
}
path: `pages/group/detail?productSkn=${e.detail.product_skn}&activityId=${e.detail.activity_id}&page_param=${e.detail.activity_id}`
})
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
},
goLogin() {
const event = global.event;
event.emit('user-is-login', { logged: this.logged, loginSuccess: this.loginSuccess });
event.emit('user-is-login', {logged: this.logged, loginSuccess: this.loginSuccess});
},
logged() {
... ... @@ -241,7 +250,38 @@ Page(Object.assign({
loginSuccess() {
},
_getMineCode() {
if (this.data.uid) {
this.service.fetchMyPrizeList({uid: this.data.uid, actPrizeId: this.data.actPrizeId}).then(res => {
let len = res.data.length > 3 ? 3 : res.data.length;
if (len) {
res.data.map((value) => {
value.user_thumb = formatImageUrl(value.user_thumb, 60, 60);
})
this.setData({
codeList: res.data,
})
wx.getSystemInfo({
success: (sys) => {
let animation = wx.createAnimation({
duration: 400 * len,
})
setTimeout(function () {
wx.createSelectorQuery().select('.code-list-item-container').boundingClientRect().exec((r) => {
animation.height(r[0].height - 65 * sys.screenWidth / 375).step();
this.setData({
animation: animation.export()
})
})
}.bind(this), 800);
}
});
}
})
}
},
_getGroupList() {
this.commonService.getGroupList({
limit: 20,
... ... @@ -307,10 +347,6 @@ Page(Object.assign({
let participantCount = r1.code === 200 ? r1.data.joinNum : 0;
// if (product.status >= ACTIVITY.END) {
// participantCount = product.limit;
// }
this.setData({
product: product,
recommends: r2.code === 200 ? r2.data : [],
... ... @@ -323,7 +359,9 @@ Page(Object.assign({
myPrizeCount: r1.code === 200 ? r1.data.myCodeNum : 0,
participantCount,
show: true,
snapData
snapData,
notice: JSON.parse(product.notice || '{}'),
lottery: JSON.parse(product.lottery_info || '{}')
});
this._setActionStatus();
... ... @@ -335,12 +373,6 @@ Page(Object.assign({
}).catch((e) => {
console.error(e);
wx.hideLoading();
// wx.showModal({
// title: "出错了",
// content: '请重新加载!',
// showCancel: false
// })
});
},
... ... @@ -382,12 +414,10 @@ Page(Object.assign({
}
}
console.log('step=>', step)
this.setData({
step: step
});
},
_setActionStatus() {
let status = ACTION_BAR_STATUS.START;
let activityStatus = this.data.product.status;
... ... @@ -396,7 +426,7 @@ Page(Object.assign({
status = ACTION_BAR_STATUS.END;
} else if (activityStatus === ACTIVITY.READY) {
status = ACTION_BAR_STATUS.READY;
}else if (activityStatus >= ACTIVITY.END) {
} else if (activityStatus >= ACTIVITY.END) {
if (this._isInActivity()) {
if (activityStatus === ACTIVITY.LUCK) {
status = ACTION_BAR_STATUS.LUCK;
... ... @@ -428,6 +458,7 @@ Page(Object.assign({
mask: true
});
this._init();
this._getMineCode();
},
share(event) {
... ... @@ -436,11 +467,6 @@ Page(Object.assign({
})
},
requireAuth() {
// this.setData({
// showAuth: true
// })
},
_jumpBanner() {
if (this.data.bannerUrl == null) {
return;
... ... @@ -451,20 +477,18 @@ Page(Object.assign({
let commonService = this.commonService;
commonService.getResourceCode('ccc32dbedf164a52b4efa34383878860')
.then(data => {
// console.log(data)
this.setData({
bannerSrc: formatImageUrl(data.src, 750, 140, 2),
bannerUrl: data.url
})
})
.catch(error => {
console.log(error)
})
},
_getUser() {
const userInfo = app.getUserInfo();
if (app.isLogin() && (!userInfo || !userInfo.nickName)) {
return this.service.getUserProfile({uid: app.getUid()}).then(json => {
if (json && json.code && json.code === 200) {
... ... @@ -479,17 +503,17 @@ Page(Object.assign({
},
handleZanActionsheetCancel({
componentId
}) {
componentId
}) {
this.setData({
'actionsheet.show': false
})
},
handleZanActionsheetClick({
componentId,
index
}) {
componentId,
index
}) {
this.setData({
'actionsheet.show': false
})
... ... @@ -501,40 +525,42 @@ Page(Object.assign({
onShareAppMessage(res) {
let params = {
TITLE: `【0元抽奖】点一下,免费拿走${this.data.product.name}`,
DESC: '我在YO!LUCK发现一个不错的商品赶快来看看吧!'
DESC: '我在YO!LUCK发现一个不错的商品赶快来看看1吧!'
};
this.setData({
shareFlag: true
})
setTimeout(function () {
this.setData({shareFlag: false});
}.bind(this), 600);
if (res.from === 'menu') {
// 用户点击右上角分享
return {
title: params.TITLE, // 分享标题
desc: params.DESC, // 分享描述
path: `/pages/zeroSell/detail?actPrizeId=${this.data.product.id}`,
imageUrl: this.data.product.cover_img,
success: function() {},
fail: function() {}
path: `/pages/zeroSell/detail?actPrizeId=${this.data.product.id}`
};
} else if (res.from === 'button') {
// 用户点击分享按钮
return {
title: params.TITLE, // 分享标题
desc: params.DESC, // 分享描述
path: `/pages/zeroSell/detail?actPrizeId=${this.data.product.id}&shareUid=${app.getUid()}`,
imageUrl: this.data.product.cover_img,
success: function() {},
fail: function() {}
};
}
},
goList() {
router.go('index');
goList(e) {
let tab = e.target.dataset.index
router.go('index', {tabIndex: tab || 0, reload: 0});
},
reportSuccess({detail}) {
yasReport(YB_LUCK_DT_JOIN_C, {ACTIVITY_ID: detail})
},
getUserInfo: function(e) {
getUserInfo: function (e) {
var that = this;
if (e.detail.errMsg === 'getUserInfo:ok') {
decodeUnionId(app.getWechatThirdSession(), e, function(response) {
decodeUnionId(app.getWechatThirdSession(), e, function (response) {
if (response.isHaveUnionID) {
that.setData({
hasUnionID: true,
... ... @@ -542,31 +568,32 @@ Page(Object.assign({
}
});
} else {
openAuthorizeSettings(function(response) {
openAuthorizeSettings(function (response) {
if (response.isHaveUnionID) {
that.setData({
hasUnionID: true,
})
};
}
;
});
}
},
getPhoneNumber: function(e) {
getPhoneNumber: function (e) {
this.setData({
showAuth: false
});
var that = this;
if (e.detail.errMsg === 'getPhoneNumber:ok') {
decodePhoneNumber(e.detail.iv, e.detail.encryptedData, '', function(result) {
decodePhoneNumber(e.detail.iv, e.detail.encryptedData, '', function (result) {
// console.log('!!!!result',result)
if (result.code != 200) {
that.wetoast.toast({
title: result.message,
titleClassName: 'wetoast-title',
duration: 1000,
success: function() {
success: function () {
that.loginAndRegisterTapped()
}.bind(that)
});
... ... @@ -574,7 +601,7 @@ Page(Object.assign({
if (result.is_register) {
that.showZanToast({
title: '欢迎加入Yoho!Family!新人礼包已发放到个人中心-优惠券,请注意查收',
success: function() {
success: function () {
let uid = app.globalData.userInfo.uid > 0 ? app.globalData.userInfo.uid : 0;
that.setData({
uid,
... ... @@ -615,14 +642,12 @@ Page(Object.assign({
content: '检测到您未打开微信用户信息授权,开启后即可进行登录',
confirmText: "去开启",
confirmColor: "#000000",
success: function(res) {
success: function (res) {
if (res.confirm) {
wx.openSetting({
success: (res) => {
// console.log(res.authSetting["scope.userInfo"])
if (res.authSetting["scope.userInfo"] !== null && res.authSetting["scope.userInfo"] !== undefined && res.authSetting["scope.userInfo"] === true) {
getUnionID(app.getWechatThirdSession(), function(response) {
// console.log(response)
getUnionID(app.getWechatThirdSession(), function (response) {
})
}
}
... ... @@ -638,7 +663,7 @@ Page(Object.assign({
wx.navigateTo({
url: '/pages/bindPhoneNumber/bindPhoneNumber'
});
}
}
}
})
} else {
... ...
<!--page/subPackage/pages/zeroSell/detail.wxml-->
<block wx:if="{{show}}">
<view class="header">
<view class="header {{shareFlag || 'mt-header'}}" >
<product-header product="{{product}}" avatars="{{avatars}}"></product-header>
<view style="height: 20rpx;"></view>
</view>
<block wx:if="{{false}}">
<counter count="{{participantCount}}" num="{{product.limit}}" status="{{product.status}}"></counter>
<prize-progress step="{{step}}"></prize-progress>
</block>
<product-header product="{{product}}" shareFlag="{{shareFlag}}" avatars="{{avatars}}"></product-header>
</view>
<block wx:if="{{false}}">
<counter count="{{participantCount}}" num="{{product.limit}}" status="{{product.status}}"></counter>
<prize-progress step="{{step}}"></prize-progress>
</block>
<view class="machine {{shareFlag ? 'machine-t-m' : 'machine-t-l'}}">
<view class="open-shadow"></view>
<view class="code-list" animation="{{animation}}">
<view class="code-list-item-container">
<view class="code-list-item"><view class="content"></view></view>
<view class="code-list-item" wx:for="{{codeList}}" wx:if="{{index < 3}}" wx:key="{{index}}">
<view class="content">
<image class="thumb" mode="widthFix" src="{{item.user_thumb}}"></image>
<view class="text">
<view>我的</view>
<view>抽奖码</view>
</view>
<view class="my-code">{{item.prize_code}}</view>
</view>
<image class="shadow" src="https://img11.static.yhbimg.com/yhb-img01/2018/12/27/19/0140fa3243af949068d2aabeedb0ea0666.png" mode="widthFix" wx:if="{{index == 2 && codeList.length>3 }}"></image>
</view>
<image src="./images/down.png" bindtap="goList" data-index="3" mode="widthFix" class="down" wx:if="{{codeList.length>3}}"></image>
</view>
</view>
</view>
<view class="help">
<help></help>
</view>
<desc list="{{product.content}}" bind:tapUrl="_jumpBanner" bannerSrc="{{bannerSrc}}" bannerUrl="{{bannerUrl}}"></desc>
<desc list="{{product.content}}" bind:tapUrl="_jumpBanner" bannerSrc="{{bannerSrc}}" bannerUrl="{{bannerUrl}}"></desc>
<view class="line"></view>
<view class="line"></view>
<more wx:if="{{recommends.length > 0}}">
<block wx:for="{{recommends}}">
<view class="product-item" >
<product-item product="{{item}}"></product-item>
</view>
</block>
</more>
<more wx:if="{{recommends.length > 0}}">
<block wx:for="{{recommends}}" wx:key="{{index}}">
<view class="product-item">
<product-item product="{{item}}" tab-idx="{{tabIdx - 1}}"></product-item>
</view>
</block>
</more>
<view class="fellow-bar" wx:if="{{product.status}}">
<fellow-bar></fellow-bar>
</view>
<group-recommend groupRecommendList="{{groupList}}" bindgoToGroupMiniApp="goToGroupMiniApp">
</group-recommend>
<view class="fellow-bar" wx:if="{{product.status && !shareFlag}}">
<fellow-bar notice="{{notice}}"></fellow-bar>
</view>
<group-recommend groupRecommendList="{{groupList}}" bindgoToGroupMiniApp="goToGroupMiniApp">
</group-recommend>
<view class="action-bar">
<action-bar wx:if="{{isLogin}}" status="{{actionStatus}}" num="{{myPrizeCount}}" share-uid="{{shareUid}}" act-prize-id="{{actPrizeId}}" bindgetcode="changeActionStatus" bindshare="share"
></action-bar>
<view class="action-bar">
<action-bar wx:if="{{isLogin}}" status="{{actionStatus}}" num="{{myPrizeCount}}" share-uid="{{shareUid}}"
act-prize-id="{{actPrizeId}}" bindgetcode="changeActionStatus" bindshare="share"
copyText="{{lottery.miniappCopy}}" text="{{lottery.miniappTip}}"
bindgaincodesuccess="reportSuccess" type="{{lottery.miniappType}}"
></action-bar>
<block wx:else>
<view class="action-bar2">
<block wx:else>
<view class="action-bar2">
<view class="action-item action-list" bindtap="goList">
<image class="action-image" src="./images/list_icon@2x.png"></image>
</view>
... ... @@ -48,15 +69,15 @@
<block wx:else>
<view class="action-item over">活动已结束</view>
</block>
</view>
</block>
</view>
<view class="foot"></view>
</view>
</block>
</view>
<view class="foot"></view>
</block>
<import src="../../vendors/zanui/actionsheet/index.wxml" />
<template is="zan-actionsheet" data="{{...actionsheet}}" />
<import src="../../vendors/zanui/actionsheet/index.wxml"/>
<template is="zan-actionsheet" data="{{...actionsheet}}"/>
<import src="../../vendors/zanui/toast/index.wxml"/>
<template is="zan-toast" data="{{zanToast}}"/>
... ... @@ -66,7 +87,9 @@
<!-- <quickNavigation id="quickNavigation" isShowIndicator="{{false}}" isShowShopCart="{{false}}" marginBottom="{{190}}"></quickNavigation> -->
<zero-alert wx:if="{{showAuth}}" >
<zero-alert wx:if="{{showAuth}}">
<view class="auth-content">OOPS 用户尚未授权登录</view>
<button class="auth-foot action-item confirm" open-type="{{!hasUnionID ? 'getUserInfo':'getPhoneNumber'}}" bindgetphonenumber="getPhoneNumber" bindgetuserinfo='getUserInfo'>授权登录</button>
<button class="auth-foot action-item confirm" open-type="{{!hasUnionID ? 'getUserInfo':'getPhoneNumber'}}"
bindgetphonenumber="getPhoneNumber" bindgetuserinfo='getUserInfo'>授权登录
</button>
</zero-alert>
... ...
... ... @@ -15,7 +15,9 @@
position: relative;
text-align: center;
overflow: hidden;
margin-top: 56rpx;
}
.mt-header{
margin-top: 56rpx;
}
.help {
... ... @@ -75,7 +77,7 @@
left: 50%;
/* transform: translateY(-50%); */
transform: translate(-50%, -50%);
}
.action-bar2 {
... ... @@ -104,4 +106,105 @@
font-weight: bolder;
text-align: center;
border-top: 1rpx solid #E0E0E0;
}
.machine {
background-image: url('https://img10.static.yhbimg.com/yhb-img01/2018/12/27/19/011f45717237b3cbf7301833e8dc28f994.png');
background-size: contain;
background-repeat: no-repeat;
min-height: 258rpx;
position: relative;
margin-left: 83.6rpx;
width: 598rpx;
overflow: hidden;
}
.machine-t-l{
margin-top: 20rpx;
}
.machine-t-m{
margin-top: 40rpx;
}
.machine .code-list {
position: relative;
width: 410rpx;
height:22rpx;
margin:110rpx auto 0 78rpx;
overflow: hidden;
}
.code-list .code-list-item {
margin-top:-12rpx;
width: 410rpx;
height: 164rpx;
overflow: hidden;
position: relative;
}
.code-list .code-list-item-container {
position: absolute;
bottom: 0;
width: 410rpx;
}
.code-list .code-list-item .code {
float: left;
}
.machine .code {
width: 410rpx;
position:relative;
}
.code-list .code-list-item .content{
width: 410rpx;
height: 164rpx;
position:relative;
background-image: url('https://img11.static.yhbimg.com/yhb-img01/2018/12/27/19/0140fa3243af949068d2aabeedb0ea0666.png');
background-size: cover;
background-repeat: no-repeat;
overflow: hidden;
z-index:4;
}
.code-list .code-list-item .content .thumb{
width: 60rpx;
height: 60rpx;
margin: 46rpx 10rpx 46rpx 32rpx;
border-radius: 30rpx;
}
.code-list .code-list-item .content .my-code{
height:44rpx;
float:right;
vertical-align:middle;
line-height:156rpx;
font-size: 32rpx;
margin-right: 46rpx;
}
.code-list .code-list-item .content .text{
font-size: 16rpx;
display: inline-block;
height:172rpx;
vertical-align:middle;
}
.code-list .code-list-item .shadow {
width: 410rpx;
position: absolute;
top: 6rpx
}
.code-list .down {
width: 20rpx;
height: 20rpx;
margin-left: 50%
}
.open-shadow {
box-shadow:0rpx 0rpx 16rpx 4rpx #000;
width:394rpx;
height:0rpx;
position:absolute;
top:112rpx;
z-index:10;
left:82rpx;
}
\ No newline at end of file
... ...
import {
yasReport,
YB_PAGE_OPEN_L
} from '../../libs/yas';
Page({
data: {
url: '',
... ... @@ -7,6 +12,7 @@ Page({
let url = decodeURIComponent(options.url);
let title = decodeURIComponent(options.title);
yasReport(YB_PAGE_OPEN_L);
this.setData({
url,
});
... ...
export function wrapperName(name) {
if (!name) {
return ''
... ...
import ZeroSellService from './service/zero-sell'
import CommonService from './service/common'
import { getSettingPromise } from '../../login/utils/index.js'
import regeneratorRuntime from '../../login/libs/regenerator-runtime/index.js';
const event = global.event;
import {getSettingPromise} from '../../login/utils/index'
import regeneratorRuntime from '../../login/libs/regenerator-runtime/index';
import {formatImageUrl} from '../../utils/util'
import {jumpByUrl} from '../../libs/urlRoute';
import router from './router/router';
import {
decodePhoneNumber,
getUnionID,
decodeUnionId,
openAuthorizeSettings,
openAuthorizeSettings
} from '../../utils/login';
import {formatImageUrl} from '../../utils/util'
import {
Toast, Actionsheet
} from '../../vendors/zanui/index';
import router from './router/router';
import { jumpByUrl } from '../../libs/urlRoute';
import {
yasReport,
YB_PAGE_OPEN_L,
YB_MAIN_TAB_C
} from '../../libs/yas';
let app = getApp()
const event = global.event;
let app = getApp();
Page(Object.assign({
data: {
... ... @@ -107,12 +106,11 @@ Page(Object.assign({
this._init();
}
new app.WeToast();
console.log(options.reload);
if(options && (Number(options.reload) !== 0)) {
console.log('执行了');
this._getResouceCode()
}
this._getBottomBanner()
this._getBottomBanner();
yasReport(YB_PAGE_OPEN_L);
},
onShow() {
... ... @@ -232,7 +230,6 @@ Page(Object.assign({
_getResouceCode() {
this.commonService.getResourceCode('194ffd46254d6ad20e6c538bea4d89d7')
.then(data => {
// console.log(data)
this.setData({
dialogSrc: formatImageUrl(data.src, 340 * app.globalData.systemInfo.pixelRatio, 340 * app.globalData.systemInfo.pixelRatio, 2),
dialogUrl: data.url
... ... @@ -240,7 +237,6 @@ Page(Object.assign({
this.dialog.showDialog();
})
.catch(error => {
console.log(error)
})
},
... ... @@ -254,7 +250,6 @@ Page(Object.assign({
})
})
.catch(error => {
console.log(error)
})
},
... ... @@ -287,7 +282,6 @@ Page(Object.assign({
let oldData = my_zero_list[type].data;
let key = `my_zero_list[${type}].data`;
let keyPage = `my_zero_list[${type}].page`;
console.log('执行了');
this.service.getMyList({type, page}).then(res => {
let data = []
if (res && res.code === 200) {
... ... @@ -315,7 +309,6 @@ Page(Object.assign({
let oldData = my_zero_list[type].data;
let key = `my_zero_list[${type}].data`;
let keyPage = `my_zero_list[${type}].page`;
console.log('执行了');
this.service.getMyList({ type, page }).then(res => {
let data = []
if (res && res.code === 200) {
... ... @@ -346,6 +339,7 @@ Page(Object.assign({
tabIndex: detail,
[`list[${detail}].page`]: 1
});
yasReport(YB_MAIN_TAB_C, {TAB_ID: detail + 1});
if (detail === 3 && !this.data.isLogin) {
return;
... ... @@ -498,7 +492,6 @@ Page(Object.assign({
},
loginCallback(params) {
console.log(params);
},
loginSuccess(params) {
... ... @@ -511,7 +504,6 @@ Page(Object.assign({
},
loginError(error) {
console.log(error);
router.go('bindPhoneNumber');
},
... ...
... ... @@ -8,7 +8,7 @@
"quickNavigation": "/pages/quickNavigation/quickNavigation",
"tabs": "./components/tabs",
"tabs-pane": "./components/tabs-pane",
"dialog": "../../component/dialog/dialog",
"dialog": "/components/dialog/dialog",
"prize-item": "./components/prize-item",
"login": "../../login/login/login"
}
... ...
... ... @@ -5,7 +5,7 @@
<image class="topgif" src="./images/yoluck.gif"/>
<view class="productList">
<block wx:for="{{list[0].products}}" wx:key="{{item.id}}">
<product-item product="{{item}}" class="product"></product-item>
<product-item product="{{item}}" class="product" tab-idx="{{tabIndex}}"></product-item>
</block>
</view>
</tabs-pane>
... ... @@ -13,7 +13,7 @@
<tabs-pane name="即将开始">
<view class="productList">
<block wx:for="{{list[1].products}}" wx:key="{{item.id}}">
<product-item product="{{item}}" class="product"></product-item>
<product-item product="{{item}}" class="product" tab-idx="{{tabIndex}}"></product-item>
</block>
</view>
</tabs-pane>
... ... @@ -21,7 +21,7 @@
<tabs-pane name="已结束">
<view class="productList">
<block wx:for="{{list[2].products}}" wx:key="{{item.id}}">
<product-item product="{{item}}" class="product"></product-item>
<product-item product="{{item}}" class="product" tab-idx="{{tabIndex}}"></product-item>
</block>
</view>
</tabs-pane>
... ... @@ -37,8 +37,8 @@
</view>
</block>
<block wx:else>
<block wx:for="{{my_zero_list[0].data}}">
<prize-item item="{{item}}" bindshare="share"></prize-item>
<block wx:for="{{my_zero_list[0].data}}" wx:key="{{index}}">
<prize-item item="{{item}}" bindshare="share" tab-idx="{{tabIndex}}"></prize-item>
</block>
</block>
<view class="title-view">
... ... @@ -50,19 +50,14 @@
</view>
</block>
<block wx:else>
<block wx:for="{{my_zero_list[1].data}}">
<prize-item item="{{item}}" bindshare="share"></prize-item>
<block wx:for="{{my_zero_list[1].data}}" wx:key="{{index}}">
<prize-item item="{{item}}" bindshare="share" tab-idx="{{tabIndex}}"></prize-item>
</block>
</block>
</block>
<block wx:else>
<login theme="light" openType="{{openType}}"></login>
</block>
<!-- <view class="productList">
<block wx:for="{{list[2].products}}" wx:key="{{item.id}}">
<product-item product="{{item}}" class="product"></product-item>
</block>
</view> -->
</tabs-pane>
<block wx:if="{{tabIndex !== 3}}">
<view class="list-foot-blank">{{footText}}</view>
... ... @@ -73,10 +68,11 @@
<image class="bottom-banner-img" src="{{bannerSrc}}"></image>
</view>
</block>
<import src="../../../../vendors/zanui/toast/index.wxml"/>
<import src="../../vendors/zanui/toast/index.wxml"/>
<template is="zan-toast" data="{{zanToast}}"/>
<import src="../../../../vendors/toast/wetoast.wxml"/>
<import src="../../vendors/toast/wetoast.wxml"/>
<template is="wetoast" data="{{...__wetoast__}}"/>
<dialog
id='dialog'
... ...
// page/subPackage/pages/zeroSell/myList.js
import ZeroSellService from './service/zero-sell'
import { Actionsheet} from '../../vendors/zanui/index';
import router from './router/router';
import {wrapperName} from './helper'
let app = null;
Page(Object.assign({
/**
* 页面的初始数据
*/
data: {
shareProduct: {},
recommends: [],
list: [{
page: 1,
data: []
}, {
page: 1,
data: []
}],
tabIndex: 0,
footText: '',
actionsheet: {
componentId: 'shareActionSheet',
show: false,
closeOnClickOverlay: true,
cancelText: '取消',
isNewShareStyle:true,
unionUserImageUrl:'http://img12.static.yhbimg.com/sns/2018/08/02/15/029b6acc4f8bc0620ecd7ec2133fcf900c.png',
actions: [{
name: '分享给好友',
className: 'action-class',
loading: false,
openType: 'share',
image_src: '../../images/share_wechat@2x.png',
},
{
name: '生成海报分享',
className: 'action-class',
loading: false,
image_src: '../../images/share_wxpeng@2x.png'
}]
},
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.service = new ZeroSellService()
app = getApp();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.setData({
[`list[${this.data.tabIndex}].page`]: 1
});
this._init();
this._getRecommend();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
let key = `list[${this.data.tabIndex}].page`;
this.setData({
[key]: 1
});
this._init().then(() => {
wx.stopPullDownRefresh();
});
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
let type = this.data.tabIndex;
let list = this.data.list;
let page = list[type].page;
let oldData = list[type].data;
let key = `list[${type}].data`;
let keyPage = `list[${type}].page`;
return this._getPage(type, page).then(data => {
this.setData({
[key]: oldData.concat(data),
[keyPage]: ++page
});
});
},
onTabChange({detail}) {
this.setData({
tabIndex: detail,
[`list[${detail}].page`]: 1
});
this._init();
},
_init(){
let type = this.data.tabIndex;
let list = this.data.list;
let page = list[type].page
let key = `list[${type}].data`
let keyPage = `list[${type}].page`
return this._getPage(type, page).then(data => {
this.setData({
[key]: data,
[keyPage]: ++page
});
});
},
_getPage(type, page) {
this.setData({
footText: '内容加载中...'
});
return this.service.getMyList({type, page}).then(result => {
if(result.code !== 200 || result.data.length === 0) {
if(type == 0) {
this.setData({
footText: '您还没有参与的抽奖,赶紧去参加吧'
});
} else {
this.setData({
footText: '暂无已公布活动,请继续参加活动'
});
}
} else {
this.setData({
footText: ''
});
}
if (result.code !== 200) {
return [];
}
return result.data;
});
},
_getRecommend() {
this.service.getRecommend({
actPrizeId: 0
})
.then(response => {
if (response && response.code === 200 && response.data){
this.setData({
recommends: response.data,
})
}
})
.catch(error => {
console.log(error)
})
},
share({detail}){
this.setData({
'actionsheet.show': true,
'shareProduct': detail
})
},
handleZanActionsheetCancel({ componentId }) {
this.setData({
'actionsheet.show': false
})
},
handleZanActionsheetClick({ componentId, index }) {
this.setData({
'actionsheet.show': false
});
let qrcode = this.service.getQrCode({
shareUid: app.getUid(),
actPrizeId: this.data.shareProduct.act_prize_id
});
if (index === 1) {
if (this.data.shareProduct.name) {
router.go('snapShare', {
product_name: this.data.shareProduct.name,
default_image: this.data.shareProduct.cover_img,
product_price: this.data.shareProduct.price,
product_qrCode: qrcode
});
}
};
},
onShareAppMessage(res) {
let params = {
TITLE: `【0元抽奖】点一下,免费拿走${this.data.shareProduct.name}`,
DESC: '我在YO!LUCK发现一个不错的商品赶快来看看吧!'
};
if (res.from === 'menu') {
// 用户点击右上角分享
return {
title: params.TITLE, // 分享标题
desc: params.DESC, // 分享描述
path: `pages/zeroSell/detail?actPrizeId=${this.data.shareProduct.act_prize_id}`,
imageUrl: this.data.shareProduct.cover_img,
success: function() {
},
fail: function() {
}
};
} else if (res.from === 'button') {
// 用户点击分享按钮
return {
title: params.TITLE, // 分享标题
desc: params.DESC, // 分享描述
path: `/pages/zeroSell/detail?actPrizeId=${this.data.shareProduct.act_prize_id}&shareUid=${app.getUid()}`,
imageUrl: this.data.shareProduct.cover_img,
success: function() {
},
fail: function() {
}
};
}
}
}, Actionsheet))
\ No newline at end of file
{
"navigationBarTitleText": "YO!LUCK",
"enablePullDownRefresh": true,
"backgroundColor": "#ebebeb",
"backgroundTextStyle": "light",
"usingComponents": {
"tabs": "./components/tabs",
"tabs-pane": "./components/tabs-pane",
"prize-item": "./components/prize-item",
"fellow-bar": "./components/fellow-bar",
"quickNavigation": "/pages/quickNavigation/quickNavigation",
"more": "./components/more",
"product-item": "./components/product-item",
"product-header": "./components/product-detail-header"
}
}
\ No newline at end of file
<!--page/subPackage/pages/zeroSell/myList.wxml-->
<import src="../../vendors/zanui/actionsheet/index.wxml" />
<tabs current-key="{{tabIndex}}" bindchange="onTabChange">
<view class="fellow-bar">
<fellow-bar></fellow-bar>
</view>
<view class="list-head-blank"></view>
<tabs-pane name="进行中">
<block wx:for="{{list[0].data}}">
<prize-item item="{{item}}" bindshare="share"></prize-item>
</block>
</tabs-pane>
<tabs-pane name="已公布">
<block wx:for="{{list[1].data}}">
<prize-item item="{{item}}"></prize-item>
</block>
</tabs-pane>
<view class="list-foot-blank" wx:if="{{footText && footText.length > 0}}">{{footText}}</view>
</tabs>
<view style="height: 20rpx;background-color:#F0F0F0"></view>
<more wx:if="{{recommends.length > 0}}">
<block wx:for="{{recommends}}">
<view class="product-item" >
<product-item product="{{item}}"></product-item>
</view>
</block>
</more>
<template is="zan-actionsheet" data="{{...actionsheet}}" />
<!-- <quickNavigation id="quickNavigation" isShowIndicator="{{false}}" isShowShopCart="{{false}}" marginBottom="{{190}}"></quickNavigation> -->
\ No newline at end of file
/* page/subPackage/pages/zeroSell/myList.wxss */
@import '../../vendors/zanui/actionsheet/index.wxss';
.list-foot-blank
{
width: 100%;
height: 88rpx;
text-align: center;
line-height: 88rpx;
font-size: 30rpx;
color: #ccc;
}
.list-head-blank {
width: 100%;
height: 156rpx;
}
.fellow-bar {
position: fixed;
top: 90rpx;
left: 0;
width: 100%;
z-index: 2;
}
\ No newline at end of file
... ... @@ -32,7 +32,7 @@ class CommonService extends Service {
})
.catch(error => {
reject(error)
})
});
})
}
... ...
... ... @@ -10,13 +10,10 @@ class Service {
_get(path, data) {
let method = path ? this.url + path : API_HOST;
console.log(`request => ${data.method || method} =>`, data);
return GET(method, data).then(result => {
if (result.code !== 200) {
console.error(`response => ${data.method || method} =>`, result);
} else {
console.log(`response => ${data.method || method} =>`, result);
}
return result
});
... ... @@ -25,13 +22,10 @@ class Service {
_post(path, data) {
let method = path ? this.url + path : API_HOST;
console.log(`request => ${data.method || method} =>`, data);
return POST(method, data).then(result => {
if (result.code !== 200) {
console.error(`response => ${data.method || method} =>`, result);
} else {
console.log(`response => ${data.method || method} =>`, result);
}
return result;
});
... ...
... ... @@ -58,15 +58,13 @@ class ZeroSellService extends Service {
return result
});
}
getRecentAvatars(data) {
return this._get('/code/recent', data);
}
getMyList(data) {
data.channel = 0
return this._get('/list/mine', data);
}
getRecentAvatars(data) {
return this._get('/code/recent', data);
}
fetchCode(data) {
data.miniAppType = MINI_APP_TYPE
... ... @@ -85,6 +83,7 @@ class ZeroSellService extends Service {
return API_HOST + '/wechat/miniapp/img-check.jpg?param=' + JSON.stringify(page_param) + `&miniQrType=${MINI_QR_TYPE}` + `&miniapp_type=${MINI_APP_TYPE}`;
}
getUserProfile(data) {
return this._get('', {
method: 'app.passport.profile',
... ...
... ... @@ -11,8 +11,10 @@ const scale = windowWidth / 375;
screenHeight = windowWidth / (canvasWidth / canvasHeight);
import {wrapperName} from './helper'
// const scale = 0.5;
import {
yasReport,
YB_PAGE_OPEN_L
} from '../../libs/yas';
var Point = function(x, y) {
return {
... ... @@ -56,6 +58,7 @@ Page({
this.creatSnapshoot();
this.getAuth();
yasReport(YB_PAGE_OPEN_L);
},
creatSnapshoot() {
... ... @@ -217,7 +220,7 @@ Page({
pCtx.setFillStyle('#ffffff');
pCtx.setFontSize(10);
pCtx.fillText('长按图片识别小程序码抢限定', 137.5 * scale, 612.5 * scale);
pCtx.fillText('长按图片识别小程序码免费抽大奖', 137.5 * scale, 612.5 * scale);
pCtx.draw();
},
... ...
... ... @@ -28,7 +28,7 @@
<image class="product-qrcode" src="{{product_qrCode}}"></image>
<view class="product-tips">
<view class="product-tips-user">{{user_name}}邀请你参与0元抽奖</view>
<view class="product-tips-text">长按图片识别小程序码抢限定</view>
<view class="product-tips-text">长按图片识别小程序码免费抽大奖</view>
</view>
</view>
</view>
... ...
... ... @@ -6,6 +6,7 @@
"postcss": true,
"minified": true,
"newFeature": true,
"nodeModules": false,
"autoAudits": false
},
"compileType": "miniprogram",
... ... @@ -30,7 +31,7 @@
"list": []
},
"miniprogram": {
"current": 4,
"current": 5,
"list": [
{
"id": 0,
... ... @@ -66,6 +67,12 @@
"pathName": "pages/bindPhoneNumber/bindPhoneNumber",
"query": "",
"scene": "1011"
},
{
"id": -1,
"name": "YOLUCK DETAIL",
"pathName": "pages/zeroSell/detail",
"query": "actPrizeId=41"
}
]
}
... ...
export default {
['pages/zeroSell/index']: {
pathName: 'index'
},
['pages/zeroSell/detail']: {
pathName: 'detail',
paramKey: 'actPrizeId'
},
['pages/zeroSell/snapshootShare']: {
pathName: 'snapshootShare',
paramKey: 'product_qrCode'
},
['pages/zeroSell/h5Page']: {
pathName: 'H5Page',
paramKey: 'url'
},
['pages/bindPhoneNumber/bindPhoneNumber']: {
pathName: 'bindPhoneNumber'
},
['pages/choosecountry/choosecountry']: {
pathName: 'choosecountry'
},
['login/login-page/login-page']: {
pathName: 'loginPage'
}
}
... ...
'use strict'
function parseActivityListData(data, bannerWidth, bannerHeight, listImageWidth, listImageHeight) {
let newData = [];
data && data.map((item, index) => {
if (index > 10) {
return;
}
item.src = item.src.replace(/{width}/g, bannerWidth).replace(/{height}/g, bannerHeight).replace('{mode}', 2);
for (var i = 0; i < item.productList.length; i++) {
item.productList[i].default_images = item.productList[i].default_images.replace(/{width}/g, listImageWidth).replace(/{height}/g, listImageHeight).replace('{mode}', 2);
}
newData.push(item);
});
return newData;
}
module.exports = {
parseActivityListData
}
'use strict'
var util = require('/util.js')
//商品详情页晒单评价需预处理的数据
function parseEvaluateListDataDetailWith(data, picWidth, picHeight, icoWidth, icoHeight, imageWidth) {
let newData = [];
if (data.length > 2) {
return newData;
}
if (data.length == 1) {
newData = data;
} else {
for (var i = 0; i < data.length; i++) {
let item = data[i];
if (i == 0 && item.url) {
newData.push(item);
break;
}
item.url = '';
newData.push(item);
}
}
return parseEvaluateListData(newData, picWidth, picHeight, icoWidth, icoHeight, imageWidth);
}
//晒单列表需处理的数据
function parseEvaluateListData(data, picWidth, picHeight, icoWidth, icoHeight, imageWidth) {
let newData = [];
data && data.map((item, index) => {
let headIco = ''; // 头像
let nickName = ''; // 昵称
let vipLevelImg = ''; // 等级
let factory_goods_name = ''; // 颜色
let size_name = ''; // 尺码
if (item.userInfo) {
nickName = getNickName(item.userInfo.nickName, item.anonymous);
headIco = item.userInfo.headIco ? item.userInfo.headIco.replace(new RegExp('{width}'), icoWidth).replace(new RegExp('{height}'), icoHeight).replace(new RegExp('{mode}'), 2) : '../userCenter/images/mine_default_head.png';
let vipLevel = item.userInfo.vipLevel;
if (vipLevel == 1) {
vipLevelImg = '../userCenter/images/yin-vip@2x.png';
} else if (vipLevel == 2) {
vipLevelImg = '../userCenter/images/jin-vip@2x.png';
} else if (vipLevel == 3) {
vipLevelImg = '../userCenter/images/baijin-vip@2x.png';
}
}
if (item.goods) {
size_name = item.goods.size_name ? '尺码: ' + item.goods.size_name : '';
factory_goods_name = item.goods.factory_goods_name ? '颜色: ' + item.goods.factory_goods_name : '';
}
let url = item.url ? item.url.replace(new RegExp('{width}'), picWidth).replace(new RegExp('{height}'), picHeight).replace(new RegExp('{mode}'), 2) : ''; //缩略图
let src = item.url ? item.url.replace(new RegExp('{width}'), imageWidth).replace(new RegExp('{height}'), imageWidth).replace(new RegExp('{mode}'), 2) : ''; //放大图
let createTime = util.formatTimeByDefined(item.createTime, 'Y.M.D');
let satisfiedArr = [];
if (item.satisfied > 0) {
for (let i = 0; i < item.satisfied; i++) {
satisfiedArr.push(i);
}
}
let sizeName = '';
if (item.size == 'SMALL') {
sizeName = '偏小';
} else if (item.size == 'MIDDLE') {
sizeName = '适中';
} else if (item.size == 'BIG') {
sizeName = '偏大';
}
let newItem = {
headIco,
nickName,
vipLevelImg,
weight: item.weight ? '体重:' + item.weight + 'kg' : '',
height: item.height ? '身高:' + item.height + 'cm' : '',
satisfied: satisfiedArr,
size: sizeName,
content: item.content,
url,
src,
createTime,
factory_goods_name,
size_name
};
newData.push(newItem);
});
return newData;
}
function getNickName(nickName, anoymous){
if (nickName == null || nickName == '') {
return '***';
}
if (!anoymous) {
if (getStrLength(nickName) <= 11) {
return nickName;
}
return subString(nickName) + '...';
} else {
if (nickName.length <= 3) {
return '***';
}
return nickName.charAt(0).toString() + '***' + nickName.charAt(nickName.length-1).toString();
}
}
//获取中英文字符串的长度
function getStrLength(value) {
let valueLength = 0;
let chinese = "[\u0391-\uFFE5]";
/* 获取字段值的长度,如果含中文字符,则每个中文字符长度为2,否则为1 */
for (let i = 0; i < value.length; i++) {
/* 获取一个字符 */
let temp = value.substring(i, i + 1);
/* 判断是否为中文字符 */
if (temp.match(chinese)) {
/* 中文字符长度为2 */
valueLength += 2;
} else {
/* 其他字符长度为1 */
valueLength += 1;
}
}
return valueLength;
}
function subString(str) {
var newLength = 0;
var newStr = "";
var chineseRegex = /[^\x00-\xff]/g;
var singleChar = "";
var strLength = str.replace(chineseRegex, "**").length;
for (var i = 0; i < strLength; i++) {
singleChar = str.charAt(i).toString();
newStr += singleChar;
if (singleChar.match(chineseRegex) != null) {
newLength += 2;
} else {
newLength++;
}
if (newLength >= 10) {
break;
}
}
return newStr;
}
module.exports = {
parseEvaluateListData,
parseEvaluateListDataDetailWith
}
\ No newline at end of file
'use strict'
function getChannelCode(channel) {
let config = {
boy: 1,
girl: 2,
child: 3,
lifestyle: 4,
};
return config[channel] ? config[channel] : config['boy'];
}
function getGenderCode(channel) {
let config = {
boy: '1,3',
girl: '2,3',
child: '',
lifestyle: '',
};
return config[channel] ? config[channel] : config['boy'];
}
function getRecPosCode(channel) {
let config = {
boy: '100001',
girl: '100002',
child: '',
lifestyle: '',
};
return config[channel] ? config[channel] : config['boy'];
}
function getRecommandContentCode(channel) {
let config = {
boy: '201504091403001',
girl: '201504091403002',
child: '201504091403002',
lifestyle: '201504091403002',
};
return config[channel] ? config[channel] : config['boy'];
}
function getResourceCode(channel){
let config = {
boy: '9cb6138be8e60c96f48107da481816c2',
girl: 'b1fa86320d3f9d9e89153129aeea1b3e',
child: 'e9875682c1599a886bfbdb965b740022',
lifestyle: '9aa25f5133f011ec96c2045eb15ae425',
};
return config[channel] ? config[channel] : config['boy'];
}
//获取首页的contentcode
function getHomeContentCode(channel){
let config = {
boy:'305e0a7a4aba32b08c6dd6dc5da47fa9',
girl:'5d9665e6a0a8ec5b2f0c126b36364d24'
}
return config[channel]?config[channel]:config['boy'];
}
module.exports = {
getChannelCode,
getGenderCode,
getRecPosCode,
getRecommandContentCode,
getResourceCode,
getHomeContentCode
}
//login.js
import {GET, POST} from '../libs/request';
import {API_HOST, SERVICE_HOST} from '../libs/config';
import {Encrypt} from '../libs/aes'
import {isStringEmpty} from './util'
import { logEvent,
YB_MY_LOGIN,
YB_PAGE_OPEN_L,
YB_REGISTER_SUCCESS,
} from '../libs/analytics.js'
import {
yasReport,
YB_REGISTER_SUCCESS
} from '../libs/yas.js'
//获取应用实例
var app = getApp()
... ... @@ -53,8 +50,6 @@ function wechatLoginAction(callbackFunc) {
app.setOpenID(responseData.openid);
//如果unionID不存在(未使用过任何有货微信产品的全新用户),调用getUnionID函数,再次获取unionID
//对于已经授权过的用户,拿到unionid之后获取一次userinfo更新个人信息.
let params = { LOGIN_TYPE: 4, PV_ID: PV_ID, };
logEvent(YB_MY_LOGIN, params);
//当unionId为空或者头像为空时,调用微信接口获取用户信息
if (!isStringEmpty(responseData.unionid)) {
... ... @@ -353,15 +348,15 @@ function checkVerifyCode(phoneNumb, verifyCode, areaCode, inviteCode, callbackFu
userInfo.uid = data.data.uid;
userInfo.profile = data.data.profile;
userInfo.mobile = phoneNumb;
userInfo.session_key = data.data.session_key;
app.setSessionkey(data.data.session_key);
app.setUserInfo(userInfo);
sendWeChatUserData(userInfo.uid, app.globalData.userInfo.nickName, app.globalData.userInfo.avatarUrl);
// console.log("登录成功:", userInfo)
if (data.data.is_register !== undefined && data.data.is_register !== null && data.data.is_register === 0 ) {
if (data.data.nFlag === 'Y') {
let logParams = {
YB_REGISTER_SUCCESS: 5,
};
logEvent(YB_REGISTER_SUCCESS, logParams);
yasReport(YB_REGISTER_SUCCESS, logParams);
callbackFunc({
succeed: true,
message: "登录成功",
... ... @@ -456,19 +451,24 @@ function autoSignin(mobile, verifyCode, areaCode, inviteCode, callbackFunc) {
userInfo.ssouid = data.data.ssouid;
userInfo.uid = data.data.uid;
userInfo.profile = data.data.profile;
userInfo.session_key = data.data.session_key;
app.setSessionkey(data.data.session_key);
app.setUserInfo(userInfo);
if (data.data.is_register !== undefined && data.data.is_register !== null && data.data.is_register === 0) {
let params = {
succeed: true,
code: data.code,
message:data.message,
};
if (data.data.nFlag === 'Y') {
params.is_register = true;
let logParams = {
YB_REGISTER_SUCCESS: 5,
};
logEvent(YB_REGISTER_SUCCESS, logParams);
yasReport(YB_REGISTER_SUCCESS, logParams);
}
callbackFunc({
succeed: true,
code: data.code,
message:data.message,
});
callbackFunc(params);
}else{
callbackFunc({
succeed: false,
... ... @@ -554,11 +554,11 @@ function BindMiniAppByAuto(mobile, countryCode, inviteCode, callbackFunc){
app.setSessionkey(data.data.session_key)
app.updateUid(data.data.uid)
sendWeChatUserData(data.data.uid, app.globalData.userInfo.nickName, app.globalData.userInfo.avatarUrl);
if (data.data.is_register !== undefined && data.data.is_register !== null && data.data.is_register === 0) {
if (data.data.nFlag === 'Y') {
let logParams = {
YB_REGISTER_SUCCESS: 5,
};
logEvent(YB_REGISTER_SUCCESS, logParams);
yasReport(YB_REGISTER_SUCCESS, logParams);
callbackFunc({
succeed: true,
message: "登录成功",
... ...
import { getGoodDetailParam,getImageUrl } from './util';
function parseHomeList(json, windowWidth, windowHeight, listImageWidth, listImageHeight){
let newList=[];
let index = 1;
json && json.map((item,index)=>{
if (item.template_name == 'focus' || item.template_name == 'newFocus'){
//焦点图 -- 只需要对列表中的图片url进行格式化 默认宽高: 750 : 500
for(var i =0;i<item.data.length;i++){
let src = item.data[i].src;
item.data[i].src = getImageUrl(item.data[i].src,750,500);
let param = getGoodDetailParam(item.data[i].url);
if(param){
let json = JSON.parse(param);
item.data[i].title = json.title;
item.data[i]._src = json.cover_url
}
}
} else if (item.template_name == 'newSingleImage'){
//新一张图片 ratio 为 高/宽 抽取出 src title ratio
item.ratio = item.data.imageWidth <= 0 || item.data.imageHeight<=0?0: item.data.imageHeight / item.data.imageWidth
item.ratio = Math.ceil(750 * item.ratio);
item.title = item.data.title;
// if(item.title != '精彩活动' && item.title!='热门品类' && item.title !='潮流品牌'){
// item.title = '';
// }
if(item.data.list && item.data.list[0]){
item.src = getImageUrl(item.data.list[0].src, item.data.imageWidth, item.data.imageHeight)
item.url = item.data.list[0].url
}
} else if (item.template_name =='new_recommend_content_five'){
//热门品类楼层
item.title = item.data.title.title;
item.moreUrl = item.data.more.url;
item.list = item.data.list;
for(var i=0;i<item.list.length;i++){
item.list[i].src = getImageUrl(item.list[i].src, 188, 198);
}
} else if (item.template_name == '3:4ImageListFloor'){
//潮流品牌图片列表
item.title = item.data.title;
item.list = item.data.list;
for(var i=0;i<item.list.length;i++){
item.list[i].src = getImageUrl(item.list[i].src,220,220);
}
let more = item.data.more;
if(more && more.url){
item.moreUrl = more.url;
}
} else if (item.template_name == 'popularListFloor' || item.template_name == 'newProductListFloor'){
//商品列表
for(var i = 0;i<item.data.list.length;i++){
try{
item.data.list[i].default_images = item.data.list[i].default_images.replace(/{width}/g, listImageWidth).replace(/{height}/g, listImageHeight).replace('{mode}', 2);
}catch(e){
console.log('--ReplaceError--')
}
item.data.list[i].index = index;
item.data.list[i].display_type = item.data.display_type; //1显示价格2显示店铺
}
} else if (item.template_name == 'image_list') {
//商品列表
for (var i = 0; i < item.data.list.length; i++) {
try{
item.data.list[i].src = item.data.list[i].src.replace(/{width}/g, 150).replace(/{height}/g, 150).replace('{mode}', 2);
}catch(e){
console.log('--ReplaceError--')
}
}
} else if (item.template_name == 'sv_new_user_floor') {
// 新人楼层
if (item.data && item.data.banner_image && item.data.banner_image.length > 0) {
for(var i = 0;i<item.data.banner_image.length;i++){
if (item.data.banner_image[i].src) {
try{
item.data.banner_image[i].src = item.data.banner_image[i].src.replace(/{width}/g, 1500).replace(/{height}/g, 720).replace('{mode}', 2);
}catch(e){
console.log('--ReplaceError--')
}
}
}
}
}
else{
item.template_name = "undefine";
}
index++;
newList.push(item);
})
return newList;
}
export{
parseHomeList
}
\ No newline at end of file
'use strict'
function getGoodInfo(data) {
let newData = [];
let idElement = '编号: '+data.erpProductId
newData.push(idElement)
newData.push('颜色: ' + data.colorName)
let gender = ''
if (data.gender == 1) {
gender = '男款'
} else if (data.gender == 2) {
gender = '女款'
} else if (data.gender == 3) {
gender = '通用'
}
if (gender) {
newData.push('性别: ' + gender)
}
data && data.standardBos.map((item, index) => {
let newItem=item.standardName+': '+item.standardVal
newData.push(newItem);
});
return newData;
}
function getGoodSize(data) {
let titleList = ['吊牌尺码']
data && data.sizeAttributeBos.map((item, index) => {
let newItem=item.attributeName;
titleList.push(newItem);
});
let sizeList=[]
data && data.sizeBoList.map((item, index) => {
let itemList=[];
itemList.push(item.sizeName)
item.sortAttributes.map((subItem,subIndex)=>{
itemList.push(subItem.sizeValue)
})
sizeList.push(itemList)
});
return {titleList,sizeList};
}
function getGoodImages(data,listImageWidth,listImageHeight){
let imageList=[]
data && data.map((item, index) => {
item=item.image_url.replace(/{width}/g, listImageWidth).replace(/{height}/g, listImageHeight).replace('{mode}',2);
imageList.push(item);
});
return imageList;
}
function getModelList(data){
let modelList=[]
let model = {}
data&&data.map((item,index) => {
model.name = item.modelName
model.height = item.height
model.weight = item.weight
model.vital =item.vitalStatistics
model.size = item.fitModelBo.fit_size
model.feel = item.fitModelBo.feel
modelList.push(item)
});
return modelList
}
module.exports = {
getGoodInfo,
getGoodSize,
getGoodImages,
getModelList,
}
\ No newline at end of file
'use strict'
//获取应用实例
let app = getApp();
const screenHeight = app.globalData.systemInfo.screenHeight;
const windowWidth = app.globalData.systemInfo.windowWidth;
const windowHeight = app.globalData.systemInfo.windowHeight;
const DEVICE_WIDTH_RATIO = windowWidth / 320;
let listWidth = Math.ceil(137.5 * DEVICE_WIDTH_RATIO);
let listHeight = Math.ceil(254 * DEVICE_WIDTH_RATIO);
const IMAGE_WIDTH = 145;
const IMAGE_HEIGHT = 193;
const IMAGE_RATIO = IMAGE_HEIGHT / IMAGE_WIDTH;
let listImageTop = 31;
let listImageWidthDefault = listWidth;
let listImageHeightDefault = Math.ceil(listWidth * IMAGE_RATIO);
function parseBrandListData(data, listImageWidth, listImageHeight) {
let newData = [];
let imageWidth = listImageWidth ? listImageWidth : listImageWidthDefault;
let imageHeight = listImageHeight ? listImageHeight : listImageHeightDefault;
data && data.map((item, index) => {
let salePrice = 0; // 售卖价
let originPrice = 0; // 原价
let salePriceStr = ''; // 拼接的售卖价
let originPriceStr = ''; // 拼接的原价
let showOriginPrice = true; // 是否显示原价
let salePriceFixed2 = '';
let originPriceFixed2 = '';
let isGlobalProduct = item.is_global && item.is_global == 'Y'; // 是否全球购商品
if (isGlobalProduct) {
salePrice = parseFloat(item.final_price);
originPrice = parseFloat(item.orign_price);
salePriceStr = item.formart_final_price;
originPriceStr = item.formart_orign_price;
} else {
salePrice = parseFloat(item.sales_price);
originPrice = parseFloat(item.market_price);
salePriceStr = '¥' + salePrice.toFixed(2);
originPriceStr = '¥' + originPrice.toFixed(2);
salePriceFixed2 = salePrice.toFixed(2);
originPriceFixed2 = originPrice.toFixed(2);
}
if (!originPrice || (salePrice == originPrice)) {
showOriginPrice = false;
}
item.showOriginPrice = showOriginPrice;
item.salePriceStr = salePriceStr;
item.originPriceStr = originPriceStr;
item.salePriceFixed2 = salePriceFixed2;
item.originPriceFixed2 = originPriceFixed2;
let default_images = item.default_images.replace(/{width}/g, imageWidth*2).replace(/{height}/g, imageHeight*2).replace('{mode}',2);
let shop_id = item.shop_id;
let shop_name = item.shop_name;
let newItem = {
product_skn: item.product_skn,
default_images,
product_name: item.product_name,
showOriginPrice,
shop_id,
shop_name,
salePriceStr,
originPriceStr,
originPriceFixed2,
salePriceFixed2,
is_shop_cart_add: item.is_shop_cart_add,//是否应该展示右侧的加入购物车按钮 默认不展示
};
newData.push(newItem);
});
return newData;
}
function cancelFilterSelectState(filters, exceptKey) {
let newFilters = {};
for (let itemKey in filters) {
if (filters.hasOwnProperty(itemKey)) {
if (itemKey != exceptKey) {
let newFilter = filters[itemKey];
newFilter.selected = false;
newFilters[itemKey] = newFilter;
}
}
}
return newFilters;
}
module.exports = {
parseBrandListData,
cancelFilterSelectState,
}