mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2025-05-20 02:20:15 +09:00
新增:联系博主页面顶部返回按钮;
修复:修复 默认封面图、默认图片、默认头像在使用随机api时候无法显示的BUG; 修复:后台管理新增文章发布失败BUG; 删除:去除联系博主页面中的 联系博主 按钮; 优化:对友链页面进行重写; 优化:对部分页面和功能进行优化。
This commit is contained in:
parent
473655171b
commit
3702cb1618
@ -24,6 +24,7 @@ const createOrEditModel = {
|
||||
"value": "string"
|
||||
}],
|
||||
"originalContent": "string",
|
||||
"formatContent": "",
|
||||
"password": "string",
|
||||
"slug": "string",
|
||||
"status": "DRAFT",
|
||||
|
@ -201,8 +201,7 @@
|
||||
"path": "contact/contact",
|
||||
"style": {
|
||||
"navigationBarTitleText": "联系博主",
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationStyle": "custom"
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
}, {
|
||||
"path": "about/about",
|
||||
@ -216,7 +215,6 @@
|
||||
"navigationBarTitleText": "设置",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}]
|
||||
},
|
||||
{
|
||||
|
@ -5,7 +5,7 @@
|
||||
<image class="avatar" :src="$utils.checkAvatarUrl(bloggerInfo.avatar)" mode="aspectFill" @click="miniProfileCard.show = true"></image>
|
||||
<view class="profile">
|
||||
<view class="author mt-24 text-size-g text-weight-b">{{ bloggerInfo.nickname }}</view>
|
||||
<view class="desc mt-24 text-size-m">{{ bloggerInfo.description || '一个爱凑热闹的、喜欢捣鼓前端的博主。' }}</view>
|
||||
<view class="desc mt-24 text-size-m">{{ bloggerInfo.description || '这个博主很懒,竟然没写介绍~' }}</view>
|
||||
</view>
|
||||
<image v-if="calcWaveUrl" :src="calcWaveUrl" mode="scaleToFill" class="gif-wave"></image>
|
||||
</view>
|
||||
|
@ -16,10 +16,10 @@
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
</view>
|
||||
<!-- 内容区域 -->
|
||||
<view class="content" v-else>
|
||||
<view class="content" v-else :class="{ 'bg-white': dataList.length !== 0 }">
|
||||
<view v-if="dataList.length == 0" class="content-empty">
|
||||
<!-- 空布局 -->
|
||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="该分类下暂无数据"></tm-empty>
|
||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="博主还没有分享图片~"></tm-empty>
|
||||
</view>
|
||||
<block v-else>
|
||||
<tm-flowLayout v-if="globalAppSettings.gallery.useWaterfull" @click="fnOnClick" ref="wafll">
|
||||
@ -227,26 +227,32 @@ export default {
|
||||
this.$httpApi
|
||||
.getPhotoListByPage(this.queryParams)
|
||||
.then(res => {
|
||||
this.loading = 'success';
|
||||
this.result = res.data;
|
||||
if (res.data.content.length != 0) {
|
||||
const _list = res.data.content.map((item, index) => {
|
||||
item['image'] = this.$utils.checkImageUrl(item.thumbnail);
|
||||
item['model'] = 'text';
|
||||
item['takeTime'] = this.$tm.dayjs(item['takeTime']).format('DD/MM/YYYY');
|
||||
return item;
|
||||
});
|
||||
this.fnCacheDataList(_list);
|
||||
if (this.globalAppSettings.gallery.useWaterfull) {
|
||||
this.dataList = _list;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.wafll.pushData(_list);
|
||||
if (res.status == 200) {
|
||||
this.loading = 'success';
|
||||
this.result = res.data;
|
||||
if (res.data.content.length != 0) {
|
||||
const _list = res.data.content.map((item, index) => {
|
||||
item['image'] = this.$utils.checkImageUrl(item.thumbnail);
|
||||
item['model'] = 'text';
|
||||
item['takeTime'] = this.$tm.dayjs(item['takeTime']).format('DD/MM/YYYY');
|
||||
return item;
|
||||
});
|
||||
} else {
|
||||
this.dataList = this.dataList.concat(_list);
|
||||
this.fnCacheDataList(_list);
|
||||
if (this.globalAppSettings.gallery.useWaterfull) {
|
||||
this.dataList = _list;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.wafll.pushData(_list);
|
||||
});
|
||||
} else {
|
||||
this.dataList = this.dataList.concat(_list);
|
||||
}
|
||||
}
|
||||
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||
} else {
|
||||
this.loading = 'error';
|
||||
this.waterfall.loading = 'finish';
|
||||
this.loadMoreText = '';
|
||||
}
|
||||
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
@ -301,6 +307,7 @@ export default {
|
||||
}
|
||||
}
|
||||
.content {
|
||||
box-sizing: border-box;
|
||||
padding: 0 24rpx;
|
||||
padding-top: 24rpx;
|
||||
|
||||
@ -312,6 +319,7 @@ export default {
|
||||
}
|
||||
}
|
||||
.loading-wrap {
|
||||
box-sizing: border-box;
|
||||
padding: 24rpx;
|
||||
}
|
||||
</style>
|
||||
|
@ -196,7 +196,10 @@ export default {
|
||||
this.$httpApi
|
||||
.getCategoryList({ more: true })
|
||||
.then(res => {
|
||||
this.categoryList = res.data;
|
||||
this.categoryList = res.data.sort((a, b) => {
|
||||
return b.postCount - a.postCount;
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
this.loading = 'success';
|
||||
}, 500);
|
||||
@ -216,12 +219,16 @@ export default {
|
||||
fnGetBanner() {
|
||||
const _this = this;
|
||||
const _format = function(list, type) {
|
||||
return list.map(item => {
|
||||
return list.map((item, index) => {
|
||||
switch (type) {
|
||||
case 'list':
|
||||
return {
|
||||
id: '',
|
||||
src: item
|
||||
id: index,
|
||||
nickname: _this.bloggerInfo.nickname,
|
||||
avatar: _this.bloggerInfo.avatar,
|
||||
address: item.href || '',
|
||||
title: item.title,
|
||||
image: _this.$utils.checkImageUrl(item.thumbnail)
|
||||
};
|
||||
case 'article':
|
||||
return {
|
||||
|
@ -7,9 +7,9 @@
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
</view>
|
||||
<view v-else class="bg-white">
|
||||
<view v-else class="content">
|
||||
<!-- 空数据 -->
|
||||
<view v-if="result.length == 0" class="empty flex flex-center"><tm-empty icon="icon-shiliangzhinengduixiang-" label="啊偶,博主还没有朋友呢~"></tm-empty></view>
|
||||
<view v-if="result.length == 0" class="content-empty flex flex-center"><tm-empty icon="icon-shiliangzhinengduixiang-" label="啊偶,博主还没有朋友呢~"></tm-empty></view>
|
||||
|
||||
<!-- 如果只有一个分组:使用列表的形式 result.length == 1 -->
|
||||
<view v-else-if="result.length == 1" class="flex flex-col pb-24">
|
||||
@ -190,7 +190,7 @@ export default {
|
||||
};
|
||||
});
|
||||
|
||||
this.result = _result.reverse();
|
||||
// this.result = _result.reverse();
|
||||
setTimeout(() => {
|
||||
this.loading = 'success';
|
||||
}, 500);
|
||||
@ -245,17 +245,24 @@ export default {
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #fafafd;
|
||||
}
|
||||
.loading-wrap {
|
||||
padding: 24rpx;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.empty {
|
||||
width: 100vw;
|
||||
height: 60vh;
|
||||
}
|
||||
.content {
|
||||
padding: 0 24rpx;
|
||||
padding-top: 24rpx;
|
||||
|
||||
.content-empty {
|
||||
height: 60vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
.link-card {
|
||||
border-bottom: 2rpx solid #f5f5f5;
|
||||
background-color: #ffffff;
|
||||
|
@ -16,7 +16,7 @@
|
||||
<view class="load-text">{{ loadMoreText }}</view>
|
||||
</block>
|
||||
|
||||
<tm-flotbutton @click="fnToTopPage" size="m" icon="icon-angle-up"></tm-flotbutton>
|
||||
<tm-flotbutton @click="fnToTopPage" color="light-blue" size="m" icon="icon-angle-up"></tm-flotbutton>
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
|
@ -2,12 +2,9 @@
|
||||
<view class="app-page flex flex-col felx-center bg-white">
|
||||
<!-- 信息 -->
|
||||
<view class="profile flex flex-col flex-center pa-36">
|
||||
<view class="avatar">
|
||||
<text v-if="false" class="icon flex flex-center"><text class="iconfont icon-check text-size-s"></text></text>
|
||||
<image class="avatar-img" :src="bloggerInfo.avatar" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="avatar"><image class="avatar-img" :src="bloggerInfo.avatar" mode="aspectFill"></image></view>
|
||||
<view class="nickname mt-24 text-weight-b text-size-g">{{ bloggerInfo.nickname }}</view>
|
||||
<view class="desc mt-24 text-size-m text-grey-darken-3">{{ bloggerInfo.description }}</view>
|
||||
<view class="desc mt-24 text-size-m text-grey-darken-3">{{ bloggerInfo.description || '这个博主很懒,竟然没写介绍~' }}</view>
|
||||
<!-- 联系图标 -->
|
||||
<view class="mt-24 contact-icons">
|
||||
<!-- 放全部:似乎显得有点拥挤 -->
|
||||
@ -19,7 +16,7 @@
|
||||
<text class="ml-12 halocoloricon halocoloricon-gitee"></text>
|
||||
<text class="ml-12 halocoloricon halocoloricon-ic_email_round"></text>
|
||||
</view>
|
||||
<view class="mt-24 ">
|
||||
<view v-if="false" class="mt-24 ">
|
||||
<tm-button theme="bg-gradient-light-blue-accent" size="m" openType="contact">在线客服联系</tm-button>
|
||||
<tm-button theme="bg-gradient-orange-accent" size="m" @click="fnOnToWeb">访问PC端博客</tm-button>
|
||||
</view>
|
||||
@ -129,7 +126,7 @@ export default {
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.fnSetPageTitle('❤');
|
||||
this.fnSetPageTitle('联系博主');
|
||||
},
|
||||
created() {
|
||||
this.fnGetData();
|
||||
@ -185,19 +182,6 @@ export default {
|
||||
border: 6rpx solid #fff;
|
||||
box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.07);
|
||||
overflow: hidden;
|
||||
.icon {
|
||||
width: 42rpx;
|
||||
height: 42rpx;
|
||||
position: absolute;
|
||||
right: 6rpx;
|
||||
bottom: 0rpx;
|
||||
border-radius: 50%;
|
||||
color: #fff;
|
||||
box-sizing: border-box;
|
||||
background-color: #03b0fd;
|
||||
border: 4rpx solid #fff;
|
||||
z-index: 2;
|
||||
}
|
||||
&-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
@ -6,10 +6,10 @@
|
||||
<tm-skeleton model="listAvatr"></tm-skeleton>
|
||||
</view>
|
||||
<!-- 内容区域 -->
|
||||
<view v-else class="app-page-content bg-white pa-24">
|
||||
<view v-else class="app-page-content pa-24" :class="{ 'bg-white': dataList.length !== 0 }">
|
||||
<view v-if="dataList.length == 0" class="content-empty flex flex-center">
|
||||
<!-- 空布局 -->
|
||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="该分类下暂无数据"></tm-empty>
|
||||
<tm-empty icon="icon-shiliangzhinengduixiang-" label="啊偶,博主还没有留言~"></tm-empty>
|
||||
</view>
|
||||
<block v-else>
|
||||
<block v-for="(item, index) in dataList" :key="index">
|
||||
@ -28,9 +28,9 @@
|
||||
</tm-translate>
|
||||
</block>
|
||||
<tm-flotbutton :offset="[16, 80]" @click="fnToTopPage" size="m" color="light-blue" icon="icon-angle-up"></tm-flotbutton>
|
||||
<tm-flotbutton actions-pos="left" :show-text="true" color="bg-gradient-orange-accent" @click="fnToComment(null)"></tm-flotbutton>
|
||||
<view class="load-text">{{ loadMoreText }}</view>
|
||||
</block>
|
||||
<tm-flotbutton actions-pos="left" :show-text="true" color="bg-gradient-orange-accent" @click="fnToComment(null)"></tm-flotbutton>
|
||||
</view>
|
||||
|
||||
<!-- 评论详情 -->
|
||||
@ -164,6 +164,7 @@ export default {
|
||||
.then(res => {
|
||||
if (res.status == 200) {
|
||||
this.loading = 'success';
|
||||
// return;
|
||||
this.loadMoreText = res.data.hasNext ? '上拉加载更多' : '呜呜,没有更多数据啦~';
|
||||
// 处理数据
|
||||
this.result = res.data;
|
||||
@ -252,12 +253,18 @@ export default {
|
||||
width: 100vw;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #fafafd;
|
||||
}
|
||||
.app-page-content {
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0rpx 0rpx 24rpx rgba(0, 0, 0, 0.05);
|
||||
// box-shadow: 0rpx 0rpx 24rpx rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
.content-empty {
|
||||
width: 100%;
|
||||
height: 60vh;
|
||||
}
|
||||
.loading-wrap {
|
||||
box-sizing: border-box;
|
||||
padding: 24rpx;
|
||||
}
|
||||
</style>
|
||||
|
@ -148,6 +148,8 @@ export default {
|
||||
isBlackTheme: false,
|
||||
loading: true,
|
||||
appSettings: {},
|
||||
isSaved: true,
|
||||
firstLoad: true,
|
||||
homeLayout: {
|
||||
list: [{ name: '一行一列', value: 'h_row_col1' }, { name: '一行两列', value: 'h_row_col2' }],
|
||||
selectDefault: ['一行一列'],
|
||||
@ -169,15 +171,17 @@ export default {
|
||||
dotPositionList: [{ name: '右边', value: 'right', checked: true }, { name: '下边', value: 'bottom', checked: false }]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 获取设置
|
||||
_appSettings() {
|
||||
return uni.$tm.vx.getters().setting.getSettings;
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
_appSettings(val) {
|
||||
this.appSettings = val;
|
||||
appSettings: {
|
||||
deep: true,
|
||||
handler() {
|
||||
if (this.firstLoad) {
|
||||
this.firstLoad = false;
|
||||
} else {
|
||||
this.isSaved = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -185,7 +189,7 @@ export default {
|
||||
this.fnSetPageTitle('应用设置');
|
||||
},
|
||||
created() {
|
||||
this.appSettings = this._appSettings;
|
||||
this.appSettings = uni.$tm.vx.getters().setting.getSettings;
|
||||
this.fnHandleFormatSelect();
|
||||
uni.showLoading({
|
||||
title: '加载中...',
|
||||
@ -242,6 +246,7 @@ export default {
|
||||
},
|
||||
// 保存
|
||||
fnOnSave() {
|
||||
this.isSaved = true;
|
||||
this.$tm.vx.commit('setting/setSettings', this.appSettings);
|
||||
uni.$tm.toast('保存成功,部分设置在重启后生效!');
|
||||
},
|
||||
@ -257,12 +262,16 @@ export default {
|
||||
confirmColor: '#03a9f4'
|
||||
})
|
||||
.then(res => {
|
||||
this.isSaved = true;
|
||||
uni.$tm.vx.actions('setting/updateDefaultAppSettings');
|
||||
uni.$tm.toast('系统设置已恢复为默认配置,部分设置在重启后生效!');
|
||||
})
|
||||
.catch(err => {});
|
||||
},
|
||||
fnOnBack() {
|
||||
if (this.isSaved) {
|
||||
uni.navigateBack();
|
||||
}
|
||||
uni.$eShowModal({
|
||||
title: '提示',
|
||||
content: '您当前可能有未保存的数据,确定返回吗?',
|
||||
@ -274,6 +283,7 @@ export default {
|
||||
})
|
||||
.then(res => {
|
||||
uni.navigateBack();
|
||||
this.isSaved = true;
|
||||
})
|
||||
.catch(err => {});
|
||||
}
|
||||
|
@ -151,7 +151,8 @@ export default {
|
||||
form: {
|
||||
content: '',
|
||||
keepRaw: true,
|
||||
sourceContent: '',
|
||||
originalContent: '',
|
||||
formatContent: '',
|
||||
type: 'PUBLIC'
|
||||
},
|
||||
modal: null,
|
||||
@ -532,9 +533,10 @@ export default {
|
||||
return uni.$tm.toast('请输入内容!');
|
||||
}
|
||||
this.form.content = _content;
|
||||
this.form.sourceContent = this.$refs.markdown.getText();
|
||||
this.form.formatContent = _content;
|
||||
this.form.originalContent = this.$refs.markdown.getText();
|
||||
uni.setStorageSync('posts-content', _content);
|
||||
uni.setStorageSync('posts-content-source', this.form.sourceContent);
|
||||
uni.setStorageSync('posts-content-source', this.form.originalContent);
|
||||
if (this.form.id) {
|
||||
this.$Router.push({
|
||||
path: '/pagesB/articles/article-setting',
|
||||
|
@ -151,7 +151,7 @@
|
||||
<!-- 操作区域 -->
|
||||
<view class="btn-bar flex flex-center bg-white">
|
||||
<tm-button theme="blue" :shadow="0" block :height="70" @click="fnOnSave(false, false)">立即保存</tm-button>
|
||||
<tm-button theme="light-blue" :shadow="0" block :height="70" @click="fnOnSave(false, true)">保存并返回</tm-button>
|
||||
<tm-button v-if="isEdit" theme="light-blue" :shadow="0" block :height="70" @click="fnOnSave(false, true)">保存并返回</tm-button>
|
||||
<!-- <block v-if="from == 'edit' && isEdit">
|
||||
<tm-button
|
||||
v-if="article.status == 'DRAFT' || article.status == 'INTIMATE' || article.status == 'RECYCLE'"
|
||||
@ -357,10 +357,21 @@ export default {
|
||||
list: ['常规', '高级', 'SEO']
|
||||
},
|
||||
article: {
|
||||
title: '',
|
||||
slug: '',
|
||||
status: '',
|
||||
content: '',
|
||||
keepRaw: true,
|
||||
sourceContent: '',
|
||||
type: 'PUBLIC'
|
||||
topPriority: 0,
|
||||
summary: '',
|
||||
password: '',
|
||||
originalContent: '',
|
||||
metaDescription: '',
|
||||
formatContent: '',
|
||||
editorType: 'MARKDOWN',
|
||||
createTime: '',
|
||||
categoryIds: [],
|
||||
tagIds: []
|
||||
},
|
||||
articleStatus: {
|
||||
list: [{ name: '发布', value: 'PUBLISHED' }, { name: '私有', value: 'INTIMATE' }, { name: '草稿', value: 'DRAFT' }, { name: '回收站', value: 'RECYCLE' }],
|
||||
@ -397,6 +408,9 @@ export default {
|
||||
this.from = from;
|
||||
this.createTime = uni.$tm.dayjs(new Date().getTime()).format('YYYY-MM-DD HH:mm:ss');
|
||||
this.fnGetSettings();
|
||||
|
||||
console.log(uni.getStorageSync('posts-content'));
|
||||
console.log(uni.getStorageSync('posts-content-source'));
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
if (this.isEdit == false) {
|
||||
@ -533,7 +547,7 @@ export default {
|
||||
}
|
||||
this.createTime = uni.$tm.dayjs(new Date(this.article.createTime).getTime()).format('YYYY-MM-DD HH:mm:ss');
|
||||
if (this.postTitle) {
|
||||
this.article.title = this.postTitle;
|
||||
this.$set(this.article, 'title', this.postTitle);
|
||||
}
|
||||
}
|
||||
const _cateRes = res[1];
|
||||
@ -577,6 +591,7 @@ export default {
|
||||
})
|
||||
.catch(err => {
|
||||
this.$tm.toast('数据加载失败,请重试!');
|
||||
console.log(err);
|
||||
this.loading = 'error';
|
||||
})
|
||||
.finally(() => {
|
||||
@ -626,7 +641,8 @@ export default {
|
||||
// 设置文章内容
|
||||
if (this.from == 'edit') {
|
||||
this.article.content = uni.getStorageSync('posts-content');
|
||||
this.article.sourceContent = uni.getStorageSync('posts-content-source');
|
||||
this.article.formatContent = uni.getStorageSync('posts-content');
|
||||
this.article.originalContent = uni.getStorageSync('posts-content-source');
|
||||
}
|
||||
if (this.articleStatus.selectValue != 'INTIMATE') {
|
||||
this.article.password = '';
|
||||
@ -651,8 +667,7 @@ export default {
|
||||
delta: 1
|
||||
});
|
||||
}
|
||||
|
||||
uni.$emit('refresh-article-list');
|
||||
// uni.$emit('refresh-article-list');
|
||||
}, 1000);
|
||||
} else {
|
||||
uni.$tm.toast('保存失败,请重试!');
|
||||
@ -662,13 +677,12 @@ export default {
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
uni.$tm.toast('保存失败,请重试!');
|
||||
uni.$tm.toast(`保存失败,${err.message}!`);
|
||||
if (isChangeStatus) {
|
||||
this.article.status = this.article.status == 'DRAFT' ? 'PUBLISHED' : 'DRAFT';
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.article.content = this.article.sourceContent = uni.getStorageInfoSync();
|
||||
this.$httpApi.admin
|
||||
.createPosts(this.article)
|
||||
.then(res => {
|
||||
@ -678,12 +692,9 @@ export default {
|
||||
uni.setStorageSync('posts-content', '');
|
||||
uni.setStorageSync('posts-content-source', '');
|
||||
setTimeout(() => {
|
||||
if (isBack) {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
}
|
||||
|
||||
uni.navigateBack({
|
||||
delta: 2
|
||||
});
|
||||
uni.$emit('refresh-article-list');
|
||||
}, 1000);
|
||||
} else {
|
||||
@ -691,7 +702,7 @@ export default {
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
uni.$tm.toast('发布失败,请重试!');
|
||||
uni.$tm.toast(`发布失败:${err.message}`);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -36,7 +36,7 @@ export const _DefaultAppSettings = {
|
||||
},
|
||||
gallery: {
|
||||
// 是否使用瀑布流
|
||||
useWaterfull: false
|
||||
useWaterfull: true
|
||||
},
|
||||
links: {
|
||||
// 是否使用简约模式
|
||||
|
51
utils/halo.logs.js
Normal file
51
utils/halo.logs.js
Normal file
@ -0,0 +1,51 @@
|
||||
/**
|
||||
* 日志工具
|
||||
*/
|
||||
const LOG_NAME = 'APP_CONFIG_LOG'
|
||||
|
||||
export const logTypes = {
|
||||
config: 'BASE_CONFIG'
|
||||
}
|
||||
export const logTypesMap = {
|
||||
BASE_CONFIG: '基础配置'
|
||||
}
|
||||
export const logUtils = {
|
||||
|
||||
/**
|
||||
* @param {Object} type 日志类型
|
||||
* @param {Object} msg 日志信息
|
||||
*/
|
||||
saveLog(type, data) {
|
||||
const {
|
||||
msg,
|
||||
page,
|
||||
path
|
||||
} = data;
|
||||
let _logs = this.getLogs()
|
||||
const logMsgObj = {
|
||||
time: new Date().getTime(),
|
||||
type: type,
|
||||
typeText: logTypesMap[type],
|
||||
page: page || '',
|
||||
path: path || '',
|
||||
msg: msg
|
||||
}
|
||||
_logs.push(logMsgObj)
|
||||
uni.setStorageSync(LOG_NAME, JSON.stringify(_logs))
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取所有的日志
|
||||
*/
|
||||
getLogs() {
|
||||
let _logs = uni.getStorageSync(LOG_NAME)
|
||||
return _logs ? JSON.parse(_logs) : [];
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除所有日志
|
||||
*/
|
||||
removeLogs() {
|
||||
uni.removeStorageSync(LOG_NAME)
|
||||
},
|
||||
}
|
@ -11,7 +11,10 @@
|
||||
*/
|
||||
|
||||
import HaloConfig from '@/config/halo.config.js';
|
||||
|
||||
import {
|
||||
logTypes,
|
||||
logUtils
|
||||
} from '@/utils/halo.logs.js'
|
||||
const utils = {
|
||||
/**
|
||||
* 检查是否为http/https链接
|
||||
@ -30,14 +33,29 @@ const utils = {
|
||||
|
||||
// 检查封面图
|
||||
checkThumbnailUrl: function(thumbnail) {
|
||||
if (!thumbnail) return HaloConfig.defaultThumbnailUrl + `&r=${new Date().getTime()}`;
|
||||
if (!HaloConfig.defaultThumbnailUrl) {
|
||||
// logUtils.saveLog(logTypes.config, {
|
||||
// path: 'checkThumbnailUrl',
|
||||
// page: 'checkThumbnailUrl',
|
||||
// msg: '未配置默认的封面图,配置参数【HaloConfig.defaultThumbnailUrl】'
|
||||
// })
|
||||
}
|
||||
let _url = HaloConfig.defaultThumbnailUrl
|
||||
if (_url) {
|
||||
_url = _url.indexOf('?') !== -1 ? _url : _url + `&r=${new Date().getTime()}`
|
||||
}
|
||||
if (!thumbnail) return _url;
|
||||
if (!this.checkIsUrl(thumbnail)) return HaloConfig.apiUrl + thumbnail;
|
||||
return thumbnail
|
||||
},
|
||||
|
||||
// 检查图片
|
||||
checkImageUrl: function(image) {
|
||||
if (!image) return HaloConfig.defaultImageUrl + `&r=${new Date().getTime()}`;
|
||||
let _url = HaloConfig.defaultImageUrl
|
||||
if (_url) {
|
||||
_url = _url.indexOf('?') !== -1 ? _url : _url + `&r=${new Date().getTime()}`
|
||||
}
|
||||
if (!image) return _url;
|
||||
if (!this.checkIsUrl(image)) return HaloConfig.apiUrl + image;
|
||||
return image
|
||||
},
|
||||
@ -46,7 +64,11 @@ const utils = {
|
||||
checkAvatarUrl: function(avatar, isAdmin = false) {
|
||||
if (isAdmin) return HaloConfig.author.avatar;
|
||||
if (!avatar) {
|
||||
return HaloConfig.defaultAvatarUrl + `&r=${new Date().getTime()}`;
|
||||
let _url = HaloConfig.defaultAvatarUrl
|
||||
if (_url) {
|
||||
_url = _url.indexOf('?') !== -1 ? _url : _url + `&r=${new Date().getTime()}`
|
||||
}
|
||||
return _url;
|
||||
}
|
||||
if (!this.checkIsUrl(avatar)) return HaloConfig.apiUrl + avatar;
|
||||
return avatar
|
||||
|
Loading…
Reference in New Issue
Block a user