瑞梦思预约小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
942 B

3 years ago
// app.js
3 years ago
const http = require('./api/http.js')
3 years ago
App({
onLaunch() {
// 登录
},
3 years ago
login(){
3 years ago
return new Promise((resolve,reject)=>{
3 years ago
wx.getUserProfile({
lang: 'zh_CN',
desc: '需要获取您的信息用来展示',
success: res => {
wx.showLoading({ title: '登录中' })
wx.login({
success: result => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
let data = {
code: result.code,
iv: res.iv,
encryptedData:res.encryptedData
}
http.$http('post','wxapp/auth',data).then((result)=>{
console.log('数据已返回')
resolve(result)
})
}
3 years ago
})
3 years ago
},
fail: res=>{
console.log('取消授权')
3 years ago
}
})
})
},
globalData: {
3 years ago
$http: http.$http
3 years ago
}
})