parent
1e89c208ea
commit
83658c86fe
@ -1,35 +1,37 @@ |
||||
<script> |
||||
import config from './config' |
||||
import store from '@/store' |
||||
import { getAccessToken } from '@/utils/auth' |
||||
import config from './config' |
||||
import store from '@/store' |
||||
import { |
||||
getAccessToken |
||||
} from '@/utils/auth' |
||||
|
||||
export default { |
||||
onLaunch: function() { |
||||
this.initApp() |
||||
}, |
||||
methods: { |
||||
// 初始化应用 |
||||
initApp() { |
||||
// 初始化应用配置 |
||||
this.initConfig() |
||||
// 检查用户登录状态 |
||||
//#ifdef H5 |
||||
this.checkLogin() |
||||
//#endif |
||||
}, |
||||
initConfig() { |
||||
this.globalData.config = config |
||||
}, |
||||
checkLogin() { |
||||
if (!getAccessToken()) { |
||||
this.$tab.reLaunch('/pages/login') |
||||
} |
||||
} |
||||
} |
||||
} |
||||
export default { |
||||
onLaunch: function() { |
||||
this.initApp() |
||||
}, |
||||
methods: { |
||||
// 初始化应用 |
||||
initApp() { |
||||
// 初始化应用配置 |
||||
this.initConfig() |
||||
// 检查用户登录状态 |
||||
//#ifdef H5 |
||||
this.checkLogin() |
||||
//#endif |
||||
}, |
||||
initConfig() { |
||||
this.globalData.config = config |
||||
}, |
||||
checkLogin() { |
||||
if (!getAccessToken()) { |
||||
this.$tab.reLaunch('/pages/login') |
||||
} |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss"> |
||||
<style lang="scss"> |
||||
@import "@/uni_modules/uview-ui/index.scss"; |
||||
@import '@/static/scss/index.scss' |
||||
</style> |
||||
@import '@/static/scss/index.scss' |
||||
</style> |
@ -1,57 +1,56 @@ |
||||
<template> |
||||
<span class="v-dict"> |
||||
<template v-for="(dict, index) in arr"> |
||||
<!-- 默认样式 --> |
||||
<span v-if="dict.colorType === 'default' || dict.colorType === '' || dict.colorType === undefined" |
||||
class="v-dict-text" |
||||
:key="dict.value" :index="index" |
||||
:class="dict.cssClass" |
||||
>{{ dict.label }}</span> |
||||
<!-- Tag 样式 --> |
||||
<span v-else |
||||
class="v-dict-text" |
||||
:key="dict.value" |
||||
:index="index" |
||||
:type="dict.colorType" |
||||
:class="dict.cssClass" |
||||
> |
||||
{{ dict.label }} |
||||
</span> |
||||
</template> |
||||
</span> |
||||
<span class="v-dict"> |
||||
<template v-for="(dict, index) in arr"> |
||||
<!-- 默认样式 --> |
||||
<span v-if="dict.colorType === 'default' || dict.colorType === '' || dict.colorType === undefined" |
||||
class="v-dict-text" :key="dict.value" :index="index" :class="dict.cssClass">{{ dict.label }}</span> |
||||
<!-- Tag 样式 --> |
||||
<span v-else class="v-dict-text" :key="dict.value" :index="index" :type="dict.colorType" |
||||
:class="dict.cssClass"> |
||||
{{ dict.label }} |
||||
</span> |
||||
</template> |
||||
</span> |
||||
</template> |
||||
<script> |
||||
import {getDictDatas2} from '@/utils/dict.js' |
||||
export default { |
||||
name: 'DictTag', |
||||
props: { |
||||
type: String, |
||||
value: [Number, String, Boolean, Array] |
||||
}, |
||||
data(){ |
||||
return{ |
||||
arr:undefined |
||||
} |
||||
}, |
||||
watch:{ |
||||
value:{ |
||||
handler(val){ |
||||
if(val){ |
||||
this.arr = this.getDictDatas2(this.type, val) |
||||
} |
||||
}, |
||||
immediate:true, |
||||
deep:true |
||||
import { |
||||
getDictDatas2 |
||||
} from '@/utils/dict.js' |
||||
export default { |
||||
name: 'DictTag', |
||||
props: { |
||||
type: String, |
||||
value: [Number, String, Boolean, Array] |
||||
}, |
||||
data() { |
||||
return { |
||||
arr: undefined |
||||
} |
||||
}, |
||||
watch: { |
||||
value: { |
||||
handler(val) { |
||||
if (val) { |
||||
this.arr = this.getDictDatas2(this.type, val) |
||||
} |
||||
}, |
||||
immediate: true, |
||||
deep: true |
||||
} |
||||
}, |
||||
mounted() { |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
<style scoped lang="scss"> |
||||
.v-dict { |
||||
& + .v-dict { |
||||
margin-left: 10px; |
||||
} |
||||
&-text{font-size: 14rem;} |
||||
.v-dict { |
||||
&+.v-dict { |
||||
margin-left: 10px; |
||||
} |
||||
|
||||
} |
||||
</style> |
||||
&-text { |
||||
font-size: 14px; |
||||
} |
||||
|
||||
} |
||||
</style> |
Loading…
Reference in new issue