Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
junlebao-milk-20240619
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
SparkProjects
junlebao-milk-20240619
Commits
824456cf
Commit
824456cf
authored
Jun 27, 2024
by
haiyoucuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
10dfbccc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
37 deletions
+40
-37
index.ts
miniprogram/pages/index/index.ts
+40
-37
No files found.
miniprogram/pages/index/index.ts
View file @
824456cf
...
...
@@ -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
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment