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
786c38f4
Commit
786c38f4
authored
Jul 17, 2020
by
薛智杰
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'swiperVideoImprove' into 'v1.1.0'
Swiper video improve See merge request
!61
parents
1e47e363
f436acd5
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
123 additions
and
52 deletions
+123
-52
.eslintcache
.eslintcache
+1
-1
app.wpy
src/app.wpy
+3
-0
raffleProbability.wxs
src/common/raffleProbability.wxs
+24
-0
utils.js
src/common/utils.js
+46
-0
wxRequest.js
src/common/wxRequest.js
+5
-1
activityList.wpy
src/components/custom/activityList.wpy
+2
-3
sign.wpy
src/components/custom/sign.wpy
+1
-1
video.wpy
src/components/custom/video.wpy
+28
-44
index.wpy
src/pages/index.wpy
+13
-2
No files found.
.eslintcache
View file @
786c38f4
{"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/app.wpy":{"size":1489,"mtime":1593414427222,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/app.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/common/api.js":{"size":1883,"mtime":1592808132670,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/common/api.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/common/eventHub.js":{"size":85,"mtime":1589422331949,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/common/eventHub.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/common/raffleProbability.js":{"size":1732,"mtime":1593414427224,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/common/raffleProbability.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/common/wxRequest.js":{"size":2437,"mtime":1593414749561,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/common/wxRequest.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/china.js":{"size":98459,"mtime":1591238093273,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/china.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/loading.wpy":{"size":1200,"mtime":1592561147880,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/loading.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/network.wpy":{"size":1449,"mtime":1591613433302,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/network.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/openAnimation.wpy":{"size":17057,"mtime":1591613433303,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/openAnimation.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/popup.wpy":{"size":4787,"mtime":1593414427232,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/popup.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/sharedPopup.wpy":{"size":8245,"mtime":1593414427234,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/sharedPopup.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/sign.wpy":{"size":11721,"mtime":1593414427235,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/sign.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/starAnimation.wpy":{"size":3927,"mtime":1592296708688,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/starAnimation.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/videoPause.wpy":{"size":898,"mtime":1589889870499,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/videoPause.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/help.wpy":{"size":3088,"mtime":1591786781412,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/help.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/morehelp.wpy":{"size":253,"mtime":1590498072492,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/morehelp.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/myraffles.wpy":{"size":3149,"mtime":1591776725635,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/myraffles.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/prize.wpy":{"size":7710,"mtime":1592983633308,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/prize.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/raffle.wpy":{"size":12912,"mtime":1593414427238,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/raffle.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/store/index.js":{"size":816,"mtime":1591777292874,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/store/index.js","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/activityList.wpy":{"size":2520,"mtime":1593414427226,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/activityList.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/index.wpy":{"size":19050,"mtime":1593414427236,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/index.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/goloading.wpy":{"size":1050,"mtime":1593414427227,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/goloading.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/agreement.wpy":{"size":210,"mtime":1592903977922,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/agreement.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/search.wpy":{"size":5487,"mtime":1593414427239,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/pages/search.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/goodsList.wpy":{"size":9202,"mtime":1593414506553,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/goodsList.wpy","messages":[],"errorCount":0,"warningCount":0}},"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/video.wpy":{"size":12052,"mtime":1593414554361,"hashOfConfig":"qbd0oj","results":{"filePath":"/Users/fukiyoshi/work/quantgroup/mini-program-wepy/src/components/custom/video.wpy","messages":[],"errorCount":0,"warningCount":0}}}
{"D:\\project\\mini-program-wepy\\src\\app.wpy":{"size":1610,"mtime":1594721970257,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\app.wpy","messages":[],"errorCount":0,"warningCount":0}},"D:\\project\\mini-program-wepy\\src\\common\\api.js":{"size":1949,"mtime":1594112587014,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\common\\api.js","messages":[],"errorCount":0,"warningCount":0}},"D:\\project\\mini-program-wepy\\src\\common\\eventHub.js":{"size":90,"mtime":1594112587015,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\common\\eventHub.js","messages":[],"errorCount":0,"warningCount":0}},"D:\\project\\mini-program-wepy\\src\\common\\raffleProbability.js":{"size":1792,"mtime":1594112587015,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\common\\raffleProbability.js","messages":[],"errorCount":0,"warningCount":0}},"D:\\project\\mini-program-wepy\\src\\common\\wxRequest.js":{"size":2675,"mtime":1594721970258,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\common\\wxRequest.js","messages":[],"errorCount":0,"warningCount":0}},"D:\\project\\mini-program-wepy\\src\\components\\custom\\activityList.wpy":{"size":2613,"mtime":1594721970259,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\components\\custom\\activityList.wpy","messages":[],"errorCount":0,"warningCount":0}},"D:\\project\\mini-program-wepy\\src\\components\\custom\\china.js":{"size":102261,"mtime":1594112587017,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\components\\custom\\china.js","messages":[],"errorCount":0,"warningCount":0}},"D:\\project\\mini-program-wepy\\src\\components\\custom\\goloading.wpy":{"size":1103,"mtime":1594112587017,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\components\\custom\\goloading.wpy","messages":[],"errorCount":0,"warningCount":0}},"D:\\project\\mini-program-wepy\\src\\components\\custom\\goodsList.wpy":{"size":9486,"mtime":1594112587018,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\components\\custom\\goodsList.wpy","messages":[],"errorCount":0,"warningCount":0}},"D:\\project\\mini-program-wepy\\src\\components\\custom\\loading.wpy":{"size":1260,"mtime":1594112587019,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\components\\custom\\loading.wpy","messages":[],"errorCount":0,"warningCount":0}},"D:\\project\\mini-program-wepy\\src\\components\\custom\\network.wpy":{"size":1517,"mtime":1594112587019,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\components\\custom\\network.wpy","messages":[],"errorCount":0,"warningCount":0}},"D:\\project\\mini-program-wepy\\src\\components\\custom\\openAnimation.wpy":{"size":17653,"mtime":1594112587019,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\components\\custom\\openAnimation.wpy","messages":[],"errorCount":0,"warningCount":0}},"D:\\project\\mini-program-wepy\\src\\components\\custom\\popup.wpy":{"size":4977,"mtime":1594112587020,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\components\\custom\\popup.wpy","messages":[],"errorCount":0,"warningCount":0}},"D:\\project\\mini-program-wepy\\src\\components\\custom\\sharedPopup.wpy":{"size":8545,"mtime":1594112587020,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\components\\custom\\sharedPopup.wpy","messages":[],"errorCount":0,"warningCount":0}},"D:\\project\\mini-program-wepy\\src\\components\\custom\\sign.wpy":{"size":12207,"mtime":1594721970259,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\components\\custom\\sign.wpy","messages":[],"errorCount":0,"warningCount":0}},"D:\\project\\mini-program-wepy\\src\\components\\custom\\starAnimation.wpy":{"size":4063,"mtime":1594112587020,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\components\\custom\\starAnimation.wpy","messages":[],"errorCount":0,"warningCount":0}},"D:\\project\\mini-program-wepy\\src\\components\\custom\\videoPause.wpy":{"size":941,"mtime":1594112587022,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\components\\custom\\videoPause.wpy","messages":[],"errorCount":0,"warningCount":0}},"D:\\project\\mini-program-wepy\\src\\pages\\agreement.wpy":{"size":225,"mtime":1594112587148,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\pages\\agreement.wpy","messages":[],"errorCount":0,"warningCount":0}},"D:\\project\\mini-program-wepy\\src\\pages\\help.wpy":{"size":3183,"mtime":1594112587148,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\pages\\help.wpy","messages":[],"errorCount":0,"warningCount":0}},"D:\\project\\mini-program-wepy\\src\\pages\\index.wpy":{"size":19975,"mtime":1594796428652,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\pages\\index.wpy","messages":[],"errorCount":0,"warningCount":0}},"D:\\project\\mini-program-wepy\\src\\pages\\morehelp.wpy":{"size":269,"mtime":1594112587149,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\pages\\morehelp.wpy","messages":[],"errorCount":0,"warningCount":0}},"D:\\project\\mini-program-wepy\\src\\pages\\myraffles.wpy":{"size":3271,"mtime":1594112587150,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\pages\\myraffles.wpy","messages":[],"errorCount":0,"warningCount":0}},"D:\\project\\mini-program-wepy\\src\\pages\\prize.wpy":{"size":7951,"mtime":1594112587150,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\pages\\prize.wpy","messages":[],"errorCount":0,"warningCount":0}},"D:\\project\\mini-program-wepy\\src\\pages\\raffle.wpy":{"size":13368,"mtime":1594112587150,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\pages\\raffle.wpy","messages":[],"errorCount":0,"warningCount":0}},"D:\\project\\mini-program-wepy\\src\\pages\\search.wpy":{"size":5690,"mtime":1594112587150,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\pages\\search.wpy","messages":[],"errorCount":0,"warningCount":0}},"D:\\project\\mini-program-wepy\\src\\store\\index.js":{"size":850,"mtime":1594112587151,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\store\\index.js","messages":[],"errorCount":0,"warningCount":0}},"D:\\project\\mini-program-wepy\\src\\common\\utils.js":{"size":1334,"mtime":1594721970258,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\common\\utils.js","messages":[],"errorCount":0,"warningCount":0}},"D:\\project\\mini-program-wepy\\src\\components\\custom\\video.wpy":{"size":11506,"mtime":1594968110826,"hashOfConfig":"p3gqur","results":{"filePath":"D:\\project\\mini-program-wepy\\src\\components\\custom\\video.wpy","messages":[],"errorCount":0,"warningCount":0}}}
\ No newline at end of file
\ No newline at end of file
src/app.wpy
View file @
786c38f4
...
@@ -55,6 +55,9 @@ wepy.app({
...
@@ -55,6 +55,9 @@ wepy.app({
'pages/search',
'pages/search',
'pages/agreement'
'pages/agreement'
],
],
"networkTimeout": {
"request": 3000
},
window: {
window: {
backgroundTextStyle: 'light',
backgroundTextStyle: 'light',
navigationBarBackgroundColor: '#f1f1f1',
navigationBarBackgroundColor: '#f1f1f1',
...
...
src/common/raffleProbability.wxs
0 → 100644
View file @
786c38f4
function getCommonDivisor(firstNum, secondNum) {
if (secondNum === 0) return firstNum;
var remainder = parseInt(firstNum % secondNum);
return getCommonDivisor(secondNum, remainder);
}
module.exports = {
getProbability: function (quantity, coinQuantity) {
if (!quantity) return 0;
// 如果用户克币数是0
if (quantity === 0) {
return '0%';
}
var divisor = getCommonDivisor(quantity, coinQuantity);
var value = quantity / divisor;
var value2 = coinQuantity / divisor;
// 如果分子比分母大说明中奖概率是100%,那么返回中奖概率
if (value >= value2) {
return '100%';
} else {
return value + '/' + value2;
}
}
};
src/common/utils.js
0 → 100644
View file @
786c38f4
/*
* @Description:
* @Date: 2020-07-09 11:14:06
* @LastEditors: gzw
* @LastEditTime: 2020-07-09 11:14:26
*/
/**
* 延时函数
* @param {Function} func 方法
* @param {Number} wait 等待时间
* @param {Boolean} immediate 是否立即执行
* @return: {Function} result 方法执行
*/
export
function
debounce
(
func
,
wait
,
immediate
)
{
let
timeout
,
args
,
context
,
timestamp
,
result
;
const
later
=
function
()
{
// 据上一次触发时间间隔
const
last
=
+
new
Date
()
-
timestamp
;
// 上次被包装函数被调用时间间隔last小于设定时间间隔wait
if
(
last
<
wait
&&
last
>
0
)
{
timeout
=
setTimeout
(
later
,
wait
-
last
);
}
else
{
timeout
=
null
;
// 如果设定为immediate===true,因为开始边界已经调用过了此处无需调用
if
(
!
immediate
)
{
result
=
func
.
apply
(
context
,
args
);
if
(
!
timeout
)
context
=
args
=
null
;
}
}
};
return
function
(...
args
)
{
context
=
this
;
timestamp
=
+
new
Date
();
const
callNow
=
immediate
&&
!
timeout
;
// 如果延时不存在,重新设定延时
if
(
!
timeout
)
timeout
=
setTimeout
(
later
,
wait
);
if
(
callNow
)
{
result
=
func
.
apply
(
context
,
args
);
context
=
args
=
null
;
}
return
result
;
};
}
src/common/wxRequest.js
View file @
786c38f4
import
wepy
from
'
@wepy/core
'
;
import
wepy
from
'
@wepy/core
'
;
import
Notify
from
'
../components/vant/notify/notify
'
;
import
Notify
from
'
../components/vant/notify/notify
'
;
const
env
=
'
prod
'
;
// 每次上线手动切换成 prod/test
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
'
;
...
@@ -58,6 +58,10 @@ const request = async (url, options) => {
...
@@ -58,6 +58,10 @@ const request = async (url, options) => {
errMsg
=
`httpurl:
${
url
}
, method:
${
options
.
method
}
, params:
${
JSON
.
stringify
(
options
.
data
)}
, status:
${
res
.
statusCode
}
, data:
${
JSON
.
stringify
(
res
.
data
)}
`
;
errMsg
=
`httpurl:
${
url
}
, method:
${
options
.
method
}
, params:
${
JSON
.
stringify
(
options
.
data
)}
, status:
${
res
.
statusCode
}
, data:
${
JSON
.
stringify
(
res
.
data
)}
`
;
if
(
env
===
'
test
'
)
console
.
error
(
errMsg
);
if
(
env
===
'
test
'
)
console
.
error
(
errMsg
);
throw
new
Error
(
errMsg
);
throw
new
Error
(
errMsg
);
}).
catch
(
e
=>
{
if
(
e
.
errMsg
===
'
request:fail timeout
'
)
{
Notify
({
message
:
'
网络异常,请稍后重试
'
,
safeAreaInsetTop
});
}
});
});
};
};
...
...
src/components/custom/activityList.wpy
View file @
786c38f4
...
@@ -66,7 +66,7 @@
...
@@ -66,7 +66,7 @@
position: absolute;
position: absolute;
z-index: 9;
z-index: 9;
bottom: 400rpx;
bottom: 400rpx;
width:
100
%;
width:
44
%;
color: @whitecolor;
color: @whitecolor;
clear: both;
clear: both;
&.anima {
&.anima {
...
@@ -77,8 +77,7 @@
...
@@ -77,8 +77,7 @@
}
}
}
}
.leftcont {
.leftcont {
width: 44%;
width: 100%;
float: left;
font-size: @font-normal;
font-size: @font-normal;
margin-left: 30rpx;
margin-left: 30rpx;
}
}
...
...
src/components/custom/sign.wpy
View file @
786c38f4
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
</div>
</div>
<div class="show-gold">
<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" mode="widthFix"></image>
<image class="show-gold-image" :class="{'gold-scale': addsunshine}" :src="goldUrl" mode="widthFix"
style="height: 22px;"
></image>
<span class="show-gold-num">
<span class="show-gold-num">
{{des}}
{{des}}
</span>
</span>
...
...
src/components/custom/video.wpy
View file @
786c38f4
...
@@ -2,28 +2,28 @@
...
@@ -2,28 +2,28 @@
<view class="container">
<view class="container">
<swiper
<swiper
class="video-swiper"
class="video-swiper"
duration="
6
00"
duration="
3
00"
circular="{{circular}}"
circular="{{circular}}"
vertical
vertical
current="
1
"
current="
0
"
bindchange="moveSwiper"
bindchange="moveSwiper"
bindanimationfinish="animationfinish">
bindanimationfinish="animationfinish">
<swiper-item wx:for="{{curQueue}}" wx:key="index">
<swiper-item wx:for="{{curQueue}}" wx:key="index">
<view class="video-swiper">
<view class="video-swiper">
<video
<video
class="video-item"
class="video-item"
v-show="item.showType && item.showType.value == 2"
id="video_{{index}}"
id="video_{{index}}"
loop
loop
enable-progress-gesture="{{false}}"
enable-progress-gesture="{{false}}"
show-center-play-btn="{{false}}"
show-center-play-btn="{{false}}"
controls="{{false}}"
controls="{{false}}"
src="{{
currentIndex == index ?item.videoUrl :nul
l}}"
src="{{
item.videoUr
l}}"
data-id="{{item.id}}"
data-id="{{item.id}}"
object-fit="contain"
object-fit="contain"
data-index="{{index}}"
data-index="{{index}}"
@tap="videoTap"
@tap="videoTap"
custom-cache="{{false}}"
custom-cache="{{false}}"
wx:if="{{item.showType && item.showType.value ==2}}"
bindplay="loadMedia"
bindplay="loadMedia"
bindloadedmetadata="loadMedia"
bindloadedmetadata="loadMedia"
>
>
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
</van-image>
</van-image>
<view class="rightcont" v-show="item.id > 0">
<view class="rightcont" v-show="item.id > 0">
<view class="info">奖品剩余: {{item.stock}}</view>
<view class="info">奖品剩余: {{item.stock}}</view>
<view class="info">中奖概率: {{
item.probability
}}</view>
<view class="info">中奖概率: {{
rp.getProbability(userAccount, item.coinQuantity)
}}</view>
<view class="progress">
<view class="progress">
<view class="text">{{item.progress}}</view>
<view class="text">{{item.progress}}</view>
<view class="orange" style="{{item.progressStyle}}"></view>
<view class="orange" style="{{item.progressStyle}}"></view>
...
@@ -48,9 +48,9 @@
...
@@ -48,9 +48,9 @@
<van-popup show="{{showPopup}}" close-on-click-overlay="{{false}}" overlay-style="background-color:transparent"></van-popup>
<van-popup show="{{showPopup}}" close-on-click-overlay="{{false}}" overlay-style="background-color:transparent"></van-popup>
</view>
</view>
</template>
</template>
<wxs module="rp" src="../../common/raffleProbability.wxs"></wxs>
<script>
<script>
import wepy from '@wepy/core';
import wepy from '@wepy/core';
import { getProbability } from '../../common/raffleProbability';
import { getAwardsDetail, getPrizeList } from '../../common/api.js';
import { getAwardsDetail, getPrizeList } from '../../common/api.js';
wepy.component({
wepy.component({
props: {
props: {
...
@@ -75,18 +75,15 @@
...
@@ -75,18 +75,15 @@
_invalidUp: 0,
_invalidUp: 0,
_invalidDown: 0,
_invalidDown: 0,
_videoContexts: [],
_videoContexts: [],
currentIndex: 1,
videoPause: false,
videoPause: false,
showPopup: false,
showPopup: false,
videoLoading: true
videoLoading: true,
isFirstRoll: true // 是否是首次加载。_last设置为1时,会出现首次加载的第二个视频不自动播放,设置为其他的值时会出现后续乱序的问题。此处为补丁
},
},
watch: {
watch: {
videoList (list) {
videoList (list) {
const newVal = list || [];
const newVal = list || [];
this._videoListChanged(newVal);
this._videoListChanged(newVal);
},
userAccount(newVal) {
this.compute(newVal);
}
}
},
},
attached() {
attached() {
...
@@ -97,22 +94,6 @@
...
@@ -97,22 +94,6 @@
];
];
},
},
methods: {
methods: {
compute (newVal) {
if (!this.curQueue.length) return;
this.curQueue.forEach(v => {
v.probability = getProbability(+newVal, +v.coinQuantity);
});
this.nextQueue.forEach(v => {
v.probability = getProbability(+newVal, +v.coinQuantity);
});
this.prevQueue.forEach(v => {
v.probability = getProbability(+newVal, +v.coinQuantity);
});
this.prevQueue = [...this.prevQueue];
this.curQueue = [...this.curQueue];
this.nextQueue = [...this.nextQueue];
this.updateAwardsInfo(this.currentIndex);
},
_videoListChanged (newVal) {
_videoListChanged (newVal) {
const _this = this;
const _this = this;
if (this.curQueue.length === 0) {
if (this.curQueue.length === 0) {
...
@@ -120,9 +101,9 @@
...
@@ -120,9 +101,9 @@
// 同时展示的元素只有三个,curQueue中始终只有三个元素,用来解决吧video过多时,资源加载问题
// 同时展示的元素只有三个,curQueue中始终只有三个元素,用来解决吧video过多时,资源加载问题
// 当前的资源加载解决方案是参考小程序的video-swiper源码
// 当前的资源加载解决方案是参考小程序的video-swiper源码
newVal.forEach(function (item, index) {
newVal.forEach(function (item, index) {
if (index ===
1
) {
if (index ===
0
) {
_this.curQueue[0] = item;
_this.curQueue[0] = item;
} else if (index ===
0
) {
} else if (index ===
1
) {
_this.curQueue[1] = item;
_this.curQueue[1] = item;
} else if (index === 2) {
} else if (index === 2) {
_this.curQueue[2] = item;
_this.curQueue[2] = item;
...
@@ -130,7 +111,7 @@
...
@@ -130,7 +111,7 @@
_this.nextQueue.push(item);
_this.nextQueue.push(item);
}
}
});
});
this.playCurrent(
1
);
this.playCurrent(
0
);
} else {
} else {
// 新进入的数组要去重,新进入的数组去重是需求的逻辑
// 新进入的数组要去重,新进入的数组去重是需求的逻辑
const curIds = this.curQueue.map(item => item.id);
const curIds = this.curQueue.map(item => item.id);
...
@@ -141,19 +122,14 @@
...
@@ -141,19 +122,14 @@
_this.nextQueue.push(item);
_this.nextQueue.push(item);
});
});
}
}
this.compute(this.userAccount);
},
},
moveSwiper(e) {
moveSwiper(e) {
this.videoPause = false;
this.videoPause = false;
this.videoLoading = true;
this.videoLoading = true;
if (e.$wx.detail.source === 'touch') {
if (e.$wx.detail.source === 'touch') {
// 增加一个透明遮罩层,控制用户滑动速度,
5
00ms内只能滑动一次,解决用户滑动过快,不触发animationfinish的bug
// 增加一个透明遮罩层,控制用户滑动速度,
4
00ms内只能滑动一次,解决用户滑动过快,不触发animationfinish的bug
this.showPopup = true;
this.showPopup = true;
setTimeout(() => {
this.showPopup = false;
}, 500);
const current = e.$wx.detail.current;
this.currentIndex = current;
// 如果next中如果就剩下4个了,请求下一页
// 如果next中如果就剩下4个了,请求下一页
if (this.nextQueue.length === 4) {
if (this.nextQueue.length === 4) {
getPrizeList().then(data => {
getPrizeList().then(data => {
...
@@ -163,15 +139,18 @@
...
@@ -163,15 +139,18 @@
}
}
},
},
animationfinish (e) {
animationfinish (e) {
let _last = this._last;
this.showPopup = false;
let curQueue = this.curQueue;
let { _last, curQueue, prevQueue, nextQueue } = this;
let prevQueue = this.prevQueue;
let nextQueue = this.nextQueue;
// 一共三个数组,curQueue是要显示的数组,prevQueue放上滑过去的元素,nextQueue放即将进入的元素
// 一共三个数组,curQueue是要显示的数组,prevQueue放上滑过去的元素,nextQueue放即将进入的元素
// 一次最多只展示3个video标签,提高加载视频的速度
// 一次最多只展示3个video标签,提高加载视频的速度
const current = e.$wx.detail.current;
const current = e.$wx.detail.current;
const diff = current - _last;
const diff = current - _last;
if (this.isFirstRoll && current === 1) {
this.playCurrent(1);
this.isFirstRoll = false;
}
if (diff === 0) return;
if (diff === 0) return;
this.isFirstRoll = false;
this._last = current;
this._last = current;
this.playCurrent(current);
this.playCurrent(current);
// 如果上滑的时候,当前滑动到第0元素,那么被划走,放入prevQueue是第一个元素,这个要自己画图才会更理解
// 如果上滑的时候,当前滑动到第0元素,那么被划走,放入prevQueue是第一个元素,这个要自己画图才会更理解
...
@@ -221,14 +200,17 @@
...
@@ -221,14 +200,17 @@
this.circular = circular;
this.circular = circular;
},
},
playCurrent (current) {
playCurrent (current) {
const that = this;
this.curQueue[current] && this.getProgress(this.curQueue[current].id);
this.curQueue[current] && this.getProgress(this.curQueue[current].id);
// 滑动到当前元素时,其他video都暂停,只播放当前video
// 滑动到当前元素时,其他video都暂停,只播放当前video
this._videoContexts.forEach(function (ctx, index) {
this._videoContexts.forEach(function (ctx, index) {
if (ctx) {
if (ctx) {
if (index !== current) {
const showType = that.curQueue[current] && that.curQueue[current].showType && that.curQueue[current].showType.value === 2;
ctx.pause();
if (index === current && showType) {
} else {
ctx.play();
ctx.play();
} else {
ctx.pause();
ctx.seek(0);
}
}
}
}
});
});
...
@@ -364,6 +346,8 @@
...
@@ -364,6 +346,8 @@
}
}
.images {
.images {
width: 100%;
width: 100%;
position: relative;
z-index: 3;
.van-image__loading {
.van-image__loading {
background-color: rgba(0,0,0,0.7);
background-color: rgba(0,0,0,0.7);
}
}
...
...
src/pages/index.wpy
View file @
786c38f4
...
@@ -233,6 +233,7 @@
...
@@ -233,6 +233,7 @@
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';
import { debounce } from '../common/utils';
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';
...
@@ -311,6 +312,10 @@
...
@@ -311,6 +312,10 @@
return;
return;
}
}
}
}
wepy.wx.showLoading({
title: '请稍候...',
mask: true
});
wx.requestSubscribeMessage({
wx.requestSubscribeMessage({
tmplIds,
tmplIds,
success (res) {
success (res) {
...
@@ -320,7 +325,7 @@
...
@@ -320,7 +325,7 @@
const rs = tmplIds.every(v => res[v] === undefined || res[v] === 'accept');
const rs = tmplIds.every(v => res[v] === undefined || res[v] === 'accept');
if (rs) {
if (rs) {
that.sign = true;
that.sign = true;
setTimeout
(async () => {
debounce
(async () => {
const innerAudioContext = wx.createInnerAudioContext();
const innerAudioContext = wx.createInnerAudioContext();
innerAudioContext.autoplay = true;
innerAudioContext.autoplay = true;
innerAudioContext.src = '/static/audio/supermarie.mp3';
innerAudioContext.src = '/static/audio/supermarie.mp3';
...
@@ -330,14 +335,20 @@
...
@@ -330,14 +335,20 @@
console.log(res.errCode);
console.log(res.errCode);
});
});
const { coins } = await signIn();
const { coins } = await signIn();
wepy.wx.hideLoading();
if (coins === 0) return;
if (coins === 0) return;
that.mainInfo.account.quantity = coins;
that.mainInfo.account.quantity = coins;
}, 1500);
}, 700)();
} else {
wepy.wx.hideLoading();
}
}
} else {
wepy.wx.hideLoading();
}
}
},
},
fail (res) {
fail (res) {
console.log('requestSubscribeMessage fail', res);
console.log('requestSubscribeMessage fail', res);
wepy.wx.hideLoading();
}
}
});
});
},
},
...
...
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