0.0.0
This commit is contained in:
30
miniprogram/app.js
Normal file
30
miniprogram/app.js
Normal file
@@ -0,0 +1,30 @@
|
||||
// app.js
|
||||
App({
|
||||
globalData: {
|
||||
env: 'cloud1-d0gmb6bjde8af3266', // TODO: 替换为你的云开发环境 ID
|
||||
userInfo: null,
|
||||
dogs: [],
|
||||
currentDogId: null,
|
||||
walkSession: null,
|
||||
},
|
||||
|
||||
onLaunch() {
|
||||
if (!wx.cloud) {
|
||||
console.error('请使用 2.2.3 或以上的基础库以使用云能力');
|
||||
return;
|
||||
}
|
||||
const { platform } = wx.getDeviceInfo();
|
||||
const isDevtools = platform === 'devtools';
|
||||
|
||||
wx.cloud.init({
|
||||
env: this.globalData.env,
|
||||
traceUser: !isDevtools,
|
||||
});
|
||||
|
||||
// 恢复未结束的遛狗会话(切后台/重启不丢,见 docs/01 §4)
|
||||
const session = wx.getStorageSync('walkSession');
|
||||
if (session) {
|
||||
this.globalData.walkSession = session;
|
||||
}
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user