Commit 8e0b53c7 authored by spc's avatar spc

Merge branch 'yd11_20200922' of gitlab2.dui88.com:wanghongyuan/new_taobao into yd11_20200922

parents 0cec1b1e 22378f38
{
"success": false,
"code": "sit nulla labore in",
"data":[
{
"taskType":"oN6Bq",
"title":"2A7h2",
"rewards":2,
"taskRateType":2,
"waitReceive":-13791948.109031975,
"status":-54118349.23389276,
"completeTimes":-92392435.91503823,
"times":"3",
"todayCompleteTimes":-80193158.01905021,
"itemIds":"non Duis id voluptate",
"url":"esse Ut nulla eiusmod"
}, {
"taskType":"T4[oj",
"title":"Oj2ZN",
"rewards":2,
"taskRateType":2,
"waitReceive":-24361244.83615884,
"status":-93556772.20227832,
"completeTimes":99358061.68916574,
"times":"3",
"todayCompleteTimes":-92796921.9007521,
"itemIds":"cillum fugiat Duis pariatur Lorem",
"url":"dolor tempor in sed proident"
},
{
"taskType":"6MZs",
"title":"(1XhjD",
"rewards":2,
"taskRateType":2,
"waitReceive":40009903.06684077,
"status":-12612373.255133048,
"completeTimes":70433951.05683738,
"times":"3",
"todayCompleteTimes":3214292.4035636783,
"itemIds":"anim est Excepteur",
"url":"dolore labore elit Ut fugiat"
},
{
"taskType":"6MZs",
"title":"(1XhjD",
"rewards":2,
"taskRateType":2,
"waitReceive":40009903.06684077,
"status":-12612373.255133048,
"completeTimes":70433951.05683738,
"times":"3",
"todayCompleteTimes":3214292.4035636783,
"itemIds":"anim est Excepteur",
"url":"dolore labore elit Ut fugiat"
},
{
"taskType":"6MZs",
"title":"(1XhjD",
"rewards":2,
"taskRateType":2,
"waitReceive":40009903.06684077,
"status":-12612373.255133048,
"completeTimes":70433951.05683738,
"times":"3",
"todayCompleteTimes":3214292.4035636783,
"itemIds":"anim est Excepteur",
"url":"dolore labore elit Ut fugiat"
},
{
"taskType":"6MZs",
"title":"(1XhjD",
"rewards":2,
"taskRateType":2,
"waitReceive":40009903.06684077,
"status":-12612373.255133048,
"completeTimes":70433951.05683738,
"times":"3",
"todayCompleteTimes":3214292.4035636783,
"itemIds":"anim est Excepteur",
"url":"dolore labore elit Ut fugiat"
},
{
"taskType":"6MZs",
"title":"(1XhjD",
"rewards":2,
"taskRateType":2,
"waitReceive":40009903.06684077,
"status":-12612373.255133048,
"completeTimes":70433951.05683738,
"times":"3",
"todayCompleteTimes":3214292.4035636783,
"itemIds":"anim est Excepteur",
"url":"dolore labore elit Ut fugiat"
},
{
"taskType":"6MZs",
"title":"(1XhjD",
"rewards":2,
"taskRateType":2,
"waitReceive":40009903.06684077,
"status":-12612373.255133048,
"completeTimes":70433951.05683738,
"times":"3",
"todayCompleteTimes":3214292.4035636783,
"itemIds":"anim est Excepteur",
"url":"dolore labore elit Ut fugiat"
}
],
"message":"in mollit exercitation Ut"
}
\ No newline at end of file
......@@ -89,11 +89,29 @@ const resCanvasListCsd = {
url: '//yun.duiba.com.cn/spark/assets/userboard_right.e62f8797b851fa7758f16d0a5b1fae6729989f8c.png',
uuid: '9606b410-5d79-4759-a3f6-026dbb6fad0b'
},
'30df14d3-e5a3-41ab-985d-26d4cad0cbfc': {
'01def08f-119f-463d-bc75-1c7ab44b55d5': {
name: '传送带左边传送带2',
ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/传送带左边传送带2.7fea2ca2aa3d648a8bdb8af805c6bd43bcdf7f19.png',
uuid: '01def08f-119f-463d-bc75-1c7ab44b55d5'
},
'f6ba8f6a-54e0-4b75-93f3-00f5051f58eb': {
name: '齿轮',
ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/齿轮.d6b4a63009dbe5f489f39eec37952e644589337a.png',
uuid: 'f6ba8f6a-54e0-4b75-93f3-00f5051f58eb'
},
'b36dec27-734f-4458-8719-afda29c8c296': {
name: '传送带带子2',
ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/传送带带子2.57e04400bd98aeb93f87a6413c82ad39ea68c372.png',
uuid: 'b36dec27-734f-4458-8719-afda29c8c296'
},
'2137d3de-174f-42b1-8ebc-c5eb667ed250': {
name: '传送带左边传送带',
ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/传送带左边传送带.7fea2ca2aa3d648a8bdb8af805c6bd43bcdf7f19.png',
uuid: '30df14d3-e5a3-41ab-985d-26d4cad0cbfc'
url: '//yun.duiba.com.cn/spark/assets/传送带左边传送带.9ecaa198fe5be733f7de4f917aac0d8a8474aa0b.png',
uuid: '2137d3de-174f-42b1-8ebc-c5eb667ed250'
}
};
export default resCanvasListCsd;
\ No newline at end of file
......@@ -63,7 +63,7 @@ export enum TbNetName {
* 任务列表
* activityId
*/
getTaskList = "babycare.getTaskList",
// getTaskList = "babycare.getTaskList",
///////////////////前端调用接口都加个mine
......
......@@ -25,8 +25,6 @@ export default class Root extends FYGE.Container {
// 舞台高度
stageHeight: number
// 计时器
timerFunc
// 计时器的倒数数字
timerNumer: number
// 比拼的用户信息
userInfo
......@@ -45,18 +43,15 @@ export default class Root extends FYGE.Container {
// Main
this.baseOption = options
this.time = options.gameParm.time
this.gameStartFlag = false
setTimeout(() => {
this.gameStartFlag = true
this.gameStart()
}, 1000)
this.once(FYGE.Event.ADDED_TO_STAGE, this.onAddToStage, this)
// 全局-游戏开始
GDispatcher.addEventListener('game-start', this.gameStart, this)
// 全局-游戏结束(外部监听)
GDispatcher.dispatchEvent('game-over')
}
initUi () {
......@@ -73,7 +68,7 @@ export default class Root extends FYGE.Container {
this.backBtn.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, this.backToPage, this)
this.addChild(this.backBtn)
let leftCsd = Tools.getSprite(resCanvasList['30df14d3-e5a3-41ab-985d-26d4cad0cbfc'].url, 0, 1160)
let leftCsd = Tools.getSprite(resCanvasList['01def08f-119f-463d-bc75-1c7ab44b55d5'].url, 0, 1160)
leftCsd.width = 370
leftCsd.height = 230
this.addChild(leftCsd)
......@@ -91,25 +86,25 @@ export default class Root extends FYGE.Container {
gameStart () {
this.scoreBoard.start(this.time)
this.goodsContainer.startGoods()
this.gameStartFlag = true
}
// 结束游戏
gameOver () {
let score = this.score
clearInterval(this.timerFunc)
this.time = 60
this.gameStartFlag = false
GDispatcher.dispatchEvent('game-over', {score: score})
this.goodsContainer.removeAllGoods()
GDispatcher.dispatchEvent('gameOver-csd', {score: score})
}
// 分数变动
gameScoreChange (data) {
let score = this.score += data.data
this.score = score < 0 ? 0 : score
this.scoreBoard.updateScore(this.score)
// console.log(this.score)
gameScoreChange (score) {
this.score += score
this.scoreBoard.updateScore(score)
}
// 创建 触摸层
createTouchRect () {
this.touchArea = Tools.getRect(750, 574, 0xff22ff, 0)
......@@ -154,6 +149,7 @@ export default class Root extends FYGE.Container {
// 清除函数
dispose() {
this.goodsContainer.destroy()
this.scoreBoard.destroy()
this.touchArea.removeEventListener(FYGE.MouseEvent.MOUSE_DOWN, this.onMouseDownArea, this)
this.touchArea.removeEventListener(FYGE.MouseEvent.MOUSE_UP, this.onMouseUpArea, this)
// throw new Error("Method not implemented.")
......
......@@ -84,9 +84,15 @@ export default class Catecher extends FYGE.Container {
this.addChild(this.userScore_right)
}
// 销毁 事件和循环
destroy () {
clearInterval(this.timerFunc)
this.timerFunc = null
}
updateScore(score) {
this.scoreLeft += score
this.userScore_left.updateScore(this.scoreLeft)
}
......@@ -98,10 +104,15 @@ export default class Catecher extends FYGE.Container {
this.timerFunc = setInterval(() => {
this.updateTime(--this.timerNumer)
// 时间消耗完毕
if (this.timerNumer <= 0) this.dispatchEvent('game-over')
if (this.timerNumer <= 0) {
this._root.gameOver()
clearInterval(this.timerFunc)
this.timerFunc = null
this.updateTime(0)
} else {
this.updateTime(--this.timerNumer)
}
}, 1000)
}
......
import { RES } from "../../../module/RES"
import resCanvasList from '../../../resCanvasList'
import { Tools } from "../../Tools"
import { getStage } from '../../scenes/stage'
// import { getStage } from '../../scenes/stage'
export default class GoodsContainer extends FYGE.Container {
_root;
// 左边的传送带
leftCsd;
// 传送带棍子 的 容器
leftCsdContainer;
// 传送带棍子 的 数组
leftCsdArr = [];
// 生产棍子 的 interval函数
createLeftCsdLineTimeOut = null;
// 传送带背景
back;
// 传送带棍子 的 容器
......@@ -37,8 +45,8 @@ export default class GoodsContainer extends FYGE.Container {
this.goodsDeepIndex = 1000
this.goodsTextures = [
{ texture: resCanvasList['d1379fca-f21e-40f0-b0f0-06c188d4b4dc'].url, score: 2, dir: 'left', wrong: -2, width: 92, height: 220, aX: -4 },
{ texture: resCanvasList['0bd734c1-9c1a-428e-8a9c-cef373baed9d'].url, score: 5, dir: 'left', wrong: -2, width: 102, height: 224, aX: -2 },,
{ texture: resCanvasList['f455b42a-0e67-43d8-b7c5-520760160631'].url, score: 1, dir: 'right', wrong: 'endGame', width: 123, height: 120, aX: -12 },
{ texture: resCanvasList['0bd734c1-9c1a-428e-8a9c-cef373baed9d'].url, score: 5, dir: 'left', wrong: -2, width: 102, height: 224, aX: -2 },
{ texture: resCanvasList['f455b42a-0e67-43d8-b7c5-520760160631'].url, score: 1, dir: 'right', wrong: 'endGame', width: 122, height: 120, aX: -12 },
{ texture: resCanvasList['9e512c7f-88e2-4b85-a2f0-afd2062247e1'].url, score: 4, dir: 'left', wrong: -2, width: 126, height: 141, aX: 0 },
{ texture: resCanvasList['30ac266d-0388-4659-9c3e-e741f3c671c7'].url, score: 3, dir: 'left', wrong: -2, width: 80, height: 206, aX: 0 },
{ texture: resCanvasList['f455b42a-0e67-43d8-b7c5-520760160631'].url, score: 1, dir: 'right', wrong: 'endGame', width: 123, height: 120, aX: -12 }
......@@ -58,6 +66,17 @@ export default class GoodsContainer extends FYGE.Container {
this.back.height = 988
this.addChild(this.back)
// this.leftCsd = new FYGE.Container()
// this.leftCsd.x = 0
// this.leftCsd.y = 524
// this.leftCsd.width = 370
// this.leftCsd.height = 230
// let leftCsdbg = Tools.getSprite(resCanvasList['2137d3de-174f-42b1-8ebc-c5eb667ed250'].url, 0, 0)
// leftCsdbg.x = leftCsdbg.y = 0
// this.leftCsd.addChild(leftCsdbg)
// this.addChildAt(this.leftCsd, -1)
// this.startLineCsd()
this.lineContainer = new FYGE.Container()
this.lineContainer.width = 750
this.lineContainer.height = 988
......@@ -84,31 +103,36 @@ export default class GoodsContainer extends FYGE.Container {
this.goodsContainer.addChild(maskGoodRect)
this.goodsContainer.mask = maskGoodRect
this.addChild(this.goodsContainer)
this.startGoods()
// let checkRect = Tools.getRect(750, 300, 0xf333ff, .1)
// checkRect.x = 0
// checkRect.y = 400
// this.addChild(checkRect)
}
// 收到 滑动方向
getDirection (direction) {
console.log(this.intoGoods)
// console.log(this.intoGoods)
if (this.intoGoods.length) {
this.intoGoods[0].turn = true
this.intoGoods[0].turnDirection(direction)
let g = this.intoGoods[0]
g.turn = true
this.intoGoods.shift()
if (g.dir === direction) {
this._root.gameScoreChange(g.score)
g.turnDirection(direction)
} else {
if (g.wrong === 'endGame') {
g.turnDirection(direction, 'gameOver')
}
}
}
}
// 销毁 事件和循环
destroy () {
getStage().removeEventListener(
this.removeEventListener(
FYGE.Event.ENTER_FRAME,
this.onEnterFrame,
this
)
// clearInterval(this.createLeftCsdLineTimeOut)
// this.createLeftCsdLineTimeOut = null
clearInterval(this.createLineTimeOut)
this.createLineTimeOut = null
clearInterval(this.createGoodTimeOut)
......@@ -123,7 +147,7 @@ export default class GoodsContainer extends FYGE.Container {
this.goodsArr.unshift(g)
this.goodsContainer.addChildAt(g, -1)
// g.zIndex = --this.goodsDeepIndex
}, 900)
}, 1250)
}
createGoods () {
......@@ -147,10 +171,13 @@ export default class GoodsContainer extends FYGE.Container {
g.alpha = 0.2
g.scaleX = 0.38
g.scaleY = 0.38
g['score'] = arr[idx].score
g['dir'] = arr[idx].dir
g['wrong'] = arr[idx].wrong
g['turn'] = false
g['into'] = false
g['speed'] = this.speed + 0.06
g['turnDirection'] = (direction, cb) => {
g['turnDirection'] = (direction, cb = '') => {
if (direction === 'left') {
// this.goodsArr.splice(index, 1)
FYGE.Tween.removeTweens(g)
......@@ -163,6 +190,12 @@ export default class GoodsContainer extends FYGE.Container {
.to({
alpha: 0
}, 580)
.call(() => {
if (cb === 'gameOver') {
this.removeAllGoods()
this._root.gameOver()
}
})
}
else if (direction === 'right') {
// this.goodsArr.splice(index, 1)
......@@ -176,6 +209,12 @@ export default class GoodsContainer extends FYGE.Container {
.to({
alpha: 0
}, 580)
.call(() => {
if (cb === 'gameOver') {
this.removeAllGoods()
this._root.gameOver()
}
})
}
}
g['fadeOut'] = (index) => {
......@@ -187,12 +226,8 @@ export default class GoodsContainer extends FYGE.Container {
this.goodsContainer.removeChild(g)
})
}
// g['test01'] = () => {
// g.width = 300
// }
// g['test02'] = () => {
// g.width = 20
// }
// g['test01'] = () => { g.width = 300 }
// g['test02'] = () => { g.width = 20 }
return g
}
......@@ -228,6 +263,14 @@ export default class GoodsContainer extends FYGE.Container {
this.goodsContainer.removeChild(g)
}
// 移除所有掉落物
removeAllGoods () {
clearInterval(this.createGoodTimeOut)
this.createGoodTimeOut = null
this.goodsArr = []
this.goodsContainer.removeChildren()
}
// 产生 传送带棍子
createLine () {
let line = Tools.getSprite(resCanvasList['ad20a814-c0d4-4010-a76d-8e9114778580'].url)
......@@ -258,7 +301,7 @@ export default class GoodsContainer extends FYGE.Container {
this.lineContainer.addChildren(...this.lineArr)
setTimeout(() => {
getStage().addEventListener(
this.addEventListener(
FYGE.Event.ENTER_FRAME,
this.onEnterFrame,
this
......@@ -271,6 +314,37 @@ export default class GoodsContainer extends FYGE.Container {
}, 1000)
}
// 左边 传送带字
createCsdLine () {
let line = Tools.getSprite(resCanvasList['ad20a814-c0d4-4010-a76d-8e9114778580'].url)
line.width = 47
line.height = 155
line.x = 375
line.y = 0
return line
}
// 左边 传送带开始滚动
startLineCsd () {
// 游戏开始 之前 传送带上需要先存在6根棍子
for (let i = 1; i <= 6; i++) {
let line = this.createCsdLine()
this.leftCsdArr.push(line)
}
this.leftCsdArr.forEach((line, index) => {
line.x += index * 50
})
this.leftCsd.addChildren(...this.leftCsdArr)
setTimeout(() => {
this.createLeftCsdLineTimeOut = setInterval(() => {
let csd = this.createCsdLine()
this.lineArr.unshift(csd)
this.leftCsd.addChild(csd)
}, 1600)
}, 1000)
}
// 移除传送带棍子 并 添加
removeLine (index) {
let l = this.lineArr.pop()
......@@ -278,6 +352,13 @@ export default class GoodsContainer extends FYGE.Container {
this.lineContainer.removeChild(l)
}
// 移除左边的传送带棍子 并 添加
removeCsdLine () {
let l = this.lineArr.pop()
// console.log(l)
this.lineContainer.removeChild(l)
}
// 传送带掉落
fallLine (line, index) {
line.speed += this.acceleratedSpeed + 0.0024
......@@ -290,9 +371,19 @@ export default class GoodsContainer extends FYGE.Container {
}
}
// 左边 传送带掉落 右移动
fallCsdLine (line, index) {
if (line.x <= -300) {
this.removeCsdLine()
} else {
line.x1 -= 0.04
}
}
onEnterFrame () {
if (this._root.gameStartFlag) this.goodsArr.forEach((good, index) => { this.fallGood(good, index) })
this.lineArr.forEach((line, index) => { this.fallLine(line, index) })
this.leftCsdArr.forEach((line, index) => { this.fallCsdLine(line, index) })
}
// 取 随机数
......
export const Options = {
// 基本参数
gameParm: {
// 填充 掉落物 数量 auto: time * 1.3, 也可配具体数量: number
num: 'auto',
// 时间
time: 90,
time: 60,
// 加分物品 掉落率 number %
getScorePR: 70,
// 减分物品 掉落率 number %
delScorePR: 20,
// 结束游戏物品(炸弹) 掉落率 number %
endGamePR: 10,
// 初速度
speed: 10,
// 最大速度
maxSpeed: 40,
// 加速度
acceleratedSpeed: 0.02,
// 掉落物 每帧 最大位移
maxDistance: 20,
// 掉落物 下落 最小间隔时间
minDelayTime: 350
},
// 背景
bgTexture: 'd0d0eb62-92dd-4144-be2b-b844788ffcb1',
// 接收物 配置项
catcher: {
texture: '10258c19-4b0d-4393-8419-edb5b5d32071',
width: 330,
height: 242,
x: 210,
y: 1220
},
// 掉落物 行数
col: 4,
// 掉落物 配置项
goods: {
getScore: {
width: 110,
height: 90,
score: 2, // 碰撞后得分 可为负(减分)
endGame: false, // 碰撞后是否结束游戏
hitTexture: '', // 碰撞后 Catcher右上角出现的图 (详细出现位置 可在 Catcher.ts 修改)
hitTWidht: 0, // 碰撞图 宽
hitTHeight: 0, // 碰撞图 高
texture: [ // 掉落物皮肤
'83e0087c-e887-4b59-9533-e4ffedf37ce0',
'da1c89ad-3fc3-4af5-bd64-dc2a0775caa8',
'975325a3-926e-400c-b60a-b21ea0df4bc0',
'436f2033-3466-48ec-b5d6-b191d3306311',
'a00742d4-6bef-48f4-9984-fd096b1f318e'
],
fn: testCb // 自定义回调函数
},
delScore: {
width: 112, height: 84, score: -2, endGame: false,
texture: ['07e13702-d050-4d18-8e28-eef8f22624a2'],
hitTexture: '', hitTWidht: 0, hitTHeight: 0,
fn: testCb
},
endGame: {
width: 110, height: 140, score: 0, endGame: true,
texture: ['ff9d2aba-9dad-4e2d-8170-489cd20169fc'],
hitTexture: '600a2350-65fd-4404-9375-ae3f765cca2f', hitTWidht: 120, hitTHeight: 100,
fn: testCb
endGamePR: 10
}
},
// 记分板 配置项
scoreBoard: {
width: 260,
height: 130,
x: 230, // 暂时没用,居中
y: 220,
texture: 'c9e3a051-c5ff-481f-8f32-8d258eaedd0b',
fontSize: 64,
// fontWeight: 700,
color: '#ff8d05'
},
// 倒计时 配置项
countdownTimer: {
x: 22,
y: 224,
height: 38,
iconTexture: '57f938ef-4751-4cae-a763-1a2f814e0489',
iconWidth: 38,
iconHeight: 38,
fontSize: 30,
// fontWeight: 500,
color: '#27944d'
}
}
function testCb (type) {
console.log('good callback run, type:', type)
}
\ No newline at end of file
......@@ -75,6 +75,14 @@ const apiList = {
isShowLoading: false
},
// 获取任务列表
getTaskList: {
handle: 'getTaskList',
method:'get',
isShowLoading: false
},
// 获取活动基本信息
getActivityBaseInfoById: {
handle: 'getActivityBaseInfoById',
method:'get',
......
......@@ -2,7 +2,14 @@
<view class="mission-modal__shade modal-animate-fade-in">
<view class="mission_wrapper">
<image class="mission_wrapper_bg" src="{{resList['e0c8c1ea-bfa2-4ac6-a70a-1b21f516af10'].url}}" />
<view class="mission_block mission_block_1">
<scroll-view
class="mission_scroll"
scroll-y="{{true}}"
trap-scroll="{{true}}"
>
<view class="mission_block mission_block_1" a:for="{{missionsList}}" a:for-item="item">
<view class="ju_xing14"></view>
<image class="mission_icon" src="{{resList['95dc5f5a-d1b2-4994-b1bb-e45ba9e53914'].url}}" />
<view class="mission_content">
......@@ -14,6 +21,8 @@
</view>
</view>
</scroll-view>
<view class="mission_block mission_block_2">
<view class="ju_xing19" />
......
......@@ -7,16 +7,22 @@ import resList from '../../resconfig/resList'
Component({
data: {
resList: resList
resList: resList,
missionsList: []
},
props: {
missionsList: []
},
props: {},
didMount() {
// this.setData({})
// this.init()
if (this.props.missionsList.length) this.setData({ missionsList: this.props.missionsList })
},
didUpdate(prevProps, prevData) {},
didUpdate(prevProps, prevData) {
if (this.data.missionsList.length !== prevData.missionsList.length) {
this.setData({ missionsList: this.props.missionsList })
}
},
methods: {
onModalClose() {
......
......@@ -3,7 +3,7 @@ import API from '../../api';
import resList from '../../resconfig/resList.js'
const { tbcc } = app;
const { SHARE_CONFIG, REDIRECT_URL } = tbcc.constants;
const { commonToast, getAuthUserInfo, navigateToOutside } = tbcc.tb;
const { commonToast, getAuthUserInfo, navigateToOutside, ConsoleStyle } = tbcc.tb;
Page({
doExchange: () => {
......@@ -11,6 +11,30 @@ Page({
url: `/pages/pageshop/pageshop`
});
},
// 视频地址列表 - 存储播放时常
videoSrcArr: [
{ url: 'https://cloud.video.taobao.com/play/u/20446068/p/1/e/6/t/1/239271757987.mp4', timeStamp: 0, totalTime: 0 },
{ url: 'https://cloud.video.taobao.com/play/u/20446068/p/1/e/6/t/1/239271757987.mp4', timeStamp: 0, totalTime: 0 },
{ url: 'https://cloud.video.taobao.com/play/u/20446068/p/1/e/6/t/1/239271757987.mp4', timeStamp: 0, totalTime: 0 }
],
// 视频记录 flag
timeStampCountFlag: false,
// 视频记录 ms - 增量
timeStamp: 0,
// 视频记录 ms - 现量
timeStampRecord: 0,
// 视频预览图列表
posterSrcArr: [
'https://yun.duiba.com.cn/spark/assets/bg1.d818f787351875b0982937d8bb68b0655febec3c.png',
'https://yun.duiba.com.cn/spark/assets/弹窗背景_奖品.dce4e3dd9a3fcae166dfbd934b714ce1bc7fa5c9.png',
'https://yun.duiba.com.cn/spark/assets/7191ae57140b4937ae42500e76aa533693326ef9.png',
],
// 是否关注电批
isFollow: false,
// 进入时获取 邀请码
inviteId: '',
data: {
resList: resList,
title: '',
......@@ -28,6 +52,8 @@ Page({
videoSrc: '',
// 封面图地址
posterSrc: '',
// 视频变大
videoShow: false,
// ------ 视频 配置 ------ //
videoSrc: '',
showAllControls: true,
......@@ -58,64 +84,30 @@ Page({
rewardsModalVisible: false,
prizesModalVisible: false,
missionModalVisible: false,
videoShow: true
},
// 视频地址列表 - 存储播放时常
videoSrcArr: [
{ url: 'https://cloud.video.taobao.com/play/u/20446068/p/1/e/6/t/1/239271757987.mp4', timeStamp: 0, totalTime: 0 },
{ url: 'https://cloud.video.taobao.com/play/u/20446068/p/1/e/6/t/1/239271757987.mp4', timeStamp: 0, totalTime: 0 },
{ url: 'https://cloud.video.taobao.com/play/u/20446068/p/1/e/6/t/1/239271757987.mp4', timeStamp: 0, totalTime: 0 }
],
// 视频记录 flag
timeStampCountFlag: false,
// 视频记录 ms - 增量
timeStamp: 0,
// 视频记录 ms - 现量
timeStampRecord: 0,
// 视频预览图列表
posterSrcArr: [
'https://yun.duiba.com.cn/spark/assets/bg1.d818f787351875b0982937d8bb68b0655febec3c.png',
'https://yun.duiba.com.cn/spark/assets/弹窗背景_奖品.dce4e3dd9a3fcae166dfbd934b714ce1bc7fa5c9.png',
'https://yun.duiba.com.cn/spark/assets/7191ae57140b4937ae42500e76aa533693326ef9.png',
],
onLoad(query) {
console.info(`Page onLoad with query: ${JSON.stringify(query)}`);
async onLoad (query) {
console.info(`%cPage onLoad with query: ${JSON.stringify(query)}`, ConsoleStyle)
if (query.inviteId) this.inviteId = query.inviteId
// 页面加载
// 开场动画
// this.openAnimation().then(res => {
// // this.getAuth();
// this.openAnimation().then(async res_ => {
// this.backToPage()
// let res = await this.getAuth()
// this.init()
// })
},
init() {
console.log('do init')
API.getActivityBaseInfoById({activityId: app.activityId}).then(res => {
console.log(res)
})
},
// 页面加载完成
onReady() {
this.videoCtx = my.createVideoContext('videoCtx')
this.setData({ videoSrc: this.videoSrcArr[0].url, posterSrc: this.posterSrcArr[0] })
this.videoCtx.play()
},
// 页面显示
onShow() {
this.getAuth()
},
// 获取用户授权信息
async getAuth() {
const userInfo = await getAuthUserInfo().catch(err => {
console.log('未授权成功', err);
console.warn('未授权成功', err);
});
if (userInfo) {
console.log('userInfo', userInfo);
console.log('%c-----用户用户授权信息\n' + '-----getAuth\n', ConsoleStyle, userInfo)
const { nickName, avatar } = userInfo;
app.nickName = nickName;
app.avatar = avatar;
......@@ -123,28 +115,38 @@ Page({
}
},
// 获取主接口
async getIndex() {
const { success, data } = await API.getIndex().catch(res => {
commonToast(res && res.message);
}) || {};
if (success && data) {
const { title, content, rule } = data;
this.setData({ title, content, rule });
}
},
// 登录接口
async login() {
const { nickName, avatar } = app;
const { success } = await API.login({ activityId: app.activityId, userNick: nickName, avatar }).catch(res => {
commonToast(res && res.message);
}) || {};
const { success, message, data } = await API.login({ activityId: app.activityId, avatar: app.avatar, userNick: nickName, avatar, isFollow: this.isFollow, inviteId: this.inviteId })
.catch(res => { commonToast(res && res.message); }) || {};
if (success) {
this.init();
console.log('%c-----用户登陆信息\n' + '-----yd.login\n', ConsoleStyle, data)
this.init(data);
}
},
// 请求 业务接口 信息
async init(data) {
API.getActivityBaseInfoById({activityId: app.activityId})
.then(res => {
const { success, message, data } = res
if (!success) {
console.warn(res)
commonToast(res && res.message)
} else {
console.log('%c-----活动基本信息\n' + '-----yd.getActivityBaseInfoById\n', ConsoleStyle, data)
}
})
.catch(res => { commonToast(res && res.message); }) || {};
let res = await API.getTaskList({activityId: app.activityId})
.then(res => {
const { success, message, data } = res
console.log(res)
console.log('%c--------任务列表\n' + '-----yd.getTaskList\n', ConsoleStyle, data)
})
},
// 分享
......@@ -153,6 +155,22 @@ Page({
return SHARE_CONFIG;
},
// 新用户 被邀请的 逻辑
hasBeenInvited () {
console.log('%c该用户是被 邀请 进入', 'color:green; font-size:16px; font-weight:bold;')
},
// 页面加载完成
onReady() {
this.videoCtx = my.createVideoContext('videoCtx')
this.setData({ videoSrc: this.videoSrcArr[0].url, posterSrc: this.posterSrcArr[0] })
this.videoCtx.play()
},
// 页面显示
onShow() {
},
// start
doStart() {
this.showCommonModal({
......@@ -165,6 +183,7 @@ Page({
});
},
// 开场动画
openAnimation () {
return new Promise((resolve, reject) => {
this.setData({ gameShow: true, gameType: 3, gameShow_timeout: true })
......@@ -375,4 +394,15 @@ Page({
},
// 获取主接口
async getIndex() {
const { success, data } = await API.getIndex().catch(res => {
commonToast(res && res.message);
}) || {};
if (success && data) {
const { title, content, rule } = data;
this.setData({ title, content, rule });
}
},
});
......@@ -60,7 +60,7 @@ const request = ({ cloud, cloudName, requestType = 'cloud' }) => {
return new Promise((resolve, reject) => {
// const url = requestPrefix + _cloudName + '.';
const url = requestPrefix + _cloudName + '.' + handle;
console.log(`requestMock url=>${url}`, `,method=>${method}`);
// console.log(`requestMock url=>${url}`, `,method=>${method}`);
my.request({
url: url,
method,
......@@ -68,7 +68,7 @@ const request = ({ cloud, cloudName, requestType = 'cloud' }) => {
dataType: 'json'
}).then(({ data: res }) => {
hideMyLoading();
console.log(`mock res,${url}=>`, res)
// console.log(`mock res,${url}=>`, res)
if (res && res.success) {
resolve(res);
} else {
......@@ -84,7 +84,7 @@ const request = ({ cloud, cloudName, requestType = 'cloud' }) => {
const requestCloud = () => {
return new Promise((resolve, reject) => {
cloud.function.invoke(_cloudName, params, handle).then(res => {
console.log('request Cloud callback=>', handle, res,JSON.stringify(res));
// console.log('request Cloud callback=>', handle, res,JSON.stringify(res));
// console.log('requestCloud', handle, params, res);
hideMyLoading();
if (res && res.success) {
......
......@@ -527,6 +527,14 @@ export function setClipboard(params) {
return promisifyMyApi('setClipboard', params)
};
export const ConsoleStyle = [
'color: #e06a82',
'font-size: 12px',
'font-weight: bold',
'text-shadow: 1px 1px rgba(0, 0, 0, 0.2)',
'padding: 3px',
].join(';')
function promisifyMyApi(methodName, params = {}) {
return new Promise((resolve, reject) => {
......
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