Browse Source

feat: 导航结束上报记录

master
jiannibang 2 years ago
parent
commit
bdfdd61408
  1. 57
      pages/index/index.js

57
pages/index/index.js

@ -4,6 +4,7 @@ import { registerGLTFLoader } from "../../loader/gltfLoader";
var THREE; var THREE;
import configData from "./config"; import configData from "./config";
import { STATES, promptStateMap } from "./index-helper"; import { STATES, promptStateMap } from "./index-helper";
import { post } from "../../app";
var _canvas; var _canvas;
let map; let map;
let locationOption; let locationOption;
@ -71,6 +72,55 @@ Page({
point: null, point: null,
resolution: null, resolution: null,
}, },
async sendArriveMsg() {
try {
const userId = getApp().globalData.openid;
if (!map) return;
let shop = map.shopMap[this.data.e]
? map.shopMap[this.data.e]
: map.facilityMap[this.data.e]
? map.facilityMap[this.data.e]
: map.pMap[this.data.e];
const isShop = !!map.shopMap[this.data.e];
const isP = !!map.pMap[this.data.e];
const isFac = !!map.facilityMap[this.data.e];
const isDevice = !shop;
if (!shop) {
const endParamList = this.data.e.split("_");
if (endParamList.length === 3) {
let [efloororder, epoint, ename] = endParamList;
efloororder = Number(efloororder);
epoint = Number(epoint);
shop = {
isDevice: true,
name: ename,
navPoint: epoint,
yaxis: epoint,
floorOrder: efloororder,
floorName: map.mall.floors[efloororder][1],
};
}
}
const body = {
userId,
navType: 2,
pointType: isShop || isDevice ? "1" : isP ? "3" : "2",
objectCode: isShop
? shop.code
: isP
? shop.name
: isFac
? shop.Type
: shop.name,
objectName: shop.name,
floorName: shop.floorName,
};
const res = await post("/Api/Statistics/CompleteUpload", body);
console.log("AR导航结束上报返回", body, res);
} catch (error) {
console.log("AR导航结束上报报错", error);
}
},
clickScreen(e) { clickScreen(e) {
let detail = e.detail; let detail = e.detail;
if (this.SDK) this.SDK.getScreenCoordinate({ x: detail.x, y: detail.y }); if (this.SDK) this.SDK.getScreenCoordinate({ x: detail.x, y: detail.y });
@ -87,6 +137,7 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
async onLoad({ e, searchType = 0 }) { async onLoad({ e, searchType = 0 }) {
this.hasArriveMsgSent = false;
this.frameIndex = 0; this.frameIndex = 0;
this.getSystemInfo(); this.getSystemInfo();
wx.setKeepScreenOn({ wx.setKeepScreenOn({
@ -95,7 +146,7 @@ Page({
const { const {
globalData: { floors }, globalData: { floors },
} = getApp(); } = getApp();
const { windowHeight } = wx.getSystemInfoSync();
const { windowHeight } = wx.getWindowInfo();
this.setData({ this.setData({
floors, floors,
filteredMallFloors: floors.filter( filteredMallFloors: floors.filter(
@ -226,6 +277,10 @@ Page({
type: nextPointType, type: nextPointType,
orientation: theta, orientation: theta,
} = res; } = res;
if (!this.hasArriveMsgSent && distance < 50 && !this.data.nextFloor) {
this.hasArriveMsgSent = true;
this.sendArriveMsg();
}
if (!this.data.totalDistance) this.setData({ totalDistance: distance }); if (!this.data.totalDistance) this.setData({ totalDistance: distance });
this.setData({ this.setData({
theta, theta,

Loading…
Cancel
Save