|
- <template>
- <div class="home">
- <section style="padding: 0 !important">
- <LazyV2HomeBannerCard></LazyV2HomeBannerCard>
- </section>
- <!-- <div class="main">
- <section style="padding: 0 !important;">
- <LazyV1HomePlatformCard1 :data="$companies"></LazyV1HomePlatformCard1>
- <div class="title-view">
- <div class="title wow animate__fadeInDown" data-wow-duration="2s">国家新一代人工智能开放创新平台</div>
- <p class="subtitle wow animate__fadeInUp" data-wow-duration="2s">
- National Open Innovation Platform for Next Generation Artificial
- Intelligence
- </p>
- </div>
- <LazyV1HomePlatformCard :data="$companies"></LazyV1HomePlatformCard>
- </section>
- </div>-->
- <section style="padding: 0 !important">
- <LazyV4HomePlatformCard :data="$companies"></LazyV4HomePlatformCard>
- </section>
- <section style="padding: 0 !important">
- <LazyV1HomeAbilityCard :data="abilities"></LazyV1HomeAbilityCard>
- </section>
- <section style="padding: 0 !important">
- <LazyV1HomeResourceCard :data="resources"></LazyV1HomeResourceCard>
- </section>
- <section style="padding: 0 !important">
- <LazyV1HomeCommunityCard :data="communities"></LazyV1HomeCommunityCard>
- </section>
- </div>
- </template>
-
- <script>
- if (process.browser) {
- // eslint-disable-next-line no-var
- var { WOW } = require('wowjs')
- }
-
- export default {
- data() {
- return {
- loading: true,
- communities: [
- { title: '启智社区', description: 'xxxxxxxxx', image: '', url: '' },
- { title: '360社区', description: 'xxxxxxxxx', image: '', url: '' },
- { title: 'jd社区', description: 'xxxxxxxxx', image: '', url: '' },
- { title: '飞桨社区', description: 'xxxxxxxxx', image: '', url: '' },
- ],
- abilityActive: 'recent',
- activeAbility: {},
- abilities: [
- {
- data: [],
- title: '热门能力',
- key: 'hot',
- },
- {
- data: [],
- title: '最近更新',
- key: 'recent',
- },
- {
- data: [],
- title: this.$configs.hot_ability_tab_1 || '文字识别',
- key: 'textrecon',
- },
- {
- data: [],
- title: this.$configs.hot_ability_tab_2 || '语音识别',
- key: 'voicerecon',
- },
- ],
- resources: [
- {
- key: 'hot',
- title: '热门资源',
- data: [],
- },
- {
- key: 'recent',
- title: '最近更新',
- data: [],
- },
- {
- key: 'dataset',
- title: this.$configs.hot_resource_category_1 || '数据集',
- data: [],
- },
- {
- key: 'code',
- title: this.$configs.hot_resource_category_2 || '源代码',
- data: [],
- },
- ],
- }
- },
- mounted() {
- this.fetch()
- if (process.browser) {
- this.$nextTick(() => {
- setTimeout(() => {
- new WOW().init()
- }, 500)
- })
- }
- setTimeout(() => {
- this.loading = false
- }, 1000)
- this.activeAbility = this.abilities.find(
- (x) => x.key === this.abilityActive
- )
- },
- methods: {
- abilityActiveToggle(toggle) {
- this.abilityActive = toggle
- this.activeAbility = this.abilities.find((x) => x.key === toggle)
- },
- fetch() {
- this.$jsonApi
- .get('resources', {
- from: 'all',
- filter: {
- hot: true,
- },
- page: { number: 1, size: 10 },
- })
- .then((res) => {
- const { data: resources } = res
- if (resources.length === 0) {
- this.$jsonApi
- .get('resources', {
- from: 'all',
- page: { number: 1, size: 10 },
- })
- .then((res) => {
- const { data: resources } = res
- this.resources[0].data = resources
- })
- .catch((error) => {
- this.$apiErrorHandler(error)
- })
- } else {
- this.resources[0].data = resources
- }
- })
- .catch((error) => {
- this.$apiErrorHandler(error)
- })
-
- this.$jsonApi
- .get('resources', {
- from: 'all',
- updatedAt: this.$dayjs().subtract(1, 'month').format('YYYY-MM-DD'),
- // filter: {
- // updatedAt: this.$dayjs().subtract(1, 'month').format('YYYY-MM-DD'),
- // },
- page: { number: 1, size: 10 },
- })
- .then((res) => {
- const { data: resources } = res
- this.resources[1].data = resources
- })
- .catch((error) => {
- this.$apiErrorHandler(error)
- })
-
- this.$jsonApi
- .get('resources', {
- from: 'all',
- filter: {
- category: this.$configs.hot_resource_category_1 || '数据集',
- },
- page: { number: 1, size: 10 },
- })
- .then((res) => {
- const { data: resources } = res
- this.resources[2].data = resources
- })
- .catch((error) => {
- this.$apiErrorHandler(error)
- })
-
- this.$jsonApi
- .get('resources', {
- from: 'all',
- filter: {
- category: this.$configs.hot_resource_category_2 || '源代码',
- },
- page: { number: 1, size: 10 },
- })
- .then((res) => {
- const { data: resources } = res
- this.resources[3].data = resources
- })
- .catch((error) => {
- this.$apiErrorHandler(error)
- })
-
- this.$jsonApi
- .get('open-abilities', {
- from: 'all',
- filter: {
- hot: true,
- },
- page: { number: 1, size: 10 },
- })
- .then((res) => {
- const { data: openAbilitis } = res
- if (openAbilitis.length === 0) {
- this.$jsonApi
- .get('open-abilities', {
- from: 'all',
- page: { number: 1, size: 10 },
- })
- .then((res) => {
- const { data: openAbilitis } = res
- this.abilities[0].data = openAbilitis
- })
- .catch((error) => {
- this.$apiErrorHandler(error)
- })
- } else {
- this.abilities[0].data = openAbilitis
- }
- })
- .catch((error) => {
- this.$apiErrorHandler(error)
- })
-
- this.$jsonApi
- .get('open-abilities', {
- from: 'all',
- updatedAt: this.$dayjs().subtract(1, 'month').format('YYYY-MM-DD'),
- // filter: {
- // updatedAt: this.$dayjs().subtract(1, 'month').format('YYYY-MM-DD'),
- // },
- page: { number: 1, size: 10 },
- })
- .then((res) => {
- const { data: openAbilitis } = res
- this.abilities[1].data = openAbilitis
- })
- .catch((error) => {
- this.$apiErrorHandler(error)
- })
-
- this.$jsonApi
- .get('open-abilities', {
- from: 'all',
- filter: {
- category: this.$configs.hot_ability_tab_1 || '文字识别',
- },
- page: { number: 1, size: 10 },
- })
- .then((res) => {
- const { data: openAbilitis } = res
- this.abilities[2].data = openAbilitis
- })
- .catch((error) => {
- this.$apiErrorHandler(error)
- })
-
- this.$jsonApi
- .get('open-abilities', {
- from: 'all',
- filter: {
- category: this.$configs.hot_ability_tab_2 || '语音识别',
- },
- page: { number: 1, size: 10 },
- })
- .then((res) => {
- const { data: openAbilitis } = res
- this.abilities[3].data = openAbilitis
- })
- .catch((error) => {
- this.$apiErrorHandler(error)
- })
- },
- },
- }
- </script>
|