Authored by 李奇

Merge branch 'hotfix/onlaunch' into 'master'

Hotfix/onlaunch



See merge request !6
import Taro from '@tarojs/taro';
import getPrivateKey from './getPrivateKey'
import config from '../../config.js'
import trimObject from './utils/trimObject.js'
... ... @@ -151,6 +152,17 @@ const sendRequest = (resolve, reject, options) => {
const statusCode = res.statusCode;
const errMsg = res.message;
const data = res.data;
// 活动平台限流
if(res.statusCode === 503 && url.indexOf(config.domains.activityHost) > -1) {
Taro.showToast({
title: '目前参与人数过多请下拉刷新',
icon: 'none',
duration: 2000
});
return reject({ code: 503, message: '目前参与人数过多请下拉刷新' });
}
if (res.statusCode === 401) {
try {
const analytics = global.analytics;
... ... @@ -183,6 +195,16 @@ const sendRequest = (resolve, reject, options) => {
fail: function (err) {
const code = err.code ? err.code : 800;
const message = err.message ? err.message : '';
// 活动平台限流
if (code === 503 && url.indexOf(config.domains.activityHost) > -1) {
Taro.showToast({
title: '目前参与人数过多请下拉刷新',
icon: 'none',
duration: 2000
});
return reject({ code: 503, message: '目前参与人数过多请下拉刷新' });
}
reject({ code, message });
},
complete: options.complete, // 无论成功还是失败, 都会调用,可以用于取消 loading 等
... ...
<!--page/subPackage/pages/zeroSell/components/action-bar.wxml-->
<form bindsubmit='submitFormId' report-submit='true'>
<view class="action-bar">
<view class="action-item action-list" bindtap="goList">
<button form-type="submit" class="action-item action-list fix-button" bindtap="goList">
<image class="action-image" src="../images/list_icon@2x.png"></image>
</view>
</button>
<block wx:if="{{status === 1}}">
<view class="action-item over">即将开始</view>
... ... @@ -16,13 +16,13 @@
</block>
<block wx:elif="{{status === 3}}">
<view class="action-item confirm" bindtap="goMyList">
我的抽奖码({{num}})
</view>
<button form-type="submit" class="action-item confirm fix-button" bindtap="goMyList">
我的抽奖码({{num}})
</button>
<view class="action-item ok" bindtap="goShare">
获取更多抽奖码
</view>
<button form-type="submit" class="action-item ok fix-button" bindtap="goShare">
获取更多抽奖码
</button>
</block>
<block wx:elif="{{status === 4}}">
... ... @@ -45,6 +45,8 @@
<view class="action-item over">活动已结束</view>
</block>
</view>
</form>
<zero-alert wx:if="{{show}}">
<view class="code-alert">
... ... @@ -59,9 +61,6 @@
<button class="foot-item" plain="true" hover-class="none" form-type="submit" bindtap="cancelAlert">取消</button>
</view>
</form>
<!-- <view class="foot-item info" bindtap="goShare">去分享</view>
<view class="foot-item" bindtap="cancelAlert">取消</view> -->
</zero-alert>
<zero-alert wx:if="{{error}}">
... ... @@ -75,4 +74,4 @@
</view>
</zero-alert>
<fellow-alert show="{{fellow}}" bindok="cancelAlert"></fellow-alert>
\ No newline at end of file
<fellow-alert show="{{fellow}}" bindok="cancelAlert"></fellow-alert>
... ...
... ... @@ -17,6 +17,17 @@
background-color: white;
}
.action-item.fix-button {
display: inline-block;
border-radius: 0;
border: none;
}
.action-item.fix-button:after {
border-radius: 0;
border: none;
}
.action-list {
flex: 0;
position: relative;
... ... @@ -31,7 +42,7 @@
left: 50%;
/* transform: translateY(-50%); */
transform: translate(-50%, -50%);
}
.ok {
... ...
// page/subPackage/pages/zeroSell/components/prize-item.js
import router from '../router/router'
import commonService from '../service/commonService'
const PRODUCT_STATUS = {
UNKNOWN: 0, // 活动关闭
}
const common = new commonService();
Component({
/**
* 组件的属性列表
... ... @@ -40,7 +43,9 @@ Component({
show: false
})
},
goDetail() {
goDetail(e) {
if (e.target.dataset.code) return;
if (this.properties.item.status === PRODUCT_STATUS.UNKNOWN) {
wx.showModal({
title: 'OOPS',
... ... @@ -52,6 +57,11 @@ Component({
actPrizeId: this.properties.item.act_prize_id
});
}
},
submitFormId(e) {
return common.addWechatFormId({
formId: e.detail.formId,
});
}
},
... ...
<!--page/subPackage/pages/zeroSell/components/prize-item.wxml-->
<form bindsubmit='submitFormId' report-submit='true'>
<view class="prize-item" bindtap="goDetail">
<image class="product-image" src="{{item.cover_img}}"></image>
<image class="product-image" src="{{item.cover_img}}"></image>
<view class="content">
<view class="code">抽奖码 <text style="color: black;">{{item.prize_code}}</text></view>
<view class="product-name" >{{item.name}}</view>
<block wx:if="{{item.status === 4}}">
<view class="btn" catchtap="goFellow">查看中奖信息</view>
</block>
... ... @@ -21,11 +21,11 @@
</block>
<block wx:else>
<view class="btn" catchtap="goShare">获得更多抽奖码</view>
<button form-type="submit" class="btn fix-button" bindtap="goShare" data-code="true">获得更多抽奖码</button>
</block>
</view>
</view>
</form>
<fellow-alert show="{{show}}" bindok="onOk"></fellow-alert>
\ No newline at end of file
<fellow-alert show="{{show}}" bindok="onOk"></fellow-alert>
... ...
... ... @@ -42,3 +42,13 @@
color: white;
background-color: #222;
}
.btn.fix-button {
line-height: inherit;
border-radius: 0;
font-size: 24rpx;
}
.btn.fix-button:after {
border-radius: 0;
}
... ...
... ... @@ -16,7 +16,8 @@ import {
} from '../../vendors/zanui/index';
import router from './router/router'
import {wrapperName} from './helper'
import { formatImageUrl } from '../../utils/util'
import { formatImageUrl, getYHStorageSync } from '../../utils/util'
import event from '../../utils/event'
import { jumpByUrl } from '../../libs/urlRoute';
import {getGlobalData, getUid, getStorageUserInfo, isLogin, setUserInfo} from '../../utils/index'
import {login as loginModel} from '../../models'
... ... @@ -241,6 +242,7 @@ Page(Object.assign({
recommends: r2.code === 200 ? r2.data : [],
avatars: (r3).map(i => {
i.user_name = wrapperName(i.user_name);
i.user_thumb = formatImageUrl(i.user_thumb, 60, 60);
return i;
}),
... ... @@ -373,7 +375,7 @@ Page(Object.assign({
_getUser() {
const userInfo = getStorageUserInfo();
if (isLogin() && (!userInfo || !userInfo.nickName)) {
... ... @@ -442,10 +444,22 @@ Page(Object.assign({
router.go('index');
},
goLogin() {
event.emit('user-is-login', {logged: this.logged, loginSuccess: this.loginSuccess});
},
logged() {
},
loginSuccess() {
},
getUserInfo: function(e) {
var that = this;
if (e.detail.errMsg === 'getUserInfo:ok') {
decodeUnionId(app.getWechatThirdSession(), e, function(response) {
decodeUnionId(that.getWechatThirdSession(), e, function(response) {
if (response.isHaveUnionID) {
that.setData({
hasUnionID: true,
... ... @@ -513,6 +527,10 @@ Page(Object.assign({
})
}
},
getWechatThirdSession() {
return getYHStorageSync('WXThird_session','app') || '';
},
//跳转到登录页面
loginAndRegisterTapped(needBind) {
let that = this;
... ... @@ -532,7 +550,7 @@ Page(Object.assign({
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(that.getWechatThirdSession(), function(response) {
// console.log(response)
})
}
... ... @@ -549,7 +567,7 @@ Page(Object.assign({
wx.navigateTo({
url: '/pages/bindPhoneNumber/bindPhoneNumber'
});
}
}
}
})
} else {
... ...
... ... @@ -7,9 +7,9 @@
<view style="height: 20rpx;"></view>
</view>
<counter count="{{participantCount}}" num="{{product.limit}}" status="{{product.status}}"></counter>
<counter wx:if="{{false}}" count="{{participantCount}}" num="{{product.limit}}" status="{{product.status}}"></counter>
<prize-progress step="{{step}}"></prize-progress>
<prize-progress step="{{step}}" wx:if="{{false}}"></prize-progress>
<view class="help">
<help></help>
</view>
... ... @@ -36,7 +36,7 @@
</view>
<block wx:if="{{product.status === 2}}">
<button class="action-item confirm" open-type="{{!hasUnionID ? 'getUserInfo':'getPhoneNumber'}}" bindgetphonenumber="getPhoneNumber" bindgetuserinfo='getUserInfo'>0元参加抽奖</button>
<button class="action-item confirm" bindtap="goLogin">0元参加抽奖</button>
</block>
<block wx:else>
... ... @@ -58,8 +58,3 @@
<import src="../../vendors/toast/wetoast.wxml"/>
<template is="wetoast" data="{{...__wetoast__}}"/>
<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>
</zero-alert>
... ...
... ... @@ -42,12 +42,11 @@ export default class yas {
});
}
uploadData(params) {
let self = this;
let sid = '';
let globalData = getGlobalData();
let globalData = getGlobalData() || {};
if (this.app && this.app.globalData) {
sid = globalData.sid || '';
}
sid = self.app.globalData && self.app.globalData.sid || globalData.sid || '';
return Taro.request({
url: config.domains.yasHost,
... ... @@ -114,14 +113,14 @@ export default class yas {
}
},
complete() {
let globalData = getGlobalData();
let globalData = getGlobalData() || {};
let userData = globalData.userInfo || {};
if (!Object.keys(userData).length) {
userData = Taro.getStorageSync('userInfo') || {};
}
let ch = globalData.ch || '';
let ch = self.app.globalData && self.app.globalData.ch || globalData.ch || '';
let uid = userData.uid || '';
self.deviceInfo.ch = ch;
... ... @@ -133,7 +132,7 @@ export default class yas {
ts: new Date().getTime(),
op: event,
uid: uid,
sid: globalData.sid || ''
sid: self.app.globalData && self.app.globalData.sid ||globalData.sid || ''
}]
}));
}
... ...