Commit 353f78d4 authored by 郝聪敏's avatar 郝聪敏

新增qs插件

parent 828f6d06
...@@ -3744,6 +3744,14 @@ ...@@ -3744,6 +3744,14 @@
"tough-cookie": "~2.4.3", "tough-cookie": "~2.4.3",
"tunnel-agent": "^0.6.0", "tunnel-agent": "^0.6.0",
"uuid": "^3.3.2" "uuid": "^3.3.2"
},
"dependencies": {
"qs": {
"version": "6.5.2",
"resolved": "http://npmprivate.quantgroups.com/qs/-/qs-6.5.2.tgz",
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==",
"dev": true
}
} }
} }
} }
...@@ -5113,10 +5121,9 @@ ...@@ -5113,10 +5121,9 @@
"dev": true "dev": true
}, },
"qs": { "qs": {
"version": "6.5.2", "version": "6.9.4",
"resolved": "http://npmprivate.quantgroups.com/qs/-/qs-6.5.2.tgz", "resolved": "http://npmprivate.quantgroups.com/qs/-/qs-6.9.4.tgz",
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", "integrity": "sha512-A1kFqHekCTM7cz0udomYUoYNWjBebHm/5wzU/XqrBRBNWectVH0QIiN+NEcZ0Dte5hvzHwbr8+XQmguPhJ6WdQ=="
"dev": true
}, },
"rc": { "rc": {
"version": "1.2.8", "version": "1.2.8",
...@@ -5343,6 +5350,12 @@ ...@@ -5343,6 +5350,12 @@
"uuid": "^3.3.2" "uuid": "^3.3.2"
}, },
"dependencies": { "dependencies": {
"qs": {
"version": "6.5.2",
"resolved": "http://npmprivate.quantgroups.com/qs/-/qs-6.5.2.tgz",
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==",
"dev": true
},
"tough-cookie": { "tough-cookie": {
"version": "2.5.0", "version": "2.5.0",
"resolved": "http://npmprivate.quantgroups.com/tough-cookie/-/tough-cookie-2.5.0.tgz", "resolved": "http://npmprivate.quantgroups.com/tough-cookie/-/tough-cookie-2.5.0.tgz",
......
...@@ -19,7 +19,8 @@ ...@@ -19,7 +19,8 @@
"dependencies": { "dependencies": {
"@wepy/core": "^2.0.0-alpha.16", "@wepy/core": "^2.0.0-alpha.16",
"@wepy/use-promisify": "^2.0.6", "@wepy/use-promisify": "^2.0.6",
"@wepy/x": "^2.0.2" "@wepy/x": "^2.0.2",
"qs": "^6.9.4"
}, },
"devDependencies": { "devDependencies": {
"@wepy/cli": "^2.0.0-alpha.28", "@wepy/cli": "^2.0.0-alpha.28",
......
...@@ -35,8 +35,8 @@ wepy.app({ ...@@ -35,8 +35,8 @@ wepy.app({
if (!wx.getStorageSync('openId')) { if (!wx.getStorageSync('openId')) {
const { code } = await wepy.wx.login(); const { code } = await wepy.wx.login();
const userInfo = await login(code); const userInfo = await login(code);
wx.setStorageSync('openId', userInfo.openId); wx.setStorageSync('openId', userInfo.openid);
wx.setStorageSync('isRegister', userInfo.isRegister); wx.setStorageSync('isRegister', userInfo.register);
} }
// wx.checkSession({ // wx.checkSession({
// success () { // success () {
......
import http from './wxRequest'; import http from './wxRequest';
import qs from 'qs';
module.exports = { module.exports = {
login(code) { login(code) {
return http.post(`/api/user/login?code=1235`); return http.post(`/api/user/login?code=${code}`);
}, },
register(params) { register(params) {
return http.post('/api/user/register', params, { 'content-type': 'application/json' }); return http.post('/api/user/register', params, { 'content-type': 'application/json' });
...@@ -14,10 +15,10 @@ module.exports = { ...@@ -14,10 +15,10 @@ module.exports = {
return http.post('/api/prize/list', params); return http.post('/api/prize/list', params);
}, },
getAwardsDetail(params) { getAwardsDetail(params) {
return http.post('/api/prize/batch', params); return http.post('/api/prize/batch', qs.stringify(params));
}, },
getActivityFeed(params) { getActivityFeed(params) {
return http.post('/api/activity/feed', params); return http.post('/api/prize/feed', qs.stringify(params));
}, },
addGold(params) { addGold(params) {
return http.post('/api/user/book', params); return http.post('/api/user/book', params);
...@@ -32,18 +33,18 @@ module.exports = { ...@@ -32,18 +33,18 @@ module.exports = {
return http.post('/api/user/join/list'); return http.post('/api/user/join/list');
}, },
getOneRaffle(params) { getOneRaffle(params) {
return http.post('/api/user/join/list',params); return http.post('/api/user/join/list', params);
}, },
getUserPhone() { getUserPhone() {
return http.post('/api/user/get/phone'); return http.post('/api/user/get/phone');
}, },
confirmRaffle(params) { confirmRaffle(params) {
return http.post('/api/user/join/confirm',params); return http.post('/api/user/join/confirm', params);
}, },
updateUserPhone(params) { updateUserPhone(params) {
return http.post('/api/user/update/phone',params); return http.post('/api/user/update/phone', params);
}, },
getPrize(params){ getPrize(params){
return http.post('/api/user/price/receive',params); return http.post('/api/user/price/receive', params);
} }
}; };
...@@ -8,7 +8,7 @@ const request = async (url, options) => { ...@@ -8,7 +8,7 @@ const request = async (url, options) => {
const safeAreaInsetTop = pages && pages.length > 0 ? pages[pages.length - 1].route === 'pages/index' : false; const safeAreaInsetTop = pages && pages.length > 0 ? pages[pages.length - 1].route === 'pages/index' : false;
const defaultOptions = { const defaultOptions = {
method: 'post', method: 'post',
header: { 'content-type': 'applicction/x-www-form-urlencoded' } header: { 'content-type': 'application/x-www-form-urlencoded' }
}; };
options = { ...defaultOptions, ...options }; options = { ...defaultOptions, ...options };
options.header = { options.header = {
......
...@@ -57,7 +57,6 @@ ...@@ -57,7 +57,6 @@
}, },
computed: { computed: {
isWin() { isWin() {
if (!this.joinRecord.id) return false;
return +this.joinRecord.status.value === 3; return +this.joinRecord.status.value === 3;
} }
}, },
...@@ -83,17 +82,16 @@ ...@@ -83,17 +82,16 @@
}, 500); }, 500);
}, 2000); }, 2000);
}, },
hideAnimation (){ hideAnimation() {
this.showAnimation = false; this.showAnimation = false;
}, },
go() { go() {
this.showAnimation = false; this.showAnimation = false;
//如果得奖了走 // 如果得奖了去领奖,否则去我的抽奖页面
if(this.isWin) { if (this.isWin) {
let id = 7; wx.navigateTo({url: '/pages/prize?joinRecordId=' + this.joinRecord.id});
wx.navigateTo({url:'/pages/prize?joinRecordId='+id})
} else { } else {
wx.navigateTo({url:'/pages/myraffles'}) wx.navigateTo({url: '/pages/myraffles'});
} }
} }
}, },
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<image class="add-gold-image" :src="addGoldUrl"></image> <image class="add-gold-image" :src="addGoldUrl"></image>
<span class="add-gold-num">+{{addGoldNum}}</span> <span class="add-gold-num">+{{addGoldNum}}</span>
</div> </div>
<div class="show-gold" @tap="showAnimation"> <div class="show-gold">
<div class="sunshine" v-if="addsunshine"></div> <div class="sunshine" v-if="addsunshine"></div>
<image class="show-gold-image" :class="{'gold-scale': addsunshine}" :src="goldUrl"></image> <image class="show-gold-image" :class="{'gold-scale': addsunshine}" :src="goldUrl"></image>
<span class="show-gold-num"> <span class="show-gold-num">
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
</template> </template>
<script> <script>
import wepy from '@wepy/core'; import wepy from '@wepy/core';
let timeout = null, timeout1 = null;
const images = { const images = {
sign: { sign: {
notComplete: '/static/images/sign@2x.png', notComplete: '/static/images/sign@2x.png',
...@@ -96,9 +95,6 @@ ...@@ -96,9 +95,6 @@
} }
}, },
computed: { computed: {
signUrl() {
return this.sign ? images['sign'].completed : images['sign'].notComplete;
},
goldUrl() { goldUrl() {
let result = images['gold'].goldOne; let result = images['gold'].goldOne;
if (this.des === 2) { if (this.des === 2) {
...@@ -161,16 +157,9 @@ ...@@ -161,16 +157,9 @@
} }
}, },
methods: { methods: {
handleTaps: function() {
this.showAnimation = !this.showAnimation;
[this.bgColor, this.fontColor] = [this.fontColor, this.bgColor];
},
signIn: function() { signIn: function() {
if (this.sign) return; if (this.sign) return;
this.$emit('sign-in', true); this.$emit('sign-in', true);
},
showAnimation: function() {
this.addGold = !this.addGold;
} }
}, },
created() { created() {
......
...@@ -179,7 +179,7 @@ ...@@ -179,7 +179,7 @@
this.prevQueue = [...this.prevQueue]; this.prevQueue = [...this.prevQueue];
}, },
async getProgress(id) { async getProgress(id) {
const detail = await getAwardsDetail(); const detail = await getAwardsDetail({ prizeId: id });
const progress = Math.round((detail.join / detail.quantity) * 100) + '%'; const progress = Math.round((detail.join / detail.quantity) * 100) + '%';
this.nextQueue.forEach(v => { this.nextQueue.forEach(v => {
if (v.id === id) { if (v.id === id) {
......
...@@ -238,8 +238,6 @@ ...@@ -238,8 +238,6 @@
<script> <script>
let touchDotX = 0, touchDotY = 0; let touchDotX = 0, touchDotY = 0;
let timeout = null;
let timeout1 = null;
import store from '../store'; import store from '../store';
import { mapState, mapActions } from '@wepy/x'; import { mapState, mapActions } from '@wepy/x';
import wepy from '@wepy/core'; import wepy from '@wepy/core';
...@@ -408,6 +406,7 @@ ...@@ -408,6 +406,7 @@
this.setUserInfo(e.$wx.detail.userInfo); this.setUserInfo(e.$wx.detail.userInfo);
await this.getMainInfo(); await this.getMainInfo();
this.authmodal = false; this.authmodal = false;
console.log('isRegister', wx.getStorageSync('isRegister'));
if (wx.getStorageSync('isRegister') === false) { if (wx.getStorageSync('isRegister') === false) {
const userInfo = { const userInfo = {
...e.$wx.detail.userInfo, ...e.$wx.detail.userInfo,
...@@ -501,14 +500,15 @@ ...@@ -501,14 +500,15 @@
}); });
}, },
onShareAppMessage: function(res) { onShareAppMessage: function(res) {
console.log(this.$wepy.userInfo, this.$wepy.awardsInfo);
if (res.from === 'button') { if (res.from === 'button') {
console.log('onShareAppMessage2', res.target); console.log('onShareAppMessage2', res.target);
} }
const openid = '提示:请注意 encodeURIComponent() 函数 与 encodeURI() 函数的区别之处,前者假定它的参数是 URI 的一部分(比如协议、主机名、路径或查询字符串)。因此 encodeURIComponent() 函数将转义用于分隔 URI 各个部分的标点符号。'; const openid = wx.getStorageSync('openId');
return { return {
title: '自定义转发标题', title: `${this.$wepy.userInfo.nickName || '您的好朋友'}邀请您来抽奖啦~`,
path: `/pages/index?openid=${openid}`, path: `/pages/index?openid=${openid}`,
imageUrl: '', imageUrl: this.$wepy.awardsInfo.photoUrl,
success: function(res) { success: function(res) {
let shareId = res.shareTickets[0]; let shareId = res.shareTickets[0];
console.log('shareId', shareId); console.log('shareId', shareId);
...@@ -523,6 +523,7 @@ ...@@ -523,6 +523,7 @@
}, },
getAwards: function() { getAwards: function() {
const { batchId, photoUrl, quantity, name, chance, progress } = this.awardsInfo; const { batchId, photoUrl, quantity, name, chance, progress } = this.awardsInfo;
if (!batchId) return;
wx.navigateTo({ wx.navigateTo({
url: `/pages/raffle?batchId=${batchId}&progress=${progress}&chance=${chance}&photoUrl=${photoUrl}&quantity=${quantity}&name=${name}` url: `/pages/raffle?batchId=${batchId}&progress=${progress}&chance=${chance}&photoUrl=${photoUrl}&quantity=${quantity}&name=${name}`
}); });
...@@ -567,27 +568,27 @@ ...@@ -567,27 +568,27 @@
} }
}); });
} }
this.list = [ // this.list = [
{value: 1, text: '白色条纹马克杯,马克吐温同款1', imgsrc: '/static/images/test1.jpg', price: '¥399.00', people: 2200, sku: '100004549235'}, // {value: 1, text: '白色条纹马克杯,马克吐温同款1', imgsrc: '/static/images/test1.jpg', price: '¥399.00', people: 2200, sku: '100004549235'},
{value: 2, text: '白色条纹马克杯,马克吐温同款2', imgsrc: '/static/images/test2.png', price: '¥1399.22', people: 2200, sku: '2004203'}, // {value: 2, text: '白色条纹马克杯,马克吐温同款2', imgsrc: '/static/images/test2.png', price: '¥1399.22', people: 2200, sku: '2004203'},
{value: 3, text: '白色条纹马克杯,马克吐温同款3', imgsrc: '/static/images/peo1.jpg', price: '¥199.22', people: 2200, sku: '17818909707'}, // {value: 3, text: '白色条纹马克杯,马克吐温同款3', imgsrc: '/static/images/peo1.jpg', price: '¥199.22', people: 2200, sku: '17818909707'},
{value: 4, text: '白色条纹马克杯,马克吐温同款4', imgsrc: '/static/images/peo2.jpg', price: '¥134.12', people: 2200, sku: '67704484242'}, // {value: 4, text: '白色条纹马克杯,马克吐温同款4', imgsrc: '/static/images/peo2.jpg', price: '¥134.12', people: 2200, sku: '67704484242'},
{value: 5, text: '白色条纹马克杯,马克吐温同款5', imgsrc: '/static/images/peo3.jpg', price: '¥194.22', people: 2200, sku: '100004549235'}, // {value: 5, text: '白色条纹马克杯,马克吐温同款5', imgsrc: '/static/images/peo3.jpg', price: '¥194.22', people: 2200, sku: '100004549235'},
{value: 6, text: '白色条纹马克杯,马克吐温同款6', imgsrc: '/static/images/peo1.jpg', price: '¥292.22', people: 2200, sku: '100004549235'}, // {value: 6, text: '白色条纹马克杯,马克吐温同款6', imgsrc: '/static/images/peo1.jpg', price: '¥292.22', people: 2200, sku: '100004549235'},
{value: 7, text: '白色条纹马克杯,马克吐温同款7', imgsrc: '/static/images/test1.jpg', price: '¥1399.92', people: 2200, sku: '100004549235'}, // {value: 7, text: '白色条纹马克杯,马克吐温同款7', imgsrc: '/static/images/test1.jpg', price: '¥1399.92', people: 2200, sku: '100004549235'},
{value: 8, text: '白色条纹马克杯,马克吐温同款8', imgsrc: '/static/images/test2.png', price: '¥1399.98', people: 2200, sku: '100004549235'}, // {value: 8, text: '白色条纹马克杯,马克吐温同款8', imgsrc: '/static/images/test2.png', price: '¥1399.98', people: 2200, sku: '100004549235'},
{value: 9, text: '白色条纹马克杯,马克吐温同款9', imgsrc: '/static/images/peo3.jpg', price: '¥1399.78', people: 2200, sku: '100004549235'}, // {value: 9, text: '白色条纹马克杯,马克吐温同款9', imgsrc: '/static/images/peo3.jpg', price: '¥1399.78', people: 2200, sku: '100004549235'},
{value: 10, text: '白色条纹马克杯,马克吐温同款10', imgsrc: '/static/images/peo2.jpg', price: '¥1399.67', people: 2200, sku: '100004549235'} // {value: 10, text: '白色条纹马克杯,马克吐温同款10', imgsrc: '/static/images/peo2.jpg', price: '¥1399.67', people: 2200, sku: '100004549235'}
]; // ];
let urls = [ // let urls = [
// 'https://www.apple.com/105/media/us/iphone-x/2017/01df5b43-28e4-4848-bf20-490c34a926a7/films/feature/iphone-x-feature-tpl-cc-us-20170912_1920x1080h.mp4', // // 'https://www.apple.com/105/media/us/iphone-x/2017/01df5b43-28e4-4848-bf20-490c34a926a7/films/feature/iphone-x-feature-tpl-cc-us-20170912_1920x1080h.mp4',
// 'https://xyqblogo.lkbang.net/VID_20200508_171710.mp4', // // 'https://xyqblogo.lkbang.net/VID_20200508_171710.mp4',
// 'https://xyqblogo.lkbang.net/VID_20200508_171710.mp4', // // 'https://xyqblogo.lkbang.net/VID_20200508_171710.mp4',
// 'https://xyqblogo.lkbang.net/VID_20200508_171710.mp4' // // 'https://xyqblogo.lkbang.net/VID_20200508_171710.mp4'
'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1590151556813&di=44964ab823b5fb5f3fadcf9ceb87553b&imgtype=0&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201503%2F07%2F20150307113019_FSEFE.thumb.700_0.png', // 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1590151556813&di=44964ab823b5fb5f3fadcf9ceb87553b&imgtype=0&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201503%2F07%2F20150307113019_FSEFE.thumb.700_0.png',
'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2944016076,351466175&fm=26&gp=0.jpg', // 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2944016076,351466175&fm=26&gp=0.jpg',
'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1590151520979&di=beba310e6bc314f7dd7ede841d068f68&imgtype=0&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201610%2F05%2F20161005092600_jCmSx.thumb.700_0.jpeg' // 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1590151520979&di=beba310e6bc314f7dd7ede841d068f68&imgtype=0&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201610%2F05%2F20161005092600_jCmSx.thumb.700_0.jpeg'
]; // ];
this.videoList = await getPrizeList(); this.videoList = await getPrizeList();
// this.videoList = urls.map((url, index) => ({ id: index + 1, url, type: 'image' })); // this.videoList = urls.map((url, index) => ({ id: index + 1, url, type: 'image' }));
}, },
...@@ -596,12 +597,20 @@ ...@@ -596,12 +597,20 @@
this.inviter = options.openid; this.inviter = options.openid;
} }
// 如果已经存在store里就不用再获取用户信息了 // 如果已经存在store里就不用再获取用户信息了
this.adlist = await getActivityFeed(); this.adlist = await getActivityFeed({ count: 50 });
if (!this.userInfo) { if (!this.userInfo) {
const setting = await wepy.wx.getSetting(); const setting = await wepy.wx.getSetting();
if (setting.authSetting['scope.userInfo']) { if (setting.authSetting['scope.userInfo']) {
const { userInfo } = wepy.wx.getUserInfo(); const { userInfo } = await wepy.wx.getUserInfo();
this.setUserInfo(userInfo); this.setUserInfo(userInfo);
if (wx.getStorageSync('isRegister') === false) {
const params = {
...userInfo,
inviter: this.inviter
};
await register(params);
wx.setStorageSync('isRegister', true);
}
await this.getMainInfo(); await this.getMainInfo();
} else { } else {
this.authmodal = true; this.authmodal = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment