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 348072f commit b33af92
Show file tree
Hide file tree
Showing 8 changed files with 1,354 additions and 135 deletions.
12 changes: 12 additions & 0 deletions pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@
"navigationBarTitleText": "收藏"
}
},
{
"path": "pages/history/history",
"style": {
"navigationBarTitleText": "播放记录"
}
},
{
"path": "pages/site/site",
"style": {
"navigationBarTitleText": "源管理"
}
},
{
"path": "pages/me/me",
"style": {
Expand Down
45 changes: 45 additions & 0 deletions pages/history/history.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<template>
<view>
<u-cell-group>
<u-cell-item
v-for="(i, j) in starList"
:key="j"
:title="i.name"
:value="i.type"
:arrow="false"
@click="openDetail(i)"
></u-cell-item>
</u-cell-group>
</view>
</template>

<script>
import db from "../../utils/database.js";
export default {
data() {
return {
starList: [],
};
},
methods: {
openDetail(item) {
const site = item.key.split("-")[0];
const id = item.key.split("-")[1];
const url = `/pages/detail/detail?site=${site}&id=${id}`;
this.$u.route({ url: url });
},
async getAllStar() {
const res = await db.getAll("star");
if (res.flag) {
this.starList = res.data;
}
},
},
onLoad() {
this.getAllStar();
},
onTabItemTap() {
this.getAllStar();
}
};
</script>
24 changes: 24 additions & 0 deletions pages/me/me.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,22 @@
<view class="name"> ZY Player Andriod </view>
<u-cell-group>
<u-cell-item
title="播放记录"
value="TODO(未完成)"
:arrow="false"
@click="openHistoryPage()"
></u-cell-item>
<u-cell-item
title="视频源管理"
value="TODO(未完成)"
:arrow="false"
@click="siteEdite()"
></u-cell-item>
<u-cell-item
title="清空播放记录"
value="清空播放记录数据"
:arrow="false"
@click="clearHistory()"
></u-cell-item>
<u-cell-item
title="清空收藏夹"
Expand Down Expand Up @@ -56,8 +68,20 @@ export default {
};
},
methods: {
openHistoryPage () {
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 () {
const res = await db.removeAll('history')
if (res.flag) {
this.$refs.uToast.show({ title: '清空播放数据成功', type: 'success', duration: '2300' })
} else {
this.$refs.uToast.show({ title: '清空播放数据失败', type: 'warning', duration: '2300' })
}
},
async clearStar() {
const res = await db.removeAll('star')
Expand Down
50 changes: 50 additions & 0 deletions pages/site/site.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<template>
<view>
<u-cell-group>
<u-cell-item
v-for="(i, j) in siteList"
:key="j"
:title="i.name"
:arrow="false"
>
<u-switch slot="right-icon" v-model="i.isActive" @change="switchChange(i)"></u-switch>
</u-cell-item>
</u-cell-group>
<u-toast ref="uToast" />
</view>
</template>

<script>
import db from "../../utils/database.js";
export default {
data() {
return {
siteList: [],
};
},
methods: {
openDetail(item) {
const site = item.key.split("-")[0];
const id = item.key.split("-")[1];
const url = `/pages/detail/detail?site=${site}&id=${id}`;
this.$u.route({ url: url });
},
async getAllSite() {
const res = await db.getAll("site");
if (res.flag) {
this.siteList = res.data;
}
},
async switchChange (e) {
await db.remove('site', e.key)
const res = await db.add('site', e)
if (res.flag) {
this.$refs.uToast.show({ title: '修改成功', type: 'success', duration: '2300' })
}
}
},
onLoad() {
this.getAllSite();
}
};
</script>
4 changes: 2 additions & 2 deletions unpackage/dist/dev/app-plus/app-config-service.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

786 changes: 665 additions & 121 deletions unpackage/dist/dev/app-plus/app-service.js

Large diffs are not rendered by default.

Loading

0 comments on commit b33af92

Please sign in to comment.