1
0
鏡像自 https://github.com/ialley-workshop-open/uni-halo.git 已同步 2026-06-11 12:49:30 +08:00
Files
uni-halo/utils/app.js
T
小莫唐尼 3702cb1618 新增:联系博主页面顶部返回按钮;
修复:修复 默认封面图、默认图片、默认头像在使用随机api时候无法显示的BUG;
修复:后台管理新增文章发布失败BUG;
删除:去除联系博主页面中的 联系博主 按钮;
优化:对友链页面进行重写;
优化:对部分页面和功能进行优化。
2022-12-09 00:24:39 +08:00

79 行
1.8 KiB
JavaScript

export const Platform = {
ios: 'ios',
android: 'android'
}
/**
* 检查当前环境是什么环境
*/
export const checkPlatform = (name) => {
return uni.getSystemInfoSync().platform == name;
}
// 默认的应用设置
export const _DefaultAppSettings = {
showStartPage: false, // 是否每次启动都显示启动页
banner: {
useDot: true,
dotPosition: 'right'
},
// 布局配置
layout: {
// h_row_col1 = 一行一列
// h_row_col2 = 一行两列
home: 'h_row_col1',
// lr_image_text=左图右文
// lr_text_image=左文右图
// tb_image_text=上图下文
// tb_text_image=上文下图
// only_text=仅文字
cardType: 'lr_image_text',
},
// 广告配置(todo)
ad: {
timeout: 3, // 屏蔽广告时长,时间到后自动恢复展示(单位小时)
disabled: false, // 是否屏蔽广告(看广告可以关闭应用内设置的广告)
},
gallery: {
// 是否使用瀑布流
useWaterfull: true
},
links: {
// 是否使用简约模式
useSimple: false,
useGroup: false,
},
about: {
showAdmin: false, // 显示后台登录入口
showAllCount: true, // 默认显示所有的统计信息(关于页面)
},
// 文章配置
article: {
},
// 联系博主页面
contact: {
// 链接是否使用复制的方式,否则直接在内部打开(小程序需要配置对应链接的业务域名)
isLinkCopy: true,
}
}
/**
* 获取应用设置
*/
export const getAppSettings = () => {
let _appSettings = uni.getStorageSync('APP_GLOBAL_SETTINGS')
if (_appSettings) return JSON.parse(_appSettings)
uni.setStorageSync('APP_GLOBAL_SETTINGS', JSON.stringify(_DefaultAppSettings))
return _appSettings;
}
/**
* 保存应用设置
*/
export const setAppSettings = (appSettings) => {
uni.setStorageSync('APP_GLOBAL_SETTINGS', JSON.stringify(appSettings))
}