Commit 9194730d authored by 范雪寒's avatar 范雪寒

fix: 移出屏幕的节点移除

parent a2858aa9
...@@ -89,7 +89,7 @@ cc.Class({ ...@@ -89,7 +89,7 @@ cc.Class({
getData(func) { getData(func) {
http('GET', 'https://staging-teach.ireadabc.com/api/courseware/v1/getdata?courseid='+this.courseid, {}).then((resStr) => { http('GET', 'https://staging-teach.ireadabc.com/api/courseware/v1/getdata?courseid=' + this.courseid, {}).then((resStr) => {
const res = JSON.parse(resStr) const res = JSON.parse(resStr)
const data = JSON.parse(res.data); const data = JSON.parse(res.data);
func(data); func(data);
...@@ -302,7 +302,7 @@ cc.Class({ ...@@ -302,7 +302,7 @@ cc.Class({
w: { big: '<color=#73edff>W</c><color=#ffffff>INDOW</color>', small: '<color=#abff61>w</c><color=#ffffff>indow</color>' }, w: { big: '<color=#73edff>W</c><color=#ffffff>INDOW</color>', small: '<color=#abff61>w</c><color=#ffffff>indow</color>' },
x: { big: '<color=#ffffff>BO</color><color=#73edff>X</c>', small: '<color=#ffffff>bo</color><color=#abff61>x</c>' }, x: { big: '<color=#ffffff>BO</color><color=#73edff>X</c>', small: '<color=#ffffff>bo</color><color=#abff61>x</c>' },
y: { big: '<color=#73edff>Y</c><color=#ffffff>OGURT</color>', small: '<color=#abff61>y</c><color=#ffffff>ogurt</color>' }, y: { big: '<color=#73edff>Y</c><color=#ffffff>OGURT</color>', small: '<color=#abff61>y</c><color=#ffffff>ogurt</color>' },
z: { big: '<color=#73edff>Z</c><color=#ffffff>EBRA</color>', small: '<color=#abff61>z</c><color=#ffffff>ebra</color' } z: { big: '<color=#73edff>Z</c><color=#ffffff>EBRA</color>', small: '<color=#abff61>z</c><color=#ffffff>ebra</color>' }
} }
const bigPictureWordRichText = cc.find('Canvas/LetterPicturePage/PictureWordBigBg/PictureWordBigRichText'); const bigPictureWordRichText = cc.find('Canvas/LetterPicturePage/PictureWordBigBg/PictureWordBigRichText');
...@@ -814,6 +814,9 @@ cc.Class({ ...@@ -814,6 +814,9 @@ cc.Class({
letterNodeBase.zIndex = 10; letterNodeBase.zIndex = 10;
cc.tween(letterNodeBase) cc.tween(letterNodeBase)
.to(1.2, { y: 1500 }, { easing: 'cubicIn' }) .to(1.2, { y: 1500 }, { easing: 'cubicIn' })
.call(() => {
letterNodeBase.active = false;
})
.start(); .start();
}, },
...@@ -862,6 +865,10 @@ cc.Class({ ...@@ -862,6 +865,10 @@ cc.Class({
cc.tween(ribbonNodeBase) cc.tween(ribbonNodeBase)
.by(3, { y: -1600, x: RandomInt(-100, 100), angle: RandomInt(-60, 60) }) .by(3, { y: -1600, x: RandomInt(-100, 100), angle: RandomInt(-60, 60) })
.call(() => {
ribbonNodeBase.active = false;
ribbonNodeBase.removeFromParent();
})
.start(); .start();
} }
}, },
...@@ -1136,7 +1143,7 @@ cc.Class({ ...@@ -1136,7 +1143,7 @@ cc.Class({
let isNeedSendData = true; let isNeedSendData = true;
rankData.forEach((item, i) => { rankData.forEach((item, i) => {
if (item.name == newData.name) { if (item.name == newData.name) {
if (item.score < newData.score) { if (item.score < newData.score) {
isNeedSendData = false; isNeedSendData = false;
} }
...@@ -1147,7 +1154,7 @@ cc.Class({ ...@@ -1147,7 +1154,7 @@ cc.Class({
this.sendData(newData); this.sendData(newData);
} }
const tmpData = {} const tmpData = {}
...@@ -1156,7 +1163,7 @@ cc.Class({ ...@@ -1156,7 +1163,7 @@ cc.Class({
if (!tmpData[scoreData.name]) { if (!tmpData[scoreData.name]) {
tmpData[scoreData.name] = scoreData tmpData[scoreData.name] = scoreData
} else { } else {
if (tmpData[scoreData.name].score > scoreData.score ) { if (tmpData[scoreData.name].score > scoreData.score) {
tmpData[scoreData.name] = scoreData; tmpData[scoreData.name] = scoreData;
} }
} }
...@@ -1171,7 +1178,7 @@ cc.Class({ ...@@ -1171,7 +1178,7 @@ cc.Class({
}) })
this.rankData = newRankData; this.rankData = newRankData;
this.setScrollView(); this.setScrollView();
cc.find('Canvas/scrollview').active = true; cc.find('Canvas/scrollview').active = true;
...@@ -1179,7 +1186,7 @@ cc.Class({ ...@@ -1179,7 +1186,7 @@ cc.Class({
}, },
sendData(data) { sendData(data) {
http('POST', 'https://staging-teach.ireadabc.com/api/dashboard/v1/studyinfo?courseid='+this.courseid, data).then((resStr) => { http('POST', 'https://staging-teach.ireadabc.com/api/dashboard/v1/studyinfo?courseid=' + this.courseid, data).then((resStr) => {
const res = JSON.parse(resStr) const res = JSON.parse(resStr)
console.log(' sendData res: ', res); console.log(' sendData res: ', res);
}); });
...@@ -1187,7 +1194,7 @@ cc.Class({ ...@@ -1187,7 +1194,7 @@ cc.Class({
}, },
receiveData(id, cb) { receiveData(id, cb) {
http('GET', 'https://staging-teach.ireadabc.com/api/dashboard/v1/studyinfo?courseid='+this.courseid, {}).then((resStr) => { http('GET', 'https://staging-teach.ireadabc.com/api/dashboard/v1/studyinfo?courseid=' + this.courseid, {}).then((resStr) => {
const res = JSON.parse(resStr) const res = JSON.parse(resStr)
if (cb) { if (cb) {
cb(res.data); cb(res.data);
...@@ -1238,8 +1245,8 @@ cc.Class({ ...@@ -1238,8 +1245,8 @@ cc.Class({
const self = this; const self = this;
self.createUserInfoButton(); self.createUserInfoButton();
}, },
showLoadingPage() { showLoadingPage() {
...@@ -1255,7 +1262,7 @@ cc.Class({ ...@@ -1255,7 +1262,7 @@ cc.Class({
loadingIcon.opacity = 0; loadingIcon.opacity = 0;
cc.tween(loadingIcon) cc.tween(loadingIcon)
.to(2, {opacity: 255}, {easing: 'cubicOut'}) .to(2, { opacity: 255 }, { easing: 'cubicOut' })
.start() .start()
}, },
...@@ -1263,7 +1270,7 @@ cc.Class({ ...@@ -1263,7 +1270,7 @@ cc.Class({
const loading = cc.find('Canvas/loading') const loading = cc.find('Canvas/loading')
cc.tween(loading) cc.tween(loading)
.to(0.5, {opacity: 0}, {easing: 'cubicOut'}) .to(0.5, { opacity: 0 }, { easing: 'cubicOut' })
.call(() => { .call(() => {
loading.active = false; loading.active = false;
}) })
...@@ -1273,108 +1280,108 @@ cc.Class({ ...@@ -1273,108 +1280,108 @@ cc.Class({
/** /**
* 点击创建用户信息授权按钮 * 点击创建用户信息授权按钮
*/ */
authorButton: null, authorButton: null,
createUserInfoButton() { createUserInfoButton() {
//获取视图窗口可见区域尺寸 //获取视图窗口可见区域尺寸
let visibleSize = cc.view.getVisibleSize(); let visibleSize = cc.view.getVisibleSize();
//获取系统信息 //获取系统信息
let wx_size = wx.getSystemInfoSync(); let wx_size = wx.getSystemInfoSync();
//计算实际大小和可见区域尺寸的比例(这里以宽度为准) //计算实际大小和可见区域尺寸的比例(这里以宽度为准)
let size_scale_width = wx_size.screenWidth / visibleSize.width; let size_scale_width = wx_size.screenWidth / visibleSize.width;
//计算创建用户信息按钮需要的属性(img_auth为蓝色参考节点) //计算创建用户信息按钮需要的属性(img_auth为蓝色参考节点)
let x = visibleSize.width / 2; //(this.img_auth.x + visibleSize.width / 2 - this.img_auth.width / 2) * size_scale_width; let x = visibleSize.width / 2; //(this.img_auth.x + visibleSize.width / 2 - this.img_auth.width / 2) * size_scale_width;
let y = visibleSize.height / 2; // (Math.abs(this.img_auth.y) + visibleSize.height / 2 - this.img_auth.height / 2) * size_scale_width; let y = visibleSize.height / 2; // (Math.abs(this.img_auth.y) + visibleSize.height / 2 - this.img_auth.height / 2) * size_scale_width;
let width = 300; // this.img_auth.width * size_scale_width; let width = 300; // this.img_auth.width * size_scale_width;
let height = 300; // this.img_auth.height * size_scale_width; let height = 300; // this.img_auth.height * size_scale_width;
const frameSize = cc.view.getFrameSize(); const frameSize = cc.view.getFrameSize();
const rankBtnW = 200; const rankBtnW = 200;
const rankBtnH = 40; const rankBtnH = 40;
const disH = -40; const disH = -40;
this.authorButton = wx.createUserInfoButton({ this.authorButton = wx.createUserInfoButton({
type: 'text', type: 'text',
text: '查看排行', text: '查看排行',
style: { style: {
left: frameSize.width / 2 - rankBtnW / 2, left: frameSize.width / 2 - rankBtnW / 2,
top: frameSize.height / 2 - rankBtnH / 2 - disH, top: frameSize.height / 2 - rankBtnH / 2 - disH,
width: 200, width: 200,
height: 40, height: 40,
lineHeight: 40, lineHeight: 40,
backgroundColor: '#cccccc', backgroundColor: '#cccccc',
color: '#222222', color: '#222222',
textAlign: 'center', textAlign: 'center',
fontSize: 16, fontSize: 16,
borderRadius: 4 borderRadius: 4
} }
}) })
const replayBtn = cc.find('Canvas/replayButton');
// replayBtn.y = cc.winSize.height / 2 - disH;
replayBtn.active = true;
console.log('this.authorButton: ', this.authorButton);
this.authorButton.onTap((res) => {
if (res.errMsg == "getUserInfo:ok") {
wx.showToast({
icon: "none",
title: "获取用户信息成功",
duration: 2000,
});
this.authorButton.hide(); //获取用户信息成功后隐藏按钮
// wx.login({
// success (res) {
// console.log('login res: ', res);
// if (res.code) {
// //发起网络请求
// const tmpUrl = 'https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=JSCODE&grant_type=authorization_code'
// wx.request({
// url: 'https://test.com/onLogin',
// data: {
// code: res.code
// }
// })
// } else {
// console.log('登录失败!' + res.errMsg)
// }
// }
// })
console.log('res: ', res)
const self = this; const replayBtn = cc.find('Canvas/replayButton');
wx.getUserInfo({ // replayBtn.y = cc.winSize.height / 2 - disH;
success(res) { replayBtn.active = true;
console.log("getUserInfo: ", res);
self.userInfo = res.userInfo; console.log('this.authorButton: ', this.authorButton);
self.showScrollView(); this.authorButton.onTap((res) => {
if (res.errMsg == "getUserInfo:ok") {
// exportJson.userInfo = res.userInfo; wx.showToast({
//此时可进行登录操作 icon: "none",
title: "获取用户信息成功",
duration: 2000,
});
this.authorButton.hide(); //获取用户信息成功后隐藏按钮
// wx.login({
// success (res) {
// console.log('login res: ', res);
// if (res.code) {
// //发起网络请求
// const tmpUrl = 'https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=JSCODE&grant_type=authorization_code'
// wx.request({
// url: 'https://test.com/onLogin',
// data: {
// code: res.code
// }
// })
// } else {
// console.log('登录失败!' + res.errMsg)
// }
// }
// })
console.log('res: ', res)
const self = this;
wx.getUserInfo({
success(res) {
console.log("getUserInfo: ", res);
self.userInfo = res.userInfo;
self.showScrollView();
// exportJson.userInfo = res.userInfo;
//此时可进行登录操作
}
});
} else {
if (res.errMsg === "getUserInfo:fail auth deny") {
wx.showToast({
icon: "none",
title: "获取用户信息失败",
duration: 2000,
});
} else {
wx.showToast({
icon: "none",
title: res.errMsg,
duration: 2000,
});
}
} }
}); });
},
} else {
if (res.errMsg === "getUserInfo:fail auth deny") {
wx.showToast({
icon: "none",
title: "获取用户信息失败",
duration: 2000,
});
} else {
wx.showToast({
icon: "none",
title: res.errMsg,
duration: 2000,
});
}
}
});
},
}); });
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