This commit is contained in:
aihe 2024-06-13 16:10:41 +08:00
parent 6791877c76
commit c45554946b
3 changed files with 41 additions and 4 deletions

View File

@ -64,6 +64,21 @@
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
}
.label-text{
position: relative;
display: inline-block;
margin-right: 20rpx;
}
.label-text-required{
&::after{
position: absolute;
font-size: 34rpx;
content: '*';
color: $uni-color-primary;
right: -16rpx;
top: 8%;
}
}
%blcok {
margin-top: 30rpx;
border-radius: 30rpx;

View File

@ -11,6 +11,10 @@ const tabBarUrls = [
]
const goto = (url, type = 1)=> {
if(!url) {
console.error("goto 缺少入参 url=========")
return
}
url = `/pages/${url}`
if(tabBarUrls.indexOf(url) > -1) {
return uni.switchTab({
@ -50,11 +54,13 @@ const showToast = (val)=> {
uni.showToast({ title: val, icon: 'none' })
}
const confirmModal = (title) => {
const confirmModal = (title, opt = {}) => {
return new Promise((resolve)=> {
uni.showModal({ content: title, confirmColor: '#B12D29' }).then((res)=> {
uni.showModal({ content: title, confirmColor: '#B12D29', ...opt }).then((res)=> {
if(res.confirm) {
resolve()
resolve(true)
} else {
resolve(false)
}
})
})
@ -246,6 +252,20 @@ const promiseTimeout = (time) => {
})
}
const setNavigationBarTitle = (title)=> {
uni.setNavigationBarTitle({
title
})
}
const reloadCurrentPage = (_thisPage)=> {
let { fullPath } = _thisPage.$page
uni.redirectTo({
url: fullPath
});
}
export {
reLaunch,
goto,
@ -265,4 +285,6 @@ export {
getImageInfo,
uniPromiseApi,
promiseTimeout,
setNavigationBarTitle,
reloadCurrentPage,
}

View File

@ -4,7 +4,7 @@ const checkParams = (param, validConfig)=> {
let errMsg = ''
Object.keys(validConfig).map(key=> {
const itemConf = validConfig[key]
if(!errMsg && itemConf.required && !param[key]) {
if(!errMsg && itemConf.required && (!param[key] || param[key]?.length == 0)) {
errMsg = itemConf.requiredMsg || `${itemConf.label}不能为空`
}
let customerValidMsg = itemConf?.validMsgFun?.({ val: param })