Commit 4ebb440a authored by mqf_0707's avatar mqf_0707

增加Lottie组件

parent 555c0714
No preview for this file type
export default { export default {
hasGameModule: false, // 是否开启游戏模块自动注入dist hasGameModule:false, // 是否开启游戏模块自动注入dist
hasLottieAnimation: true,// 使用Lottie动画
defaultPlugins: [ defaultPlugins: [
[ [
'@pluve/taro-plugin-mars', // taro暂时未支持阿里小程序自定义插件 需要引用插件的页面需配置 '@pluve/taro-plugin-mars', // taro暂时未支持阿里小程序自定义插件 需要引用插件的页面需配置
...@@ -11,9 +12,17 @@ export default { ...@@ -11,9 +12,17 @@ export default {
} }
] ]
], ],
addPages: ['pages/games/games'],// 游戏页面(自动注入app.json) addPages: ['pages/games/games'],// 游戏页面(自动注入app.json)'pages/games/games'
gamePages: [// 拷贝相关页面和依赖到dist目录 gamePages: [// 拷贝相关页面和依赖到dist目录
{ from: 'src/pages/games', to: 'dist/pages/games' }, { from: 'src/pages/games', to: 'dist/pages/games' },
{ from: 'minigame/node_modules', to: 'dist/node_modules'} { from: 'minigame/node_modules', to: 'dist/node_modules'},
{ from: 'src/components/_miniprogram/taskModal', to: 'dist/components/taskModal'},
// { from: 'src/lottie', to: 'dist/lottie'},
// { from: 'src/components/_miniprogram/lottieAnimation', to: 'dist/components/lottieAnimation'}
],
lottiePages: [
{ from: 'minigame/node_modules', to: 'dist/node_modules'},
{ from: 'src/lottie', to: 'dist/lottie'},
{ from: 'src/components/_miniprogram/lottieAnimation', to: 'dist/components/lottieAnimation'}
] ]
} }
\ No newline at end of file
// eslint-disable-next-line import/no-commonjs // eslint-disable-next-line import/no-commonjs
const path = require('path') const path = require('path')
const { hasGameModule, defaultPlugins, addPages, gamePages } = require('./default').default const { hasGameModule, defaultPlugins, addPages, gamePages, hasLottieAnimation, lottiePages } = require('./default').default
const config = { const config = {
projectName: 'taro-test', projectName: 'taro-test',
...@@ -16,16 +16,17 @@ const config = { ...@@ -16,16 +16,17 @@ const config = {
alias: { alias: {
'@': path.resolve(__dirname, '..', 'src/') '@': path.resolve(__dirname, '..', 'src/')
}, },
plugins: hasGameModule ? [...defaultPlugins,[ // 是否开启原生页面自动注入 plugins: hasGameModule || hasLottieAnimation ? [...defaultPlugins,[ // 是否开启原生页面自动注入
path.resolve(__dirname,'..')+'/plugin/changeAppJsonPlugin.js', path.resolve(__dirname,'..')+'/plugin/changeAppJsonPlugin.js',
{ {
addPages: addPages hasGameModule,
hasLottieAnimation
} }
]] : defaultPlugins, ]] : defaultPlugins,
defineConstants: { defineConstants: {
}, },
copy: { copy: {
patterns: hasGameModule ? gamePages : [], patterns: hasGameModule ? gamePages : hasLottieAnimation ? lottiePages : [],
options: { options: {
} }
}, },
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
"fyge-tbmini": { "fyge": {
"version": "1.4.8", "version": "2.0.23",
"resolved": "https://registry.npmjs.org/fyge-tbmini/-/fyge-tbmini-1.4.8.tgz", "resolved": "https://registry.npmjs.org/fyge/-/fyge-2.0.23.tgz",
"integrity": "sha512-07+DySosT5rIR6nfkfqc1+hnfaeuiDrMGBe4dOVqi+IdWIbgjv/vY7Wm/zVQJ5gqjU607b2jfkzY/rA6r97s4A==" "integrity": "sha512-5EA6FHrwpp9sAMyctuyE+gyUH10uGT5PPp1O1gZfohJNx1/bkCPcUomnXApa8367tJ5UiPhiVi3dZeqUdJiZVQ=="
} }
} }
} }
...@@ -4,6 +4,6 @@ ...@@ -4,6 +4,6 @@
"main": "", "main": "",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"fyge-tbmini": "^1.3.1" "fyge": "*"
} }
} }
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
duiba-utils@^1.0.0:
version "1.0.9"
resolved "http://npm.dui88.com:80/duiba-utils/-/duiba-utils-1.0.9.tgz#7a1e09e08a8754a1563b18aa6b117cb270f76877"
integrity sha512-3YB5w05gNruS4yyN0cx2Qktr0vG0AXYOumfV6WYlzlMx3kGX3AihBLT2/PouERtkLfFk2q4cIikSkgwramHTmg==
fyge@*:
version "2.0.23"
resolved "http://npm.dui88.com:80/fyge/-/fyge-2.0.23.tgz#36550f93d9578cd3b02ae9772f93aa94730abd25"
integrity sha512-nNUD5HAPyknIMKdxxa50HzriLuBFmk4XLnZw5CgiX3mH7ROJzsh/ToRMTKXcxwH3r3ICid95cgEo0iCPIHSIsQ==
dependencies:
duiba-utils "^1.0.0"
tslib "^2.1.0"
tslib@^2.1.0:
version "2.2.0"
resolved "http://npm.dui88.com:80/tslib/-/tslib-2.2.0.tgz#fb2c475977e35e241311ede2693cee1ec6698f5c"
integrity sha1-+yxHWXfjXiQTEe3iaTzuHsZpj1w=
This diff is collapsed.
...@@ -45,12 +45,13 @@ ...@@ -45,12 +45,13 @@
"@tarojs/taro": "v3.2.0-canary.9", "@tarojs/taro": "v3.2.0-canary.9",
"@tbmp/mp-cloud-sdk": "^1.4.2", "@tbmp/mp-cloud-sdk": "^1.4.2",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"fyge": "*",
"hox": "^1.1.2", "hox": "^1.1.2",
"lodash": "4.17.15", "lodash": "4.17.15",
"react": "^16.10.0", "react": "^16.10.0",
"react-dom": "^16.10.0", "react-dom": "^16.10.0",
"taro-ui": "^3.0.0-alpha.3", "taro-ui": "^3.0.0-alpha.3",
"tbcc-sdk-ts": "^1.0.4" "tbcc-sdk-ts": "^1.0.5"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.8.0", "@babel/core": "^7.8.0",
......
const fs = require('fs'); const fs = require('fs');
const path = require('path') const path = require('path')
const { addPages } = require('../config/default').default
export default (ctx, options) => { export default (ctx, options) => {
// plugin 主体 // plugin 主体
const { addPages = [] } = options const { hasGameModule = false, hasLottieAnimation = false } = options
ctx.onBuildStart(() => { ctx.onBuildStart(() => {
// console.log('编译开始!') // console.log('编译开始!')
}) })
ctx.onBuildFinish(() => { ctx.onBuildFinish(() => {
const dirUrl = path.resolve(__dirname,'..')+'/dist/app.json' if(hasGameModule) {
const rawdata = fs.readFileSync(dirUrl); const dirUrl = path.resolve(__dirname,'..')+'/dist/app.json'
const { pages, ...ext } = JSON.parse(rawdata); const rawdata = fs.readFileSync(dirUrl);
let new_pages = [...pages,...addPages] const { pages, ...ext } = JSON.parse(rawdata);
let new_pages = [...pages,...addPages]
const new_info = { const _new_info = {
pages: new_pages, ...ext,
...ext pages: new_pages
}
fs.writeFileSync(dirUrl, JSON.stringify(_new_info));
}
if(hasLottieAnimation) {
const dirUrl = path.resolve(__dirname,'..')+'/dist/pages/index/index.json'
const rawdata = fs.readFileSync(dirUrl);
const { usingComponents, ...ext } = JSON.parse(rawdata);
const new_info = {
...ext,
usingComponents: {
...usingComponents,
"lottie-modal":"/components/lottieAnimation/lottieAnimation"
}
}
fs.writeFileSync(dirUrl, JSON.stringify(new_info));
} }
fs.writeFileSync(dirUrl, JSON.stringify(new_info));
console.log('文件写入成功!'); console.log('文件写入成功!');
//ctx.writeFileToDist({ filePath: string, content: string }) //ctx.writeFileToDist({ filePath: string, content: string })
}) })
} }
\ No newline at end of file
...@@ -20,14 +20,8 @@ class App extends Component { ...@@ -20,14 +20,8 @@ class App extends Component {
app.tornadoAPI = tornadoAPI app.tornadoAPI = tornadoAPI
app.activityId = activityId || defaultActivityId app.activityId = activityId || defaultActivityId
} }
// this.props.children 是将要会渲染的页面
render() { render() {
return this.props.children return this.props.children
} }
} }
// export default withModel(useAuthInfoModel, authInfo => ({
// authInfo
// }))(App);
export default App export default App
.canvas {
width:100%;
height:100%;
}
.page-game {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
width:100%;
height:100vh;
flex: 1;
display: flex;
flex-direction: column;
}
\ No newline at end of file
<view class="page-game">
<canvas id="canvas" type="2d" class="canvas" disable-scroll="true"
onReady="onCanvasReady"
></canvas>
</view>
\ No newline at end of file
import * as fyge from "fyge"
import lottieData from '/lottie/index.js'
Component({
mixins: [],
data: {},
props: {
type: 1
},
didMount() {},
didUpdate() {},
didUnmount() {
//舞台销毁
if (this.stage) this.stage.destroy();
//循环停止
this.canvas.cancelAnimationFrame(this.timeId)
},
methods: {
onCanvasReady() {
const { type } = this.props
console.log("进canvas了")
var self = this;
my.createCanvas({
id: 'canvas',
success: (ccc) => {
this.canvas = ccc;
const dpr = my.getSystemInfoSync().pixelRatio
//显示尺寸
const windowWidth = my.getSystemInfoSync().windowWidth;
const windowHeight = my.getSystemInfoSync().windowHeight;
//实际尺寸
ccc.width = windowWidth * dpr + dpr;//重新修改会有误差
ccc.height = windowHeight * dpr + dpr;
//兼容小程序
fyge.initedByCanvas(ccc)
var stage = this.stage = new fyge.Stage(ccc, 750, 1624, windowWidth, windowHeight,1);
//加载
console.warn(lottieData[type])
var l = stage.addChild(new fyge.Lottie(lottieData[type]))
l.play()
// fyge.GlobalLoader.loadJson((s, json) => {
// console.warn(lottieData)
// var l = stage.addChild(new fyge.Lottie(lottieData))
// l.play()
// }, "cloud://F4263E74E20F2B51C2C51BC350F83396//index_animation.json")//云存储地址
//循环
let loop = () => {
stage.flush();
fyge.Tween.flush()
this.timeId = ccc.requestAnimationFrame(loop)
//用timeId移除ccc.cancelAnimationFrame(timeId)
}
loop()
}
})
}
},
});
.canvas {
width:100%;
height:100%;
}
.page-game {
width:100%;
height:100vh;
flex: 1;
display: flex;
flex-direction: column;
background: #eeeeee;
}
\ No newline at end of file
<view class="page-game">
</view>
\ No newline at end of file
Component({
mixins: [],
data: {},
props: {
},
didMount() {},
didUpdate() {},
didUnmount() {
//舞台销毁
},
methods: {
},
});
{
"component": true
}
\ No newline at end of file
.dialog-container {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 20;
}
.dialog-modal__shade {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.75);
}
.dialog-modal__container {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.dialog-modal__container-bottom {
animation: bottom-up 1s linear forwards;
}
.dialog-modal__close {
position: absolute;
right: 20rpx;
top: -80rpx;
height: 48rpx;
width: 48rpx;
background: url('//yun.dui88.com/taobaomini/clientCTest/modal_close_btn.png') center center no-repeat;
background-size: 48rpx 48rpx;
}
@keyframes bottom-up {
from {
transform: translate(0,100vh);
}
to {
transform: translate(0,0);
}
}
.task-modal-container {
width: 100%;
height: 700rpx;
position: absolute;
bottom: 0;
left: 0;
background-color: #ffffff;
}
.task-modal-content__title {
text-align: center;
margin: 30rpx 0;
}
.task-modal-content__list {
width: 100%;
height: 600rpx;
padding: 0 16rpx;
}
.task-modal-content__scroll {
width: 100%;
height: 100%;
}
.task-modal-content-item {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16rpx;
padding: 16rpx;
border: 1rpx solid #eee;
}
.task-modal-content-item__left {
width: 120rpx;
height: 120rpx;
display: flex;
justify-content: center;
align-items: center;
background-color: #eee;
}
.task-modal-content-item__left image {
width: 80rpx;
}
.task-modal-content-item__left-label {
flex: 1;
flex-direction: column;
align-items: center;
margin: 0 16rpx;
}
.task-modal-content-item__left-title {
}
.task-modal-content-item__left-reward {
margin-top: 10rpx;
}
.task-modal-content__list-item__right {
display: flex;
justify-content: center;
align-items: center;
width: 150rpx;
height: 60rpx;
background-color: #eee;
border-radius: 30rpx;
}
.task-item__status-1 {
}
.task-item__status-2 {
}
.task-item__status-3 {
}
\ No newline at end of file
<view class="dialog-container">
<view class="dialog-modal__shade modal-animate-fade-in" />
<view class="dialog-modal__container {{ 'dialog-modal__container-bottom'}} ">
<view class="task-modal-container">
<view class="dialog-modal__close" onTap="onModalClose" />
<view class="task-modal-content">
<view class="task-modal-content__title">任务模块</view>
<view class="task-modal-content__list">
<scroll-view scroll-y="{{true}}" class="task-modal-content__scroll">
<view class="task-modal-content-item" a:for="{{taskList}}">
<view class="task-modal-content-item__left">
<image src="{{taskIcon[item.taskType]}}" mode="widthFix" />
</view>
<view class="task-modal-content-item__left-label">
<view class="task-modal-content-item__left-title">{{item.title}}</view>
<view class="task-modal-content-item__left-reward">抽盒次数+{{item.rewards}}</view>
</view>
<view class="task-modal-content__list-item__right {{'task-item__status-'+item.status}}" data-item="{{item}}" onTap="handleTapItem">
{{
item.status == 1 ? doTaskTxt[item.taskType] : commonTaskTxt[taskType]
}}
</view>
</view>
</scroll-view>
</view>
</view>
</view>
</view>
</view>
<member-shop
a:if="{{memberShopVisible}}"
expend="{{memberShopVisible}}"
onSuccess="onSuccess"
onFail="closeCommonModal"
onClose="closeCommonModal" />
\ No newline at end of file
import { cloudRequest, throttleHandle, commonToast, favorShop, navigateTo, navigateToOutside, showSharePanel } from './utils';
const app = getApp();
const taskConfig = {
taskStatus: { // 任务状态
1: '//yun.duiba.com.cn/baicaoweiFarmer/task_btn_01.png',
2: '//yun.duiba.com.cn/baicaoweiFarmer/task_btn_02.png',
3: '//yun.duiba.com.cn/baicaoweiFarmer/task_btn_03.png'
},
taskIcon: {// 任务图标
follow: '//yun.duiba.com.cn/baicaoweiFarmer/follow.png',
member: '//yun.duiba.com.cn/baicaoweiFarmer/memberStar1.png',
invites: '//yun.duiba.com.cn/baicaoweiFarmer/invites.png',
jumpLink: '//yun.duiba.com.cn/baicaoweiFarmer/browseGoodsLink.png',
browseGoods: '//yun.duiba.com.cn/baicaoweiFarmer/browseGoods.png',
orderGoods: '//yun.duiba.com.cn/baicaoweiFarmer/orderGoods.png',
collectGoods: '//yun.duiba.com.cn/baicaoweiFarmer/orderGoods.png',
sign: '//yun.duiba.com.cn/baicaoweiFarmer/orderGoods.png',
},
commonTaskTxt: {
1: '去完成',
2: '待领取',
3: '已完成'
},
doTaskTxt: {
follow: '立即关注',
invites: '去邀请',
member: '1秒入会',
sign: '立即签到',
jumpLink: '去完成',
browseGoods: '去完成',
orderGoods: '去完成',
collectGoods: '去完成',
},
browseType: 1, // 1 跳转即算完成 2 跳转浏览15s 才算完成
browseTime: 15, // 浏览时间
}
const cloudName = 'luolai'
const GO_TO_INVITE = 2 // 数据埋点
const SELLER_ID = 2374579403 // 商家sellerId
Component({
mixins: [],
data: {
taskStatus: taskConfig.taskStatus,
taskIcon: taskConfig.taskIcon,
commonTaskTxt: taskConfig.commonTaskTxt,
doTaskTxt: taskConfig.doTaskTxt,
taskList: [
{
taskType: 'follow',
title: '关注店铺',
taskRateType: 1,
times: 1,
completeTimes: 0,
status: 1,
rewards: 1
},
{
taskType: 'member',
title: '加入会员',
taskRateType: 1,
times: 1,
completeTimes: 0,
status: 1,
rewards: 1
},
{
taskType: 'invites',
title: '邀请好友入会',
taskRateType: 1,
times: 3,
completeTimes: 0,
status: 1,
rewards: 1
},
{
taskType: 'jumpLink',
title: '浏览店铺15s',
taskRateType: 2,
times: 1,
completeTimes: 0,
status: 1,
rewards: 1
},
{
taskType: 'browseGoods',
title: '浏览商品',
taskRateType: 2,
times: 1,
completeTimes: 0,
status: 1,
rewards: 1
},
{
taskType: 'orderGoods',
title: '下单任务',
taskRateType: 2,
times: 1,
completeTimes: 0,
status: 1,
rewards: 1
},
{
taskType: 'collectGoods',
title: '收藏商品',
taskRateType: 2,
times: 1,
todayCompleteTimes: 0,
status: 1,
rewards: 1
},
{
taskType: 'sign',
title: '每日签到',
taskRateType: 2,
times: 1,
todayCompleteTimes: 0,
status: 1,
rewards: 1
}
],
memberShopVisible: false,
currentTaskType: null,
preBrowseTime: null
},
props: {
taskFlag: 1,
dataName: '',
onModalClose: () => {},
onUpdate: () => {}
},
didMount() {
this.getTaskList()
},
didUpdate(preProps,preData) {
const { taskFlag } = this.props
const { isFlashTask = false } = app
const { browseTime } = taskConfig
const { preBrowseTime, currentTaskType } = this.data
if(preProps.taskFlag !== taskFlag && isFlashTask) {
// console.log((Date.now() - preBrowseTime)/1000)
if(preBrowseTime && ((Date.now() - preBrowseTime) / 1000) >= browseTime) {
this.doCompleteTask(currentTaskType,true)
}
else {
if(currentTaskType === 'jumpLink') {
this.setData({ preBrowseTime: null, currentTaskType: null})
}
this.getTaskList(true)
}
}
},
didUnmount() {
},
methods: {
// 关闭弹窗
onModalClose() {
const { onModalClose, dataName } = this.props;
onModalClose && onModalClose(dataName);
},
// 按钮
handleTapItem: throttleHandle(async function(e) {
const { activityId } = app
const { status, taskType, url, rewards, itemIds, keepTime } = e.target.dataset.item
if(status == 3) return;
if(status == 2) {
const { success, data } = await cloudRequest(cloudName,{ activityId, taskType }, 'receiveTaskRewards').catch(res => {
commonToast(res && res.message);
}) || {};
if (success && data) {
const { rewards, receiveTimes } = data
let message = taskType == 'invites' ?
`成功邀请${receiveTimes}名好友,抽盒次数+${rewards}`:`抽盒次数+${rewards}`
commonToast(message)
this.getTaskList()
this.props.onUpdate()
}
}
else {
this.goToComplete(taskType,url,itemIds,keepTime)
}
},2000),
// 做任务
async goToComplete(taskType,url,itemIds,keepTime) {
const { activityId } = app
const { browseType } = taskConfig
switch(taskType) {
case 'member':
// 去加入会员
this.setData({ memberShopVisible: true })
break;
case 'follow':
let isFollow = await favorShop(SELLER_ID)
if(isFollow) {
this.doCompleteTask(taskType)
}
break;
case 'invites':
// 邀请好友
showSharePanel();
await cloudRequest(cloudName,{ activityId, type: GO_TO_INVITE }, 'addStat')
break;
case 'jumpLink':
// 跳转任务
navigateToOutside(url || 'https://www.feizhu.com')
if(browseType === 1) {
this.doCompleteTask(taskType)
}
else {
app.isFlashTask = true
this.setData({ preBrowseTime: Date.now(), currentTaskType: taskType})
}
break;
case 'browseGoods':
// 跳转浏览页面
app.isFlashTask = true
navigateTo(`/pages/browseGoods/browseGoods?itemIds=${itemIds}&keepTime=${keepTime}`)
break;
case 'orderGoods':
// 跳转下单页面
app.isFlashTask = true
navigateTo(`/pages/orderGoods/orderGoods?itemIds=${itemIds}`)
break;
case 'collectGoods':
// 跳转收藏页面
app.isFlashTask = true
navigateTo(`/pages/collectGoods/collectGoods?itemIds=${itemIds}`)
break;
case 'sign':
// 签到
this.doCompleteTask(taskType)
break;
}
},
// 完成任务
async doCompleteTask(taskType, flag) {
const { activityId } = app
let { success, data } = await cloudRequest(cloudName,{ activityId, taskType }, 'doCompleteTask') || {}
if(success) {
this.getTaskList()
flag && this.setData({ preBrowseTime: null })
}
},
// 获取任务列表
async getTaskList(flag) {
const { activityId } = app
const { success, data } = await cloudRequest(cloudName,{ activityId }, 'getTaskList').catch(res => {
commonToast(res && res.message);
}) || {};
if (success && data) {
const { list } = data
app.isFlashTask = flag ? false : true
// this.setData({ taskList: list })
}
},
// 关闭入会组件
closeCommonModal() {
this.setData({ memberShopVisible: false })
},
// 入会成功
onSuccess() {
this.getTaskList()
this.setData({ memberShopVisible: false })
}
},
});
{
"component": true,
"usingComponents": {
"member-shop":"/components/_miniprogram/memberModal/memberModal"
}
}
\ No newline at end of file
/**
* 获取任务数据
* @param {*} _cloudName
* @param {*} params
* @param {*} loading
*/
export const cloudRequest = async (_cloudName, params, handle, loading = false) => {
const { cloud } = getApp();
loading && my.showLoading()
return new Promise((resolve, reject) => {
cloud.function.invoke(_cloudName, params, handle).then(res => {
console.log(`调用${handle}接口返回结果`, res)
loading && my.hideLoading()
if (res && res.success) {
resolve(res);
} else {
reject(res);
}
return res;
}).catch(() => {
loading && my.hideLoading()
reject();
});
});
}
/**
* 函数节流,普通防连点
* @param {fun} fun 函数
* @param {delay} delay 时间
*/
export const throttleHandle = (fun, delay = 1000) => {
let last, deferTimer;
return function () {
let now = +new Date();
if (last && now < last + delay) {
clearTimeout(deferTimer);
deferTimer = setTimeout(() => {
last = now;
}, delay);
} else {
last = now;
fun.apply(this, arguments);
}
};
}
/**
* toast
* @param {*} content
* @param {*} duration
* @param {*} successCb
*/
export const commonToast = (content, duration, successCb) => {
my.showToast({
content: content || '换个姿势再试一次~',
duration: duration || 3000,
success: successCb
})
};
/**
* 执行关注店铺
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
export const favorShop = async (sellerId) => {
if (!sellerId) {
return false;
}
return new Promise((resolve, reject) => {
// @ts-ignore
my.tb.favorShop({
id: +sellerId,
success: res => {
if(res.error === 11) resolve(true)
resolve(res)
},
fail: err => {
reject(err)
}
})
})
};
/**
* 跳转到外部链接
* @param {string} url 跳转链接
*/
export const navigateToOutside = url => {
if (!url) {
console.error('navigateToOutside: 请传入url');
return false;
}
my.call('navigateToOutside',{ url });
};
/**
* 跳转到内部链接(新开窗口)
* @param {string} url 跳转链接
*/
export const navigateTo = url => {
if (!url) {
console.error('navigateTo: 请传入url');
return false;
}
my.navigateTo({ url });
};
/**
* 调起分享面板
*/
export const showSharePanel = async () => {
my.showSharePanel();
}
\ No newline at end of file
export default { export default {
env: 'test', // 云函数环境 test 测试环境 online 线上环境 env: 'test', // 云函数环境 test 测试环境 online 线上环境
requestType: 'tornadoAPI', // cloud: 云函数, yapi: yapi 接口, ams: ams接口,tornadoAPI: 风驰台接口 requestType: 'yapi', // cloud: 云函数, yapi: yapi 接口, ams: ams接口,tornadoAPI: 风驰台接口
cloudName: 'luolai', // 主云函数项目名 CommonToC cloudName: 'CommonToC', // 主云函数项目名 CommonToC
sellerId: '2207644377875', sellerId: '2207644377875',
tornadoAPI: 'https://tornado.duibadev.com.cn/tbServer/api?db=db3000000038851072&proxyIp=172.16.130.158', // 新增:当requestType: 'tornadoAPI'时,找服务端提供地址 tornadoAPI: 'https://tornado.duibadev.com.cn/tbServer/api?db=db3000000038851072&proxyIp=172.16.130.158', // 新增:当requestType: 'tornadoAPI'时,找服务端提供地址
defaultActivityId: '60642aafc752d118247c2a2d' // 默认活动id defaultActivityId: '60642aafc752d118247c2a2d' // 默认活动id
......
const testLottie = require('./lottieData')
export default {
1: testLottie
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -35,6 +35,7 @@ function BrowseGoodsPage() { ...@@ -35,6 +35,7 @@ function BrowseGoodsPage() {
useEffect(() => { useEffect(() => {
listSuccess && list.length && browseGoodsTimes() listSuccess && list.length && browseGoodsTimes()
return () => clearInterval(this.timer)
}, [ list ]) }, [ list ])
useDidShow(() => { useDidShow(() => {
......
...@@ -9,3 +9,4 @@ ...@@ -9,3 +9,4 @@
></canvas> ></canvas>
</view> </view>
<task-modal />
\ No newline at end of file
{ {
"disableScroll": "true" "disableScroll": "true",
"usingComponents": {
"task-modal": "/components/taskModal/taskModal"
}
} }
\ No newline at end of file
import * as FYGE from "fyge-tbmini"; import * as FYGE from "fyge";
(function webpackUniversalModuleDefinition(root, factory) { (function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object') if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(); module.exports = factory();
...@@ -4,6 +4,7 @@ export default { ...@@ -4,6 +4,7 @@ export default {
allowsBounceVertical: 'NO', allowsBounceVertical: 'NO',
enableShareAppMessage: true, enableShareAppMessage: true,
usingComponents: { usingComponents: {
'member-modal': '../../components/_miniprogram/memberModal/memberModal' 'member-modal': '../../components/_miniprogram/memberModal/memberModal',
'lottie-modal': '../../components/_miniprogram/lottieBlank/lottieBlank'
} }
} }
...@@ -13,9 +13,10 @@ import CountDown from '@/components/CountDown/CountDown' ...@@ -13,9 +13,10 @@ import CountDown from '@/components/CountDown/CountDown'
import styles from './index.module.less' import styles from './index.module.less'
import tbcc from 'tbcc-sdk-ts' import tbcc from 'tbcc-sdk-ts'
const { navigateTo } = tbcc.tb const { navigateTo } = tbcc.tb
const { getImgShareUrl } = tbcc.utils
const INDEX_CONFIG = { const INDEX_CONFIG = {
bg: '', // 背景 bg: '', // 背景 cloud://C4015B7CEC23CF013A78247E2852524F//火箭待机小球抖动.json
ruleButton: '', // 规则按钮 ruleButton: '', // 规则按钮
myPrizeButton: '', // 我的奖品按钮 myPrizeButton: '', // 我的奖品按钮
shareButton: '', // 分享按钮 shareButton: '', // 分享按钮
...@@ -36,7 +37,7 @@ function Index() { ...@@ -36,7 +37,7 @@ function Index() {
success && setActivityInfoAndStatus(data) success && setActivityInfoAndStatus(data)
} }
// 授权登录完成 // 授权登录完成
useLogin(() => { useLogin(async () => {
fetchActivityInfo() fetchActivityInfo()
}) })
...@@ -82,6 +83,7 @@ function Index() { ...@@ -82,6 +83,7 @@ function Index() {
{/* <View className={styles.countTime}> {/* <View className={styles.countTime}>
<CountDown endTime={(Date.now() + 3 * 60 * 60 * 1000)} fontSize={'20rpx'} color={'#1B5F7F'} onUpdate={() => updateFlash()} /> <CountDown endTime={(Date.now() + 3 * 60 * 60 * 1000)} fontSize={'20rpx'} color={'#1B5F7F'} onUpdate={() => updateFlash()} />
</View> */} </View> */}
{ true && <lottie-modal />}
<View className={styles.rule} style={{ backgroundImage: `url(${INDEX_CONFIG.ruleButton})` }} onTap={() => setRuleModalVisible(true)}>活动规则</View> <View className={styles.rule} style={{ backgroundImage: `url(${INDEX_CONFIG.ruleButton})` }} onTap={() => setRuleModalVisible(true)}>活动规则</View>
<View className={styles.my_prize} style={{ backgroundImage: `url(${INDEX_CONFIG.myPrizeButton})` }} onTap={onGoMyPrizePage}>我的奖品</View> <View className={styles.my_prize} style={{ backgroundImage: `url(${INDEX_CONFIG.myPrizeButton})` }} onTap={onGoMyPrizePage}>我的奖品</View>
<View className={styles.share} style={{ backgroundImage: `url(${INDEX_CONFIG.shareButton})` }} onTap={onShare}>分享</View> <View className={styles.share} style={{ backgroundImage: `url(${INDEX_CONFIG.shareButton})` }} onTap={onShare}>分享</View>
......
...@@ -86,4 +86,4 @@ ...@@ -86,4 +86,4 @@
width: 100%; width: 100%;
height: 2500px; height: 2500px;
background: #eee; background: #eee;
} }
\ No newline at end of file
...@@ -25,7 +25,7 @@ const { addStat } = require('../api') ...@@ -25,7 +25,7 @@ const { addStat } = require('../api')
const eventType = event?.type const eventType = event?.type
if (eventType === 'tap') { if (eventType === 'tap') {
const element = document.getElementById(args?.[0]?.target?.id) const element = document.getElementById(args?.[0]?.target?.id)
const mdType = element.dataset?.md const mdType = element?.dataset?.md
// 事件会触发两次,这里过滤掉 // 事件会触发两次,这里过滤掉
const canTrigger = !lastTriggerTime || mdType !== lastTriggerMd || event.timeStamp - lastTriggerTime >= 100 const canTrigger = !lastTriggerTime || mdType !== lastTriggerMd || event.timeStamp - lastTriggerTime >= 100
if (mdType && canTrigger) { if (mdType && canTrigger) {
......
This diff is collapsed.
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