Commit d9c0e1a9 authored by 任建锋's avatar 任建锋

--

parent 9b08ac71
......@@ -108,6 +108,11 @@ const apiList = {
method: 'get',
isShowLoading: false
},
drawLotteryPrize: {
handle: 'drawLotteryPrize',
method: 'get',
isShowLoading: false
},
/**获取用户信息 */
getUserInfo: {
handle: 'getUserInfo',
......
<view class="getcardpanel ">
<view class={{show?"p_show":"p_hide"}}>
<image class="getcardcontinuebtn " a:if={{doJoinData.drawLotteryStatus==1}} onTap="hiddenPanelEvent" data-value="getcardpanel" src={{resList['48d28917-741f-45d4-bcc9-322f29bcf5d8'].url}} />
<image class="getcardopenboxbtn " a:if={{doJoinData.drawLotteryStatus==2}} src={{resList['65d0f064-2527-4aef-8563-858eaf7ccf1e'].url}} />
<image class="dim51 " src={{resList['8c31274b-1016-4b8c-b413-9fc98174e118'].url}} />
......@@ -12,4 +13,7 @@
<image class="yuan_jiao_ju368847 " src={{resList['d7329665-f4f6-42bc-ab46-0af63a0837eb'].url}} />
<text class="getcardcontenttext ">再抽取{{doJoinData.restCardTypeCount}}张不同卡牌即可领取奖励</text>
</view>
</view>
<canvas id="canvas" type="2d" onReady="onCanvasReady"></canvas>
</view>
\ No newline at end of file
......@@ -2,19 +2,102 @@
import { DataCenter } from '../../DataCenter';
import resList from '../../resconfig/resList';
import lottie from '@tbminiapp/lottie-miniapp'
async function loadCloud(url, onLoad, onError) {
if (url.indexOf("cloud://") == 0) {
//@ts-ignore
const { cloud } = getApp();
//获取临时地址
var urls = await cloud.file.getTempFileURL({ fileId: [url] })
url = urls[0].url.replace('-internal', '');
}
my.downloadFile({
url: url,
success(res) {
var i = res.apFilePath;//临时地址是否有必要缓存下,如果读不到再考虑下载。
my.getFileSystemManager().readFile({
filePath: i,
encoding: "utf8",
success: function (r) {
onLoad(JSON.parse(r.data) )
},
fail: function (res) {
onError && onError(res)
}
})
},
fail(res) {
onError && onError(res)
},
});
}
Component({
props: {},
data: {},
data: {
show:false
},
methods: {
hiddenPanelEvent(e){
this.props.onTapHiddenPanelEvent(e);
},
onCanvasReady() {
try{
my.alert({
title:"",
content:"11"
});
if(!my.createCanvas){
my.alert({
title:"",
content:"33"
});
}
this.canvas=my.createCanvas({
id: 'canvas',
success: (canvas) => {
my.alert({
title:"",
content:"22"
});
lottie.setup(canvas);
const context = canvas.getContext('2d')
let ani = lottie.loadAnimation({
loop: true, autoplay: true,
animationData: DataCenter.lottieData,
rendererSettings: {context: context},
})
ani.onComplete=()=>{
// this.setData({
// show:true
// })
}
},
});
my.alert({
title:"",
content:JSON.stringify(this.canvas)
});
}catch(e){
my.alert({
title:"",
content:JSON.stringify(e)
});
}
},
},
didMount(props) {
console.log(DataCenter.doJoinData)
this.setData({
resList: resList,
doJoinData:DataCenter.doJoinData.data
doJoinData:DataCenter.doJoinData?DataCenter.doJoinData.data:{}
});
// setTimeout(()=>{
// this.onCanvasReady()
// },2000)
}
});
\ No newline at end of file
......@@ -6,3 +6,22 @@
.mycardpanel .mycardbody .mycardcontent{
overflow-y:scroll;
}
#canvas{
position:fixed;
top:0;
left:0;
bottom:0;
margin:auto;
width:750rpx;
height:1624rpx;
pointer-events: none;
}
.getcardpanel {
height: 1094rpx !important;
}
.p_show{
opacity:1;
}
.p_hide{
opacity:1;
}
\ No newline at end of file
<view class="noneprizepanel ">
<image class="dim56 " src={{resList['d9dff4ee-9718-43f2-8197-e752b1a91028'].url}} />
<image class="noneprizecontinuebtn " src={{resList['9d618b16-4a1c-448f-b30d-80996f64e4cb'].url}} />
<span class="hen_yi_han_jiang_li_yu_ni_ca_jian_er_guo ">很遗憾,奖励与你擦肩而过…</span>
<image class="noneprizeclosebtn " src={{resList['878b3751-e6b3-4ae6-9811-77e938801873'].url}} />
<span class="chi_da_jiang_jin_yi_bu_zhi_yao53 ">离大奖仅一步之遥</span>
</view>
\ No newline at end of file
<text class="hen_yi_han_jiang_li_yu_ni_ca_jian_er_guo ">很遗憾,奖励与你擦肩而过…</text>
<image class="noneprizeclosebtn " onTap="hiddenPanelEvent" data-value="noneprizepanel" src={{resList['878b3751-e6b3-4ae6-9811-77e938801873'].url}} />
<text class="chi_da_jiang_jin_yi_bu_zhi_yao53 ">离大奖仅一步之遥</text>
</view>
\ No newline at end of file
......@@ -4,9 +4,12 @@ import resList from '../../resconfig/resList';
Component({
props: {},
data: {},
methods: {},
onInit(props) {
methods: {
hiddenPanelEvent(e){
this.props.onTapHiddenPanelEvent(e);
}
},
didMount(props) {
this.setData({
resList: resList
});
......
/* 程序样式 */
@import './your.acss';
.prizepanel {
width: 739rpx;
height: 954rpx;
......
......@@ -2,9 +2,9 @@
<image class="dim97 " src={{resList['76a9cc41-7074-45cc-ab2f-c5dd47e07058'].url}} />
<image class="prizecontinuebtn " src={{resList['d1ef5d28-4bb0-4e36-b4cd-f03032b5c15e'].url}} />
<view class="xiao_biao_ti94 ">
<span class="gong_xi_huo_de_yi_xia_jiang_li ">恭喜获得以下奖励</span>
<span class="jiang_pin_yi_fa_fang_ke_zai_jiang_pin_zhong_cha_kan95 ">奖品已发放,可在【奖品】中查看</span>
<text class="gong_xi_huo_de_yi_xia_jiang_li ">恭喜获得以下奖励</text>
<text class="jiang_pin_yi_fa_fang_ke_zai_jiang_pin_zhong_cha_kan95 ">奖品已发放,可在【奖品】中查看</text>
</view>
<image class="prizeimg " src={{resList['944dc7c0-cd64-4901-a9aa-e85f3d8e97a8'].url}} />
<image class="prizeclosebtn " src={{resList['878b3751-e6b3-4ae6-9811-77e938801873'].url}} />
</view>
\ No newline at end of file
<image class="prizeclosebtn " onTap="hiddenPanelEvent" data-value="prizepanel" src={{resList['878b3751-e6b3-4ae6-9811-77e938801873'].url}} />
</view>
\ No newline at end of file
'use strict';
import { DataCenter } from '../../DataCenter';
import resList from '../../resconfig/resList';
Component({
props: {},
data: {},
methods: {},
onInit(props) {
methods: {
hiddenPanelEvent(e){
this.props.onTapHiddenPanelEvent(e);
}
},
didMount(props) {
this.setData({
resList: resList
resList: resList,
drawLotteryPrizeData:DataCenter.drawLotteryPrizeData,
});
}
});
\ No newline at end of file
.prizepanel{
height:1200rpx !important;
}
......@@ -6,4 +6,6 @@
<mycardpanel a:if={{showWinLists.indexOf("mycardpanel")!=-1}} CollectCardInfo={{CollectCardInfo}} onTapHiddenPanelEvent="hiddenPanelEvent" />
<taskpanel a:if={{showWinLists.indexOf("taskpanel")!=-1}} onTapHiddenPanelEvent="hiddenPanelEvent" />
<prizetipspanel a:if={{showWinLists.indexOf("prizetipspanel")!=-1}} onTapHiddenPanelEvent="hiddenPanelEvent" />
<prizepanel a:if={{showWinLists.indexOf("prizepanel")!=-1}} onTapHiddenPanelEvent="hiddenPanelEvent" />
<noneprizepanel a:if={{showWinLists.indexOf("noneprizepanel")!=-1}} onTapHiddenPanelEvent="hiddenPanelEvent" />
</view>
......@@ -7,6 +7,8 @@
"nonumberpanel":"../../components/comnonumberpanel/comnonumberpanel",
"mycardpanel":"../../components/commycardpanel/commycardpanel",
"taskpanel":"../../components/comtaskpanel/comtaskpanel",
"prizetipspanel":"../../components/comprizetipspanel/comprizetipspanel"
"prizetipspanel":"../../components/comprizetipspanel/comprizetipspanel",
"prizepanel":"../../components/comprizepanel/comprizepanel",
"noneprizepanel":"../../components/comnoneprizepanel/comnoneprizepanel"
}
}
\ No newline at end of file
{
"_args": [
[
"@tbmp/mp-cloud-sdk@1.4.2",
"/Users/wanghongyuan/new_taobao/taobao_mini/client"
]
],
"_from": "@tbmp/mp-cloud-sdk@1.4.2",
"_id": "@tbmp/mp-cloud-sdk@1.4.2",
"_inBundle": false,
"_integrity": "sha1-/49BtdDaNJ6H9+f9DDBMPgt/BbQ=",
"_location": "/@tbmp/mp-cloud-sdk",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@tbmp/mp-cloud-sdk@1.4.2",
"name": "@tbmp/mp-cloud-sdk",
"escapedName": "@tbmp%2fmp-cloud-sdk",
"scope": "@tbmp",
"rawSpec": "1.4.2",
"saveSpec": null,
"fetchSpec": "1.4.2"
"version": "1.4.2",
"description": "",
"main": "index.js",
"types": "./types/platforms/mp/index.d.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npm.taobao.org/@tbmp/mp-cloud-sdk/download/@tbmp/mp-cloud-sdk-1.4.2.tgz",
"_spec": "1.4.2",
"_where": "/Users/wanghongyuan/new_taobao/taobao_mini/client",
"author": "",
"description": "",
"gitHead": "c074f811312aea20c97a289aa9ac785e72de2368",
"license": "ISC",
"main": "index.js",
"name": "@tbmp/mp-cloud-sdk",
"publishConfig": {
"access": "public"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"types": "./types/platforms/mp/index.d.ts",
"version": "1.4.2"
"gitHead": "c074f811312aea20c97a289aa9ac785e72de2368"
}
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"_args": [
[
"fyge-tbmini@1.3.7",
"/Users/wanghongyuan/new_taobao/taobao_mini/client"
]
],
"_from": "fyge-tbmini@1.3.7",
"_id": "fyge-tbmini@1.3.7",
"_inBundle": false,
"_integrity": "sha1-zp/KWSj+rRCGDOTrfo0BQxQxYqQ=",
"_location": "/fyge-tbmini",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "fyge-tbmini@1.3.7",
"name": "fyge-tbmini",
"escapedName": "fyge-tbmini",
"rawSpec": "1.3.7",
"saveSpec": null,
"fetchSpec": "1.3.7"
},
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npm.taobao.org/fyge-tbmini/download/fyge-tbmini-1.3.7.tgz",
"_spec": "1.3.7",
"_where": "/Users/wanghongyuan/new_taobao/taobao_mini/client",
"author": {
"name": "MrKwon"
},
"dependencies": {},
"description": "淘宝小程序canvas渲染引擎",
"devDependencies": {
"dts-bundle": "^0.7.3",
"glob": "^7.1.6",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-progress": "^1.1.2",
"rollup-plugin-typescript": "^1.0.1",
"rollup-plugin-typescript2": "^0.25.2",
"rollup-plugin-uglify": "^6.0.3",
"ts-loader": "^4.0.0",
"typescript": "^2.7.2",
"uglifyjs-webpack-plugin": "^2.1.2",
"webpack": "^4.1.0",
"webpack-cli": "^3.3.2"
},
"keywords": [
"淘宝小程序,canvas,webgl"
],
"license": "ISC",
"main": "./build/fyge.min.js",
"name": "fyge-tbmini",
"scripts": {
"build": "webpack",
"declare": "node scripts/declare.js src/index.ts",
"dev": "webpack -w",
"dev1": "rollup -c -m -w",
"test": "echo \"Error: no test specified\" && exit 1",
"watch": "webpack --watch"
},
"types": "./build/FYGE.d.ts",
"version": "1.3.7"
}
......@@ -4,10 +4,7 @@
"main": "",
"license": "MIT",
"dependencies": {
"@tbminiapp/lottie-miniapp": "0.0.4",
"@tbmp/mp-cloud-sdk": "*",
"fyge-tbmini": "^1.3.7",
"svga-parser": "^1.1.0",
"tans_lottie": "^1.0.4"
"@tbminiapp/lottie-miniapp": "^0.0.4",
"@tbmp/mp-cloud-sdk": "*"
}
}
......@@ -19,7 +19,9 @@
onTap='clickOptions' data-value={{{index,status:item.status}}}
>
<image a:if={{item.status == 3}} class="unlockover " src={{resList['26336845-54c5-4a6f-a97e-f3f13d3fef27'].url}} />
<view a:if={{item.status == 2}} class="unlockready ">
<view a:if={{item.status == 2}} class="unlockready "
onTap="onTapUnlockPrizesItem" data-value={{item.needCardTypes}}
>
<image class="unlockreadyicon " src={{resList['a2bdbf64-229d-46a1-89df-43b3537ab255'].url}} />
<image class="unlockreadynumbg " src={{resList['cbed0e02-fb26-4b19-a121-8b7d24310652'].url}} />
<view class="unlockreadynum fontVerticalCenter">{{item.needCardTypes}}</view>
......@@ -46,7 +48,7 @@
<image class="indexdrawitemend " src={{resList['49e09b9b-b884-4921-b40f-5a1bb3b366d9'].url}} />
<view class="indexdrawitemcount fontVerticalCenter">{{item.needTimes}}</view>
</view>
<view class="indexdrawitemsuccess " ><giftbox a:if={{item.status == 2}} /></view>
<view class="indexdrawitemsuccess " onTap="onTapIndexDrawItem" data-value={{item.needTimes}}><giftbox a:if={{item.status == 2}} /></view>
<!--<image a:if={{item.status == 2}} class="indexdrawitemsuccess " src={{resList['5d8bf336-cef9-4f9f-8824-6d40e64c673e'].url}} />-->
<image a:if={{item.status == 3}} class="indexdrawitemover " src={{resList['9dbbe0b5-a157-40f0-8d13-9f8165e57246'].url}} />
<image a:if={{item.status == 1}} class="indexdrawitemnone " src={{resList['7441ff80-fd13-40de-b4db-9e5d3c013b9b'].url}} />
......@@ -80,6 +82,5 @@
<image class="indexrulebtn " onTap="showPanelEvent" data-value="{{'rulepanel'}}" src={{resList['abc5f112-fa04-42fa-bfec-f633567807c8'].url}} />
<image class="indexrecordbtn " src={{resList['5a6679e0-89f7-4582-a89b-116a35e9750a'].url}} />
</view>
<panel showWinLists="{{showWinLists}}" CollectCardInfo={{CollectCardInfo}} onOpenTaskPanel="openTaskPanel" onTapHiddenPanelEvent="hiddenPanelEvent"/>
</view>
\ No newline at end of file
......@@ -8,23 +8,75 @@ const { SHARE_CONFIG, REDIRECT_URL } = tbcc.constants;
import API from '../../api';
import { DataCenter } from '../../DataCenter';
const { commonToast, getAuthUserInfo, navigateToOutside } = tbcc.tb;
import lottie from '@tbminiapp/lottie-miniapp'
let time1,time2
async function loadCloud(url, onLoad, onError) {
if (url.indexOf("cloud://") == 0) {
//@ts-ignore
const { cloud } = getApp();
//获取临时地址
var urls = await cloud.file.getTempFileURL({ fileId: [url] })
url = urls[0].url.replace('-internal', '');
}
my.downloadFile({
url: url,
success(res) {
var i = res.apFilePath;//临时地址是否有必要缓存下,如果读不到再考虑下载。
my.getFileSystemManager().readFile({
filePath: i,
encoding: "utf8",
success: function (r) {
onLoad(JSON.parse(r.data) )
},
fail: function (res) {
onError && onError(res)
}
})
},
fail(res) {
onError && onError(res)
},
});
}
Page({
data: {
showWinLists:[],
opacityState:"opacityShow",
},
onLoad(props) {
this.setData({
resList: resList,
showPanel:this.showPanel
});
loadCloud("cloud://4028B2AAA0799F6D94C6A0398B238DE3//开卡效果.json", (data)=>{
DataCenter.lottieData=data
}, ()=>{})
//初始化首页信息
this.getIndex()
},
// onCanvasReady() {
// my.createCanvas({
// id: 'canvas',
// success: (canvas) => {
// lottie.setup(canvas);
// const context = canvas.getContext('2d')
// const { cloud } = getApp();
// loadCloud("cloud://4028B2AAA0799F6D94C6A0398B238DE3//开卡效果.json", (data)=>{
// let ani = lottie.loadAnimation({
// loop: true, autoplay: true,
// animationData: data,
// rendererSettings: { context: context, },
// })
// }, ()=>{})
// }
// });
// },
/**
* 获取主接口
*/
......@@ -72,6 +124,38 @@ Page({
this.setCarouselList()
},
onTapUnlockPrizesItem(e){
let needCardTypes = e.target.dataset.value;
this.drawLotteryPrize(7,needCardTypes)
},
onTapIndexDrawItem(e){
let needTimes = e.target.dataset.value;
this.drawLotteryPrize(8,needTimes)
},
async drawLotteryPrize(prizeDataType,need){
const { activityId } = getApp();
let data={ activityId,prizeDataType}
if(prizeDataType==7){
data.needCards=need;
}else if(prizeDataType==8){
data.needTimes=need;
}
//抽奖
let drawLotteryPrizeData = await API.drawLotteryPrize(data).catch(res => {
commonToast(res && res.message);
}) || {};
DataCenter.drawLotteryPrizeData=drawLotteryPrizeData.data;
if(drawLotteryPrizeData&&drawLotteryPrizeData.data){
let {type}=drawLotteryPrizeData.data;
if(type==5){
this.showPanel("noneprizepanel")
}else{
this.showPanel("prizepanel")
}
}
},
//奖品轮播
async setCarouselList(){
const { activityId } = getApp();
......@@ -155,6 +239,7 @@ Page({
//立即翻拍
async doJoin(){
//抽卡
this.showPanel("getcardpanel");
const { activityId } = getApp();
let doJoin = await API.doJoin({ activityId }).catch(res => {
if(res&&res.code=="310003"){
......
......@@ -21,6 +21,38 @@
border-radius:50%
}
.indexpage .indexcontent .indexunlockprizesbody .indexunlockprizesitem .unlockready{
animation: unlockreadyicon2An 1.7s infinite !important;
animation-timing-function: linear;
transform-origin:center !important;
}
@keyframes unlockreadyicon2An {
0% {
transform:scale(1,1);
}
10% {
transform:scale(0.96,0.96);
}
22% {
transform:scale(1.03,1.03);
}
32% {
transform:scale(0.98,0.98);
}
40% {
transform:scale(1,1);
}
100% {
transform:scale(1,1);
}
}
.indexdrawitem .indexdrawitembegin {display: none!important;}
/* .indexdrawitem .indexdrawitemcenter{display: none!important;} */
......
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