Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mini-program-wepy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
mini-program-wepy
Commits
eee933be
Commit
eee933be
authored
Jun 15, 2020
by
ziyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 优化代码暂存
parent
ca35f130
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
18 additions
and
21 deletions
+18
-21
prizeList.wpy
src/components/custom/prizeList.wpy
+4
-5
index.wpy
src/pages/index.wpy
+5
-5
raffle.wpy
src/pages/raffle.wpy
+9
-11
peo1.jpg
static/images/peo1.jpg
+0
-0
peo2.jpg
static/images/peo2.jpg
+0
-0
peo3.jpg
static/images/peo3.jpg
+0
-0
play.png
static/images/play.png
+0
-0
selected.png
static/images/selected.png
+0
-0
selectno.png
static/images/selectno.png
+0
-0
test1.jpg
static/images/test1.jpg
+0
-0
test2.png
static/images/test2.png
+0
-0
No files found.
src/components/custom/prizeList.wpy
View file @
eee933be
...
@@ -116,7 +116,7 @@
...
@@ -116,7 +116,7 @@
import wepy from '@wepy/core';
import wepy from '@wepy/core';
import { getProbability } from '../../common/raffleProbability';
import { getProbability } from '../../common/raffleProbability';
import { getAwardsDetail } from '../../common/api.js';
import { getAwardsDetail } from '../../common/api.js';
let _videoContexts = [];
wepy.component({
wepy.component({
props: {
props: {
videoList: {
videoList: {
...
@@ -131,7 +131,6 @@
...
@@ -131,7 +131,6 @@
data: {
data: {
pause: false,
pause: false,
curQueue: [],
curQueue: [],
_videoContexts: [],
current: 0
current: 0
},
},
watch: {
watch: {
...
@@ -177,7 +176,7 @@
...
@@ -177,7 +176,7 @@
},
},
_videoListChanged (newVal) {
_videoListChanged (newVal) {
this.curQueue = newVal.map((item, index) => {
this.curQueue = newVal.map((item, index) => {
this.
_videoContexts.push(item.videoUrl ? wx.createVideoContext(`video_${index}`, this.$wx) : null);
_videoContexts.push(item.videoUrl ? wx.createVideoContext(`video_${index}`, this.$wx) : null);
item.time = 0;
item.time = 0;
return item;
return item;
});
});
...
@@ -220,7 +219,7 @@
...
@@ -220,7 +219,7 @@
playCurrent(current) {
playCurrent(current) {
if (!this.curQueue || this.curQueue.length <= 1) return;
if (!this.curQueue || this.curQueue.length <= 1) return;
// 播放当前视频
// 播放当前视频
this.
_videoContexts.forEach((ctx, index) => {
_videoContexts.forEach((ctx, index) => {
if (index !== current) {
if (index !== current) {
ctx && ctx.pause();
ctx && ctx.pause();
} else {
} else {
...
@@ -240,7 +239,7 @@
...
@@ -240,7 +239,7 @@
},
},
videoTap(e) {
videoTap(e) {
const current = e.currentTarget.dataset.index;
const current = e.currentTarget.dataset.index;
this.
_videoContexts.forEach((ctx, index) => {
_videoContexts.forEach((ctx, index) => {
if (index === current) {
if (index === current) {
this.pause ? ctx.play() : ctx.pause();
this.pause ? ctx.play() : ctx.pause();
}
}
...
...
src/pages/index.wpy
View file @
eee933be
...
@@ -205,6 +205,7 @@
...
@@ -205,6 +205,7 @@
import Notify from '../components/vant/notify/notify';
import Notify from '../components/vant/notify/notify';
import Dialog from '../components/vant/dialog/dialog';
import Dialog from '../components/vant/dialog/dialog';
import { login, register, getMainInfo, addGold, getPrizeList, signIn, getActivityFeed, checkCornCode } from '../common/api.js';
import { login, register, getMainInfo, addGold, getPrizeList, signIn, getActivityFeed, checkCornCode } from '../common/api.js';
let awardsInfo = {};
wepy.page({
wepy.page({
store,
store,
data: {
data: {
...
@@ -216,7 +217,6 @@
...
@@ -216,7 +217,6 @@
inviter: '',
inviter: '',
mainInfo: null,
mainInfo: null,
showModal: 0, // 1: 展示领取金币弹窗 2: 展示抽奖弹窗 3: 头像菜单弹窗
showModal: 0, // 1: 展示领取金币弹窗 2: 展示抽奖弹窗 3: 头像菜单弹窗
awardsInfo: {},
isReceive: false, // 是否显示领取克币动画
isReceive: false, // 是否显示领取克币动画
cornModal:false,
cornModal:false,
cornCode: '', //克币充值码
cornCode: '', //克币充值码
...
@@ -314,8 +314,8 @@
...
@@ -314,8 +314,8 @@
const openid = wx.getStorageSync('openId');
const openid = wx.getStorageSync('openId');
return {
return {
title: `${(this.$wepy.userInfo && this.$wepy.userInfo.nickName) || '您的好朋友'}邀请您来抽奖啦~`,
title: `${(this.$wepy.userInfo && this.$wepy.userInfo.nickName) || '您的好朋友'}邀请您来抽奖啦~`,
path: `/pages/index?openid=${openid}&prizeId=${
this.$wepy.
awardsInfo.id}`,
path: `/pages/index?openid=${openid}&prizeId=${awardsInfo.id}`,
imageUrl: decodeURIComponent(
this.$wepy.
awardsInfo.photoUrl),
imageUrl: decodeURIComponent(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);
...
@@ -326,7 +326,7 @@
...
@@ -326,7 +326,7 @@
};
};
},
},
getAwards: function() {
getAwards: function() {
const { id, photoUrl, name, chance } =
this.
awardsInfo;
const { id, photoUrl, name, chance } = awardsInfo;
if ((!id && id !== 0) || !this.mainInfo || !this.mainInfo.account) {
if ((!id && id !== 0) || !this.mainInfo || !this.mainInfo.account) {
Notify({ message: '服务器异常,请稍后重试', safeAreaInsetTop: true });
Notify({ message: '服务器异常,请稍后重试', safeAreaInsetTop: true });
return;
return;
...
@@ -345,7 +345,7 @@
...
@@ -345,7 +345,7 @@
});
});
},
},
getAwardsInfo: function(v) {
getAwardsInfo: function(v) {
this.
awardsInfo = v;
awardsInfo = v;
},
},
showMenu: function(v) {
showMenu: function(v) {
this.showModal = v ? 3 : 0;
this.showModal = v ? 3 : 0;
...
...
src/pages/raffle.wpy
View file @
eee933be
...
@@ -253,21 +253,19 @@
...
@@ -253,21 +253,19 @@
import Dialog from '../components/vant/dialog/dialog';
import Dialog from '../components/vant/dialog/dialog';
import { updateUserPhone, confirmRaffle, register, login, getAwardsDetail, checkInnerCode } from '../common/api';
import { updateUserPhone, confirmRaffle, register, login, getAwardsDetail, checkInnerCode } from '../common/api';
import store from '../store';
import store from '../store';
let hasPhone = false, innerActivity= '', batchId = null;
wepy.page({
wepy.page({
store,
store,
data: {
data: {
progress: '0%',
progress: '0%',
progressStyle: 'width:0%',
progressStyle: 'width:0%',
isCheck: true,
isCheck: true,
batchId: null,
quantity: '',
quantity: '',
name: '',
name: '',
chance: '',
chance: '',
photoUrl: '',
photoUrl: '',
btnfont: '立即参与',
btnfont: '立即参与',
hasPhone: false,
isInnerDone: 'hide',
isInnerDone: 'hide',
innerActivity: '',
isError: false,
isError: false,
code: '',
code: '',
errorText: '',
errorText: '',
...
@@ -285,7 +283,7 @@
...
@@ -285,7 +283,7 @@
function goprize() {
function goprize() {
updateUserPhone(detail).then(() => {
updateUserPhone(detail).then(() => {
wx.setStorageSync('hasPhone', true);
wx.setStorageSync('hasPhone', true);
that.
hasPhone = true;
hasPhone = true;
that.joinin();
that.joinin();
}).catch(() => {
}).catch(() => {
that.btnfont = '立即参与';
that.btnfont = '立即参与';
...
@@ -319,7 +317,7 @@
...
@@ -319,7 +317,7 @@
wx.setStorageSync('isRegister', true);
wx.setStorageSync('isRegister', true);
}
}
this.btnfont = '参与中...';
this.btnfont = '参与中...';
confirmRaffle({batchId:
this.
batchId}).then(data => {
confirmRaffle({batchId: batchId}).then(data => {
this.btnfont = '立即参与';
this.btnfont = '立即参与';
let code = data.joinCode;
let code = data.joinCode;
if (code === undefined) code = 3;
if (code === undefined) code = 3;
...
@@ -342,9 +340,9 @@
...
@@ -342,9 +340,9 @@
Notify({message: '勾选同意后才可以抽奖!'});
Notify({message: '勾选同意后才可以抽奖!'});
return;
return;
}
}
if (
this.
hasPhone) {
if (hasPhone) {
// 当有innerActivity并且没有邀请码(没有验证过)并且不是VIP的时候才显示modal
// 当有innerActivity并且没有邀请码(没有验证过)并且不是VIP的时候才显示modal
if (
this.innerActivity && !this.innerActivity.haveCode && !this.
innerActivity.vip) {
if (
innerActivity && !innerActivity.haveCode && !
innerActivity.vip) {
this.showModal();
this.showModal();
} else {
} else {
this.confirmRaff();
this.confirmRaff();
...
@@ -354,7 +352,7 @@
...
@@ -354,7 +352,7 @@
async getProgress(id) {
async getProgress(id) {
let detail = await getAwardsDetail({ prizeId: id });
let detail = await getAwardsDetail({ prizeId: id });
detail = detail || {};
detail = detail || {};
this.
batchId = detail.id;
batchId = detail.id;
if (detail.quantity) {
if (detail.quantity) {
if (detail.join > detail.quantity) detail.join = detail.quantity;
if (detail.join > detail.quantity) detail.join = detail.quantity;
const progressFloat = detail.join / detail.quantity;
const progressFloat = detail.join / detail.quantity;
...
@@ -403,7 +401,7 @@
...
@@ -403,7 +401,7 @@
},
},
computed: {
computed: {
opentype() {
opentype() {
if (this.isCheck && !
this.
hasPhone) {
if (this.isCheck && !hasPhone) {
return 'getPhoneNumber';
return 'getPhoneNumber';
} else {
} else {
return '';
return '';
...
@@ -420,12 +418,12 @@
...
@@ -420,12 +418,12 @@
onLoad (query) {
onLoad (query) {
let {prizeId, quantity, name, chance, photoUrl} = query;
let {prizeId, quantity, name, chance, photoUrl} = query;
this.getProgress(prizeId);
this.getProgress(prizeId);
this.hasPhone = wx.getStorageSync('hasPhone');
this.quantity = quantity || '';
this.quantity = quantity || '';
this.name = name;
this.name = name;
this.chance = chance;
this.chance = chance;
this.photoUrl = decodeURIComponent(photoUrl);
this.photoUrl = decodeURIComponent(photoUrl);
this.innerActivity = wx.getStorageSync('innerActivity');
hasPhone = wx.getStorageSync('hasPhone');
innerActivity = wx.getStorageSync('innerActivity');
}
}
});
});
</script>
</script>
...
...
static/images/peo1.jpg
deleted
100644 → 0
View file @
ca35f130
7.24 KB
static/images/peo2.jpg
deleted
100644 → 0
View file @
ca35f130
7.26 KB
static/images/peo3.jpg
deleted
100644 → 0
View file @
ca35f130
5.47 KB
static/images/play.png
deleted
100644 → 0
View file @
ca35f130
2.79 KB
static/images/selected.png
deleted
100644 → 0
View file @
ca35f130
612 Bytes
static/images/selectno.png
deleted
100644 → 0
View file @
ca35f130
325 Bytes
static/images/test1.jpg
deleted
100644 → 0
View file @
ca35f130
8.65 KB
static/images/test2.png
deleted
100644 → 0
View file @
ca35f130
461 KB
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment