更新 入职排行
This commit is contained in:
parent
6357fa0c35
commit
e7bb0e51fb
|
|
@ -264,9 +264,6 @@
|
||||||
{
|
{
|
||||||
"__id__": 8
|
"__id__": 8
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"__id__": 11
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"__id__": 13
|
"__id__": 13
|
||||||
},
|
},
|
||||||
|
|
@ -453,130 +450,6 @@
|
||||||
"_alignWithScreen": true,
|
"_alignWithScreen": true,
|
||||||
"_id": "81GN3uXINKVLeW4+iKSlim"
|
"_id": "81GN3uXINKVLeW4+iKSlim"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"__type__": "cc.Node",
|
|
||||||
"_name": "bg",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"_parent": {
|
|
||||||
"__id__": 5
|
|
||||||
},
|
|
||||||
"_children": [],
|
|
||||||
"_active": true,
|
|
||||||
"_components": [
|
|
||||||
{
|
|
||||||
"__id__": 9
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 10
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"_prefab": null,
|
|
||||||
"_opacity": 255,
|
|
||||||
"_color": {
|
|
||||||
"__type__": "cc.Color",
|
|
||||||
"r": 255,
|
|
||||||
"g": 255,
|
|
||||||
"b": 255,
|
|
||||||
"a": 255
|
|
||||||
},
|
|
||||||
"_contentSize": {
|
|
||||||
"__type__": "cc.Size",
|
|
||||||
"width": 1080,
|
|
||||||
"height": 1920
|
|
||||||
},
|
|
||||||
"_anchorPoint": {
|
|
||||||
"__type__": "cc.Vec2",
|
|
||||||
"x": 0.5,
|
|
||||||
"y": 0.5
|
|
||||||
},
|
|
||||||
"_trs": {
|
|
||||||
"__type__": "TypedArray",
|
|
||||||
"ctor": "Float64Array",
|
|
||||||
"array": [
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"_eulerAngles": {
|
|
||||||
"__type__": "cc.Vec3",
|
|
||||||
"x": 0,
|
|
||||||
"y": 0,
|
|
||||||
"z": 0
|
|
||||||
},
|
|
||||||
"_skewX": 0,
|
|
||||||
"_skewY": 0,
|
|
||||||
"_is3DNode": false,
|
|
||||||
"_groupIndex": 0,
|
|
||||||
"groupIndex": 0,
|
|
||||||
"_id": "e2DtJec2tHzprX4psCclS5"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.Sprite",
|
|
||||||
"_name": "",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"node": {
|
|
||||||
"__id__": 8
|
|
||||||
},
|
|
||||||
"_enabled": true,
|
|
||||||
"_materials": [
|
|
||||||
{
|
|
||||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"_srcBlendFactor": 770,
|
|
||||||
"_dstBlendFactor": 771,
|
|
||||||
"_spriteFrame": {
|
|
||||||
"__uuid__": "2dece190-21a1-4502-9947-858be2b5d927"
|
|
||||||
},
|
|
||||||
"_type": 0,
|
|
||||||
"_sizeMode": 0,
|
|
||||||
"_fillType": 0,
|
|
||||||
"_fillCenter": {
|
|
||||||
"__type__": "cc.Vec2",
|
|
||||||
"x": 0,
|
|
||||||
"y": 0
|
|
||||||
},
|
|
||||||
"_fillStart": 0,
|
|
||||||
"_fillRange": 0,
|
|
||||||
"_isTrimmedMode": true,
|
|
||||||
"_atlas": null,
|
|
||||||
"_id": "47rxTBxMlBq5TBHiYjLPlp"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.Widget",
|
|
||||||
"_name": "",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"node": {
|
|
||||||
"__id__": 8
|
|
||||||
},
|
|
||||||
"_enabled": true,
|
|
||||||
"alignMode": 1,
|
|
||||||
"_target": null,
|
|
||||||
"_alignFlags": 45,
|
|
||||||
"_left": 0,
|
|
||||||
"_right": 0,
|
|
||||||
"_top": 0,
|
|
||||||
"_bottom": 0,
|
|
||||||
"_verticalCenter": 0,
|
|
||||||
"_horizontalCenter": 0,
|
|
||||||
"_isAbsLeft": true,
|
|
||||||
"_isAbsRight": true,
|
|
||||||
"_isAbsTop": true,
|
|
||||||
"_isAbsBottom": true,
|
|
||||||
"_isAbsHorizontalCenter": true,
|
|
||||||
"_isAbsVerticalCenter": true,
|
|
||||||
"_originalWidth": 1080,
|
|
||||||
"_originalHeight": 2340,
|
|
||||||
"_id": "0a5XlUuGZCprz0fwaiG835"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"__type__": "cc.Node",
|
"__type__": "cc.Node",
|
||||||
"_name": "Career",
|
"_name": "Career",
|
||||||
|
|
@ -584,7 +457,11 @@
|
||||||
"_parent": {
|
"_parent": {
|
||||||
"__id__": 5
|
"__id__": 5
|
||||||
},
|
},
|
||||||
"_children": [],
|
"_children": [
|
||||||
|
{
|
||||||
|
"__id__": 9
|
||||||
|
}
|
||||||
|
],
|
||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
|
|
@ -639,12 +516,136 @@
|
||||||
"groupIndex": 0,
|
"groupIndex": 0,
|
||||||
"_id": "edmRxn2gNM9KAeDeklTUSw"
|
"_id": "edmRxn2gNM9KAeDeklTUSw"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.Node",
|
||||||
|
"_name": "bg",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"_parent": {
|
||||||
|
"__id__": 8
|
||||||
|
},
|
||||||
|
"_children": [],
|
||||||
|
"_active": true,
|
||||||
|
"_components": [
|
||||||
|
{
|
||||||
|
"__id__": 10
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 11
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_prefab": null,
|
||||||
|
"_opacity": 255,
|
||||||
|
"_color": {
|
||||||
|
"__type__": "cc.Color",
|
||||||
|
"r": 255,
|
||||||
|
"g": 255,
|
||||||
|
"b": 255,
|
||||||
|
"a": 255
|
||||||
|
},
|
||||||
|
"_contentSize": {
|
||||||
|
"__type__": "cc.Size",
|
||||||
|
"width": 1080,
|
||||||
|
"height": 10000
|
||||||
|
},
|
||||||
|
"_anchorPoint": {
|
||||||
|
"__type__": "cc.Vec2",
|
||||||
|
"x": 0.5,
|
||||||
|
"y": 1
|
||||||
|
},
|
||||||
|
"_trs": {
|
||||||
|
"__type__": "TypedArray",
|
||||||
|
"ctor": "Float64Array",
|
||||||
|
"array": [
|
||||||
|
0,
|
||||||
|
1170,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"_eulerAngles": {
|
||||||
|
"__type__": "cc.Vec3",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"_skewX": 0,
|
||||||
|
"_skewY": 0,
|
||||||
|
"_is3DNode": false,
|
||||||
|
"_groupIndex": 0,
|
||||||
|
"groupIndex": 0,
|
||||||
|
"_id": "e2DtJec2tHzprX4psCclS5"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.Sprite",
|
||||||
|
"_name": "",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"node": {
|
||||||
|
"__id__": 9
|
||||||
|
},
|
||||||
|
"_enabled": true,
|
||||||
|
"_materials": [
|
||||||
|
{
|
||||||
|
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_srcBlendFactor": 770,
|
||||||
|
"_dstBlendFactor": 771,
|
||||||
|
"_spriteFrame": {
|
||||||
|
"__uuid__": "2dece190-21a1-4502-9947-858be2b5d927"
|
||||||
|
},
|
||||||
|
"_type": 1,
|
||||||
|
"_sizeMode": 0,
|
||||||
|
"_fillType": 0,
|
||||||
|
"_fillCenter": {
|
||||||
|
"__type__": "cc.Vec2",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"_fillStart": 0,
|
||||||
|
"_fillRange": 0,
|
||||||
|
"_isTrimmedMode": true,
|
||||||
|
"_atlas": null,
|
||||||
|
"_id": "47rxTBxMlBq5TBHiYjLPlp"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.Widget",
|
"__type__": "cc.Widget",
|
||||||
"_name": "",
|
"_name": "",
|
||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"node": {
|
"node": {
|
||||||
"__id__": 11
|
"__id__": 9
|
||||||
|
},
|
||||||
|
"_enabled": true,
|
||||||
|
"alignMode": 1,
|
||||||
|
"_target": null,
|
||||||
|
"_alignFlags": 41,
|
||||||
|
"_left": 0,
|
||||||
|
"_right": 0,
|
||||||
|
"_top": -210,
|
||||||
|
"_bottom": -210,
|
||||||
|
"_verticalCenter": 0,
|
||||||
|
"_horizontalCenter": 0,
|
||||||
|
"_isAbsLeft": true,
|
||||||
|
"_isAbsRight": true,
|
||||||
|
"_isAbsTop": true,
|
||||||
|
"_isAbsBottom": true,
|
||||||
|
"_isAbsHorizontalCenter": true,
|
||||||
|
"_isAbsVerticalCenter": true,
|
||||||
|
"_originalWidth": 1080,
|
||||||
|
"_originalHeight": 2340,
|
||||||
|
"_id": "0a5XlUuGZCprz0fwaiG835"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.Widget",
|
||||||
|
"_name": "",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"node": {
|
||||||
|
"__id__": 8
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"alignMode": 1,
|
"alignMode": 1,
|
||||||
|
|
@ -11301,7 +11302,7 @@
|
||||||
},
|
},
|
||||||
"component": "",
|
"component": "",
|
||||||
"_componentId": "1dc93b4fehOrpGgTkihBH4g",
|
"_componentId": "1dc93b4fehOrpGgTkihBH4g",
|
||||||
"handler": "openShop",
|
"handler": "openPosition",
|
||||||
"customEventData": ""
|
"customEventData": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -265,6 +265,9 @@ export default class GameManager extends cc.Component {
|
||||||
if (data.data.addLevel) {
|
if (data.data.addLevel) {
|
||||||
cc.fx.GameConfig.GM_INFO.addLevel = data.data.addLevel;
|
cc.fx.GameConfig.GM_INFO.addLevel = data.data.addLevel;
|
||||||
}
|
}
|
||||||
|
if (data.data.address) {
|
||||||
|
cc.fx.GameConfig.GM_INFO.address = data.data.address;
|
||||||
|
}
|
||||||
this.checkDailyQuests();
|
this.checkDailyQuests();
|
||||||
//如果有连胜记录,就赋值
|
//如果有连胜记录,就赋值
|
||||||
if (data.data.winStreak) {
|
if (data.data.winStreak) {
|
||||||
|
|
|
||||||
|
|
@ -320,7 +320,7 @@ export default class JiaZai extends cc.Component {
|
||||||
console.log("执行开始游戏gameshow");
|
console.log("执行开始游戏gameshow");
|
||||||
cc.fx.GameTool.getHealth((data) => {
|
cc.fx.GameTool.getHealth((data) => {
|
||||||
if (this.level) {
|
if (this.level) {
|
||||||
NumberToImage.numberToImageNodes4((cc.fx.GameConfig.GM_INFO.level + 1), 43, 15, "custom", this.level, true);
|
NumberToImage.numberToImageNodes((cc.fx.GameConfig.GM_INFO.level + 1), 43, 15, "level_", this.level, true);
|
||||||
}
|
}
|
||||||
if (this.coin) {
|
if (this.coin) {
|
||||||
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
||||||
|
|
@ -353,7 +353,10 @@ export default class JiaZai extends cc.Component {
|
||||||
|
|
||||||
|
|
||||||
cc.fx.GameTool.getHealth((data) => {
|
cc.fx.GameTool.getHealth((data) => {
|
||||||
NumberToImage.numberToImageNodes((cc.fx.GameConfig.GM_INFO.level + 1), 43, 15, "level_", this.level, true);
|
NumberToImage.numberToImageNodes4((cc.fx.GameConfig.GM_INFO.level + 1), 43, 15, "custom", this.level, true);
|
||||||
|
for (let i = 0; i < this.level.children.length; i++) {
|
||||||
|
this.level.children[i].color = cc.Color.BLACK;
|
||||||
|
}
|
||||||
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
||||||
this.setHealthInfo(true);
|
this.setHealthInfo(true);
|
||||||
});
|
});
|
||||||
|
|
@ -2293,7 +2296,7 @@ export default class JiaZai extends cc.Component {
|
||||||
count: item[1] // 数值
|
count: item[1] // 数值
|
||||||
}));
|
}));
|
||||||
// 排序后的结果
|
// 排序后的结果
|
||||||
console.log("sortedArray", sortedArray);
|
// console.log("sortedArray", sortedArray);
|
||||||
let city = JSON.parse(JSON.stringify(cc.fx.GameConfig.CITY));
|
let city = JSON.parse(JSON.stringify(cc.fx.GameConfig.CITY));
|
||||||
let rankData = [];
|
let rankData = [];
|
||||||
for (let i = 0; i < sortedArray.length; i++) {
|
for (let i = 0; i < sortedArray.length; i++) {
|
||||||
|
|
@ -2330,16 +2333,26 @@ export default class JiaZai extends cc.Component {
|
||||||
let topData = data.all ? data.all : [];
|
let topData = data.all ? data.all : [];
|
||||||
if (this.RankNode != null && this.RankNode != undefined) {
|
if (this.RankNode != null && this.RankNode != undefined) {
|
||||||
this.node.getChildByName("Career").addChild(this.RankNode);
|
this.node.getChildByName("Career").addChild(this.RankNode);
|
||||||
|
// this.node.getChildByName("Career").getChildByName("bg").parent = this.RankNode;
|
||||||
|
this.RankNode.opacity = 0;
|
||||||
this.RankNode.zIndex = 3;
|
this.RankNode.zIndex = 3;
|
||||||
this.RankNode.getComponent("CareerManager").init(rankData, topData);
|
this.RankNode.getComponent("CareerManager").init(rankData, topData);
|
||||||
|
cc.tween(this.RankNode)
|
||||||
|
.to(0.2, { opacity: 255 })
|
||||||
|
.start()
|
||||||
} else {
|
} else {
|
||||||
this.LoadCareer(() => {
|
this.LoadCareer(() => {
|
||||||
this.node.getChildByName("Career").addChild(this.RankNode);
|
this.node.getChildByName("Career").addChild(this.RankNode);
|
||||||
|
// this.node.getChildByName("Career").getChildByName("bg").parent = this.RankNode;
|
||||||
|
this.RankNode.opacity = 0;
|
||||||
this.RankNode.zIndex = 3;
|
this.RankNode.zIndex = 3;
|
||||||
this.RankNode.getComponent("CareerManager").init(rankData, topData);
|
this.RankNode.getComponent("CareerManager").init(rankData, topData);
|
||||||
|
cc.tween(this.RankNode)
|
||||||
|
.to(0.2, { opacity: 255 })
|
||||||
|
.start()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
console.log("rankData", rankData);
|
// console.log("rankData", rankData);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2364,6 +2377,19 @@ export default class JiaZai extends cc.Component {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openPosition() {
|
||||||
|
if (cc.fx.GameConfig.GM_INFO.address == "") {
|
||||||
|
console.log("没有地址");
|
||||||
|
MiniGameSdk.API.getWechatCityInfo((success, data, error) => {
|
||||||
|
if (success) {
|
||||||
|
console.log('详细城市信息:', data);
|
||||||
|
// 包含省份、城市、区县等详细信息
|
||||||
|
const { province, city, district } = data;
|
||||||
|
}
|
||||||
|
}, true); // 第二个参数设为true启用逆解析
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
update(dt) {
|
update(dt) {
|
||||||
if (this.newbieGift && this.monthlyCardNode) {
|
if (this.newbieGift && this.monthlyCardNode) {
|
||||||
if (this.monthlyCardNode.active == true) {
|
if (this.monthlyCardNode.active == true) {
|
||||||
|
|
|
||||||
|
|
@ -1875,6 +1875,265 @@ export namespace MiniGameSdk {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打开位置设置页面
|
||||||
|
*/
|
||||||
|
static openLocationSetting() {
|
||||||
|
//@ts-ignore
|
||||||
|
if (typeof wx !== 'undefined' && wx !== null) {
|
||||||
|
//@ts-ignore
|
||||||
|
wx.openSetting({
|
||||||
|
success: (res) => {
|
||||||
|
console.log('打开设置成功:', res);
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.log('打开设置失败:', err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取微信小游戏用户城市信息
|
||||||
|
* @param callback 回调函数,参数为城市信息对象或错误信息
|
||||||
|
* @param useReverseGeocoding 是否使用逆解析获取详细地址信息(需要网络请求)
|
||||||
|
*/
|
||||||
|
static getWechatCityInfo(callback: (success: boolean, data?: any, error?: any) => void, useReverseGeocoding: boolean = false) {
|
||||||
|
//@ts-ignore
|
||||||
|
if (typeof wx !== 'undefined' && wx !== null) {
|
||||||
|
// 检查是否已授权位置权限
|
||||||
|
//@ts-ignore
|
||||||
|
wx.getSetting({
|
||||||
|
success: (res) => {
|
||||||
|
if (res.authSetting['scope.userLocation']) {
|
||||||
|
// 已授权,获取位置信息
|
||||||
|
API._getCityInfo(callback, useReverseGeocoding);
|
||||||
|
} else {
|
||||||
|
// 未授权,先请求授权
|
||||||
|
//@ts-ignore
|
||||||
|
wx.authorize({
|
||||||
|
scope: 'scope.userLocation',
|
||||||
|
success: () => {
|
||||||
|
// 授权成功,获取城市信息
|
||||||
|
API._getCityInfo(callback, useReverseGeocoding);
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
// 授权失败,提示用户手动授权
|
||||||
|
console.log('位置授权失败:', err);
|
||||||
|
callback(false, null, '位置授权失败,请手动授权');
|
||||||
|
|
||||||
|
// 引导用户去设置页面手动授权
|
||||||
|
//@ts-ignore
|
||||||
|
wx.showModal({
|
||||||
|
title: '位置权限申请',
|
||||||
|
content: '需要获取您的位置信息以确定所在城市,请在设置中开启位置权限',
|
||||||
|
confirmText: '去设置',
|
||||||
|
success: (modalRes) => {
|
||||||
|
if (modalRes.confirm) {
|
||||||
|
//@ts-ignore
|
||||||
|
wx.openSetting({
|
||||||
|
success: (settingRes) => {
|
||||||
|
if (settingRes.authSetting['scope.userLocation']) {
|
||||||
|
// 用户手动授权成功,重新获取城市信息
|
||||||
|
API._getCityInfo(callback, useReverseGeocoding);
|
||||||
|
} else {
|
||||||
|
callback(false, null, '用户拒绝授权位置权限');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.log('获取设置失败:', err);
|
||||||
|
callback(false, null, '获取设置失败');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
callback(false, null, '非微信环境');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内部方法:实际获取城市信息
|
||||||
|
*/
|
||||||
|
private static _getCityInfo(callback: (success: boolean, data?: any, error?: any) => void, useReverseGeocoding: boolean) {
|
||||||
|
//@ts-ignore
|
||||||
|
wx.getLocation({
|
||||||
|
type: 'gcj02', // 使用国测局坐标系,更适合中国地图
|
||||||
|
success: (res) => {
|
||||||
|
console.log('获取位置成功:', res);
|
||||||
|
|
||||||
|
if (useReverseGeocoding) {
|
||||||
|
// 使用逆解析获取详细地址信息
|
||||||
|
API._reverseGeocoding(res.latitude, res.longitude, callback);
|
||||||
|
} else {
|
||||||
|
// 直接返回基本位置信息,包含经纬度
|
||||||
|
const cityInfo = {
|
||||||
|
latitude: res.latitude, // 纬度
|
||||||
|
longitude: res.longitude, // 经度
|
||||||
|
province: '', // 省份(需要通过逆解析获取)
|
||||||
|
city: '', // 城市(需要通过逆解析获取)
|
||||||
|
district: '', // 区县(需要通过逆解析获取)
|
||||||
|
address: '' // 详细地址(需要通过逆解析获取)
|
||||||
|
};
|
||||||
|
callback(true, cityInfo);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.log('获取位置失败:', err);
|
||||||
|
callback(false, null, err.errMsg || '获取位置失败');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 逆解析经纬度获取详细地址信息
|
||||||
|
*/
|
||||||
|
private static _reverseGeocoding(latitude: number, longitude: number, callback: (success: boolean, data?: any, error?: any) => void) {
|
||||||
|
// 注意:微信小游戏本身不提供逆解析API,需要调用第三方服务或自己的服务器
|
||||||
|
// 这里提供一个示例,实际使用时需要替换为你的服务器接口
|
||||||
|
|
||||||
|
// 示例:使用腾讯地图逆解析API(需要申请key)
|
||||||
|
const key = 'YOUR_TENCENT_MAP_KEY'; // 需要替换为实际的key
|
||||||
|
const url = `https://apis.map.qq.com/ws/geocoder/v1/?location=${latitude},${longitude}&key=${key}&get_poi=0`;
|
||||||
|
|
||||||
|
//@ts-ignore
|
||||||
|
wx.request({
|
||||||
|
url: url,
|
||||||
|
method: 'GET',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.statusCode === 200 && res.data.status === 0) {
|
||||||
|
const result = res.data.result;
|
||||||
|
const cityInfo = {
|
||||||
|
latitude: latitude,
|
||||||
|
longitude: longitude,
|
||||||
|
province: result.address_component.province, // 省份
|
||||||
|
city: result.address_component.city, // 城市
|
||||||
|
district: result.address_component.district, // 区县
|
||||||
|
address: result.address, // 详细地址
|
||||||
|
formatted_address: result.formatted_addresses?.recommend || result.address // 格式化地址
|
||||||
|
};
|
||||||
|
console.log('逆解析成功:', cityInfo);
|
||||||
|
callback(true, cityInfo);
|
||||||
|
} else {
|
||||||
|
console.log('逆解析失败:', res.data);
|
||||||
|
callback(false, null, '逆解析失败');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.log('逆解析请求失败:', err);
|
||||||
|
callback(false, null, '逆解析请求失败');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用微信城市选择器获取城市信息(用户手动选择)
|
||||||
|
* @param callback 回调函数
|
||||||
|
*/
|
||||||
|
static chooseWechatCity(callback: (success: boolean, data?: any, error?: any) => void) {
|
||||||
|
//@ts-ignore
|
||||||
|
if (typeof wx !== 'undefined' && wx !== null) {
|
||||||
|
//@ts-ignore
|
||||||
|
wx.chooseLocation({
|
||||||
|
success: (res) => {
|
||||||
|
console.log('选择位置成功:', res);
|
||||||
|
const cityInfo = {
|
||||||
|
name: res.name, // 位置名称
|
||||||
|
address: res.address, // 详细地址
|
||||||
|
latitude: res.latitude, // 纬度
|
||||||
|
longitude: res.longitude, // 经度
|
||||||
|
// 从地址中提取城市信息(简单处理)
|
||||||
|
province: API._extractProvinceFromAddress(res.address),
|
||||||
|
city: API._extractCityFromAddress(res.address)
|
||||||
|
};
|
||||||
|
callback(true, cityInfo);
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.log('选择位置失败:', err);
|
||||||
|
callback(false, null, err.errMsg || '选择位置失败');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
callback(false, null, '非微信环境');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从地址字符串中提取省份信息
|
||||||
|
*/
|
||||||
|
private static _extractProvinceFromAddress(address: string): string {
|
||||||
|
// 简单的省份提取逻辑,实际使用时可能需要更复杂的处理
|
||||||
|
const provinces = ['北京', '天津', '上海', '重庆', '河北', '山西', '辽宁', '吉林', '黑龙江', '江苏', '浙江',
|
||||||
|
'安徽', '福建', '江西', '山东', '河南', '湖北', '湖南', '广东', '海南', '四川', '贵州',
|
||||||
|
'云南', '陕西', '甘肃', '青海', '台湾', '内蒙古', '广西', '西藏', '宁夏', '新疆', '香港', '澳门'];
|
||||||
|
|
||||||
|
for (const province of provinces) {
|
||||||
|
if (address.includes(province)) {
|
||||||
|
return province;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从地址字符串中提取城市信息
|
||||||
|
*/
|
||||||
|
private static _extractCityFromAddress(address: string): string {
|
||||||
|
// 简单的城市提取逻辑
|
||||||
|
const cities = ['北京', '上海', '天津', '重庆', '石家庄', '太原', '呼和浩特', '沈阳', '长春', '哈尔滨',
|
||||||
|
'南京', '杭州', '合肥', '福州', '南昌', '济南', '郑州', '武汉', '长沙', '广州', '南宁',
|
||||||
|
'海口', '成都', '贵阳', '昆明', '拉萨', '西安', '兰州', '西宁', '银川', '乌鲁木齐'];
|
||||||
|
|
||||||
|
for (const city of cities) {
|
||||||
|
if (address.includes(city)) {
|
||||||
|
return city;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户IP地址对应的城市信息(不需要位置权限)
|
||||||
|
* @param callback 回调函数
|
||||||
|
*/
|
||||||
|
static getCityByIP(callback: (success: boolean, data?: any, error?: any) => void) {
|
||||||
|
// 调用IP定位服务获取城市信息
|
||||||
|
// 示例:使用第三方IP定位服务
|
||||||
|
const url = 'https://restapi.amap.com/v3/ip?key=YOUR_AMAP_KEY'; // 需要替换为实际的高德地图key
|
||||||
|
|
||||||
|
//@ts-ignore
|
||||||
|
wx.request({
|
||||||
|
url: url,
|
||||||
|
method: 'GET',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.statusCode === 200 && res.data.status === '1') {
|
||||||
|
const ipInfo = res.data;
|
||||||
|
const cityInfo = {
|
||||||
|
province: ipInfo.province, // 省份
|
||||||
|
city: ipInfo.city, // 城市
|
||||||
|
adcode: ipInfo.adcode, // 区域编码
|
||||||
|
rectangle: ipInfo.rectangle // 城市范围坐标
|
||||||
|
};
|
||||||
|
console.log('IP定位成功:', cityInfo);
|
||||||
|
callback(true, cityInfo);
|
||||||
|
} else {
|
||||||
|
console.log('IP定位失败:', res.data);
|
||||||
|
callback(false, null, 'IP定位失败');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.log('IP定位请求失败:', err);
|
||||||
|
callback(false, null, 'IP定位请求失败');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -132,7 +132,7 @@ export class GameConfig {
|
||||||
getProgress: number; //获取进度
|
getProgress: number; //获取进度
|
||||||
getItemType: number; popPassCheck: boolean; // 弹窗通行证
|
getItemType: number; popPassCheck: boolean; // 弹窗通行证
|
||||||
passCheckActivate: boolean; winStreak: number; //连胜
|
passCheckActivate: boolean; winStreak: number; //连胜
|
||||||
tasks: { levelPass: { value: number; target: number; state: number; }; share: { value: number; target: number; state: number; }; useEnergy: { value: number; target: number; state: number; }; useProp: { value: number; target: number; state: number; }; }; addLevel: number;
|
tasks: { levelPass: { value: number; target: number; state: number; }; share: { value: number; target: number; state: number; }; useEnergy: { value: number; target: number; state: number; }; useProp: { value: number; target: number; state: number; }; }; addLevel: number; address: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -303,7 +303,8 @@ export class GameConfig {
|
||||||
passCheckActivate: false,
|
passCheckActivate: false,
|
||||||
winStreak: 0, //连胜
|
winStreak: 0, //连胜
|
||||||
tasks: { levelPass: { value: 0, target: 0, state: 0 }, share: { value: 0, target: 0, state: 0 }, useEnergy: { value: 0, target: 0, state: 0 }, useProp: { value: 0, target: 0, state: 0 } },
|
tasks: { levelPass: { value: 0, target: 0, state: 0 }, share: { value: 0, target: 0, state: 0 }, useEnergy: { value: 0, target: 0, state: 0 }, useProp: { value: 0, target: 0, state: 0 } },
|
||||||
addLevel: 0
|
addLevel: 0,
|
||||||
|
address: "",
|
||||||
};
|
};
|
||||||
// this.setCode(this.getKey("scode"));
|
// this.setCode(this.getKey("scode"));
|
||||||
// this.GM_INFO.level = 0;
|
// this.GM_INFO.level = 0;
|
||||||
|
|
|
||||||
|
|
@ -1057,8 +1057,6 @@ export default class Utils {
|
||||||
}, 3000);
|
}, 3000);
|
||||||
console.log("请求uid:" + Utils.uid);
|
console.log("请求uid:" + Utils.uid);
|
||||||
Utils.POST("getSRank", { uid: cc.fx.GameConfig.GM_INFO.uid }, res => {
|
Utils.POST("getSRank", { uid: cc.fx.GameConfig.GM_INFO.uid }, res => {
|
||||||
console.log("查询入职排行榜结果");
|
|
||||||
console.log(res);
|
|
||||||
// 清除超时定时器
|
// 清除超时定时器
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
if (!isCallBackCalled) {
|
if (!isCallBackCalled) {
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
"height": 2340,
|
"height": 2340,
|
||||||
"rawWidth": 1080,
|
"rawWidth": 1080,
|
||||||
"rawHeight": 2340,
|
"rawHeight": 2340,
|
||||||
"borderTop": 0,
|
"borderTop": 1801,
|
||||||
"borderBottom": 0,
|
"borderBottom": 0,
|
||||||
"borderLeft": 0,
|
"borderLeft": 0,
|
||||||
"borderRight": 0,
|
"borderRight": 0,
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -139,7 +139,7 @@ export default class CareerList extends cc.Component {
|
||||||
this.content = this.scrollView.content;
|
this.content = this.scrollView.content;
|
||||||
this.content.anchorX = 0;
|
this.content.anchorX = 0;
|
||||||
this.content.anchorY = 1;
|
this.content.anchorY = 1;
|
||||||
this.content.removeAllChildren();
|
// this.content.removeAllChildren();
|
||||||
|
|
||||||
// 初始化firstRender
|
// 初始化firstRender
|
||||||
if (this.firstRender) {
|
if (this.firstRender) {
|
||||||
|
|
@ -165,7 +165,6 @@ export default class CareerList extends cc.Component {
|
||||||
// 检查 itemDataList 是否为有效数组,如果不是则初始化为空数组
|
// 检查 itemDataList 是否为有效数组,如果不是则初始化为空数组
|
||||||
this.itemDataList = itemDataList.slice();
|
this.itemDataList = itemDataList.slice();
|
||||||
this.topData = topData;
|
this.topData = topData;
|
||||||
console.log(this.topData);
|
|
||||||
this.firstRenderInit();
|
this.firstRenderInit();
|
||||||
this.updateContent();
|
this.updateContent();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ export default class CareerManager extends cc.Component {
|
||||||
rankTotal: number; //获取排行榜用户数量 现在为100
|
rankTotal: number; //获取排行榜用户数量 现在为100
|
||||||
|
|
||||||
onLoad() {
|
onLoad() {
|
||||||
|
this.node.opacity = 0;
|
||||||
// this.init();
|
// this.init();
|
||||||
}
|
}
|
||||||
//初始化数据
|
//初始化数据
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user