Skip to content

Commit

Permalink
Merge branch 'master' of github.com:szuprefix/vue-django
Browse files Browse the repository at this point in the history
  • Loading branch information
szuprefix committed Apr 8, 2020
2 parents 83738d9 + 69f26c6 commit 56be179
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/components/media/qcloud/Video.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
// console.log(this.fileID,this.appID)
this.init()
},
beforeDestroy () {
this.player.dispose()
this.player = null
},
methods: {
loadStyle (href) {
var link = document.createElement('link')
Expand Down
39 changes: 39 additions & 0 deletions src/components/mobile/CellGroup.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<template>
<group :title="$attrs.title">
<cell :link="c.link" v-for="c in cellItems">
<span slot="title">{{c.title}}<badge v-if="c.badge" :text="c.badge"></badge></span>
</cell>
</group>

</template>
<script>
import {Cell, Group, Badge} from 'vux'
export default{
props: {
items: Array
},
data () {
return {
cellItems: []
}
},
mounted () {
this.cellItems = this.items
this.getBadges()
},
components: {Cell, Group, Badge},
methods: {
getBadges () {
this.cellItems.forEach((a, i) => {
if (a.getBadge) {
this.$http.get(a.getBadge).then(({data}) => {
this.cellItems[i] = {...a, badge: data.count}
// console.log(this.cellItems)
})
}
})
}
},
computed: {}
}
</script>
10 changes: 10 additions & 0 deletions src/components/mobile/Tabbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,23 @@
created () {
this.normalizeItems()
// console.log(this.tabItems)
this.getBadges()
},
methods: {
normalizeItems () {
this.tabItems = arrayNormalize(this.items, {}, (a) => {
a.label = a.label || a.name
return a
})
},
getBadges () {
this.tabItems.forEach((a, i) => {
if (a.getBadge) {
this.$http.get(a.getBadge).then(({data}) => {
this.tabItems[i] = {...a, badge: data.count}
})
}
})
}
},
components: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/mobile/model/Cells.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
methods: {
genGetLinkFunc() {
let l = this.$attrs.link || `/${this.$attrs.appModel.replace('.', '/')}/$\{id}/`
let l = this.$attrs.link || `/${this.$attrs.appModel.replace('.', '/')}/$\{id}`
if (this.relationModelName) {
l = `${l}?relation_model_name=${this.relationModelName}`
}
Expand Down
9 changes: 7 additions & 2 deletions src/components/mobile/model/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
appModel: String,
owner: Object,
queries: {type: Object, default: {}},
layout: {type: String, default: 'panel'}
layout: {type: String, default: 'panel'},
prepare: Function
},
data () {
return {
Expand All @@ -46,7 +47,11 @@
return this.model.query(qd).then(data => {
this.loading = false
this.count = data.count
this.data = data.results
let ds = data.results
if (this.prepare) {
ds = this.prepare(ds)
}
this.data = ds
})
},
loadMore (loaded) {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/duration.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
export default function (key) {
let ms = localStorage.getItem(key)
ms = (ms && Math.floor(ms)) || 0
console.debug(key, localStorage.getItem(key))
// console.debug(key, localStorage.getItem(key))
return {
lastTime: undefined,
ms: ms,
Expand Down
4 changes: 2 additions & 2 deletions src/utils/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ export function toThousandslsFilter (num) {
return (+num || 0).toString().replace(/^-?\d+/g, m => m.replace(/(?=(?!\b)(\d{3})+$)/g, ','))
}

export function percent (value) {
let a = value && (value * 100).toFixed(2)
export function percent (value, fixed) {
let a = value && (value * 100).toFixed(fixed === undefined ? 2 : fixed)
return `${a}%`
}

Expand Down

0 comments on commit 56be179

Please sign in to comment.