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 1666835 commit 153597d
Show file tree
Hide file tree
Showing 6 changed files with 575 additions and 50 deletions.
16 changes: 14 additions & 2 deletions pages/detail/detail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
@confirm="playConfirm"
></u-select>
</view>
<u-toast ref="uToast" />
</view>
</template>

Expand Down Expand Up @@ -88,11 +89,22 @@ export default {
moreShowEvent() {
this.moreShow = !this.moreShow;
},
moreConfirm(e) {
async moreConfirm(e) {
const val = e[0].value;
if (val === "share") {
}
console.log(e, "eeee");
if (val === "star") {
let s = {...this.detail}
s.key = `${this.siteKey}-${this.id}`
const res = await db.add('star', s)
if (res.flag) {
this.$refs.uToast.show({
title: '收藏成功',
type: 'success',
duration: '2300'
})
}
}
},
playEvent() {
if (this.playList.length <= 1) {
Expand Down
64 changes: 40 additions & 24 deletions pages/star/star.vue
Original file line number Diff line number Diff line change
@@ -1,29 +1,45 @@
<template>
<view>
<u-cell-group>
<u-cell-item v-for="i in 50" :key="i" title="电影名称" value="资源来源" :arrow="false" @click="openDetail"></u-cell-item>
</u-cell-group>
</view>
<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>
export default {
data() {
return {
site: 'kaka',
id: 'haha'
}
},
methods: {
openDetail (item) {
const url = `/pages/detail/detail?site=${this.site}&id=${this.id}&name=${item.label}&url=${item.value}`
this.$u.route({url: url})
}
},
onLoad() {}
}
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>

<style>
</style>
317 changes: 305 additions & 12 deletions unpackage/dist/dev/app-plus/app-service.js

Large diffs are not rendered by default.

Loading

0 comments on commit 153597d

Please sign in to comment.