1 Star 4 Fork 0

coderyaling / second-shop-web

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
app.js 942 Bytes
一键复制 编辑 原始数据 按行查看 历史
yy 提交于 2023-07-29 11:44 . 优化项目
// app.js
//app.js
import touch from './utils/touch.js' //新加
App({
globalData: {
userInfo: {},
Modelmes: null,
model: ['iPhone X', 'iPhone XR', 'iPhone XS Max', 'iPhone 11', 'iPhone 11 Pro', 'iPhone 11 Pro Max', 'iPhone 12', 'iPhone 12 Pro', 'iPhone 12 Pro Max']
},
touch: new touch(), //实例化这个touch对象
onLaunch() {
const {
model
} = this.globalData
wx.getSystemInfo({ //当小程序初始化完成时 获取用户的手机机型
success: (res) => {
const hasMa = model.find(item => item === res.model)
this.globalData.Modelmes = hasMa && hasMa.length > 0
}
})
// 展示本地存储能力
const logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
}
})
},
})
微信
1
https://gitee.com/coderyaling/second-shop-web.git
git@gitee.com:coderyaling/second-shop-web.git
coderyaling
second-shop-web
second-shop-web
master

搜索帮助