This commit is contained in:
31
src/app.ts
31
src/app.ts
@@ -1,15 +1,10 @@
|
||||
import { createApp } from "vue";
|
||||
import "./app.scss";
|
||||
import Taro from "@tarojs/taro";
|
||||
// import * as Sentry from "sentry-miniapp";
|
||||
import {createApp} from 'vue';
|
||||
import Taro from '@tarojs/taro';
|
||||
import './app.scss';
|
||||
|
||||
// 小程序场景值
|
||||
const scenes = [1007, 1008, 1011, 1012, 1013, 1047, 1048, 1049];
|
||||
|
||||
// Sentry.init({
|
||||
// dsn: "https://47703e01ba4344b8b252c15e8fd980fd@sentry.io/1528228",
|
||||
// });
|
||||
|
||||
const App = createApp({
|
||||
onLaunch(options: {
|
||||
path: string;
|
||||
@@ -19,20 +14,20 @@ const App = createApp({
|
||||
referrerInfo: object | any;
|
||||
}) {
|
||||
// 检测更新
|
||||
if (Taro.canIUse("getUpdateManager") && options.scene !== 1154) {
|
||||
if (Taro.canIUse('getUpdateManager') && options.scene !== 1154) {
|
||||
const updateManager = Taro.getUpdateManager();
|
||||
updateManager.onCheckForUpdate(function (res) {
|
||||
if (res.hasUpdate) {
|
||||
updateManager.onUpdateFailed(function () {
|
||||
return Taro.showToast({
|
||||
title: "新版本下载失败",
|
||||
icon: "none",
|
||||
title: '新版本下载失败',
|
||||
icon: 'none',
|
||||
});
|
||||
});
|
||||
updateManager.onUpdateReady(function () {
|
||||
Taro.showModal({
|
||||
title: "更新提示",
|
||||
content: "新版本已经下载好,是否重启当前应用?",
|
||||
title: '更新提示',
|
||||
content: '新版本已经下载好,是否重启当前应用?',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
updateManager.applyUpdate();
|
||||
@@ -42,8 +37,8 @@ const App = createApp({
|
||||
});
|
||||
updateManager.onUpdateFailed(function () {
|
||||
Taro.showModal({
|
||||
title: "发现新版本",
|
||||
content: "请删除当前小程序,重启搜索打开...",
|
||||
title: '发现新版本',
|
||||
content: '请删除当前小程序,重启搜索打开...',
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -55,10 +50,10 @@ const App = createApp({
|
||||
if (scenes.includes(options.scene)) {
|
||||
if (options.query.scene) {
|
||||
Taro.showToast({
|
||||
title: "已检测到推荐人",
|
||||
icon: "none",
|
||||
title: '已检测到推荐人',
|
||||
icon: 'none',
|
||||
});
|
||||
Taro.setStorageSync("bind_id", options.query.scene);
|
||||
Taro.setStorageSync('bind_id', options.query.scene);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user