mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2025-05-19 01:50:15 +09:00
update: 优化审核模式,新增审核使用模拟数据
This commit is contained in:
parent
74a5efb596
commit
bf41b08b35
@ -1,30 +1,50 @@
|
|||||||
// 应用设置存储key值
|
// 应用设置存储key值
|
||||||
export const _AppConfigKey = 'APP_GLOBAL_CONFIGS';
|
export const _AppConfigKey = 'APP_GLOBAL_CONFIGS';
|
||||||
|
export const _AppMockJsonKey = 'APP_GLOBAL_MOCK_JSON';
|
||||||
|
|
||||||
// 默认的应用设置
|
// 默认的应用设置
|
||||||
export const DefaultAppConfigs = {
|
export const DefaultAppConfigs = {
|
||||||
loveConfig: {},
|
loveConfig: {},
|
||||||
imagesConfig: {},
|
imagesConfig: {},
|
||||||
authorConfig: {},
|
authorConfig: {},
|
||||||
appConfig: {},
|
appConfig: {},
|
||||||
pluginConfig: {},
|
pluginConfig: {},
|
||||||
pageConfig:{}
|
pageConfig: {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取应用设置
|
* 获取应用设置
|
||||||
*/
|
*/
|
||||||
export const getAppConfigs = () => {
|
export const getAppConfigs = () => {
|
||||||
let configs = uni.getStorageSync(_AppConfigKey)
|
let configs = uni.getStorageSync(_AppConfigKey)
|
||||||
if (configs) return JSON.parse(configs)
|
if (configs) return JSON.parse(configs)
|
||||||
|
|
||||||
uni.setStorageSync(_AppConfigKey, JSON.stringify(DefaultAppConfigs))
|
uni.setStorageSync(_AppConfigKey, JSON.stringify(DefaultAppConfigs))
|
||||||
return DefaultAppConfigs;
|
return DefaultAppConfigs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存应用设置
|
* 保存应用设置
|
||||||
*/
|
*/
|
||||||
export const setAppConfigs = (configs) => {
|
export const setAppConfigs = (configs) => {
|
||||||
uni.setStorageSync(_AppConfigKey, JSON.stringify(configs))
|
uni.setStorageSync(_AppConfigKey, JSON.stringify(configs))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取应用模拟数据
|
||||||
|
*/
|
||||||
|
export const getAppMockJson = () => {
|
||||||
|
let json = uni.getStorageSync(_AppMockJsonKey)
|
||||||
|
if (json) return JSON.parse(json)
|
||||||
|
|
||||||
|
uni.setStorageSync(_AppMockJsonKey, JSON.stringify({}))
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存应用模拟数据
|
||||||
|
*/
|
||||||
|
export const setAppMockJson = (json) => {
|
||||||
|
uni.setStorageSync(_AppMockJsonKey, JSON.stringify(json))
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,11 @@
|
|||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
// uni.$tm.vx.commit('setWxShare', res.shareConfig);
|
// uni.$tm.vx.commit('setWxShare', res.shareConfig);
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
// 获取mockjson
|
||||||
|
await uni.$tm.vx.actions('config/fetchMockJson')
|
||||||
|
|
||||||
|
// 进入检查
|
||||||
this.fnCheckShowStarted();
|
this.fnCheckShowStarted();
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
|
@ -190,7 +190,8 @@
|
|||||||
path: '/pagesA/archives/archives',
|
path: '/pagesA/archives/archives',
|
||||||
isAdmin: false,
|
isAdmin: false,
|
||||||
type: 'page',
|
type: 'page',
|
||||||
show: !this.haloConfigs.basicConfig.auditModeEnabled
|
// show: !this.haloConfigs.basicConfig.auditModeEnabled
|
||||||
|
show: true
|
||||||
}, {
|
}, {
|
||||||
key: 'love',
|
key: 'love',
|
||||||
title: '恋爱日记',
|
title: '恋爱日记',
|
||||||
@ -610,4 +611,4 @@
|
|||||||
transform: initial;
|
transform: initial;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,235 +1,258 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page">
|
<view class="app-page">
|
||||||
<view class="auditModeEnabled" v-if="haloConfigs.basicConfig.auditModeEnabled">
|
|
||||||
<view>你好呀,很开心认识你!</view>
|
<view v-if="loading !== 'success'" class="loading-wrap">
|
||||||
<view style="margin-top: 36rpx;">
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
{{haloConfigs.appConfig.appInfo.name}}
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
</view>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
</view>
|
</view>
|
||||||
<block v-else>
|
<!-- 内容区域 -->
|
||||||
<view v-if="loading != 'success'" class="loading-wrap">
|
<view v-else class="app-page-content">
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<view v-if="dataList.length === 0" class="content-empty flex flex-center" style="height: 70vh;">
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<!-- 空布局 -->
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无数据"></tm-empty>
|
||||||
</view>
|
</view>
|
||||||
<!-- 内容区域 -->
|
<block v-else>
|
||||||
<view v-else class="app-page-content">
|
<tm-translate v-for="(item, index) in dataList" :key="index"
|
||||||
<view v-if="dataList.length == 0" class="content-empty flex flex-center" style="height: 70vh;">
|
style="box-sizing: border-box;width: 50%;padding: 0 8rpx;" animation-name="fadeUp"
|
||||||
<!-- 空布局 -->
|
:wait="calcAniWait(index)">
|
||||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无数据"></tm-empty>
|
<view class="catgory-card" :style="{backgroundImage:`url(${item.spec.cover})`}">
|
||||||
</view>
|
<view class="content" @click="handleToCategory(item)">
|
||||||
<block v-else>
|
<view style="font-size: 32rpx;color: #ffffff;">{{ item.spec.displayName }}</view>
|
||||||
<tm-translate v-for="(item, index) in dataList" :key="index"
|
<view v-if="!haloConfigs.basicConfig.auditModeEnabled" style="font-size: 24rpx;color: #ffffff;margin-top: 6rpx;">
|
||||||
style="box-sizing: border-box;width: 50%;padding: 0 8rpx;" animation-name="fadeUp"
|
共 {{ item.postCount }} 篇文章
|
||||||
:wait="calcAniWait(index)">
|
</view>
|
||||||
<view class="catgory-card" :style="{backgroundImage:`url(${item.spec.cover})`}">
|
<view v-else style="font-size: 24rpx;color: #ffffff;margin-top: 6rpx;">
|
||||||
<view class="content" @click="handleToCategory(item)">
|
共 {{ item.postCount }} 篇内容
|
||||||
<view style="font-size: 32rpx;color: #ffffff;">{{ item.spec.displayName }}</view>
|
</view>
|
||||||
<view style="font-size: 24rpx;color: #ffffff;margin-top: 6rpx;">共
|
</view>
|
||||||
{{ item.postCount }} 篇文章
|
</view>
|
||||||
</view>
|
</tm-translate>
|
||||||
</view>
|
<tm-flotbutton @click="fnToTopPage" size="m" color="light-blue"
|
||||||
</view>
|
icon="icon-angle-up"></tm-flotbutton>
|
||||||
</tm-translate>
|
<view class="load-text">{{ loadMoreText }}</view>
|
||||||
<tm-flotbutton @click="fnToTopPage" size="m" color="light-blue"
|
</block>
|
||||||
icon="icon-angle-up"></tm-flotbutton>
|
</view>
|
||||||
<view class="load-text">{{ loadMoreText }}</view>
|
|
||||||
</block>
|
</view>
|
||||||
</view>
|
|
||||||
</block>
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||||
|
|
||||||
import MarkdownConfig from '@/common/markdown/markdown.config.js';
|
import MarkdownConfig from '@/common/markdown/markdown.config.js';
|
||||||
import mpHtml from '@/components/mp-html/components/mp-html/mp-html.vue';
|
import mpHtml from '@/components/mp-html/components/mp-html/mp-html.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
tmSkeleton,
|
tmSkeleton,
|
||||||
tmFlotbutton,
|
tmFlotbutton,
|
||||||
tmTranslate,
|
tmTranslate,
|
||||||
tmEmpty,
|
tmEmpty,
|
||||||
mpHtml
|
mpHtml
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
markdownConfig: MarkdownConfig,
|
markdownConfig: MarkdownConfig,
|
||||||
loading: 'loading',
|
loading: 'loading',
|
||||||
queryParams: {
|
queryParams: {
|
||||||
size: 20,
|
size: 20,
|
||||||
page: 1
|
page: 1
|
||||||
},
|
},
|
||||||
hasNext: false,
|
hasNext: false,
|
||||||
dataList: [],
|
dataList: [],
|
||||||
isLoadMore: false,
|
isLoadMore: false,
|
||||||
loadMoreText: '加载中...'
|
loadMoreText: '加载中...'
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
haloConfigs() {
|
haloConfigs() {
|
||||||
return this.$tm.vx.getters().getConfigs;
|
return this.$tm.vx.getters().getConfigs;
|
||||||
},
|
},
|
||||||
},
|
mockJson() {
|
||||||
onLoad() {
|
return this.$tm.vx.getters().getMockJson;
|
||||||
this.fnGetData();
|
}
|
||||||
},
|
},
|
||||||
onPullDownRefresh() {
|
onLoad() {
|
||||||
this.isLoadMore = false;
|
this.fnGetData();
|
||||||
this.queryParams.page = 0;
|
},
|
||||||
this.fnGetData();
|
onPullDownRefresh() {
|
||||||
},
|
this.isLoadMore = false;
|
||||||
|
this.queryParams.page = 0;
|
||||||
|
this.fnGetData();
|
||||||
|
},
|
||||||
|
|
||||||
onReachBottom(e) {
|
onReachBottom(e) {
|
||||||
if (this.hasNext) {
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
this.queryParams.page += 1;
|
uni.showToast({
|
||||||
this.isLoadMore = true;
|
icon: 'none',
|
||||||
this.fnGetData();
|
title: '没有更多数据了'
|
||||||
} else {
|
});
|
||||||
uni.showToast({
|
return
|
||||||
icon: 'none',
|
}
|
||||||
title: '没有更多数据了'
|
if (this.hasNext) {
|
||||||
});
|
this.queryParams.page += 1;
|
||||||
}
|
this.isLoadMore = true;
|
||||||
},
|
this.fnGetData();
|
||||||
methods: {
|
} else {
|
||||||
fnGetData() {
|
uni.showToast({
|
||||||
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
icon: 'none',
|
||||||
uni.setNavigationBarTitle({
|
title: '没有更多数据了'
|
||||||
title: "你好,很高兴认识你!"
|
});
|
||||||
})
|
}
|
||||||
return;
|
},
|
||||||
}
|
methods: {
|
||||||
uni.showLoading({
|
fnGetData() {
|
||||||
mask: true,
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
title: '加载中...'
|
this.dataList = this.mockJson.category.list.map((item) => {
|
||||||
});
|
return {
|
||||||
// 设置状态为加载中
|
metadata: {
|
||||||
if (!this.isLoadMore) {
|
name: Date.now() * Math.random(),
|
||||||
this.loading = 'loading';
|
},
|
||||||
}
|
spec: {
|
||||||
this.loadMoreText = '加载中...';
|
displayName: item.title,
|
||||||
this.$httpApi.v2
|
cover: this.$utils.checkImageUrl(item.cover)
|
||||||
.getCategoryList(this.queryParams)
|
},
|
||||||
.then(res => {
|
postCount: 0
|
||||||
console.log('请求结果:');
|
}
|
||||||
console.log(res);
|
});
|
||||||
|
this.loading = 'success';
|
||||||
|
this.loadMoreText = '呜呜,没有更多数据啦~';
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.showLoading({
|
||||||
|
mask: true,
|
||||||
|
title: '加载中...'
|
||||||
|
});
|
||||||
|
// 设置状态为加载中
|
||||||
|
if (!this.isLoadMore) {
|
||||||
|
this.loading = 'loading';
|
||||||
|
}
|
||||||
|
this.loadMoreText = '加载中...';
|
||||||
|
this.$httpApi.v2
|
||||||
|
.getCategoryList(this.queryParams)
|
||||||
|
.then(res => {
|
||||||
|
console.log('请求结果:');
|
||||||
|
console.log(res);
|
||||||
|
|
||||||
this.loading = 'success';
|
this.loading = 'success';
|
||||||
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||||
// 处理数据
|
// 处理数据
|
||||||
this.hasNext = res.hasNext;
|
this.hasNext = res.hasNext;
|
||||||
|
|
||||||
const tempItems = res.items.map(item => {
|
const tempItems = res.items.map(item => {
|
||||||
item.spec.cover = this.$utils.checkThumbnailUrl(item.spec.cover, true)
|
item.spec.cover = this.$utils.checkThumbnailUrl(item.spec.cover, true)
|
||||||
return item;
|
return item;
|
||||||
})
|
})
|
||||||
|
|
||||||
if (this.isLoadMore) {
|
if (this.isLoadMore) {
|
||||||
this.dataList = this.dataList.concat(tempItems);
|
this.dataList = this.dataList.concat(tempItems);
|
||||||
} else {
|
} else {
|
||||||
this.dataList = tempItems;
|
this.dataList = tempItems;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
this.loading = 'error';
|
this.loading = 'error';
|
||||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
uni.stopPullDownRefresh();
|
uni.stopPullDownRefresh();
|
||||||
}, 500);
|
}, 500);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handlePreview(index, list) {
|
handlePreview(index, list) {
|
||||||
uni.previewImage({
|
uni.previewImage({
|
||||||
current: index,
|
current: index,
|
||||||
urls: list.map(item => item.url)
|
urls: list.map(item => item.url)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleToCategory(data) {
|
handleToCategory(data) {
|
||||||
uni.navigateTo({
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
url: `/pagesA/category-detail/category-detail?name=${data.metadata.name}&title=${data.spec.displayName}`
|
return;
|
||||||
})
|
}
|
||||||
}
|
uni.navigateTo({
|
||||||
}
|
url: `/pagesA/category-detail/category-detail?name=${data.metadata.name}&title=${data.spec.displayName}`
|
||||||
};
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.app-page {
|
.app-page {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: 24rpx 0;
|
padding: 24rpx 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.auditModeEnabled {
|
.auditModeEnabled {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 80vh;
|
height: 80vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading-wrap {
|
.loading-wrap {
|
||||||
padding: 24rpx;
|
padding: 24rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-page-content {
|
.app-page-content {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
padding: 0 12rpx;
|
padding: 0 12rpx;
|
||||||
gap: 20rpx 0;
|
gap: 20rpx 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.catgory-card {
|
.catgory-card {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 200rpx;
|
height: 200rpx;
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
background-color: #ffff;
|
background-color: #ffff;
|
||||||
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
|
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
background-color: rgba(0, 0, 0, 0.15);
|
background-color: rgba(0, 0, 0, 0.15);
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.load-text {
|
.load-text {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -94,6 +94,12 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
galleryConfig() {
|
galleryConfig() {
|
||||||
return this.$tm.vx.getters().getConfigs.pageConfig.galleryConfig;
|
return this.$tm.vx.getters().getConfigs.pageConfig.galleryConfig;
|
||||||
|
},
|
||||||
|
haloConfigs() {
|
||||||
|
return this.$tm.vx.getters().getConfigs;
|
||||||
|
},
|
||||||
|
mockJson() {
|
||||||
|
return this.$tm.vx.getters().getMockJson;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -114,6 +120,13 @@ export default {
|
|||||||
this.fnGetData(true);
|
this.fnGetData(true);
|
||||||
},
|
},
|
||||||
onReachBottom(e) {
|
onReachBottom(e) {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '没有更多数据了'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (this.hasNext) {
|
if (this.hasNext) {
|
||||||
this.queryParams.page += 1;
|
this.queryParams.page += 1;
|
||||||
this.isLoadMore = true;
|
this.isLoadMore = true;
|
||||||
@ -130,11 +143,15 @@ export default {
|
|||||||
this.fnResetSetAniWaitIndex();
|
this.fnResetSetAniWaitIndex();
|
||||||
this.queryParams.group = this.category.list[index].name;
|
this.queryParams.group = this.category.list[index].name;
|
||||||
this.queryParams.page = 1;
|
this.queryParams.page = 1;
|
||||||
this.fnToTopPage();
|
this.fnToTopPage();
|
||||||
this.dataList = [];
|
this.dataList = [];
|
||||||
this.fnGetData(true);
|
this.fnGetData(true);
|
||||||
},
|
},
|
||||||
fnGetCategory() {
|
fnGetCategory() {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
this.fnGetData(true);
|
||||||
|
return
|
||||||
|
}
|
||||||
this.$httpApi.v2.getPhotoGroupList({
|
this.$httpApi.v2.getPhotoGroupList({
|
||||||
page: 1,
|
page: 1,
|
||||||
size: 0
|
size: 0
|
||||||
@ -151,7 +168,37 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
fnGetData(isClearWallfull = false) {
|
fnGetData(isClearWaterfall = false) {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
this.dataList = this.mockJson.gallery.list.map(item => {
|
||||||
|
return {
|
||||||
|
metadata: {
|
||||||
|
name: Date.now() * Math.random(),
|
||||||
|
},
|
||||||
|
spec: {
|
||||||
|
url: this.$utils.checkImageUrl(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
this.loading = 'success';
|
||||||
|
|
||||||
|
if (this.galleryConfig.useWaterfall) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if (isClearWaterfall) {
|
||||||
|
this.$refs.wafll.clear()
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
this.$refs.wafll.pushData(this.dataList)
|
||||||
|
}, 50)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.loadMoreText = '呜呜,没有更多数据啦~';
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 设置状态为加载中
|
// 设置状态为加载中
|
||||||
if (!this.isLoadMore) {
|
if (!this.isLoadMore) {
|
||||||
this.loading = 'loading';
|
this.loading = 'loading';
|
||||||
@ -174,9 +221,9 @@ export default {
|
|||||||
}
|
}
|
||||||
if (this.galleryConfig.useWaterfall) {
|
if (this.galleryConfig.useWaterfall) {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if(isClearWallfull){
|
if (isClearWaterfall) {
|
||||||
this.$refs.wafll.clear()
|
this.$refs.wafll.clear()
|
||||||
}
|
}
|
||||||
this.$refs.wafll.pushData(_list)
|
this.$refs.wafll.pushData(_list)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1,464 +1,549 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page">
|
<view class="app-page">
|
||||||
<tm-menubars iconColor="white" color="white" :flat="true" :showback="false">
|
<tm-menubars iconColor="white" color="white" :flat="true" :showback="false">
|
||||||
<view slot="left">
|
<view slot="left">
|
||||||
<image @click="fnOnLogoToPage" class="logo ml-24 round-24" :src="appInfo.logo" mode="scaleToFill" />
|
<image @click="fnOnLogoToPage" class="logo ml-24 round-24" :src="appInfo.logo" mode="scaleToFill"/>
|
||||||
</view>
|
</view>
|
||||||
<view class="search-input round-12 pt-12 pb-12 flex pl-24" @click="fnToSearch">
|
<view class="search-input round-12 pt-12 pb-12 flex pl-24" @click="fnToSearch">
|
||||||
<text class="search-input_icon iconfont text-size-m icon-search text-grey"></text>
|
<text class="search-input_icon iconfont text-size-m icon-search text-grey"></text>
|
||||||
<view class="search-input_text pl-12 text-size-m text-grey">搜索内容...</view>
|
<view class="search-input_text pl-12 text-size-m text-grey">搜索内容...</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- #ifdef APP-PLUS || H5 -->
|
<!-- #ifdef APP-PLUS || H5 -->
|
||||||
<view slot="right" class="mr-24 text-size-m text-grey text-overflow">{{ appInfo.name }}</view>
|
<view slot="right" class="mr-24 text-size-m text-grey text-overflow">{{ appInfo.name }}</view>
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
</tm-menubars>
|
</tm-menubars>
|
||||||
<view v-if="loading !== 'success' && articleList.length===0" class="loading-wrap">
|
<view v-if="loading !== 'success' && articleList.length===0" class="loading-wrap">
|
||||||
<tm-skeleton model="card"></tm-skeleton>
|
<tm-skeleton model="card"></tm-skeleton>
|
||||||
<tm-skeleton model="cardActions"></tm-skeleton>
|
<tm-skeleton model="cardActions"></tm-skeleton>
|
||||||
<tm-skeleton model="list"></tm-skeleton>
|
<tm-skeleton model="list"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
</view>
|
</view>
|
||||||
<block v-else>
|
<block v-else>
|
||||||
<view v-if="!haloConfigs.basicConfig.auditModeEnabled" class="bg-white pb-24">
|
<view class="bg-white pb-24">
|
||||||
<view class="banner bg-white ml-24 mr-24 mt-12 round-3" v-if="bannerList.length != 0">
|
<view class="banner bg-white ml-24 mr-24 mt-12 round-3" v-if="bannerList.length !== 0">
|
||||||
<e-swiper :dotPosition="globalAppSettings.banner.dotPosition" :autoplay="true"
|
<e-swiper :dotPosition="globalAppSettings.banner.dotPosition" :autoplay="true"
|
||||||
:useDot="globalAppSettings.banner.useDot" :list="bannerList"
|
:useDot="globalAppSettings.banner.useDot" :list="bannerList"
|
||||||
@on-click="fnOnBannerClick"></e-swiper>
|
@on-click="fnOnBannerClick"></e-swiper>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 精品分类 -->
|
<!-- 精品分类 -->
|
||||||
<block v-if="haloConfigs.pageConfig.homeConfig.useCategory">
|
<block v-if="calcIsShowCategory">
|
||||||
<view class="flex flex-between mt-16 mb-24 pl-24 pr-24">
|
<view class="flex flex-between mt-16 mb-24 pl-24 pr-24">
|
||||||
<view class="page-item_title text-weight-b ">精品分类</view>
|
<view class="page-item_title text-weight-b ">精品分类</view>
|
||||||
<view class="show-more flex flex-center bg-white round-3" @click="fnToCategoryPage">
|
<view class="show-more flex flex-center bg-white round-3" @click="fnToCategoryPage">
|
||||||
<text class="iconfont icon-angle-right text-size-s text-grey-darken-1"></text>
|
<text class="iconfont icon-angle-right text-size-s text-grey-darken-1"></text>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="false" class="flex flex-center text-size-s text-grey-darken-1"
|
<view v-if="false" class="flex flex-center text-size-s text-grey-darken-1"
|
||||||
@click="fnToCategoryPage">
|
@click="fnToCategoryPage">
|
||||||
<text class=" text-size-m">查看更多</text>
|
<text class=" text-size-m">查看更多</text>
|
||||||
<text class="iconfont icon-angle-right text-size-s "></text>
|
<text class="iconfont icon-angle-right text-size-s "></text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<scroll-view class="category" scroll-x="true">
|
<scroll-view class="category" scroll-x="true">
|
||||||
<view v-if="categoryList.length == 0" class="cate-empty round-3 mr-5 flex flex-center text-grey">
|
<view v-if="categoryList.length === 0" class="cate-empty round-3 mr-5 flex flex-center text-grey">
|
||||||
还没有任何分类~
|
还没有任何分类~
|
||||||
</view>
|
</view>
|
||||||
<block v-else>
|
<block v-else>
|
||||||
<view class="content" v-for="(category, index) in categoryList" :key="category.metadata.name"
|
<view class="content" v-for="(category, index) in categoryList" :key="category.metadata.name"
|
||||||
@click="fnToCategoryBy(category)">
|
@click="fnToCategoryBy(category)">
|
||||||
<category-mini-card :category="category"></category-mini-card>
|
<category-mini-card :category="category"></category-mini-card>
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</block>
|
</block>
|
||||||
|
|
||||||
<!-- 最新文章 -->
|
<!-- 最新文章 -->
|
||||||
<view v-if="!haloConfigs.basicConfig.auditModeEnabled" class="flex flex-between mt-24 mb-24 pl-24 pr-24">
|
<view class="flex flex-between mt-24 mb-24 pl-24 pr-24">
|
||||||
<view class="page-item_title text-weight-b">最新列表</view>
|
<view class="page-item_title text-weight-b">最新列表</view>
|
||||||
<view class="show-more flex flex-center bg-white round-3" @click="fnToArticlesPage">
|
<view class="show-more flex flex-center bg-white round-3" @click="fnToArticlesPage">
|
||||||
<text class="iconfont icon-angle-right text-size-s text-grey-darken-1"></text>
|
<text class="iconfont icon-angle-right text-size-s text-grey-darken-1"></text>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="false" class="flex flex-center text-size-s text-grey-darken-1" @click="fnToArticlesPage">
|
<view v-if="false" class="flex flex-center text-size-s text-grey-darken-1" @click="fnToArticlesPage">
|
||||||
<text class=" text-size-m ">查看更多</text>
|
<text class=" text-size-m ">查看更多</text>
|
||||||
<text class="iconfont icon-angle-right text-size-s "></text>
|
<text class="iconfont icon-angle-right text-size-s "></text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="articleList.length == 0" class="article-empty">
|
<view v-if="articleList.length === 0" class="article-empty">
|
||||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="博主还没有发表任何内容~"></tm-empty>
|
<tm-empty icon="icon-shiliangzhinengduixiang-" label="博主还没有发表任何内容~"></tm-empty>
|
||||||
</view>
|
</view>
|
||||||
<block v-else>
|
<block v-else>
|
||||||
<view :class="globalAppSettings.layout.home">
|
<view :class="globalAppSettings.layout.home">
|
||||||
<tm-translate v-for="(article, index) in articleList" :key="index" class="ani-item"
|
<tm-translate v-for="(article, index) in articleList" :key="index" class="ani-item"
|
||||||
animation-name="fadeUp" :wait="calcAniWait(index)">
|
animation-name="fadeUp" :wait="calcAniWait(index)">
|
||||||
<article-card from="home" :article="article" :post="article"
|
<article-card from="home" :article="article" :post="article"
|
||||||
@on-click="fnToArticleDetail"></article-card>
|
@on-click="fnToArticleDetail"></article-card>
|
||||||
</tm-translate>
|
</tm-translate>
|
||||||
</view>
|
</view>
|
||||||
<view class="load-text mt-12">{{ loadMoreText }}</view>
|
<view class="load-text mt-12">{{ loadMoreText }}</view>
|
||||||
<tm-flotbutton v-if="articleList.length > 10" color="light-blue" @click="fnToTopPage" size="m"
|
<tm-flotbutton v-if="articleList.length > 10" color="light-blue" @click="fnToTopPage" size="m"
|
||||||
icon="icon-angle-up"></tm-flotbutton>
|
icon="icon-angle-up"></tm-flotbutton>
|
||||||
</block>
|
</block>
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import tmMenubars from '@/tm-vuetify/components/tm-menubars/tm-menubars.vue';
|
import tmMenubars from '@/tm-vuetify/components/tm-menubars/tm-menubars.vue';
|
||||||
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
|
||||||
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
|
||||||
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
|
||||||
import tmIcons from '@/tm-vuetify/components/tm-icons/tm-icons.vue';
|
import tmIcons from '@/tm-vuetify/components/tm-icons/tm-icons.vue';
|
||||||
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
|
||||||
|
|
||||||
import eSwiper from '@/components/e-swiper/e-swiper.vue';
|
import eSwiper from '@/components/e-swiper/e-swiper.vue';
|
||||||
import qs from 'qs'
|
import qs from 'qs'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
tmMenubars,
|
tmMenubars,
|
||||||
tmSkeleton,
|
tmSkeleton,
|
||||||
tmTranslate,
|
tmTranslate,
|
||||||
tmFlotbutton,
|
tmFlotbutton,
|
||||||
tmIcons,
|
tmIcons,
|
||||||
tmEmpty,
|
tmEmpty,
|
||||||
eSwiper
|
eSwiper
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: 'loading',
|
loading: 'loading',
|
||||||
queryParams: {
|
queryParams: {
|
||||||
size: 5,
|
size: 5,
|
||||||
page: 1,
|
page: 1,
|
||||||
sort: ['spec.pinned,desc', 'spec.publishTime,desc']
|
sort: ['spec.pinned,desc', 'spec.publishTime,desc']
|
||||||
},
|
},
|
||||||
result: {},
|
result: {},
|
||||||
isLoadMore: false,
|
isLoadMore: false,
|
||||||
loadMoreText: '加载中...',
|
loadMoreText: '加载中...',
|
||||||
bannerCurrent: 0,
|
bannerCurrent: 0,
|
||||||
bannerList: [],
|
bannerList: [],
|
||||||
noticeList: [],
|
noticeList: [],
|
||||||
articleList: [],
|
articleList: [],
|
||||||
categoryList: [],
|
categoryList: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
haloConfigs() {
|
haloConfigs() {
|
||||||
return this.$tm.vx.getters().getConfigs;
|
return this.$tm.vx.getters().getConfigs;
|
||||||
},
|
},
|
||||||
bloggerInfo() {
|
bloggerInfo() {
|
||||||
const blogger = this.$tm.vx.getters().getConfigs.authorConfig.blogger;
|
const blogger = this.$tm.vx.getters().getConfigs.authorConfig.blogger;
|
||||||
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
|
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
|
||||||
return blogger;
|
return blogger;
|
||||||
},
|
},
|
||||||
appInfo() {
|
appInfo() {
|
||||||
const appInfo = this.haloConfigs.appConfig.appInfo;
|
const appInfo = this.haloConfigs.appConfig.appInfo;
|
||||||
appInfo.logo = this.$utils.checkImageUrl(appInfo.logo)
|
appInfo.logo = this.$utils.checkImageUrl(appInfo.logo)
|
||||||
return appInfo;
|
return appInfo;
|
||||||
}
|
},
|
||||||
},
|
mockJson() {
|
||||||
onLoad() {
|
return this.$tm.vx.getters().getMockJson;
|
||||||
this.fnSetPageTitle();
|
},
|
||||||
},
|
calcIsShowCategory() {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled && this.categoryList.length !== 0) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return this.haloConfigs.pageConfig.homeConfig.useCategory
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
this.fnSetPageTitle();
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.fnQuery();
|
||||||
|
},
|
||||||
|
onPullDownRefresh() {
|
||||||
|
this.isLoadMore = false;
|
||||||
|
this.queryParams.page = 1;
|
||||||
|
this.fnQuery();
|
||||||
|
},
|
||||||
|
onReachBottom(e) {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '没有更多数据了'
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (this.result.hasNext) {
|
||||||
|
this.queryParams.page += 1;
|
||||||
|
this.isLoadMore = true;
|
||||||
|
this.fnGetArticleList();
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '没有更多数据了'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
fnQuery() {
|
||||||
|
console.log('this.mockJson', this.mockJson)
|
||||||
|
this.fnGetBanner();
|
||||||
|
this.fnGetArticleList();
|
||||||
|
this.fnGetCategoryList();
|
||||||
|
},
|
||||||
|
fnGetCategoryList() {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
this.categoryList = this.mockJson.home.categoryList.map((item) => {
|
||||||
|
return {
|
||||||
|
metadata: {
|
||||||
|
name: Date.now() * Math.random(),
|
||||||
|
},
|
||||||
|
spec: {
|
||||||
|
displayName: item.title,
|
||||||
|
cover: item.cover
|
||||||
|
},
|
||||||
|
postCount: 0
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
created() {
|
if (!this.calcIsShowCategory) {
|
||||||
this.fnQuery();
|
return;
|
||||||
},
|
}
|
||||||
onPullDownRefresh() {
|
|
||||||
this.isLoadMore = false;
|
|
||||||
this.queryParams.page = 1;
|
|
||||||
this.fnQuery();
|
|
||||||
},
|
|
||||||
onReachBottom(e) {
|
|
||||||
if (this.result.hasNext) {
|
|
||||||
this.queryParams.page += 1;
|
|
||||||
this.isLoadMore = true;
|
|
||||||
this.fnGetArticleList();
|
|
||||||
} else {
|
|
||||||
uni.showToast({
|
|
||||||
icon: 'none',
|
|
||||||
title: '没有更多数据了'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
fnQuery() {
|
|
||||||
this.fnGetBanner();
|
|
||||||
this.fnGetArticleList();
|
|
||||||
this.fnGetCategoryList();
|
|
||||||
},
|
|
||||||
|
|
||||||
fnGetCategoryList() {
|
this.$httpApi.v2
|
||||||
if (!this.haloConfigs.pageConfig.homeConfig.useCategory) {
|
.getCategoryList({})
|
||||||
return;
|
.then(res => {
|
||||||
}
|
this.categoryList = res.items.sort((a, b) => {
|
||||||
this.$httpApi.v2
|
return b.postCount - a.postCount;
|
||||||
.getCategoryList({})
|
});
|
||||||
.then(res => {
|
|
||||||
this.categoryList = res.items.sort((a, b) => {
|
|
||||||
return b.postCount - a.postCount;
|
|
||||||
});
|
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.loading = 'success';
|
this.loading = 'success';
|
||||||
}, 500);
|
}, 500);
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
this.loading = 'error';
|
this.loading = 'error';
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
uni.stopPullDownRefresh();
|
uni.stopPullDownRefresh();
|
||||||
}, 500);
|
}, 500);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 获取轮播图
|
// 获取轮播图
|
||||||
fnGetBanner() {
|
fnGetBanner() {
|
||||||
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
return;
|
this.bannerList = this.mockJson.home.bannerList.map((item) => {
|
||||||
}
|
return {
|
||||||
const _this = this;
|
mp4: '',
|
||||||
const _format = function(list) {
|
id: Date.now() * Math.random(),
|
||||||
return list.map((item, index) => {
|
nickname: this.haloConfigs.authorConfig.blogger.nickname,
|
||||||
return {
|
avatar: this.$utils.checkAvatarUrl(this.haloConfigs.authorConfig.blogger.avatar),
|
||||||
mp4: '',
|
address: '',
|
||||||
id: item.metadata.name,
|
createTime: item.time,
|
||||||
nickname: item.owner.displayName,
|
title: item.title,
|
||||||
avatar: _this.$utils.checkAvatarUrl(item.owner.avatar),
|
src: this.$utils.checkThumbnailUrl(item.cover),
|
||||||
address: '',
|
image: this.$utils.checkThumbnailUrl(item.cover)
|
||||||
createTime: uni.$tm.dayjs(item.spec.publishTime).fromNow(),
|
}
|
||||||
title: item.spec.title,
|
});
|
||||||
src: _this.$utils.checkThumbnailUrl(item.spec.cover),
|
return;
|
||||||
image: _this.$utils.checkThumbnailUrl(item.spec.cover)
|
}
|
||||||
};
|
const _this = this;
|
||||||
});
|
const _format = function (list) {
|
||||||
};
|
return list.map((item, index) => {
|
||||||
|
return {
|
||||||
|
mp4: '',
|
||||||
|
id: item.metadata.name,
|
||||||
|
nickname: item.owner.displayName,
|
||||||
|
avatar: _this.$utils.checkAvatarUrl(item.owner.avatar),
|
||||||
|
address: '',
|
||||||
|
createTime: uni.$tm.dayjs(item.spec.publishTime).fromNow(),
|
||||||
|
title: item.spec.title,
|
||||||
|
src: _this.$utils.checkThumbnailUrl(item.spec.cover),
|
||||||
|
image: _this.$utils.checkThumbnailUrl(item.spec.cover)
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const paramsStr = qs.stringify(this.queryParams, {
|
const paramsStr = qs.stringify(this.queryParams, {
|
||||||
allowDots: true,
|
allowDots: true,
|
||||||
encodeValuesOnly: true,
|
encodeValuesOnly: true,
|
||||||
skipNulls: true,
|
skipNulls: true,
|
||||||
encode: true,
|
encode: true,
|
||||||
arrayFormat: 'repeat'
|
arrayFormat: 'repeat'
|
||||||
})
|
})
|
||||||
uni.request({
|
uni.request({
|
||||||
url: this.$baseApiUrl + '/apis/api.content.halo.run/v1alpha1/posts?' + paramsStr,
|
url: this.$baseApiUrl + '/apis/api.content.halo.run/v1alpha1/posts?' + paramsStr,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
this.bannerList = _format(res.data.items);
|
this.bannerList = _format(res.data.items);
|
||||||
},
|
},
|
||||||
fail: (err) => {}
|
fail: (err) => {
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
fnOnBannerChange(e) {
|
fnOnBannerChange(e) {
|
||||||
this.bannerCurrent = e.current;
|
this.bannerCurrent = e.current;
|
||||||
},
|
},
|
||||||
fnOnBannerClick(item) {
|
fnOnBannerClick(item) {
|
||||||
if (item.id == '') return;
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
this.fnToArticleDetail({
|
return;
|
||||||
metadata: {
|
}
|
||||||
name: item.id
|
if (item.id === '') return;
|
||||||
}
|
this.fnToArticleDetail({
|
||||||
});
|
metadata: {
|
||||||
},
|
name: item.id
|
||||||
// 文章列表
|
}
|
||||||
fnGetArticleList() {
|
});
|
||||||
// 设置状态为加载中
|
},
|
||||||
if (!this.isLoadMore) {
|
// 文章列表
|
||||||
this.loading = 'loading';
|
fnGetArticleList() {
|
||||||
}
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
this.loadMoreText = '加载中...';
|
this.articleList = this.mockJson.home.postList.map((item) => {
|
||||||
|
return {
|
||||||
|
metadata: {
|
||||||
|
name: Date.now() * Math.random(),
|
||||||
|
},
|
||||||
|
spec: {
|
||||||
|
pinned: false,
|
||||||
|
cover: item.cover,
|
||||||
|
title: item.title,
|
||||||
|
publishTime: item.time
|
||||||
|
},
|
||||||
|
status: {
|
||||||
|
excerpt: item.desc
|
||||||
|
},
|
||||||
|
stats: {
|
||||||
|
visit: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.loading = 'success';
|
||||||
|
this.loadMoreText = '呜呜,没有更多数据啦~';
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 设置状态为加载中
|
||||||
|
if (!this.isLoadMore) {
|
||||||
|
this.loading = 'loading';
|
||||||
|
}
|
||||||
|
this.loadMoreText = '加载中...';
|
||||||
|
|
||||||
const paramsStr = qs.stringify(this.queryParams, {
|
const paramsStr = qs.stringify(this.queryParams, {
|
||||||
allowDots: true,
|
allowDots: true,
|
||||||
encodeValuesOnly: true,
|
encodeValuesOnly: true,
|
||||||
skipNulls: true,
|
skipNulls: true,
|
||||||
encode: true,
|
encode: true,
|
||||||
arrayFormat: 'repeat'
|
arrayFormat: 'repeat'
|
||||||
})
|
})
|
||||||
uni.request({
|
uni.request({
|
||||||
url: this.$baseApiUrl + '/apis/api.content.halo.run/v1alpha1/posts?' + paramsStr,
|
url: this.$baseApiUrl + '/apis/api.content.halo.run/v1alpha1/posts?' + paramsStr,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
const data = res.data;
|
const data = res.data;
|
||||||
this.result.hasNext = data.hasNext;
|
this.result.hasNext = data.hasNext;
|
||||||
if (this.isLoadMore) {
|
if (this.isLoadMore) {
|
||||||
this.articleList = this.articleList.concat(data.items);
|
this.articleList = this.articleList.concat(data.items);
|
||||||
} else {
|
} else {
|
||||||
this.articleList = data.items;
|
this.articleList = data.items;
|
||||||
}
|
}
|
||||||
this.loading = 'success';
|
this.loading = 'success';
|
||||||
this.loadMoreText = data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
this.loadMoreText = data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
uni.stopPullDownRefresh();
|
uni.stopPullDownRefresh();
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
this.loading = 'error';
|
this.loading = 'error';
|
||||||
this.loadMoreText = '加载失败,请下拉刷新!';
|
this.loadMoreText = '加载失败,请下拉刷新!';
|
||||||
uni.$tm.toast(err.message || '数据加载失败!');
|
uni.$tm.toast(err.message || '数据加载失败!');
|
||||||
uni.stopPullDownRefresh();
|
uni.stopPullDownRefresh();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
//跳转文章详情
|
||||||
|
fnToArticleDetail(article) {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pagesA/article-detail/article-detail?name=' + article.metadata.name,
|
||||||
|
animationType: 'slide-in-right'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 快捷导航页面跳转
|
||||||
|
fnToNavPage(item) {
|
||||||
|
switch (item.type) {
|
||||||
|
case 'tabbar':
|
||||||
|
uni.switchTab({
|
||||||
|
url: item.path
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'page':
|
||||||
|
uni.navigateTo({
|
||||||
|
url: item.path
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 分类页面
|
||||||
|
fnToCategoryPage() {
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/tabbar/category/category'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 所有的文章列表页面
|
||||||
|
fnToArticlesPage() {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pagesA/articles/articles'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
//跳转文章详情
|
// 根据slug查询分类下的文章
|
||||||
fnToArticleDetail(article) {
|
fnToCategoryBy(category) {
|
||||||
uni.navigateTo({
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
url: '/pagesA/article-detail/article-detail?name=' + article.metadata.name,
|
return;
|
||||||
animationType: 'slide-in-right'
|
}
|
||||||
});
|
uni.navigateTo({
|
||||||
},
|
url: `/pagesA/category-detail/category-detail?name=${category.metadata.name}&title=${category.spec.displayName}`
|
||||||
// 快捷导航页面跳转
|
});
|
||||||
fnToNavPage(item) {
|
},
|
||||||
switch (item.type) {
|
|
||||||
case 'tabbar':
|
|
||||||
uni.switchTab({
|
|
||||||
url: item.path
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case 'page':
|
|
||||||
uni.navigateTo({
|
|
||||||
url: item.path
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 分类页面
|
|
||||||
fnToCategoryPage() {
|
|
||||||
uni.switchTab({
|
|
||||||
url: '/pages/tabbar/category/category'
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 所有的文章列表页面
|
|
||||||
fnToArticlesPage() {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pagesA/articles/articles'
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
// 根据slug查询分类下的文章
|
fnChangeMode() {
|
||||||
fnToCategoryBy(category) {
|
const isBlackTheme = this.$tm.vx.state().tmVuetify.black;
|
||||||
uni.navigateTo({
|
this.$tm.theme.setBlack(!isBlackTheme);
|
||||||
url: `/pagesA/category-detail/category-detail?name=${category.metadata.name}&title=${category.spec.displayName}`
|
uni.setNavigationBarColor({
|
||||||
});
|
backgroundColor: !isBlackTheme ? '#0a0a0a' : '#ffffff',
|
||||||
},
|
frontColor: !isBlackTheme ? '#ffffff' : '#0a0a0a'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
fnChangeMode() {
|
fnToSearch() {
|
||||||
const isBlackTheme = this.$tm.vx.state().tmVuetify.black;
|
uni.navigateTo({
|
||||||
this.$tm.theme.setBlack(!isBlackTheme);
|
url: '/pagesA/articles/articles'
|
||||||
uni.setNavigationBarColor({
|
});
|
||||||
backgroundColor: !isBlackTheme ? '#0a0a0a' : '#ffffff',
|
},
|
||||||
frontColor: !isBlackTheme ? '#ffffff' : '#0a0a0a'
|
fnOnLogoToPage() {
|
||||||
});
|
uni.switchTab({
|
||||||
},
|
url: '/pages/tabbar/about/about'
|
||||||
|
})
|
||||||
fnToSearch() {
|
}
|
||||||
uni.navigateTo({
|
}
|
||||||
url: '/pagesA/articles/articles'
|
};
|
||||||
});
|
|
||||||
},
|
|
||||||
fnOnLogoToPage() {
|
|
||||||
uni.switchTab({
|
|
||||||
url: '/pages/tabbar/about/about'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.app-page {
|
.app-page {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
// background-color: #ffffff;
|
// background-color: #ffffff;
|
||||||
|
|
||||||
.logo {
|
.logo {
|
||||||
width: 60rpx;
|
width: 60rpx;
|
||||||
height: 60rpx;
|
height: 60rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep {
|
::v-deep {
|
||||||
.tm-menubars .body .body_wk .left {
|
.tm-menubars .body .body_wk .left {
|
||||||
min-width: initial;
|
min-width: initial;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading-wrap {
|
.loading-wrap {
|
||||||
padding: 24rpx;
|
padding: 24rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-input {
|
.search-input {
|
||||||
background-color: #f5f5f5;
|
background-color: #f5f5f5;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
/* #ifdef MP-WEIXIN */
|
/* #ifdef MP-WEIXIN */
|
||||||
margin-right: 24rpx;
|
margin-right: 24rpx;
|
||||||
|
|
||||||
/* #endif */
|
/* #endif */
|
||||||
&_icon {}
|
&_icon {
|
||||||
|
}
|
||||||
|
|
||||||
&_text {}
|
&_text {
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.show-more {
|
.show-more {
|
||||||
width: 42rpx;
|
width: 42rpx;
|
||||||
height: 42rpx;
|
height: 42rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
box-shadow: 0rpx 0rpx 24rpx rgba(0, 0, 0, 0.03);
|
box-shadow: 0rpx 0rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||||
}
|
}
|
||||||
|
|
||||||
.banner {
|
.banner {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.quick-nav {
|
.quick-nav {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
||||||
// box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
|
// box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
|
||||||
.name {
|
.name {
|
||||||
color: var(--main-text-color);
|
color: var(--main-text-color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.category {
|
.category {
|
||||||
width: 94vw;
|
width: 94vw;
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 200rpx;
|
height: 200rpx;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
margin: 0 24rpx;
|
margin: 0 24rpx;
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding-left: 24rpx;
|
padding-left: 24rpx;
|
||||||
|
|
||||||
&:first-child {
|
&:first-child {
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.cate-empty {
|
.cate-empty {
|
||||||
height: inherit;
|
height: inherit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-item {
|
.page-item {
|
||||||
&_title {
|
&_title {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-left: 24rpx;
|
padding-left: 24rpx;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
color: var(--main-text-color);
|
color: var(--main-text-color);
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0rpx;
|
left: 0rpx;
|
||||||
top: 8rpx;
|
top: 8rpx;
|
||||||
width: 8rpx;
|
width: 8rpx;
|
||||||
height: 30rpx;
|
height: 30rpx;
|
||||||
background-color: rgba(33, 150, 243, 1);
|
background-color: rgba(33, 150, 243, 1);
|
||||||
border-radius: 6rpx;
|
border-radius: 6rpx;
|
||||||
z-index: 0;
|
z-index: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.h_row_col2 {
|
.h_row_col2 {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 0 12rpx;
|
padding: 0 12rpx;
|
||||||
|
|
||||||
.ani-item {
|
.ani-item {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page">
|
<view class="app-page">
|
||||||
<view v-if="loading != 'success'" class="loading-wrap">
|
<view v-if="loading !== 'success'" class="loading-wrap">
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||||
</view>
|
</view>
|
||||||
<!-- 内容区域 -->
|
<!-- 内容区域 -->
|
||||||
<view v-else class="app-page-content">
|
<view v-else class="app-page-content">
|
||||||
<view v-if="dataList.length == 0" class="content-empty flex flex-center" style="min-height: 70vh;">
|
<view v-if="dataList.length === 0" class="content-empty flex flex-center" style="min-height: 70vh;">
|
||||||
<!-- 空布局 -->
|
<!-- 空布局 -->
|
||||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无数据"></tm-empty>
|
<tm-empty icon="icon-shiliangzhinengduixiang-" label="暂无数据"></tm-empty>
|
||||||
</view>
|
</view>
|
||||||
@ -101,6 +101,12 @@ export default {
|
|||||||
let blogger = this.$tm.vx.getters().getConfigs.authorConfig.blogger;
|
let blogger = this.$tm.vx.getters().getConfigs.authorConfig.blogger;
|
||||||
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
|
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
|
||||||
return blogger;
|
return blogger;
|
||||||
|
},
|
||||||
|
haloConfigs() {
|
||||||
|
return this.$tm.vx.getters().getConfigs;
|
||||||
|
},
|
||||||
|
mockJson() {
|
||||||
|
return this.$tm.vx.getters().getMockJson;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -114,6 +120,13 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
onReachBottom(e) {
|
onReachBottom(e) {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '没有更多数据了'
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
if (this.hasNext) {
|
if (this.hasNext) {
|
||||||
this.queryParams.page += 1;
|
this.queryParams.page += 1;
|
||||||
this.isLoadMore = true;
|
this.isLoadMore = true;
|
||||||
@ -127,6 +140,37 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fnGetData() {
|
fnGetData() {
|
||||||
|
if (this.haloConfigs.basicConfig.auditModeEnabled) {
|
||||||
|
this.dataList = this.mockJson.moments.list.map((item) => {
|
||||||
|
return {
|
||||||
|
metadata: {
|
||||||
|
name: Date.now() * Math.random(),
|
||||||
|
},
|
||||||
|
spec: {
|
||||||
|
user: {
|
||||||
|
displayName: this.bloggerInfo.nickname,
|
||||||
|
avatar: this.$utils.checkAvatarUrl(this.bloggerInfo.avatar),
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
html: item.content
|
||||||
|
},
|
||||||
|
releaseTime: item.time
|
||||||
|
},
|
||||||
|
images: item.images.map((img) => {
|
||||||
|
return {
|
||||||
|
type: "PHOTO",
|
||||||
|
url: this.$utils.checkThumbnailUrl(img),
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
videos: []
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.loading = 'success';
|
||||||
|
this.loadMoreText = '呜呜,没有更多数据啦~';
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
|
return;
|
||||||
|
}
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
mask: true,
|
mask: true,
|
||||||
title: '加载中...'
|
title: '加载中...'
|
||||||
@ -139,9 +183,6 @@ export default {
|
|||||||
this.$httpApi.v2
|
this.$httpApi.v2
|
||||||
.getMomentList(this.queryParams)
|
.getMomentList(this.queryParams)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log('请求结果:');
|
|
||||||
console.log(res);
|
|
||||||
|
|
||||||
this.loading = 'success';
|
this.loading = 'success';
|
||||||
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
this.loadMoreText = res.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||||
this.hasNext = res.hasNext;
|
this.hasNext = res.hasNext;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -5,25 +5,34 @@
|
|||||||
* 时间:2024年06月22日 12:00:44
|
* 时间:2024年06月22日 12:00:44
|
||||||
* 版本:v0.1.0
|
* 版本:v0.1.0
|
||||||
*/
|
*/
|
||||||
import {DefaultAppConfigs, getAppConfigs, setAppConfigs} from '@/config/index.js'
|
import {DefaultAppConfigs, getAppConfigs, setAppConfigs,setAppMockJson,getAppMockJson} from '@/config/index.js'
|
||||||
import v2Config from '@/api/v2/all.config.js'
|
import v2Config from '@/api/v2/all.config.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
state: {
|
state: {
|
||||||
configs: getAppConfigs(),
|
configs: getAppConfigs(),
|
||||||
|
mockJson: getAppMockJson(),
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
getConfigs(state) {
|
getConfigs(state) {
|
||||||
if (state.configs) return state.configs;
|
if (state.configs) return state.configs;
|
||||||
return getAppConfigs()
|
return getAppConfigs()
|
||||||
},
|
},
|
||||||
|
getMockJson(state) {
|
||||||
|
if(state.mockJson) return state.mockJson;
|
||||||
|
return getAppMockJson()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
setConfigs(state, data) {
|
setConfigs(state, data) {
|
||||||
state.configs = data;
|
state.configs = data;
|
||||||
setAppConfigs(data)
|
setAppConfigs(data)
|
||||||
},
|
},
|
||||||
|
setMockJson(state, data) {
|
||||||
|
setAppMockJson(data)
|
||||||
|
state.mockJson = data;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
fetchConfigs({commit, dispatch}) {
|
fetchConfigs({commit, dispatch}) {
|
||||||
@ -47,5 +56,30 @@ export default {
|
|||||||
setDefaultAppSettings({commit}) {
|
setDefaultAppSettings({commit}) {
|
||||||
commit('setConfigs', JSON.parse(JSON.stringify(DefaultAppConfigs)))
|
commit('setConfigs', JSON.parse(JSON.stringify(DefaultAppConfigs)))
|
||||||
},
|
},
|
||||||
|
// 请求模拟数据
|
||||||
|
fetchMockJson({state, commit, dispatch}) {
|
||||||
|
return new Promise(async (resolve, reject) => {
|
||||||
|
// const mockJsonUrl = utils.checkUrl(state.configs.basicConfig.auditModeMock)
|
||||||
|
const mockJsonUrl = "https://uni-halo.925i.cn/unihalo.mock.json"
|
||||||
|
uni.request({
|
||||||
|
url: mockJsonUrl,
|
||||||
|
method: "GET",
|
||||||
|
success: (res) => {
|
||||||
|
console.log("mockJson", res.data)
|
||||||
|
commit('setMockJson', res.data)
|
||||||
|
resolve({
|
||||||
|
ok: true,
|
||||||
|
data: res.data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
resolve({
|
||||||
|
ok: false,
|
||||||
|
data: err
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user