Commit 824456cf authored by haiyoucuv's avatar haiyoucuv

init

parent 10dfbccc
......@@ -29,18 +29,21 @@ ComponentWithStore({
canIUseGetUserProfile: wx.canIUse('getUserProfile'),
canIUseNicknameComp: wx.canIUse('input.type.nickname'),
},
created() {
// 登录
wx.login({
success: async (res) => {
console.log(res.code)
// 发送 res.code 到后台换取 openId, sessionKey, unionId
await dbLogin({code: res.code});
await this.updateHomeInfo();
},
});
},
methods: {
async onShow() {
store.doLog(507, 10)
// 登录
wx.login({
success: async (res) => {
console.log(res.code)
// 发送 res.code 到后台换取 openId, sessionKey, unionId
await dbLogin({code: res.code});
await this.updateHomeInfo();
},
});
await this.updateHomeInfo();
const {channel, city} = this.options || {};
store.paramsObj = {channel, city};
},
......@@ -99,8 +102,8 @@ ComponentWithStore({
// 跳转活动页
jumpActPage: _asyncThrottle(async function () {
store.doLog(508, 4)
wx.switchTab({ url: "/pages/activity/activity" })
store.doLog(508, 4)
wx.switchTab({url: "/pages/activity/activity"})
}),
closeGetPanel() {
......@@ -118,43 +121,43 @@ ComponentWithStore({
// this.getPos()
},
getPos() {
wx.getLocation({
type: 'wgs84',
success (res) {
const latitude = res.latitude
const longitude = res.longitude
const speed = res.speed
const accuracy = res.accuracy
}
})
wx.getLocation({
type: 'wgs84',
success(res) {
const latitude = res.latitude
const longitude = res.longitude
const speed = res.speed
const accuracy = res.accuracy
}
})
},
async onChooseAvatar(e: any) {
const {avatarUrl} = e.detail
console.log('avatarUrl', avatarUrl);
wx.getFileSystemManager().readFile({
filePath: e.detail.avatarUrl, //地址
encoding: 'base64', //编码格式
success: async(res) => {
let base64 = 'data:image/png;base64,' + res.data
const data = await store.doImgUpload(base64)
console.info('头像上传后data', data);
if (data) {
await dbLogin({
avatar: data,
});
await this.updateHomeInfo();
filePath: e.detail.avatarUrl, //地址
encoding: 'base64', //编码格式
success: async (res) => {
let base64 = 'data:image/png;base64,' + res.data
const data = await store.doImgUpload(base64)
console.info('头像上传后data', data);
if (data) {
await dbLogin({
avatar: data,
});
await this.updateHomeInfo();
}
}
}
})
},
async onInputChange(e: any) {
const nickName = e.detail.value
if (nickName) {
await dbLogin({
nickname: nickName,
});
await this.updateHomeInfo();
await dbLogin({
nickname: nickName,
});
await this.updateHomeInfo();
}
},
getUserProfile() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment