mirror of
https://github.com/cuiocean/ZY-Player.git
synced 2026-02-14 16:06:48 +08:00
Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
17be5d45f1 | ||
|
|
f493fcd24e | ||
|
|
d040bc01fc | ||
|
|
6644c97811 | ||
|
|
68960ab5bb | ||
|
|
46de044214 | ||
|
|
0cbf9ca7fb | ||
|
|
6fa40af9bd | ||
|
|
7343f1824a | ||
|
|
3df0665950 | ||
|
|
022b1b28ad | ||
|
|
55d1740354 | ||
|
|
9d71991103 | ||
|
|
361e24ecad | ||
|
|
53f80d2cce | ||
|
|
880dd9ff35 | ||
|
|
42c89120da | ||
|
|
d990aa92b0 | ||
|
|
e117564ecb | ||
|
|
99592e3fcb | ||
|
|
adc8fd4329 | ||
|
|
579caddaeb | ||
|
|
1d5344f292 | ||
|
|
22dc74ea3a | ||
|
|
72d7c91540 |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "zy",
|
||||
"version": "2.6.1",
|
||||
"version": "2.6.2",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
@@ -37,6 +37,7 @@
|
||||
"randomstring": "^1.1.5",
|
||||
"v-fit-columns": "^0.2.0",
|
||||
"vue": "^2.6.12",
|
||||
"vue-clickaway": "^2.2.2",
|
||||
"vue-infinite-loading": "^2.4.5",
|
||||
"vue-waterfall-plugin": "^1.1.0",
|
||||
"vuedraggable": "^2.24.2",
|
||||
|
||||
@@ -235,8 +235,15 @@
|
||||
background-color: none !important;
|
||||
}
|
||||
.el-input{
|
||||
font-size: 1rem;
|
||||
width: 200px;
|
||||
}
|
||||
.el-select-dropdown__item{
|
||||
font-size: 1rem;
|
||||
}
|
||||
.el-select{
|
||||
margin-left: 20px;
|
||||
}
|
||||
}
|
||||
.listpage-body{
|
||||
height: calc(100% - 60px);
|
||||
|
||||
@@ -359,6 +359,31 @@
|
||||
color: var(--d-fc-2);
|
||||
}
|
||||
}
|
||||
.el-select-dropdown{
|
||||
color: var(--d-fc-1);
|
||||
border: none;
|
||||
background-color: var(--d-bgc-1);
|
||||
box-shadow: var(--d-bsc);
|
||||
}
|
||||
.el-select-dropdown__item{
|
||||
color: var(--d-fc-1);
|
||||
border: none;
|
||||
background-color: var(--d-bgc-1);
|
||||
}
|
||||
.el-select-dropdown__item.hover{
|
||||
background-color: var(--d-c-1);
|
||||
box-shadow: var(--d-bsc);
|
||||
}
|
||||
.el-select-dropdown__item.selected{
|
||||
color: var(--d-fc-1);
|
||||
background-color: var(--d-c-1);
|
||||
box-shadow: var(--d-bsc);
|
||||
}
|
||||
.el-select-dropdown__item.selected.hover{
|
||||
color: var(--d-fc-1);
|
||||
background-color: var(--d-c-1);
|
||||
box-shadow: var(--d-bsc);
|
||||
}
|
||||
}
|
||||
.listpage-body{
|
||||
color: var(--d-fc-1);
|
||||
|
||||
@@ -354,6 +354,31 @@
|
||||
color: var(--g-fc-2);
|
||||
}
|
||||
}
|
||||
.el-select-dropdown{
|
||||
color: var(--g-fc-1);
|
||||
border: none;
|
||||
background-color: var(--g-bgc-1);
|
||||
box-shadow: var(--g-bsc);
|
||||
}
|
||||
.el-select-dropdown__item{
|
||||
color: var(--g-fc-1);
|
||||
border: none;
|
||||
background-color: var(--g-bgc-1);
|
||||
}
|
||||
.el-select-dropdown__item.hover{
|
||||
background-color: var(--g-c-1);
|
||||
box-shadow: var(--g-bsc);
|
||||
}
|
||||
.el-select-dropdown__item.selected{
|
||||
color: var(--g-fc-1);
|
||||
background-color: var(--g-c-1);
|
||||
box-shadow: var(--g-bsc);
|
||||
}
|
||||
.el-select-dropdown__item.selected.hover{
|
||||
color: var(--g-fc-1);
|
||||
background-color: var(--g-c-1);
|
||||
box-shadow: var(--g-bsc);
|
||||
}
|
||||
}
|
||||
.listpage-body{
|
||||
color: var(--g-fc-1);
|
||||
|
||||
@@ -334,26 +334,51 @@
|
||||
.listpage{
|
||||
color: var(--l-fc-2);
|
||||
.listpage-header{
|
||||
border-bottom-color: var(--l-c-3);
|
||||
.btn{
|
||||
&:hover{
|
||||
color: var(--l-fc-3)
|
||||
}
|
||||
border-bottom-color: var(--l-c-3);
|
||||
.btn{
|
||||
&:hover{
|
||||
color: var(--l-fc-3)
|
||||
}
|
||||
.el-button{
|
||||
background-color: var(--l-bgc-2);
|
||||
}
|
||||
.el-button{
|
||||
background-color: var(--l-bgc-2);
|
||||
color: var(--l-fc-2);
|
||||
&:hover{
|
||||
color: var(--l-fc-3)
|
||||
}
|
||||
}
|
||||
.el-input{
|
||||
input{
|
||||
background-color: var(--l-bgc-1);
|
||||
border: 1px solid var(--l-bgc-1);
|
||||
color: var(--l-fc-2);
|
||||
&:hover{
|
||||
color: var(--l-fc-3)
|
||||
}
|
||||
}
|
||||
.el-input{
|
||||
input{
|
||||
background-color: var(--l-bgc-1);
|
||||
border: 1px solid var(--l-bgc-1);
|
||||
color: var(--l-fc-2);
|
||||
}
|
||||
}
|
||||
}
|
||||
.el-select-dropdown{
|
||||
color: var(--l-fc-1);
|
||||
border: none;
|
||||
background-color: var(--l-bgc-1);
|
||||
box-shadow: var(--l-bsc);
|
||||
}
|
||||
.el-select-dropdown__item{
|
||||
color: var(--l-fc-1);
|
||||
border: none;
|
||||
background-color: var(--l-bgc-1);
|
||||
}
|
||||
.el-select-dropdown__item.hover{
|
||||
background-color: var(--l-c-1);
|
||||
box-shadow: var(--l-bsc);
|
||||
}
|
||||
.el-select-dropdown__item.selected{
|
||||
color: var(--l-fc-1);
|
||||
background-color: var(--l-c-1);
|
||||
box-shadow: var(--l-bsc);
|
||||
}
|
||||
.el-select-dropdown__item.selected.hover{
|
||||
color: var(--l-fc-1);
|
||||
background-color: var(--l-c-1);
|
||||
box-shadow: var(--l-bsc);
|
||||
}
|
||||
}
|
||||
.listpage-body{
|
||||
color: var(--l-fc-1);
|
||||
|
||||
@@ -333,26 +333,51 @@
|
||||
.listpage{
|
||||
color: var(--p-fc-2);
|
||||
.listpage-header{
|
||||
border-bottom-color: var(--p-c-3);
|
||||
.btn{
|
||||
&:hover{
|
||||
color: var(--p-fc-3)
|
||||
}
|
||||
border-bottom-color: var(--p-c-3);
|
||||
.btn{
|
||||
&:hover{
|
||||
color: var(--p-fc-3)
|
||||
}
|
||||
.el-button{
|
||||
background-color: var(--p-bgc-2);
|
||||
}
|
||||
.el-button{
|
||||
background-color: var(--p-bgc-2);
|
||||
color: var(--p-fc-2);
|
||||
&:hover{
|
||||
color: var(--p-fc-3)
|
||||
}
|
||||
}
|
||||
.el-input{
|
||||
input{
|
||||
background-color: var(--p-bgc-1);
|
||||
border: 1px solid var(--p-bgc-1);
|
||||
color: var(--p-fc-2);
|
||||
&:hover{
|
||||
color: var(--p-fc-3)
|
||||
}
|
||||
}
|
||||
.el-input{
|
||||
input{
|
||||
background-color: var(--p-bgc-1);
|
||||
border: 1px solid var(--p-bgc-1);
|
||||
color: var(--p-fc-2);
|
||||
}
|
||||
}
|
||||
}
|
||||
.el-select-dropdown{
|
||||
color: var(--p-fc-1);
|
||||
border: none;
|
||||
background-color: var(--p-bgc-1);
|
||||
box-shadow: var(--p-bsc);
|
||||
}
|
||||
.el-select-dropdown__item{
|
||||
color: var(--p-fc-1);
|
||||
border: none;
|
||||
background-color: var(--p-bgc-1);
|
||||
}
|
||||
.el-select-dropdown__item.hover{
|
||||
background-color: var(--p-c-1);
|
||||
box-shadow: var(--p-bsc);
|
||||
}
|
||||
.el-select-dropdown__item.selected{
|
||||
color: var(--p-fc-1);
|
||||
background-color: var(--p-c-1);
|
||||
box-shadow: var(--p-bsc);
|
||||
}
|
||||
.el-select-dropdown__item.selected.hover{
|
||||
color: var(--p-fc-1);
|
||||
background-color: var(--p-c-1);
|
||||
box-shadow: var(--p-bsc);
|
||||
}
|
||||
}
|
||||
.listpage-body{
|
||||
color: var(--p-fc-1);
|
||||
|
||||
@@ -256,25 +256,9 @@ export default {
|
||||
}
|
||||
},
|
||||
doubanLinkEvent () {
|
||||
const open = require('open')
|
||||
const axios = require('axios')
|
||||
const cheerio = require('cheerio')
|
||||
const name = this.detail.info.name.trim()
|
||||
// 豆瓣搜索链接
|
||||
var doubanSearchLink = 'https://www.douban.com/search?q=' + name
|
||||
var link = doubanSearchLink
|
||||
axios.get(doubanSearchLink).then(res => {
|
||||
const $ = cheerio.load(res.data)
|
||||
// 比较第一和第二豆瓣搜索结果, 如果名字相符, 就打开该链接,否则打开搜索页面
|
||||
var nameInDouban = $($('div.result')[0]).find('div>div>h3>a').first()
|
||||
if (name.replace(/\s/g, '') === nameInDouban.text().replace(/\s/g, '')) {
|
||||
link = nameInDouban.attr('href')
|
||||
} else {
|
||||
nameInDouban = $($('div.result')[1]).find('div>div>h3>a').first()
|
||||
if (name.replace(/\s/g, '') === nameInDouban.text().replace(/\s/g, '')) {
|
||||
link = nameInDouban.attr('href')
|
||||
}
|
||||
}
|
||||
zy.doubanLink(name).then(link => {
|
||||
const open = require('open')
|
||||
open(link)
|
||||
})
|
||||
},
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<div class="listpage" id="sites">
|
||||
<div class="listpage-header" v-show="!enableBatchEdit">
|
||||
<el-switch v-model="enableBatchEdit" active-text="批处理分组">></el-switch>
|
||||
<el-checkbox v-model="setting.excludeR18Films" @change="excludeR18FilmsChangeEvent">屏蔽福利片</el-checkbox>
|
||||
<el-button @click="addSite" icon="el-icon-document-add">新增</el-button>
|
||||
<el-button @click="exportSites" icon="el-icon-upload2" >导出</el-button>
|
||||
<el-button @click="importSites" icon="el-icon-download">导入</el-button>
|
||||
@@ -111,7 +112,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import { mapMutations } from 'vuex'
|
||||
import { sites } from '../lib/dexie'
|
||||
import { sites, setting } from '../lib/dexie'
|
||||
import zy from '../lib/site/tools'
|
||||
import { remote } from 'electron'
|
||||
import { sites as defaultSites } from '../lib/dexie/initData'
|
||||
@@ -187,6 +188,12 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['SET_SETTING', 'SET_EDITSITES']),
|
||||
excludeR18FilmsChangeEvent () {
|
||||
setting.find().then(res => {
|
||||
res.excludeR18Films = this.setting.excludeR18Films
|
||||
setting.update(res)
|
||||
})
|
||||
},
|
||||
filterHandle (value, row) {
|
||||
return row.group === value
|
||||
},
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
</div>
|
||||
<div class="name" @click="detailEvent(site, props.data)">{{props.data.name}}</div>
|
||||
<div class="info">
|
||||
<span>{{props.data.area}}</span>
|
||||
<span>{{props.data.year}}</span>
|
||||
<span>{{props.data.note}}</span>
|
||||
<span>{{props.data.type}}</span>
|
||||
@@ -116,7 +117,7 @@
|
||||
</div>
|
||||
<div class="show-table" v-show="show.find">
|
||||
<el-table size="mini"
|
||||
:data="searchContents"
|
||||
:data="searchContents.filter(res => !setting.excludeR18Films || (res.type !== undefined && !containsR18Keywords(res.type)))"
|
||||
height="100%"
|
||||
row-key="id"
|
||||
@row-click="(row) => detailEvent(row.site, row)"
|
||||
@@ -252,11 +253,15 @@ export default {
|
||||
},
|
||||
sitesList () {
|
||||
return this.$store.getters.getEditSites.sites // 需要监听的数据
|
||||
},
|
||||
filterSettings () {
|
||||
return this.$store.getters.getSetting.excludeR18Films // 需要监听的数据
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
classNameFilter: (name) => {
|
||||
return name.replace(/[^\u4e00-\u9fa5]/gi, '')
|
||||
const clsName = name.toString()
|
||||
return clsName.replace(/[^\u4e00-\u9fa5]/gi, '')
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -268,6 +273,9 @@ export default {
|
||||
},
|
||||
sitesList () {
|
||||
this.getAllsites()
|
||||
},
|
||||
filterSettings () {
|
||||
this.siteClick(this.site)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -283,10 +291,9 @@ export default {
|
||||
this.classList = []
|
||||
this.type = {}
|
||||
this.getClass().then(res => {
|
||||
if (res) {
|
||||
this.show.class = true
|
||||
this.infiniteId += 1
|
||||
}
|
||||
this.show.class = true
|
||||
this.infiniteId += 1
|
||||
this.classClick(this.classList[0])
|
||||
})
|
||||
}
|
||||
},
|
||||
@@ -463,10 +470,10 @@ export default {
|
||||
if (this.view === 'Film') {
|
||||
if (this.setting.view === 'picture') {
|
||||
this.$refs.filmWaterfall.refresh()
|
||||
this.getPage().then(() => {
|
||||
this.infiniteId += 1
|
||||
})
|
||||
}
|
||||
this.getPage().then(() => {
|
||||
this.infiniteId += 1
|
||||
})
|
||||
}
|
||||
},
|
||||
getAllSearch () {
|
||||
@@ -554,8 +561,10 @@ export default {
|
||||
this.sites = res.filter((item, index, self) => {
|
||||
return self.indexOf(item) >= 0 && item.isActive
|
||||
})
|
||||
this.site = this.sites[0]
|
||||
this.siteClick(this.site)
|
||||
if (this.site === undefined || !this.sites.some(x => x.key === this.site.key)) {
|
||||
this.site = this.sites[0]
|
||||
this.siteClick(this.site)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@
|
||||
<ul v-show="right.type === 'shortcut'" class="list-shortcut">
|
||||
<li v-for="(m, n) in right.shortcut" :key="n"><span class="title">{{m.desc}} -- [ {{m.key}} ]</span></li>
|
||||
</ul>
|
||||
<ul v-show="right.type === 'other'" class="list-other">
|
||||
<ul v-show="right.type === 'other'" class="list-other" v-on-clickaway="closeListEvent">
|
||||
<li v-show="right.other.length === 0">无数据</li>
|
||||
<li @click="otherItemEvent(m)" v-for="(m, n) in right.other" :key="n"><span class="title">{{m.name}} - [{{m.site.name}}]</span></li>
|
||||
</ul>
|
||||
@@ -145,6 +145,8 @@ import zy from '../lib/site/tools'
|
||||
import Player from 'xgplayer'
|
||||
import Hls from 'xgplayer-hls.js'
|
||||
import mt from 'mousetrap'
|
||||
import { directive as onClickaway } from 'vue-clickaway'
|
||||
|
||||
const { remote, ipcRenderer, clipboard } = require('electron')
|
||||
|
||||
const VIDEO_DETAIL_CACHE = {}
|
||||
@@ -247,6 +249,9 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
directives: {
|
||||
onClickaway: onClickaway
|
||||
},
|
||||
computed: {
|
||||
view: {
|
||||
get () {
|
||||
@@ -776,9 +781,7 @@ export default {
|
||||
},
|
||||
async otherItemEvent (e) {
|
||||
// 打开当前播放的剧集index, 定位到当前的时间
|
||||
this.video = { key: e.key, info: { id: e.id, name: e.name, site: e.site, index: this.video.info.index, time: this.video.info.time } }
|
||||
this.right.show = false
|
||||
this.right.type = ''
|
||||
this.video = { key: e.key, info: { id: e.id, name: e.name, site: e.site, index: this.video.info.index, time: this.xg.currentTime } }
|
||||
},
|
||||
mtEvent () {
|
||||
setting.find().then(res => {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="listpage-header" id="recommandataions-header">
|
||||
<el-switch v-model="viewMode" active-text="海报" active-value="picture" inactive-text="列表" inactive-value="list" @change="updateViewMode"></el-switch>
|
||||
<el-button type="text">视频数:{{ recommandations.length }}</el-button>
|
||||
<el-select size="mini" v-model="selectedAreas" multiple collapse-tags style="margin-left: 20px;" placeholder="地区">
|
||||
<el-select v-model="selectedAreas" multiple collapse-tags placeholder="地区" :popper-append-to-body="false">
|
||||
<el-option
|
||||
v-for="item in areas"
|
||||
:key="item"
|
||||
@@ -11,7 +11,7 @@
|
||||
:value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-select size="mini" v-model="selectedTypes" multiple collapse-tags style="margin-left: 20px;" placeholder="类型">
|
||||
<el-select v-model="selectedTypes" multiple collapse-tags placeholder="类型" :popper-append-to-body="false">
|
||||
<el-option
|
||||
v-for="item in types"
|
||||
:key="item"
|
||||
@@ -194,8 +194,7 @@ export default {
|
||||
axios.get(url).then(res => {
|
||||
if (res.status === 200) {
|
||||
if (res.data.length > 0) {
|
||||
this.recommandations = res.data
|
||||
this.recommandations.sort(function (a, b) {
|
||||
this.recommandations = res.data.sort(function (a, b) {
|
||||
return b.detail.year - a.detail.year
|
||||
})
|
||||
recommandation.clear().then(recommandation.bulkAdd(this.recommandations))
|
||||
@@ -276,9 +275,8 @@ export default {
|
||||
},
|
||||
getRecommandations () {
|
||||
recommandation.all().then(res => {
|
||||
this.recommandations = res
|
||||
this.recommandations.sort(function (a, b) {
|
||||
return b.detail.year - a.detail.year
|
||||
this.recommandations = res.sort(function (a, b) {
|
||||
return b.id - a.id
|
||||
})
|
||||
this.getFilterData()
|
||||
})
|
||||
|
||||
@@ -87,9 +87,6 @@
|
||||
<div class="zy-input" @click="toggleExcludeRootClasses">
|
||||
<input type="checkbox" v-model = "d.excludeRootClasses" @change="updateSettingEvent"> 屏蔽主分类
|
||||
</div>
|
||||
<div class="zy-input" @click="toggleExcludeR18Films">
|
||||
<input type="checkbox" v-model = "d.excludeR18Films" @change="updateSettingEvent"> 屏蔽福利片
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="theme">
|
||||
@@ -270,10 +267,6 @@ export default {
|
||||
this.d.searchAllSites = !this.d.searchAllSites
|
||||
this.updateSettingEvent()
|
||||
},
|
||||
toggleExcludeR18Films () {
|
||||
this.d.excludeR18Films = !this.d.excludeR18Films
|
||||
this.updateSettingEvent()
|
||||
},
|
||||
toggleExcludeRootClasses () {
|
||||
this.d.excludeRootClasses = !this.d.excludeRootClasses
|
||||
this.updateSettingEvent()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="share" id="share" @click="shareClickEvent">
|
||||
<div class="share" id="share" @click="shareClickEvent" v-on-clickaway="shareClickEvent">
|
||||
<div class="left">
|
||||
<img :src="pic" alt="" @load="picLoadEvent">
|
||||
</div>
|
||||
@@ -22,6 +22,7 @@ import { mapMutations } from 'vuex'
|
||||
import QrcodeVue from 'qrcode.vue'
|
||||
import html2canvas from 'html2canvas'
|
||||
import zy from '../lib/site/tools'
|
||||
import { directive as onClickaway } from 'vue-clickaway'
|
||||
const { clipboard, nativeImage } = require('electron')
|
||||
export default {
|
||||
name: 'share',
|
||||
@@ -56,6 +57,9 @@ export default {
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
directives: {
|
||||
onClickaway: onClickaway
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['SET_SHARE']),
|
||||
shareClickEvent () {
|
||||
|
||||
@@ -102,6 +102,7 @@
|
||||
</div>
|
||||
<div class="name" @click="detailEvent(props.data)">{{props.data.name}}</div>
|
||||
<div class="info">
|
||||
<span>{{props.data.detail.area}}</span>
|
||||
<span>{{props.data.detail.year}}</span>
|
||||
<span>{{props.data.detail.note}}</span>
|
||||
<span>{{props.data.detail.type}}</span>
|
||||
@@ -128,7 +129,8 @@ export default {
|
||||
return {
|
||||
list: [],
|
||||
sites: [],
|
||||
viewMode: 'picture'
|
||||
viewMode: 'picture',
|
||||
numNoUpdate: 0
|
||||
}
|
||||
},
|
||||
components: {
|
||||
@@ -175,6 +177,13 @@ export default {
|
||||
this.getFavorites()
|
||||
this.$refs.starWaterfall.refresh()
|
||||
}
|
||||
},
|
||||
numNoUpdate () {
|
||||
// 如果所有收藏都没有更新的话
|
||||
if (this.numNoUpdate === this.list.length) {
|
||||
this.numNoUpdate = 0
|
||||
this.$message.warning('未查询到任何更新')
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -254,11 +263,12 @@ export default {
|
||||
index: e.index
|
||||
}
|
||||
star.get(e.id).then(resStar => {
|
||||
var msg = ''
|
||||
if (e.detail.last !== detailRes.last) {
|
||||
if (!e.hasUpdate && e.detail.last !== detailRes.last) {
|
||||
doc.hasUpdate = true
|
||||
msg = `同步"${e.name}"成功, 检查到更新。`
|
||||
var msg = `同步"${e.name}"成功, 检查到更新。`
|
||||
this.$message.success(msg)
|
||||
} else {
|
||||
this.numNoUpdate += 1
|
||||
}
|
||||
star.update(e.id, doc)
|
||||
this.getFavorites()
|
||||
@@ -269,6 +279,7 @@ export default {
|
||||
})
|
||||
},
|
||||
updateAllEvent () {
|
||||
this.numNoUpdate = 0
|
||||
this.list.forEach(e => {
|
||||
this.updateEvent(e)
|
||||
})
|
||||
@@ -334,7 +345,9 @@ export default {
|
||||
},
|
||||
getFavorites () {
|
||||
star.all().then(res => {
|
||||
this.list = res.reverse()
|
||||
this.list = res.sort(function (a, b) {
|
||||
return b.id - a.id
|
||||
})
|
||||
})
|
||||
},
|
||||
getAllsites () {
|
||||
@@ -355,7 +368,7 @@ export default {
|
||||
remote.dialog.showSaveDialog(options).then(result => {
|
||||
if (!result.canceled) {
|
||||
fs.writeFileSync(result.filePath, str)
|
||||
this.$message.success('已保存成功')
|
||||
this.$message.success('导出收藏成功')
|
||||
}
|
||||
}).catch(err => {
|
||||
this.$message.error(err)
|
||||
@@ -372,14 +385,16 @@ export default {
|
||||
}
|
||||
remote.dialog.showOpenDialog(options).then(result => {
|
||||
if (!result.canceled) {
|
||||
var starList = this.list
|
||||
var starList = Array.from(this.list)
|
||||
var id = this.list.length + 1
|
||||
result.filePaths.forEach(file => {
|
||||
var str = fs.readFileSync(file)
|
||||
const json = JSON.parse(str)
|
||||
json.forEach(ele => {
|
||||
const starExists = starList.includes(x => x.key === ele.key && x.ids === ele.ids)
|
||||
json.reverse().forEach(ele => {
|
||||
const starExists = starList.some(x => x.key === ele.key && x.ids === ele.ids)
|
||||
if (!starExists) {
|
||||
var doc = {
|
||||
id: id,
|
||||
key: ele.key,
|
||||
ids: ele.ids,
|
||||
site: ele.site === undefined ? ele.site = this.sites.find(x => x.key === ele.key) : ele.site,
|
||||
@@ -398,6 +413,7 @@ export default {
|
||||
note: ele.note
|
||||
} : ele.detail
|
||||
}
|
||||
id += 1
|
||||
starList.push(doc)
|
||||
}
|
||||
})
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
||||
import Vue from 'vue'
|
||||
import { Message, Button, Table, TableColumn, Tag, Input, Dialog, Form, FormItem, Switch, Select, Option } from 'element-ui'
|
||||
import { Message, Button, Table, TableColumn, Tag, Input, Dialog, Form, FormItem, Switch, Select, Option, Checkbox } from 'element-ui'
|
||||
import Plugin from 'v-fit-columns'
|
||||
Vue.use(Button)
|
||||
Vue.use(Table)
|
||||
@@ -13,4 +13,5 @@ Vue.use(Switch)
|
||||
Vue.use(Plugin)
|
||||
Vue.use(Select)
|
||||
Vue.use(Option)
|
||||
Vue.use(Checkbox)
|
||||
Vue.prototype.$message = Message
|
||||
|
||||
@@ -214,11 +214,11 @@ const zy = {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 获取豆瓣评分
|
||||
* 获取豆瓣页面链接
|
||||
* @param {*} name 视频名称
|
||||
* @returns 豆瓣评分
|
||||
* @returns 豆瓣页面链接,如果没有搜到该视频,返回搜索页面链接
|
||||
*/
|
||||
doubanRate (name) {
|
||||
doubanLink (name) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// 豆瓣搜索链接
|
||||
var nameToSearch = name.replace(/\s/g, '')
|
||||
@@ -229,17 +229,38 @@ const zy = {
|
||||
var link = ''
|
||||
var linkInDouban = $($('div.result')[0]).find('div>div>h3>a').first()
|
||||
var nameInDouban = linkInDouban.text().replace(/\s/g, '')
|
||||
if (nameToSearch.includes(nameInDouban) || nameInDouban.includes(nameToSearch)) {
|
||||
if (nameToSearch === nameInDouban) {
|
||||
link = linkInDouban.attr('href')
|
||||
} else {
|
||||
linkInDouban = $($('div.result')[1]).find('div>div>h3>a').first()
|
||||
nameInDouban = linkInDouban.text().replace(/\s/g, '')
|
||||
if (nameToSearch.includes(nameInDouban) || nameInDouban.includes(nameToSearch)) {
|
||||
if (nameToSearch === nameInDouban) {
|
||||
link = linkInDouban.attr('href')
|
||||
}
|
||||
}
|
||||
// 如果找到链接,就打开该链接获取评分
|
||||
if (link) {
|
||||
resolve(link)
|
||||
} else {
|
||||
// 如果没找到符合的链接,返回搜索页面
|
||||
resolve(doubanSearchLink)
|
||||
}
|
||||
}).catch(err => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 获取豆瓣评分
|
||||
* @param {*} name 视频名称
|
||||
* @returns 豆瓣评分
|
||||
*/
|
||||
doubanRate (name) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var nameToSearch = name.replace(/\s/g, '')
|
||||
this.doubanLink(nameToSearch).then(link => {
|
||||
if (link.includes('https://www.douban.com/search')) {
|
||||
resolve('暂无评分')
|
||||
} else {
|
||||
axios.get(link).then(response => {
|
||||
const parsedHtml = cheerio.load(response.data)
|
||||
var rating = parsedHtml('body').find('#interest_sectl').first().find('strong').first()
|
||||
@@ -251,8 +272,6 @@ const zy = {
|
||||
}).catch(err => {
|
||||
reject(err)
|
||||
})
|
||||
} else {
|
||||
resolve('暂无评分')
|
||||
}
|
||||
}).catch(err => {
|
||||
reject(err)
|
||||
|
||||
Reference in New Issue
Block a user