增加库存显示

This commit is contained in:
2023-10-27 14:50:28 +08:00
parent 2f788956c6
commit 6cd9823bd8
5 changed files with 276 additions and 412 deletions

View File

@@ -1,8 +1,9 @@
import { createApp } from "vue";
import "./app.scss";
import Taro from "@tarojs/taro";
import {createApp} from 'vue'
import './app.scss'
import Taro from '@tarojs/taro'
const scenes = [1007, 1008, 1011, 1012, 1013, 1047, 1048, 1049];
// 小程序场景值
const scenes = [1007, 1008, 1011, 1012, 1013, 1047, 1048, 1049]
const App = createApp({
onLaunch(options: {
@@ -12,61 +13,50 @@ const App = createApp({
shareTicket: string;
referrerInfo: object | any;
}) {
// if (scenes.includes(options.scene)) {
// if (options.query.scene) {
// Taro.showToast({
// title: "已检测到推荐人",
// icon: "none",
// });
// Taro.setStorageSync("bind_id", options.query.scene);
// }
// }
// 检测更新
if (Taro.canIUse("getUpdateManager") && options.scene !== 1154) {
const updateManager = Taro.getUpdateManager();
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();
updateManager.applyUpdate()
}
},
});
});
}
})
})
updateManager.onUpdateFailed(function () {
Taro.showModal({
title: "发现新版本",
content: "请删除当前小程序,重启搜索打开...",
});
});
title: '发现新版本',
content: '请删除当前小程序,重启搜索打开...'
})
})
}
});
})
}
},
onShow() {
const options = Taro.getCurrentInstance().router as any;
console.log("onShow", options);
const options = Taro.getCurrentInstance().router as any
if (scenes.includes(options.scene)) {
if (options.query.scene) {
Taro.showToast({
title: "已检测到推荐人",
icon: "none",
});
Taro.setStorageSync("bind_id", options.query.scene);
title: '已检测到推荐人',
icon: 'none'
})
Taro.setStorageSync('bind_id', options.query.scene)
}
}
},
// 入口组件不需要实现 render 方法,即使实现了也会被 taro 所覆盖
});
}
})
export default App;
export default App