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
af2112cb
Commit
af2112cb
authored
Jun 10, 2020
by
郝聪敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改抽奖页面参数异常问题
parent
4616bf57
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
13 deletions
+22
-13
prizeList.wpy
src/components/custom/prizeList.wpy
+17
-10
index.wpy
src/pages/index.wpy
+4
-2
raffle.wpy
src/pages/raffle.wpy
+1
-1
No files found.
src/components/custom/prizeList.wpy
View file @
af2112cb
...
@@ -128,7 +128,8 @@
...
@@ -128,7 +128,8 @@
data: {
data: {
pause: false,
pause: false,
curQueue: [],
curQueue: [],
_videoContexts: []
_videoContexts: [],
current: 0
},
},
watch: {
watch: {
videoList () {
videoList () {
...
@@ -150,6 +151,7 @@
...
@@ -150,6 +151,7 @@
v.probability = getProbability(+newVal, +v.coinQuantity);
v.probability = getProbability(+newVal, +v.coinQuantity);
});
});
this.curQueue = [...this.curQueue];
this.curQueue = [...this.curQueue];
this.updateAwardsInfo(this.current);
},
},
async getProgress(id) {
async getProgress(id) {
let detail = await getAwardsDetail({ prizeId: id });
let detail = await getAwardsDetail({ prizeId: id });
...
@@ -178,6 +180,7 @@
...
@@ -178,6 +180,7 @@
},
},
async bindanimationfinish(e) {
async bindanimationfinish(e) {
const current = e.$wx.detail.current;
const current = e.$wx.detail.current;
this.current = current;
this.pause = false;
this.pause = false;
this.playCurrent(current);
this.playCurrent(current);
this.trigger(e, 'change');
this.trigger(e, 'change');
...
@@ -197,9 +200,20 @@
...
@@ -197,9 +200,20 @@
this.curQueue = [...this.curQueue];
this.curQueue = [...this.curQueue];
}
}
},
},
updateAwardsInfo(current) {
const { id, photoUrl, videoSnapUrl, showType, name, probability } = this.curQueue[current];
this.$emit('getAwardsInfo', {
id,
photoUrl: showType.value === 1 ? encodeURIComponent(photoUrl) : encodeURIComponent(videoSnapUrl),
name,
chance: probability
});
},
playCurrent(current) {
playCurrent(current) {
if (!this.curQueue || this.curQueue.length <= 1) return;
if (!this.curQueue || this.curQueue.length <= 1) return;
// 更新抽奖页面参数
this.updateAwardsInfo(current);
// 播放当前视频
this._videoContexts.forEach((ctx, index) => {
this._videoContexts.forEach((ctx, index) => {
if (index !== current) {
if (index !== current) {
ctx && ctx.pause();
ctx && ctx.pause();
...
@@ -207,15 +221,8 @@
...
@@ -207,15 +221,8 @@
ctx && ctx.play();
ctx && ctx.play();
}
}
});
});
// 更新奖品进度
this.getProgress(this.curQueue[current].id);
this.getProgress(this.curQueue[current].id);
const { id, photoUrl, name, probability } = this.curQueue[current];
this.$emit('getAwardsInfo', {
id,
photoUrl,
name,
chance: probability
});
},
},
trigger(e, type) {
trigger(e, type) {
var ext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var ext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
...
...
src/pages/index.wpy
View file @
af2112cb
...
@@ -314,6 +314,7 @@
...
@@ -314,6 +314,7 @@
Notify({ message: '您的克币数为0, 无法参与抽奖', safeAreaInsetTop: true });
Notify({ message: '您的克币数为0, 无法参与抽奖', safeAreaInsetTop: true });
return;
return;
}
}
wx.navigateTo({
wx.navigateTo({
url: `/pages/raffle?prizeId=${id}&chance=${chance}&photoUrl=${photoUrl}&quantity=${this.mainInfo.account.quantity}&name=${name}`
url: `/pages/raffle?prizeId=${id}&chance=${chance}&photoUrl=${photoUrl}&quantity=${this.mainInfo.account.quantity}&name=${name}`
});
});
...
@@ -327,6 +328,7 @@
...
@@ -327,6 +328,7 @@
getSharedGold: async function(v) {
getSharedGold: async function(v) {
this.showModal = 0;
this.showModal = 0;
await addGold(v);
await addGold(v);
this.showActivity();
let account = this.mainInfo.account || {};
let account = this.mainInfo.account || {};
let quantity = account.quantity || 0;
let quantity = account.quantity || 0;
this.mainInfo.account.quantity = quantity + v.quantity;
this.mainInfo.account.quantity = quantity + v.quantity;
...
@@ -339,7 +341,7 @@
...
@@ -339,7 +341,7 @@
},
},
getMainInfo: async function() {
getMainInfo: async function() {
this.mainInfo = await getMainInfo();
this.mainInfo = await getMainInfo();
this.sign =
(this.mainInfo && this.mainInfo.signin) || true
;
this.sign =
this.mainInfo && this.mainInfo.signin
;
wx.setStorageSync('hasPhone', this.mainInfo.phone);
wx.setStorageSync('hasPhone', this.mainInfo.phone);
if (this.mainInfo && this.mainInfo.innerActivity) {
if (this.mainInfo && this.mainInfo.innerActivity) {
wx.setStorageSync('innerActivity', this.mainInfo.innerActivity);
wx.setStorageSync('innerActivity', this.mainInfo.innerActivity);
...
@@ -412,7 +414,7 @@
...
@@ -412,7 +414,7 @@
},
},
async onShow() {
async onShow() {
let join = wx.getStorageSync('userJoin');
let join = wx.getStorageSync('userJoin');
if (join == 1) {
if (join ==
=
1) {
wx.removeStorageSync('userJoin');
wx.removeStorageSync('userJoin');
this.showActivity();
this.showActivity();
}
}
...
...
src/pages/raffle.wpy
View file @
af2112cb
...
@@ -401,7 +401,7 @@
...
@@ -401,7 +401,7 @@
this.quantity = quantity || '';
this.quantity = quantity || '';
this.name = name;
this.name = name;
this.chance = chance;
this.chance = chance;
this.photoUrl =
photoUrl
;
this.photoUrl =
decodeURIComponent(photoUrl)
;
this.innerActivity = wx.getStorageSync('innerActivity');
this.innerActivity = wx.getStorageSync('innerActivity');
}
}
});
});
...
...
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