Skip to content

Commit 3b3478f

Browse files
committed
update list
1 parent 333b3c4 commit 3b3478f

File tree

7 files changed

+184
-166
lines changed

7 files changed

+184
-166
lines changed

server/api/userApi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ router.post('/checkDay/all', (req, res) => {
195195
})
196196
})
197197

198-
// leetcode提交id | username,leetName,a ppKey,submitId,submitDay,submitMonth
198+
// leetcode提交id | username,leetName,appKey,submitId,submitDay,submitMonth
199199

200200
router.post('/leetcode/add', (req, res) => {
201201
let sql = $sql.user.leetcode.add

server/sqlMap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var sqlMap = {
3333
checkDay: {
3434
check: 'insert into team_user_checkday(userid,appKey,timestamp) values (?,?,?)',
3535
get: 'select * from team_user_checkday where userid = ?',
36-
all: 'select * from team_user_checkday where timeStamp > ?'
36+
all: 'select * from team_user_checkday where timeStamp > ? ORDER BY timeStamp ASC'
3737
},
3838
get: {
3939
uid: "select id from team_user_info where username = ?",

src/App.vue

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
<template>
22
<div id="AppView">
33
<Controller />
4-
<appViewHead :isSettingCloseDirect="needs.isSettingCloseDirect" :title="appTitle"></appViewHead>
4+
<appViewHead
5+
:isSettingCloseDirect="needs.isSettingCloseDirect"
6+
:title="appTitle"
7+
></appViewHead>
58
<Navigation />
69
<AppMainContainer />
7-
<appViewFoot :status="statusReal.status" :statusText="statusReal.text"></appViewFoot>
10+
<appViewFoot
11+
:status="statusReal.status"
12+
:statusText="statusReal.text"
13+
></appViewFoot>
814
</div>
915
</template>
1016

@@ -75,19 +81,6 @@ export default {
7581
if (this.needs.setting.userSetting.alwaysOnTop)
7682
ipcRenderer.send("setting-always-on-top")
7783
else ipcRenderer.send("setting-always-not-top")
78-
79-
if (this.needs.setting.userSetting.colorSchemeMode == "light") {
80-
ipcRenderer.send("color-schemeMode-light")
81-
document.querySelector("html").classList.remove("dark")
82-
} else if (this.needs.setting.userSetting.colorSchemeMode == "dark") {
83-
ipcRenderer.send("color-schemeMode-dark")
84-
document.querySelector("html").classList.add("dark")
85-
} else ipcRenderer.send("color-schemeMode-system")
86-
87-
const themeMedia = window.matchMedia("(prefers-color-scheme: light)")
88-
if (themeMedia.matches)
89-
document.querySelector("html").classList.remove("dark")
90-
else document.querySelector("html").classList.add("dark")
9184
},
9285
9386
initApp: function () {
@@ -111,7 +104,8 @@ export default {
111104
z-index: 2009;
112105
}
113106
114-
.appViewHead {}
107+
.appViewHead {
108+
}
115109
116110
:deep().el-message {
117111
z-index: 10000;

src/components/Frameworks/Navigation/index.vue

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
class="avatar"
55
@click="handleOpenUserArea"
66
v-show="isLogined"
7+
:image="avatarUrl"
78
:isDot="false"
89
/>
910
<div class="shiftOperations">
@@ -60,6 +61,7 @@ export default {
6061
isLogined: false,
6162
colorMode: "light",
6263
signText: "登录",
64+
avatarUrl: "",
6365
}
6466
},
6567
beforeCreate() {
@@ -81,21 +83,25 @@ export default {
8183
localStorage.getItem("checkKey") == (undefined || null)
8284
)
8385
this.initColorMode()
86+
this.initUserAvatar()
8487
},
8588
methods: {
8689
initColorMode: function () {
87-
if (window.matchMedia("(prefers-color-scheme: light)").matches) {
90+
this.colorMode =
91+
localStorage.getItem("color-scheme-mode") ||
92+
(window.matchMedia("(prefers-color-scheme: dark)").matches
93+
? "dark"
94+
: "light")
95+
ipcRenderer.send(`color-schemeMode-${this.colorMode}`)
96+
this.$public.emit("update-color-mode", this.colorMode)
97+
98+
if (this.colorMode === "light") {
8899
document.querySelector("html").classList.remove("dark")
89-
this.colorMode = "light"
90100
} else {
91101
document.querySelector("html").classList.add("dark")
92-
this.colorMode = "dark"
93102
}
94103
95-
console.log(
96-
this.colorMode,
97-
window.matchMedia("(prefers-color-scheme: light)").matches
98-
)
104+
console.log("colorMode", this.colorMode)
99105
},
100106
handleOpenUserArea: function () {
101107
this.$router.push({ path: "/userArea" })
@@ -109,17 +115,15 @@ export default {
109115
},
110116
switchColorMode: function () {
111117
this.$conf.getConfPromise().then((data) => {
112-
ipcRenderer.send(
113-
`color-schemeMode-${
114-
this.colorMode === "light" ? "dark" : "light"
115-
}`
116-
)
117-
118118
data.data.userSetting.colorSchemeMode = this.colorMode
119+
localStorage.setItem(
120+
"color-scheme-mode",
121+
this.colorMode === "light" ? "dark" : "light"
122+
)
119123
this.handleStorgeSetting(data.data, () => {
124+
console.log(data.data)
120125
setTimeout(() => {
121126
this.initColorMode()
122-
this.$public.emit("update-color-mode", this.colorMode)
123127
}, 0)
124128
})
125129
})
@@ -132,6 +136,11 @@ export default {
132136
})
133137
cb && cb()
134138
},
139+
initUserAvatar: function () {
140+
this.$conf.getConfPromise().then((data) => {
141+
this.avatarUrl = data.data.userInfo.avatar
142+
})
143+
},
135144
},
136145
}
137146
</script>

src/components/Score/index.vue

Lines changed: 93 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -6,51 +6,31 @@
66
<el-icon :size="18"><Refresh /></el-icon>
77
</span>
88
</h1>
9-
<el-pagination
10-
v-if="total"
11-
v-model:currentPage="submitPage"
12-
:total="total"
13-
background
14-
@current-change="getSubmitArr"
15-
layout="prev, pager, next, total, jumper"
16-
v-loading="loading"
17-
></el-pagination
18-
><br />
19-
<el-table :data="subs" border :default-sort="{ order: sortByCount }">
20-
<el-table-column
21-
prop="timeStamp"
22-
label="时间"
23-
sortable
24-
align="center"
25-
>
26-
<template #default="scope">
27-
{{
28-
new Date(parseInt(scope.row.timeStamp)).toLocaleString()
29-
}}
30-
</template>
31-
</el-table-column>
32-
<el-table-column
33-
prop="leetName"
34-
label="提交名"
35-
sortable
36-
align="center"
37-
/>
38-
<el-table-column prop="submitId" label="提交ID" align="center" />
39-
<el-table-column label="操作" align="center">
40-
<template #default="scope">
41-
<el-link
42-
type="primary"
43-
@click="
44-
getSubmissionDetail(
45-
scope.row.submitId,
46-
scope.row.userid
47-
)
48-
"
49-
>查看</el-link
50-
>
51-
</template>
52-
</el-table-column>
53-
</el-table>
9+
<!-- use div acheve a list to show subs data, do not use el-table -->
10+
<div v-if="subs.length" class="sub-list">
11+
<div v-for="item in subs" :key="item.submitId" class="sub-item">
12+
<div class="sub-item-content">
13+
<span class="no-wrap">
14+
<span
15+
class="id"
16+
@click="
17+
getSubmissionDetail(item.submitId, item.userid)
18+
"
19+
>{{ item.submitId }}</span
20+
>
21+
<span class="leetName">{{
22+
item.leetName + "a long fix"
23+
}}</span>
24+
</span>
25+
<span class="time">{{
26+
getComputedTime(item.timeStamp)
27+
}}</span>
28+
</div>
29+
</div>
30+
</div>
31+
<div v-else class="empty">
32+
<el-empty description="暂无提交记录"></el-empty>
33+
</div>
5434
<Detail
5535
class="detail"
5636
ref="detail"
@@ -73,6 +53,7 @@ export default {
7353
loading: true,
7454
loadingClass: "",
7555
subs: [],
56+
submissionStatus: {},
7657
submissionDetail: {},
7758
submitPage: 1,
7859
pageLimit: 10,
@@ -98,24 +79,25 @@ export default {
9879
.getSubmissionStatus(`${id}`)
9980
.then((result) => {
10081
const { submissionDetail } = result.data.data
82+
console.log(submissionDetail, result)
10183
if (!submissionDetail) {
10284
this.$public.emit("notice", {
10385
type: "error",
104-
msg: `❌ 检测到未登入 LeetCode 无法获取题解详情`,
86+
msg: `无法获取题解详情 ERRCODE: -3`,
10587
})
10688
return 0
10789
}
10890
this.getSubmitor(uid)
10991
this.submissionDetail = submissionDetail
11092
this.$public.emit("notice", {
11193
type: "success",
112-
msg: `提交返回数据`,
94+
msg: `提交返回数据`,
11395
})
11496
})
115-
.catch((e) => {
97+
.catch(() => {
11698
this.$public.emit("notice", {
11799
type: "error",
118-
msg: `获取提交返回数据失败 ${e.message}`,
100+
msg: `获取提交返回数据失败 ERRCODE: -2`,
119101
})
120102
})
121103
}, 300),
@@ -134,13 +116,18 @@ export default {
134116
this.total = result.data.all
135117
this.submitPage = val
136118
this.loading = false
119+
console.log(this.subs)
120+
137121
this.$public.emit("notice", {
138122
type: "success",
139-
msg: "获取提交列表",
123+
msg: "获取提交列表",
140124
})
141125
})
142-
.catch((err) => {
143-
console.log(err.message)
126+
.catch(() => {
127+
this.$public.emit("notice", {
128+
type: "error",
129+
msg: `获取提交返回数据失败 ERRCODE: -2`,
130+
})
144131
})
145132
})
146133
}, 400),
@@ -169,11 +156,27 @@ export default {
169156
},
170157
})
171158
}, 500),
172-
getQuestionPage: function () {},
173159
initTables: function () {
174160
this.submitPage = 1
175161
this.getSubmitArr()
176162
},
163+
getComputedTime: function (timestamp) {
164+
function addzero(num) {
165+
return num < 10 ? "0" + num : num
166+
}
167+
168+
const date = new Date(parseInt(timestamp))
169+
const Y = date.getFullYear() + "-"
170+
const M =
171+
(date.getMonth() + 1 < 10
172+
? "0" + (date.getMonth() + 1)
173+
: date.getMonth() + 1) + "-"
174+
const D = addzero(date.getDate()) + " "
175+
const h = addzero(date.getHours()) + ":"
176+
const m = addzero(date.getMinutes()) + ":"
177+
const s = addzero(date.getSeconds())
178+
return Y + M + D + h + m + s
179+
},
177180
},
178181
}
179182
</script>
@@ -190,8 +193,43 @@ h1 {
190193
h1 span {
191194
@apply flex items-center py-2;
192195
}
193-
.el-pagination {
194-
@apply inline-block w-full pt-4;
196+
197+
.sub-list {
198+
@apply inline-flex justify-center flex-col w-full flex-grow my-4;
199+
}
200+
201+
.sub-list .sub-item {
202+
@apply flex items-center justify-between w-full my-1 px-4 py-2 text-base border-2 rounded-lg
203+
border-gray-200 dark:border-gray-700
204+
hover:border-gray-300 dark:hover:border-gray-500
205+
hover:shadow
206+
hover:bg-gray-50 dark:hover:bg-gray-600 transition-all;
207+
}
208+
209+
.sub-list .sub-item-content {
210+
@apply inline-flex justify-between w-full;
211+
}
212+
213+
.sub-item-content .no-wrap {
214+
@apply truncate;
215+
}
216+
217+
.sub-item-content .id {
218+
@apply inline-flex items-center justify-center pr-2 border-r-2
219+
border-gray-200 dark:border-gray-700
220+
transition-all cursor-pointer;
221+
}
222+
.sub-item:hover .id {
223+
@apply border-gray-300 dark:border-gray-500;
224+
}
225+
226+
.sub-item-content .leetName {
227+
@apply inline-flex items-center mx-2;
228+
}
229+
230+
.sub-item-content .time {
231+
@apply inline-flex items-center
232+
whitespace-nowrap;
195233
}
196234
197235
.op {

0 commit comments

Comments
 (0)