Authored by huangyi

完成渠道化需求基本功能

... ... @@ -22,7 +22,7 @@ Component({
}
},
dada: {
data: {
isShow: false,
},
... ...
export const API_HOST = 'https://api.yoho.cn';
export const SERVICE_HOST = 'https://api.yoho.cn';
//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 = 'http://192.168.102.49:6006';
// export const ACTIVITY_HOST = 'http://172.16.10.53:6006'
// export const ACTIVITY_HOST = 'http://yoho-activity-platform.test3.ingress.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 API_HOST = 'http://dev-api.yohops.com:9999';
... ... @@ -14,8 +14,8 @@ 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-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';
... ...
... ... @@ -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>
</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>抽奖价 ¥
<text class="lucky">0</text>
</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">{{product.price}}</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;
... ...
... ... @@ -17,8 +17,8 @@ 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';
const ACTIVITY = {
UNKNOWN: 0,
... ... @@ -71,11 +71,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,
... ... @@ -98,12 +98,14 @@ Page(Object.assign({
}
]
},
animation: null,
shareFlag:false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
onLoad: function (options) {
app = getApp();
this.service = new ZeroSellService();
... ... @@ -135,12 +137,13 @@ Page(Object.assign({
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {},
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
onShow: function () {
wx.showLoading({
mask: true
});
... ... @@ -153,7 +156,7 @@ Page(Object.assign({
isLogin: app.isLogin(),
uid
})
this._getMineCode();
this._getUser();
this._getGroupList();
... ... @@ -172,21 +175,21 @@ Page(Object.assign({
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
onPullDownRefresh: function () {
wx.showLoading({
mask: true
});
... ... @@ -198,7 +201,7 @@ Page(Object.assign({
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
onReachBottom: function () {
if (this.data.loading) return;
let page = this.data.page || 1;
page = page + 1;
... ... @@ -227,13 +230,13 @@ Page(Object.assign({
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
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() {
... ... @@ -243,7 +246,32 @@ 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;
let animation = wx.createAnimation({
duration: 400 * len,
})
this.setData({
codeList: res.data,
})
this.animation = animation
setTimeout(function () {
let query = wx.createSelectorQuery();
query.select('.code-list-item-container').boundingClientRect();
query.exec((res) => {
animation.height(res[0].height - 63).step();
this.setData({
animation: animation.export()
})
})
}.bind(this), 400);
})
}
},
_getGroupList() {
this.commonService.getGroupList({
limit: 20,
... ... @@ -389,7 +417,6 @@ Page(Object.assign({
step: step
});
},
_setActionStatus() {
let status = ACTION_BAR_STATUS.START;
let activityStatus = this.data.product.status;
... ... @@ -398,7 +425,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;
... ... @@ -505,16 +532,25 @@ Page(Object.assign({
TITLE: `【0元抽奖】点一下,免费拿走${this.data.product.name}`,
DESC: '我在YO!LUCK发现一个不错的商品赶快来看看吧!'
};
this.setData({
shareFlag: true
})
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() {}
success: ()=> {
this.setData({
shareFlag: false
})
},
fail: ()=> {
this.setData({
shareFlag: false
})
}
};
} else if (res.from === 'button') {
// 用户点击分享按钮
... ... @@ -523,9 +559,16 @@ Page(Object.assign({
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() {}
success: ()=> {
this.setData({
shareFlag: false
})
},
fail: ()=> {
this.setData({
shareFlag: false
})
}
};
}
},
... ... @@ -533,10 +576,10 @@ Page(Object.assign({
router.go('index');
},
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,
... ... @@ -544,31 +587,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)
});
... ... @@ -576,7 +620,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,
... ... @@ -617,13 +661,13 @@ 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) {
getUnionID(app.getWechatThirdSession(), function (response) {
// console.log(response)
})
}
... ...
<!--page/subPackage/pages/zeroSell/detail.wxml-->
<block wx:if="{{show}}">
<view class="header">
<view class="header">
<product-header product="{{product}}" avatars="{{avatars}}"></product-header>
<product-header product="{{product}}" shareFlag="{{shareFlag}}" 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>
</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">
<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}}">
<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>
</view>
</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}}">
<more wx:if="{{recommends.length > 0}}">
<block wx:for="{{recommends}}">
<view class="product-item" >
<view class="product-item">
<product-item product="{{item}}"></product-item>
</view>
</block>
</more>
</more>
<view class="fellow-bar" wx:if="{{product.status}}">
<view class="fellow-bar" wx:if="{{product.status}}">
<fellow-bar></fellow-bar>
</view>
<group-recommend groupRecommendList="{{groupList}}" bindgoToGroupMiniApp="goToGroupMiniApp">
</group-recommend>
</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"
<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>
<block wx:else>
... ... @@ -50,13 +68,13 @@
</block>
</view>
</block>
</view>
<view class="foot"></view>
</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 +84,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>
... ...
... ... @@ -105,3 +105,75 @@
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 .code-list {
position: relative;
width: 410rpx;
height:22rpx;
margin: 120rpx auto 0 74rpx;
overflow: hidden;
}
.code-list .code-list-item {
margin-top:-9rpx;
width: 410rpx;
height: 164rpx;
overflow: hidden;
}
.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: contain;
background-repeat: no-repeat;
overflow: hidden;
}
.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;
}
... ...
... ... @@ -151,7 +151,6 @@ Page(Object.assign({
this.setData({
footText: '内容加载中...'
});
return this.service.getMyList({type, page}).then(result => {
if(result.code !== 200 || result.data.length === 0) {
... ...
... ... @@ -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',
... ...
... ... @@ -29,7 +29,7 @@
"list": []
},
"miniprogram": {
"current": 4,
"current": 5,
"list": [
{
"id": 0,
... ... @@ -65,6 +65,12 @@
"pathName": "pages/bindPhoneNumber/bindPhoneNumber",
"query": "",
"scene": "1011"
},
{
"id": -1,
"name": "YOLUCK DETAIL",
"pathName": "pages/zeroSell/detail",
"query": "actPrizeId=41"
}
]
}
... ...