Skip to content
This repository was archived by the owner on Jul 30, 2020. It is now read-only.

Commit f3d2d15

Browse files
committed
添加扫码登陆&样式优化
1 parent a64900c commit f3d2d15

File tree

11 files changed

+185
-164
lines changed

11 files changed

+185
-164
lines changed

src/components/authorHead.vue

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,28 @@ export default {
1414
},
1515
computed: {
1616
formatCreateAt() {
17-
return passTime(this.user&&this.user.create_at).slice(0, -1);
17+
return passTime(this.user && this.user.create_at).slice(0, -1);
1818
}
1919
}
2020
};
2121
</script>
2222

23-
<style scoped>
23+
<style lang='scss' scoped>
2424
.header {
2525
display: flex;
2626
flex-direction: column;
2727
align-items: center;
28-
color: #41b883;
28+
color: $color;
2929
font-size: 30rpx;
3030
background-color: white;
31-
}
32-
.img {
33-
width: 200rpx;
34-
height: 200rpx;
35-
border-radius: 50%;
36-
margin-top: 30rpx;
37-
}
38-
.span {
39-
margin-top: 20rpx;
31+
.img {
32+
width: 200rpx;
33+
height: 200rpx;
34+
border-radius: 50%;
35+
margin-top: 30rpx;
36+
}
37+
.span {
38+
margin-top: 20rpx;
39+
}
4040
}
4141
</style>

