Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 141e496

Browse files
committed
⭐ 新增:关于我
1 parent c14e162 commit 141e496

File tree

4 files changed

+96
-3
lines changed

4 files changed

+96
-3
lines changed

‎src/pages/profile/index.vue‎

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,76 @@
11
<template>
2-
<div class="md-board">
3-
我的
2+
<div class="md-profile">
3+
<!-- <view class="header">
4+
<text class="title">{{ title }}</text>
5+
</view> -->
6+
<view class="user" @click="getUserInfo">
7+
<image class="user-avatar" :src="userInfo.avatarUrl" mode="aspectFit"/>
8+
<text class="user-nickname">{{ userInfo.nickName }}</text>
9+
<text :hidden="!userInfo.city">{{ userInfo.city }}, {{ userInfo.province }}</text>
10+
<text :hidden="!userInfo.city"> Thanks~ </text>
11+
</view>
412
</div>
513
</template>
614

715
<script>
16+
import { login, getUserInfo } from '@/utils/wechat'
817
export default {
18+
data () {
19+
return {
20+
title: '关于',
21+
userInfo: {
22+
wechat: 'SG',
23+
nickName: 'https://github.com/mini-mpvue/mpvue-douban',
24+
avatarUrl: '/static/images/qrcode-sg.png'
25+
}
26+
}
27+
},
28+
29+
methods: {
30+
async getUserInfo () {
31+
const data = await getUserInfo()
32+
this.userInfo = data.userInfo
33+
}
34+
},
35+
36+
mounted () {
37+
login().then(res => {
38+
console.log(res)
39+
})
40+
}
941
}
1042
</script>
1143

1244
<style>
45+
.header {
46+
display: flex;
47+
justify-content: center;
48+
border-bottom: 1rpx solid #ccc;
49+
}
50+
51+
.header text {
52+
padding: 40rpx;
53+
color: #999;
54+
font-size: 148rpx;
55+
text-align: center;
56+
}
57+
58+
.user {
59+
display: flex;
60+
flex-direction: column;
61+
align-items: center;
62+
}
63+
64+
.user-avatar {
65+
width: 100%;
66+
height: 620rpx;
67+
margin: 40rpx;
68+
}
69+
70+
.user-nickname {
71+
color: #aaa;
72+
font-size: 30rpx;
73+
margin-bottom: 30rpx;
74+
}
1375
1476
</style>

‎src/pages/profile/main.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ app.$mount()
66

77
export default {
88
config: {
9-
navigationBarTitleText: '我的'
9+
navigationBarTitleText: '关于我'
1010
}
1111
}

‎src/utils/wechat.js‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import wx from './wx'
2+
3+
export function login () {
4+
return new Promise((resolve, reject) => {
5+
wx.login({ success: resolve, fail: reject })
6+
})
7+
}
8+
9+
export function getUserInfo () {
10+
return new Promise((resolve, reject) => {
11+
wx.getUserInfo({ success: resolve, fail: reject })
12+
})
13+
}
14+
15+
export function setStorage (key, value) {
16+
return new Promise((resolve, reject) => {
17+
wx.setStorage({ key: key, data: value, success: resolve, fail: reject })
18+
})
19+
}
20+
21+
export function getStorage (key) {
22+
return new Promise((resolve, reject) => {
23+
wx.getStorage({ key: key, success: resolve, fail: reject })
24+
})
25+
}
26+
27+
export function getLocation (type) {
28+
return new Promise((resolve, reject) => {
29+
wx.getLocation({ type: type, success: resolve, fail: reject })
30+
})
31+
}

‎static/images/qrcode-sg.png‎

51.9 KB
Loading[フレーム]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /