modify:新增小程序

This commit is contained in:
ECRZ
2026-01-06 18:00:43 +08:00
parent 498fa0e915
commit da4a055c1c
47 changed files with 7321 additions and 61 deletions

52
Sale/app.js Normal file
View File

@@ -0,0 +1,52 @@
// app.js
App({
onLaunch() {
console.log('钢材价格查询小程序启动')
// 检查更新
this.checkUpdate()
},
/**
* 检查小程序更新
*/
checkUpdate() {
if (wx.canIUse('getUpdateManager')) {
const updateManager = wx.getUpdateManager()
updateManager.onCheckForUpdate((res) => {
if (res.hasUpdate) {
console.log('发现新版本')
}
})
updateManager.onUpdateReady(() => {
wx.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success: (res) => {
if (res.confirm) {
updateManager.applyUpdate()
}
}
})
})
updateManager.onUpdateFailed(() => {
wx.showModal({
title: '更新失败',
content: '新版本下载失败,请检查网络后重试',
showCancel: false
})
})
}
},
globalData: {
// API 基础地址
apiBaseUrl: 'http://localhost:3000',
// 应用信息
appName: '钢材价格查询',
version: '1.0.0'
}
})