src/components/card.vue

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ export default {
4444
methods: {
4545
goAuthorPage(e) {
4646
// e.currentTarget.dataset.author
47-
wx.navigateTo({ url: `../user/main?loginname=${e.currentTarget.dataset.loginname}`});
47+
wx.navigateTo({
48+
url: `../user/main?loginname=${e.currentTarget.dataset.loginname}`
49+
});
4850
},
4951
goDetail() {
5052
wx.navigateTo({
@@ -55,7 +57,7 @@ export default {
5557
};
5658
</script>
5759

58-
<style scoped>
60+
<style lang='scss' scoped>
5961
.container {
6062
height: 330rpx;
6163
padding: 30rpx;
@@ -64,39 +66,39 @@ export default {
6466
display: flex;
6567
flex-direction: column;
6668
justify-content: space-between;
67-
}
68-
.head {
69-
color: rgb(65, 184, 131);
70-
display: flex;
71-
align-items: center;
72-
}
73-
.head-img {
74-
width: 64rpx;
75-
height: 64rpx;
76-
}
77-
.info {
78-
flex-direction: column;
79-
display: flex;
80-
margin-left: 26rpx;
81-
}
82-
.time {
83-
color: #888;
84-
}
85-
.body {
86-
color: rgb(65, 184, 131);
87-
}
88-
.body > p {
89-
font-weight: bold;
90-
}
91-
.number {
92-
color: #888;
93-
font-size: 26rpx;
94-
}
95-
.number + .number {
96-
margin-left: 20rpx;
97-
}
98-
.foot {
99-
display: flex;
100-
justify-content: space-between;
69+
.head {
70+
color: $color;
71+
display: flex;
72+
align-items: center;
73+
.head-img {
74+
width: 64rpx;
75+
height: 64rpx;
76+
}
77+
.info {
78+
flex-direction: column;
79+
display: flex;
80+
margin-left: 26rpx;
81+
.time {
82+
color: $borderColor;
83+
}
84+
}
85+
}
86+
.body {
87+
color: $color;
88+
& > p {
89+
font-weight: bold;
90+
}
91+
}
92+
.foot {
93+
display: flex;
94+
justify-content: space-between;
95+
.number {
96+
color: $borderColor;
97+
font-size: 26rpx;
98+
& + & {
99+
margin-left: 20rpx;
100+
}
101+
}
102+
}
101103
}
102104
</style>

src/components/login.vue

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
<div class='mask' v-if='visible'>
33
<div class="container">
44
<input class='input' type="text" v-model='accesstoken' placeholder='请输入accesstoken'>
5-
<button class='button' :disabled='!accesstoken.length' @click.stop="login">登录</button>
5+
<button class='button' :disabled='!accesstoken.length' @click.stop="clickLogin">登录</button>
6+
<button class='button' @click.stop="scale" style='margin-top: 20rpx;'>扫码登陆</button>
7+
<div class='tips'>登录网页版cnode后在设置中查看accesstoken或二维码</div>
68
</div>
79
</div>
810

@@ -22,14 +24,13 @@ export default {
2224
};
2325
},
2426
methods: {
25-
async login() {
27+
async login(accesstoken) {
2628
const res = await this.$http.post(`${api}/accesstoken`, {
27-
accesstoken: this.accesstoken
29+
accesstoken
2830
});
2931
if (res.data.success) {
30-
const from = wx.getStorageSync("from");
3132
wx.setStorageSync("me", res.data.loginname);
32-
wx.setStorageSync("accesstoken", this.accesstoken);
33+
wx.setStorageSync("accesstoken", accesstoken);
3334
// 触发关闭
3435
this.$emit("modalClose");
3536
} else {
@@ -39,30 +40,46 @@ export default {
3940
duration: 2000
4041
});
4142
}
43+
},
44+
clickLogin(){
45+
this.login(this.accesstoken);
46+
},
47+
scale() {
48+
wx.scanCode({
49+
success: async res => {
50+
51+
this.login(res.result);
52+
}
53+
});
4254
}
4355
}
4456
};
4557
</script>
46-
<style scoped>
58+
<style lang='scss' scoped>
4759
.mask {
4860
position: fixed;
4961
background-color: white;
5062
height: 100vh;
5163
width: 100vw;
5264
z-index: 2333;
53-
}
54-
.container {
55-
display: flex;
56-
flex-direction: column;
57-
align-items: center;
58-
}
59-
.button {
60-
width: 600rpx;
61-
margin-top: 150rpx;
62-
}
63-
.input {
64-
border-bottom: 2rpx solid #888;
65-
width: 600rpx;
66-
margin-top: 200rpx;
65+
.container {
66+
display: flex;
67+
flex-direction: column;
68+
align-items: center;
69+
.input {
70+
border-bottom: 2rpx solid $borderColor;
71+
width: 600rpx;
72+
margin-top: 200rpx;
73+
}
74+
.button {
75+
width: 600rpx;
76+
margin-top: 150rpx;
77+
}
78+
.tips {
79+
font-size: 22rpx;
80+
color: #888;
81+
margin-top: 10rpx;
82+
}
83+
}
6784
}
6885
</style>

src/components/sendReply.vue

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default {
3434
}
3535
);
3636
if (res.data.success) {
37-
this.content = '';
37+
this.content = "";
3838
this.$emit("reply-success");
3939
}
4040
} catch (e) {
@@ -51,32 +51,32 @@ export default {
5151
}
5252
};
5353
</script>
54-
<style scoped>
55-
.container {
56-
display: flex;
57-
flex-direction: column;
58-
align-items: center;
59-
background-color: white;
60-
position: absolute;
61-
bottom: 0;
62-
width: 100%;
63-
box-sizing: border-box;
64-
padding: 20px;
65-
}
54+
<style lang='scss' scoped>
6655
.mask {
6756
height: 100vh;
6857
width: 100vw;
6958
position: fixed;
70-
z-index:1;
59+
z-index: 1;
7160
background-color: rgba(0, 0, 0, 0.6);
72-
}
73-
.textarea {
74-
border: 2rpx solid #888;
75-
}
76-
.button {
77-
background-color: #41b883;
78-
color: white;
79-
width: 300rpx;
80-
margin-top: 26rpx;
61+
.container {
62+
display: flex;
63+
flex-direction: column;
64+
align-items: center;
65+
background-color: white;
66+
position: absolute;
67+
bottom: 0;
68+
width: 100%;
69+
box-sizing: border-box;
70+
padding: 20px;
71+
.textarea {
72+
border: 2rpx solid $borderColor;
73+
}
74+
.button {
75+
background-color: $color;
76+
color: white;
77+
width: 300rpx;
78+
margin-top: 26rpx;
79+
}
80+
}
8181
}
8282
</style>

src/pages/detail/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,14 +310,14 @@ export default {
310310
display: flex;
311311
margin-left: 26rpx;
312312
.time {
313-
color: #888;
313+
color: $borderColor;
314314
}
315315
}
316316
}
317317
.reply-content {
318318
font-size: 40rpx;
319319
& + & {
320-
border-top: 2rpx solid #888;
320+
border-top: 2rpx solid $borderColor;
321321
}
322322
}
323323
.foot {

src/pages/list/index.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ export default {
6262
}
6363
};
6464
</script>
65-
<style scoped>
65+
<style lang='scss' scoped>
6666
.container {
6767
background-color: rgb(245, 245, 249);
6868
min-height: 100vh;
69-
}
70-
.margin {
71-
margin-bottom: 20rpx;
69+
.margin {
70+
margin-bottom: 20rpx;
71+
}
7272
}
7373
</style>

src/pages/me/index.vue

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ export default {
2828
login
2929
},
3030
methods: {
31-
logout(){
32-
wx.clearStorageSync('accesstoken');
33-
wx.clearStorageSync('me');
31+
logout() {
32+
wx.clearStorageSync("accesstoken");
33+
wx.clearStorageSync("me");
3434
this.visible = true;
3535
},
36-
setListFrom(e){
36+
setListFrom(e) {
3737
// e.target.dataset.item
38-
wx.setStorageSync('fromItem',e.target.dataset.item)
38+
wx.setStorageSync("fromItem", e.target.dataset.item);
3939
},
4040
closeModalEvent() {
4141
this.visible = false;
@@ -64,25 +64,25 @@ export default {
6464
};
6565
</script>
6666

67-
<style scoped>
67+
<style lang='scss' scoped>
6868
.container {
6969
height: 100vh;
7070
background-color: rgb(245, 245, 249);
71-
}
72-
.body {
73-
margin-top: 30rpx;
74-
background-color: white;
75-
}
76-
.list-item {
77-
height: 76rpx;
78-
line-height: 76rpx;
79-
margin: 0 30rpx;
80-
padding: 10rpx 0;
81-
}
82-
.margin {
83-
margin-top: 30rpx;
84-
}
85-
.list-item + .list-item {
86-
border-top: 2rpx solid #888;
71+
.body {
72+
margin-top: 30rpx;
73+
background-color: white;
74+
.list-item {
75+
height: 76rpx;
76+
line-height: 76rpx;
77+
margin: 0 30rpx;
78+
padding: 10rpx 0;
79+
& + & {
80+
border-top: 2rpx solid $borderColor;
81+
}
82+
}
83+
.margin {
84+
margin-top: 30rpx;
85+
}
86+
}
8787
}
8888
</style>

0 commit comments

Comments
 (0)