init project

This commit is contained in:
limqhz
2020-06-21 16:27:58 +08:00
commit e8fe10b5fb
178 changed files with 9964 additions and 0 deletions

View File

@@ -0,0 +1,104 @@
// pages/authorizedMask/authorizedMask.js
const app = getApp();
Component({
/**
* 组件的属性列表
*/
properties: {
isSetting: {
type: Boolean,
value: false
},
content: {
type: String,
value: '使用小程序需要您授权登录'
},
isCancel: {
type: Boolean,
value: false
},
/**
* Only: 只有一個
* TwainCance 兩個帶取消
* */
type: {
type: String,
value: 'Only'
}
},
/**
* 组件的初始数据
*/
data: {
showBox: true,
},
/**
* 组件的方法列表
*/
methods: {
stopSlide() {
return;
},
wxTap() {
this.setData({
showBox: false
})
},
// 微信登录
wxLogin(e) {
if (e.detail.errMsg === 'getUserInfo:fail auth deny') {
this.setData({
showBox: true
})
return
}
this.setData({
showBox: false
})
let that = this;
wx.login({
success: function(res) {
if (res.code) {
app.$api.login({
avatar: e.detail.userInfo.avatarUrl,
code: res.code,
nickname: e.detail.userInfo.nickName,
}).then(res => {
wx.setStorageSync('access_token', res.data.accessToken);
wx.setStorageSync('userInfo', e.detail.userInfo);
that.triggerEvent('loginSuccess', {}, {});
})
} else {
wx.showToast({
title: '登录失败',
icon: 'none',
})
}
},
fail: function(res) {
wx.showToast({
title: '登录失败',
icon: 'none',
})
},
})
},
// 取消
cance() {
this.triggerEvent('cance', {}, {});
},
// 打开设置
setSuccess: function (e) {
this.triggerEvent('setsuccess', e.detail, {});
// if (e.detail.authSetting["scope.userLocation"]) {//如果打开了地理位置就会为true
// this.setData({
// showFlag: true
// })
// }
}
}
})