Skip to content

Commit

Permalink
feat: support download
Browse files Browse the repository at this point in the history
  • Loading branch information
Linkontoask committed Dec 12, 2020
1 parent 7ea601a commit 09b2477
Show file tree
Hide file tree
Showing 15 changed files with 199 additions and 77 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,4 @@ yarn bootstrap
- [nativescript-vue](https://github.com/nativescript-vue/nativescript-vue)
- [browser module](https://philipwalton.com/articles/deploying-es2015-code-in-production-today/)
- [dayjs](https://day.js.org/docs/zh-CN/installation/installation)
- [lerna](https://github.com/lerna/lerna)
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"postuninstall": "electron-builder install-app-deps",
"log": "conventional-changelog -p eslint -i CHANGELOG.md -s -r 0",
"electron:generate-icons": "electron-icon-builder --input=./public/icon.png --output=build --flatten",
"svgo": "svgo -f ./src/assets/svg",
"storybook": "start-storybook -p 6006"
},
"gitHooks": {
Expand Down Expand Up @@ -70,6 +71,7 @@
"@types/md5": "^2.2.1",
"@types/mocha": "^5.2.4",
"@types/scriptjs": "^0.0.2",
"@types/file-saver": "^2.0.1",
"@typescript-eslint/eslint-plugin": "^2.33.0",
"@typescript-eslint/parser": "^2.33.0",
"@vue/cli-plugin-babel": "~4.5.0",
Expand Down Expand Up @@ -105,6 +107,7 @@
"http-proxy-middleware": "^1.0.6",
"husky": "^4.3.0",
"lerna": "^3.22.1",
"file-saver": "^2.0.5",
"less": "^3.0.4",
"less-loader": "^5.0.0",
"lint-staged": "^9.5.0",
Expand All @@ -113,6 +116,7 @@
"react-is": "^16.13.1",
"scriptjs": "^2.5.9",
"spectron": "^12.0.0",
"svgo": "^1.3.2",
"stylelint": "^13.7.2",
"stylelint-config-prettier": "^8.0.2",
"stylelint-config-recess-order": "^2.3.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/unblock/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
"access": "public"
},
"devDependencies": {
"jest": "^26.6.3",
"@babel/core": "^7.12.9",
"@babel/preset-env": "^7.12.7",
"babel-jest": "^26.6.3"
"babel-jest": "^26.6.3",
"jest": "^26.6.3"
}
}
1 change: 1 addition & 0 deletions src/assets/svg/vinyl.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 16 additions & 14 deletions src/components-global/icon/main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,26 @@ export default defineComponent({
// eslint-disable-next-line vue/require-default-prop
height: {
type: Number as PropType<number>
},
className: {
type: String as PropType<string>,
default: ''
}
},
setup(props) {
const { icon, color, height, size } = toRefs(props)
const { icon, color, height, size, className } = toRefs(props)
return () => (
<>
<svg
class="icon"
aria-hidden="true"
style={{
width: size.value,
height: height?.value || size.value,
fill: color.value
}}
>
<use href={'#icon-' + icon.value}></use>
</svg>
</>
<svg
class={'icon ' + className.value}
aria-hidden="true"
style={{
width: size.value,
height: height?.value || size.value,
fill: color.value
}}
>
<use href={'#icon-' + icon.value}></use>
</svg>
)
}
})
29 changes: 25 additions & 4 deletions src/components/secondary-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,39 @@ import { Secondary } from '@/layout/secondary/secondary'
import { Image } from '@/components/image/index'
import { MoreThen } from '@/components/more-then/index'
import { Table } from '@/components/table'
import { FormatSource, ListFormat } from '@/interface/index'
import { formatTime, noop } from '@/utils/index'
import { FormatSource, ListFormat, SongsBase } from '@/interface/index'
import { formatTime, noop, download } from '@/utils/index'
import { getSongUrl } from '@/api/index'
import { RouterLink, useRouter } from 'vue-router'
import dayjs from 'dayjs'
import './index.less'

const columns = [
{
width: 80,
width: 40,
align: 'center',
customRender: ({ index }: { index: number }) => (
<div>{++index < 10 ? '0' + index : index}</div>
<div class="gay no-hover">{++index < 10 ? '0' + index : index}</div>
)
},
{
width: 70,
align: 'center',
customRender: ({ text }: { text: ListFormat }) => (
<div>
<ve-button type="text">
<icon icon="shoucang" className="gay" size={20} />
</ve-button>
<ve-button
type="text"
onClick={async () => {
const url = await getSongUrl<SongsBase[]>(text.id)
download(url[0].url, text.name)
}}
>
<icon icon="icondownload" className="gay" size={22} />
</ve-button>
</div>
)
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/iconfont/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import $script from 'scriptjs'
import { noop } from '@/utils/index'

const ICONFONT_URL = 'font_2132275_ybsarqqzpm'
const ICONFONT_URL = 'font_2132275_vy63016frs8'

// repair electron packaging '//' protocol problem
$script(`https://at.alicdn.com/t/${ICONFONT_URL}.js`, noop)
Expand Down
Loading

0 comments on commit 09b2477

Please sign in to comment.