jiangchengfeiyi-xiaochengxu/common/globalFont.js

70 lines
1.8 KiB
JavaScript
Raw Normal View History

2025-03-24 03:33:28 +00:00
import { bkgPubilcPath,loginUrl } from "./globalImagesUrl";
import { ref } from 'vue';
// const bkgUrl = ref('https://www.carboner.cn:8888/api/file/downloadFile?objectKey=feiyi/miniProgram/login/bkg.png')
2025-03-24 03:33:28 +00:00
//缓存背景图片
// const bkgCache = 'bkgCache'; //缓存的键
2025-03-24 03:33:28 +00:00
export const getFonts =()=>{ //改为查询背景图片
// wx.getStorage({
// key: bkgCache,
// success: (res) => {
// console.log('缓存图片的路径--->',res.data);
// bkgPubilcPath.value = res.data
// },
// fail: ()=> {
// wx.downloadFile({
// url: 'https://www.carboner.cn:8888/api/file/downloadFile?objectKey=feiyi/miniProgram/login/bkg.png',
// success: (res) => {
// console.log('成功res--->',res);
// if(res.statusCode === 200) {
// const filePath = res.tempFilePath;
// wx.setStorage({
// key: bkgCache,
// data: filePath
// });
// console.log('图片下载并缓存成功,本地路径--->',filePath);
// bkgPubilcPath.value= filePath
// } else {
// console.log('图片下载失败');
// }
// },
// fail: (err) => {
// console.log('下载失败',err);
// }
// })
// }
// })
2025-03-19 07:16:09 +00:00
}
export const getZSFont = () => {
uni.loadFontFace({
family: 'ZhongShanFonts',
2025-03-19 08:22:28 +00:00
source: `url("https://www.carboner.cn:8888/api/file/download/ZhongShanFonts.ttf")`,
2025-04-05 08:12:09 +00:00
global: true,
2025-03-19 07:16:09 +00:00
success:(res) =>{
2025-04-05 08:12:09 +00:00
console.log('字体调用成功');
2025-03-19 07:16:09 +00:00
},
fail:(err) => {
console.log('err',err);
}
})
}
//欢迎页
export const getFZXZFont = () => {
uni.loadFontFace({
family: 'FangZhengXiaoZhuan',
2025-03-19 08:22:28 +00:00
source: `url("https://www.carboner.cn:8888/api/file/download/FangZhengXiaoZhuan.ttf")`,
2025-04-05 08:12:09 +00:00
global: true,
2025-03-19 07:16:09 +00:00
success:(res) =>{
2025-04-05 08:12:09 +00:00
console.log('字体调用成功');
2025-03-19 07:16:09 +00:00
},
fail:(err) => {
console.log('err',err);
}
})
}