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
fbc7b073
Commit
fbc7b073
authored
Jun 10, 2020
by
郝聪敏
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/animation' into 'master'
优化 See merge request
!42
parents
b8b162ca
b7eae932
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
181 additions
and
79 deletions
+181
-79
api.js
src/common/api.js
+1
-1
wxRequest.js
src/common/wxRequest.js
+1
-0
prizeList.wpy
src/components/custom/prizeList.wpy
+13
-8
sign.wpy
src/components/custom/sign.wpy
+7
-4
index.wpy
src/pages/index.wpy
+148
-64
index.js
src/store/index.js
+11
-2
No files found.
src/common/api.js
View file @
fbc7b073
...
@@ -8,7 +8,7 @@ module.exports = {
...
@@ -8,7 +8,7 @@ module.exports = {
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
'
});
},
},
get
User
Info
(
params
)
{
get
Main
Info
(
params
)
{
return
http
.
post
(
'
/api/user/main
'
,
params
);
return
http
.
post
(
'
/api/user/main
'
,
params
);
},
},
getAwardsInfo
(
params
)
{
getAwardsInfo
(
params
)
{
...
...
src/common/wxRequest.js
View file @
fbc7b073
...
@@ -5,6 +5,7 @@ const env = 'test'; // 每次上线手动切换成 prod/test
...
@@ -5,6 +5,7 @@ const env = 'test'; // 每次上线手动切换成 prod/test
let
baseUrl
=
'
https://api-luckii.q-gp.com
'
;
let
baseUrl
=
'
https://api-luckii.q-gp.com
'
;
if
(
env
===
'
test
'
)
{
if
(
env
===
'
test
'
)
{
baseUrl
=
'
https://luckii-qa.liangkebang.net
'
;
baseUrl
=
'
https://luckii-qa.liangkebang.net
'
;
// baseUrl = 'https://luckiiapi.q-gp.com/yapi/mock/325';
}
}
const
request
=
async
(
url
,
options
)
=>
{
const
request
=
async
(
url
,
options
)
=>
{
const
pages
=
getCurrentPages
();
const
pages
=
getCurrentPages
();
...
...
src/components/custom/prizeList.wpy
View file @
fbc7b073
...
@@ -74,11 +74,11 @@
...
@@ -74,11 +74,11 @@
current="0"
current="0"
bindanimationfinish="bindanimationfinish"
bindanimationfinish="bindanimationfinish"
>
>
<swiper-item
class="{{item.photoUrl ? 'image-item' : 'video-item'}
}" v-for="(item, idx) in curQueue" :key="item.id">
<swiper-item
:class="{'image-item': item.showType && item.showType.value === 1
}" v-for="(item, idx) in curQueue" :key="item.id">
<view class="video-wrapper">
<view class="video-wrapper">
<video
<video
id="video_{{idx}}"
id="video_{{idx}}"
class="video
_
item"
class="video
-
item"
loop
loop
show-center-play-btn="{{false}}"
show-center-play-btn="{{false}}"
enable-progress-gesture="{{false}}"
enable-progress-gesture="{{false}}"
...
@@ -90,12 +90,12 @@
...
@@ -90,12 +90,12 @@
binderror="onError"
binderror="onError"
bindtimeupdate="onTimeUpdate"
bindtimeupdate="onTimeUpdate"
@tap="videoTap"
@tap="videoTap"
v-if="
!item.photoUrl
"
v-if="
item.showType && item.showType.value === 2
"
>
>
<video-loading v-if="item.time === 0" :snapshot="item.
snapshot
"/>
<video-loading v-if="item.time === 0" :snapshot="item.
videoSnapUrl
"/>
<video-pause :pause="pause"></video-pause>
<video-pause :pause="pause"></video-pause>
</video>
</video>
<image v-if="item.
photoUrl
" class="images" :src="item.photoUrl" mode="widthFix"></image>
<image v-if="item.
showType && item.showType.value === 1
" class="images" :src="item.photoUrl" mode="widthFix"></image>
<view class="rightcont">
<view class="rightcont">
<view class="info">奖品库存: {{item.stock}}/{{item.totalStock}}</view>
<view class="info">奖品库存: {{item.stock}}/{{item.totalStock}}</view>
<view class="info">中奖概率: {{item.probability}}</view>
<view class="info">中奖概率: {{item.probability}}</view>
...
@@ -134,7 +134,7 @@
...
@@ -134,7 +134,7 @@
videoList () {
videoList () {
const newVal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
const newVal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
this._videoListChanged(newVal);
this._videoListChanged(newVal);
//
this.compute(this.userAccount);
this.compute(this.userAccount);
},
},
userAccount(newVal) {
userAccount(newVal) {
this.compute(newVal);
this.compute(newVal);
...
@@ -154,6 +154,7 @@
...
@@ -154,6 +154,7 @@
async getProgress(id) {
async getProgress(id) {
let detail = await getAwardsDetail({ prizeId: id });
let detail = await getAwardsDetail({ prizeId: id });
detail = detail || {};
detail = detail || {};
if (detail.join > detail.quantity) detail.join = detail.quantity;
const progress = Math.round((detail.join / detail.quantity) * 100) + '%';
const progress = Math.round((detail.join / detail.quantity) * 100) + '%';
this.curQueue.forEach(v => {
this.curQueue.forEach(v => {
...
@@ -179,6 +180,7 @@
...
@@ -179,6 +180,7 @@
const current = e.$wx.detail.current;
const current = e.$wx.detail.current;
this.pause = false;
this.pause = false;
this.playCurrent(current);
this.playCurrent(current);
this.trigger(e, 'change');
},
},
onError(e) {
onError(e) {
this.trigger(e, 'error');
this.trigger(e, 'error');
...
@@ -211,7 +213,6 @@
...
@@ -211,7 +213,6 @@
this.$emit('getAwardsInfo', {
this.$emit('getAwardsInfo', {
id,
id,
photoUrl,
photoUrl,
quantity: this.userAccount,
name,
name,
chance: probability
chance: probability
});
});
...
@@ -229,8 +230,12 @@
...
@@ -229,8 +230,12 @@
this.pause ? ctx.play() : ctx.pause();
this.pause ? ctx.play() : ctx.pause();
}
}
});
});
this.curQueue.forEach((item, index) => {
if (index === current && item.time !== 0) {
this.pause = !this.pause;
this.pause = !this.pause;
}
}
});
}
}
}
});
});
</script>
</script>
...
...
src/components/custom/sign.wpy
View file @
fbc7b073
...
@@ -38,6 +38,8 @@
...
@@ -38,6 +38,8 @@
</template>
</template>
<script>
<script>
import wepy from '@wepy/core';
import wepy from '@wepy/core';
import store from '../../store';
import { mapState } from '@wepy/x';
const images = {
const images = {
sign: {
sign: {
notComplete: '/static/images/sign@2x.png',
notComplete: '/static/images/sign@2x.png',
...
@@ -56,6 +58,7 @@
...
@@ -56,6 +58,7 @@
lottery: '/static/images/lottery@2x.png'
lottery: '/static/images/lottery@2x.png'
};
};
wepy.component({
wepy.component({
store,
data: {
data: {
showAnimation: false,
showAnimation: false,
addGold: false,
addGold: false,
...
@@ -98,6 +101,7 @@
...
@@ -98,6 +101,7 @@
}
}
},
},
computed: {
computed: {
...mapState(['safeAreaStyle']),
goldUrl() {
goldUrl() {
let result = images['gold'].goldOne;
let result = images['gold'].goldOne;
if (this.des === 2) {
if (this.des === 2) {
...
@@ -115,6 +119,9 @@
...
@@ -115,6 +119,9 @@
},
},
addGoldUrl: function() {
addGoldUrl: function() {
return images['gold'].addGoldUrl;
return images['gold'].addGoldUrl;
},
containerStyle() {
return 'position:relative; ' + this.safeAreaStyle;
}
}
},
},
watch: {
watch: {
...
@@ -169,10 +176,6 @@
...
@@ -169,10 +176,6 @@
}
}
}
}
},
},
created() {
let statusHeight = this.$app.$options.globalData.statusBarHeight || '';
statusHeight && (this.containerStyle = 'position:relative; top:' + statusHeight + 'px');
}
});
});
</script>
</script>
<style lang="less">
<style lang="less">
...
...
src/pages/index.wpy
View file @
fbc7b073
This diff is collapsed.
Click to expand it.
src/store/index.js
View file @
fbc7b073
...
@@ -2,8 +2,11 @@ import Vuex from '@wepy/x';
...
@@ -2,8 +2,11 @@ import Vuex from '@wepy/x';
export
default
new
Vuex
.
Store
({
export
default
new
Vuex
.
Store
({
state
:
{
state
:
{
userInfo
:
''
,
userInfo
:
{
isConnected
:
true
avatarUrl
:
'
/static/images/user@2x.png
'
},
isConnected
:
true
,
safeAreaStyle
:
''
},
},
mutations
:
{
mutations
:
{
setInfo
(
state
,
info
)
{
setInfo
(
state
,
info
)
{
...
@@ -11,6 +14,9 @@ export default new Vuex.Store({
...
@@ -11,6 +14,9 @@ export default new Vuex.Store({
},
},
setIsConnected
(
state
,
isConnected
)
{
setIsConnected
(
state
,
isConnected
)
{
state
.
isConnected
=
isConnected
;
state
.
isConnected
=
isConnected
;
},
setSafeAreaStyle
(
state
,
safeAreaStyle
)
{
state
.
safeAreaStyle
=
safeAreaStyle
;
}
}
},
},
actions
:
{
actions
:
{
...
@@ -20,6 +26,9 @@ export default new Vuex.Store({
...
@@ -20,6 +26,9 @@ export default new Vuex.Store({
setIsConnected
({
commit
})
{
setIsConnected
({
commit
})
{
const
isConnected
=
wx
.
getStorageSync
(
'
onNetworkStatusChange
'
);
const
isConnected
=
wx
.
getStorageSync
(
'
onNetworkStatusChange
'
);
commit
(
'
setIsConnected
'
,
isConnected
);
commit
(
'
setIsConnected
'
,
isConnected
);
},
setSafeAreaStyle
({
commit
},
safeAreaStyle
)
{
commit
(
'
setSafeAreaStyle
'
,
safeAreaStyle
);
}
}
}
}
});
});
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