You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

184 lines
4.0 KiB
Vue

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<script setup>
/**
* name
* usersa0ChunLuyu
* date2024年8月7日 20:05:05
*/
import {
ref
} from 'vue'
import {
$api,
$response,
} from '@/api'
import {
onShow,
onHide,
onLoad,onError
} from '@dcloudio/uni-app'
import {
useStore
} from '@/store'
const $store = useStore()
const setConfigStore = () => {
const config_str = uni.getStorageSync('CONFIG_CONFIG')
const config = JSON.parse(config_str)
$store.config = config
if (!config.color) {
document.body.classList.toggle('grayscale');
}
const openid_str = uni.getStorageSync('OPENID')
let url = window.location.href
if (!openid_str) {
if (url.indexOf('/pages/main/login/login') === -1) {
uni.redirectTo({
url: '/pages/main/login/login'
})
}
}
const save_info_str = uni.getStorageSync('SAVE_INFO')
if (!!save_info_str) {
$store.save_info = JSON.parse(save_info_str)
} else {
$store.resetSaveInfo()
}
}
const getConfigConfig = async () => {
const response = await $api('ConfigConfig')
$response(response, () => {
uni.setStorageSync('CONFIG_CONFIG', JSON.stringify(response.data.config))
setConfigStore()
})
}
const getConfigVersion = async () => {
const response = await $api('ConfigVersion')
$response(response, () => {
const config_version = uni.getStorageSync('CONFIG_VERSION')
let get_config = false
if (!config_version) {
get_config = true
} else {
if (config_version !== response.data.version) {
get_config = true
}
}
uni.setStorageSync('CONFIG_VERSION', response.data.version)
//if (!!get_config) {
if (true) {
getConfigConfig()
} else {
setConfigStore()
}
})
}
const handleFontSize=()=> {
// 设置网页字体为默认大小
WeixinJSBridge.invoke('setFontSizeCallback', {
'fontSize': 0
});
// 重写设置网页字体大小的事件
WeixinJSBridge.on('menu:setfont', function() {
WeixinJSBridge.invoke('setFontSizeCallback', {
'fontSize': 0
});
});
}
onShow(() => {
if (typeof WeixinJSBridge == "object" && typeof WeixinJSBridge.invoke == "function") {
handleFontSize();
} else {
if (document.addEventListener) {
document.addEventListener("WeixinJSBridgeReady", handleFontSize, false);
} else if (document.attachEvent) {
document.attachEvent("WeixinJSBridgeReady", handleFontSize);
document.attachEvent("onWeixinJSBridgeReady", handleFontSize);
}
}
console.log(`\n %c 鹿和 %c https://sa0.online/ \n\n`, 'color: #ffffff; background: #fd6b60; padding:5px 0;',
'color: #fd6b60;background: #ffffff; padding:5px 0;')
getConfigVersion()
})
onLoad(()=>{
})
</script>
<style lang="scss">
/*每个页面公共css */
@import '@/uni_modules/uni-scss/index.scss';
/* #ifndef APP-NVUE */
@import '@/static/customicons.css';
/* #endif */
.grayscale {
filter: grayscale(100%);
}
// 设置整个项目的背景色
page {
background-color: #f5f5f5;
}
.bottom_blank_wrapper {
height: calc(20rpx + var(--safe-area-inset-bottom));
}
.botm_blank_wrapper {
width: 100%;
height: 20rpx;
}
.top_blank_wrapper::after {
content: ".";
}
.top_blank_wrapper {
height: 0;
width: 100%;
opacity: 0;
}
.navbar_blank_wrapper {
height: calc(100rpx + var(--safe-area-inset-top));
}
.input_line_wrapper {
display: flex;
align-items: center;
flex-wrap: wrap;
justify-content: space-between;
}
.input_line_tag_wrapper {
width: 200rpx;
height: 60rpx;
line-height: 60rpx;
text-align: center;
background: #f9f9f9;
font-size: 26rpx;
font-weight: bold;
border-radius: 6rpx;
}
.input_line_input_wrapper {
width: 500rpx;
}
</style>
<style>
@import "@/static/iconfont.css";
/* #ifdef H5 */
body { /* IOS禁止微信调整字体大小 */
-webkit-text-size-adjust: 100% !important;
text-size-adjust: 100% !important;
-moz-text-size-adjust: 100% !important;
}
/* #endif */
</style>