新增下载列表定位文件功能

pull/96/head
lyswhut 2019-09-05 22:41:10 +08:00
parent 3dd9ad9ead
commit 5cbf2d8047
5 changed files with 28 additions and 5 deletions

View File

@ -13,6 +13,7 @@ module.exports = win => {
// })
mainOn('close', event => {
if (win) {
// window.destroy()
win.close()
}
})

View File

@ -91,7 +91,7 @@ if (isMac) {
Menu.setApplicationMenu(null)
}
app.once('ready', createWindow)
app.on('ready', createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {

View File

@ -54,6 +54,17 @@ svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/19
path(fill='currentColor' d='M219.791,152.899c-0.818,11.185-4.039,21.758-9.569,31.426c-3.635,6.354-1.43,14.452,4.919,18.087c2.082,1.187,4.34,1.751,6.576,1.751c4.599,0,9.062-2.393,11.517-6.675c7.508-13.138,11.889-27.491,12.986-42.663c1.714-23.397-4.836-46.781-18.455-65.845c-4.256-5.96-12.536-7.332-18.491-3.081c-5.959,4.259-7.337,12.531-3.08,18.491C216.218,118.425,221.055,135.653,219.791,152.899z')
path(fill='currentColor' d='M290.7,158c3.34-45.736-16.508-89.592-53.097-117.318c-5.841-4.433-14.146-3.27-18.568,2.556c-4.428,5.838-3.283,14.151,2.558,18.568c29.401,22.281,45.355,57.521,42.668,94.252c-2.02,27.636-14.375,53.159-34.787,71.867c-5.396,4.95-5.758,13.339-0.808,18.729c2.609,2.854,6.188,4.298,9.771,4.298c3.194,0,6.41-1.154,8.953-3.484C272.805,224.175,288.184,192.408,290.7,158z')
g#icon-sdCard
// 0 0 291.13 291.13
path(fill='currentColor' d="M 50.981 282.415 c 1.722 -2.372 5.494 -4.293 8.419 -4.293 h 172.331 c 2.92 0 6.695 1.921 8.419 4.293 l 6.339 8.715 h 41.74 V 18.538 C 288.23 8.298 279.929 0 269.698 0 H 48.988 L 2.9 49.632 V 291.13 h 41.744 L 50.981 282.415 Z M 240.348 27.418 c 0 -2.926 2.371 -5.302 5.302 -5.302 h 17.668 c 2.931 0 5.303 2.376 5.303 5.302 v 50.373 c 0 2.928 -2.372 5.302 -5.303 5.302 H 245.65 c -2.931 0 -5.302 -2.375 -5.302 -5.302 V 27.418 Z M 197.929 27.418 c 0 -2.926 2.371 -5.302 5.302 -5.302 h 17.668 c 2.931 0 5.303 2.376 5.303 5.302 v 50.373 c 0 2.928 -2.372 5.302 -5.303 5.302 h -17.668 c -2.931 0 -5.302 -2.375 -5.302 -5.302 V 27.418 Z M 155.509 27.418 c 0 -2.926 2.372 -5.302 5.303 -5.302 h 17.668 c 2.931 0 5.303 2.376 5.303 5.302 v 50.373 c 0 2.928 -2.372 5.302 -5.303 5.302 h -17.668 c -2.931 0 -5.303 -2.375 -5.303 -5.302 V 27.418 Z M 113.088 27.418 c 0 -2.926 2.376 -5.302 5.302 -5.302 h 17.673 c 2.926 0 5.303 2.376 5.303 5.302 v 50.373 c 0 2.928 -2.377 5.302 -5.303 5.302 H 118.39 c -2.926 0 -5.302 -2.375 -5.302 -5.302 V 27.418 Z M 70.668 27.418 c 0 -2.926 2.377 -5.302 5.303 -5.302 h 17.673 c 2.926 0 5.302 2.376 5.302 5.302 v 50.373 c 0 2.928 -2.376 5.302 -5.302 5.302 H 75.971 c -2.926 0 -5.303 -2.375 -5.303 -5.302 V 27.418 Z M 28.25 104.303 V 53.93 c 0 -2.926 2.377 -5.302 5.303 -5.302 h 17.673 c 2.925 0 5.302 2.376 5.302 5.302 v 50.373 c 0 2.928 -2.377 5.303 -5.302 5.303 H 33.552 C 30.626 109.605 28.25 107.231 28.25 104.303 Z")
g#icon-musicFolder
// 0 0 247.498 247.498
path(fill='currentColor' d="M 0 200.188 c 0 14.645 11.871 26.513 26.512 26.513 h 194.475 c 14.639 0 26.512 -11.868 26.512 -26.513 V 86.192 c 0 -14.641 -11.873 -26.512 -26.512 -26.512 H 0 V 200.188 Z M 85.553 156.537 c 4.137 -0.869 8.2 -0.678 11.788 0.373 v -43.856 c 0 -3 2.11 -5.605 5.049 -6.224 l 53.047 -11.19 l 0.011 -0.005 c 0.196 -0.041 0.414 -0.041 0.621 -0.062 c 0.228 -0.021 0.445 -0.07 0.673 -0.07 c 0 0 0 0 0.011 0 c 0.093 0 0.171 0.021 0.259 0.025 c 0.331 0.011 0.663 0.034 0.984 0.102 c 0.201 0.041 0.383 0.111 0.579 0.171 c 0.197 0.062 0.404 0.106 0.601 0.184 c 0.207 0.091 0.404 0.207 0.606 0.318 c 0.155 0.085 0.315 0.155 0.471 0.256 c 0.182 0.117 0.337 0.269 0.508 0.407 c 0.155 0.121 0.311 0.228 0.445 0.362 c 0.146 0.143 0.27 0.311 0.404 0.471 c 0.124 0.153 0.269 0.295 0.383 0.471 c 0.135 0.197 0.238 0.414 0.342 0.621 c 0.088 0.153 0.176 0.295 0.254 0.456 c 0.14 0.323 0.238 0.668 0.326 1.012 c 0.01 0.065 0.041 0.122 0.062 0.186 v 0.006 c 0.042 0.223 0.052 0.46 0.073 0.688 c 0.021 0.202 0.062 0.404 0.062 0.604 c 0 0.005 0 0.005 0 0.01 v 58.148 c 0 0.367 -0.041 0.74 -0.113 1.103 c -0.135 8.196 -7.208 15.866 -17.233 17.999 c -11.319 2.413 -22.113 -3.2 -24.096 -12.521 c -1.983 -9.331 5.6 -18.838 16.93 -21.251 c 4.137 -0.87 8.202 -0.674 11.785 0.373 v -36.001 l -40.317 8.502 v 52.985 c 0 0.373 -0.042 0.74 -0.106 1.098 c -0.143 8.202 -7.216 15.876 -17.233 18.01 c -11.33 2.407 -22.121 -3.2 -24.104 -12.521 C 66.64 168.452 74.223 158.945 85.553 156.537 Z")
g#icon-musicFile
// -61 0 512 512
path(fill='currentColor' d='m295 120.5h86.230469l-111.230469-111.695312v86.53125c0 13.875 11.214844 25.164062 25 25.164062zm0 0')
path(fill='currentColor' d='m240 346.5c0 8.269531 6.730469 15 15 15s15-6.730469 15-15v-15.25h-15c-7.960938 0-15 6.324219-15 15.25zm0 0')
path(fill='currentColor' d='m295 150.5c-30.328125 0-55-24.746094-55-55.167969v-95.332031h-185c-30.328125 0-55 24.746094-55 55.167969v401.667969c0 30.417968 24.671875 55.164062 55 55.164062h280c30.328125 0 55-24.746094 55-55.167969v-306.332031zm5 196c0 24.8125-20.1875 45-45 45s-45-20.1875-45-45c0-25.507812 20.53125-45.25 45-45.25h15v-56.144531l-90 22.59375v108.925781c0 24.8125-20.1875 45-45 45s-45-20.1875-45-45c0-25.507812 20.53125-45.25 45-45.25h15v-75.375c0-6.878906 4.675781-12.875 11.347656-14.546875l120-30.125c9.46875-2.382813 18.652344 4.796875 18.652344 14.546875zm0 0')
path(fill='currentColor' d='m120 376.625c0 8.269531 6.730469 15 15 15s15-6.730469 15-15v-15.25h-15c-7.960938 0-15 6.324219-15 15.25zm0 0')
</template>

View File

@ -15,6 +15,9 @@ div(:class="$style.btns")
button(type="button" v-if="pauseBtn" title="暂停" @click.stop="handleClick('pause')")
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 277.338 277.338' space='preserve')
use(xlink:href='#icon-pause')
button(type="button" v-if="fileBtn" title="定位文件" @click.stop="handleClick('file')")
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='-61 0 512 512' space='preserve')
use(xlink:href='#icon-musicFile')
button(type="button" v-if="removeBtn" title="移除" @click.stop="handleClick('remove')")
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 212.982 212.982' space='preserve')
use(xlink:href='#icon-delete')
@ -57,6 +60,10 @@ export default {
type: Boolean,
default: false,
},
fileBtn: {
type: Boolean,
default: false,
},
},
computed: {
...mapGetters(['userInfo']),

View File

@ -25,7 +25,7 @@ div(:class="$style.download")
td.break(style="width: 15%;") {{item.statusText}}
td.break(style="width: 10%;") {{item.type && item.type.toUpperCase()}}
td(style="width: 20%; padding-left: 0; padding-right: 0;")
material-list-buttons(:index="index" :download-btn="false" :start-btn="!item.isComplate && item.status != downloadStatus.WAITING && (item.status != downloadStatus.RUN)"
material-list-buttons(:index="index" :download-btn="false" :file-btn="true" :start-btn="!item.isComplate && item.status != downloadStatus.WAITING && (item.status != downloadStatus.RUN)"
:pause-btn="!item.isComplate && (item.status == downloadStatus.RUN || item.status == downloadStatus.WAITING)"
:play-btn="item.status == downloadStatus.COMPLETED" @btn-click="handleListBtnClick")
material-flow-btn(:show="isShowEditBtn" :play-btn="false" :download-btn="false" :add-btn="false" :start-btn="true" :pause-btn="true" @btn-click="handleFlowBtnClick")
@ -34,8 +34,7 @@ div(:class="$style.download")
<script>
import { mapGetters, mapActions, mapMutations } from 'vuex'
import { checkPath } from '../utils'
import { checkPath, openDirInExplorer } from '../utils'
export default {
name: 'Download',
data() {
@ -128,6 +127,8 @@ export default {
break
case 'remove':
this.removeTask(info.index)
case 'file':
this.handleOpenFolder(info.index)
break
}
},
@ -170,6 +171,9 @@ export default {
}
this.resetSelect()
},
handleOpenFolder(index) {
openDirInExplorer(this.list[index].filePath)
},
},
}
</script>