Skip to content

Commit

Permalink
优化源管理,以及优化获取资源接口返回空的清空
Browse files Browse the repository at this point in the history
  • Loading branch information
Hunlongyu committed Nov 18, 2020
1 parent b33af92 commit d435aae
Show file tree
Hide file tree
Showing 5 changed files with 5,328 additions and 5,318 deletions.
3 changes: 1 addition & 2 deletions pages/me/me.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
></u-cell-item>
<u-cell-item
title="视频源管理"
value="TODO(未完成"
value="TODO(待完善"
:arrow="false"
@click="siteEdite()"
></u-cell-item>
Expand Down Expand Up @@ -72,7 +72,6 @@ export default {
this.$refs.uToast.show({ title: '播放记录努力开发中...', type: 'warning', duration: '2300' })
},
siteEdite () {
this.$refs.uToast.show({ title: '视频源管理努力开发中...', type: 'warning', duration: '2300' })
this.$u.route({ url: '/pages/site/site' });
},
async clearHistory () {
Expand Down
19 changes: 18 additions & 1 deletion pages/site/site.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,29 @@ export default {
async getAllSite() {
const res = await db.getAll("site");
if (res.flag) {
this.siteList = res.data;
if (res.data.length <= 0) {
return false
}
res.data.sort((a, b) => {
if (a.isActive) {
return -1
}
if (b.isActive) {
return 1
}
})
await db.removeAll('site')
for (const item of res.data) {
await db.add('site', item)
}
const second = await db.getAll("site");
this.siteList = second.data;
}
},
async switchChange (e) {
await db.remove('site', e.key)
const res = await db.add('site', e)
await this.getAllSite()
if (res.flag) {
this.$refs.uToast.show({ title: '修改成功', type: 'success', duration: '2300' })
}
Expand Down
Loading

0 comments on commit d435aae

Please sign in to comment.