Fix uniapp v2 login and sass compatibility

This commit is contained in:
danaisuiyuan
2026-05-03 15:56:26 +08:00
parent 8472bb4639
commit 79436c011c
75 changed files with 188 additions and 147 deletions

View File

@@ -28,6 +28,23 @@ import {
} from './../config/cache';
import Routine from '@/libs/routine';
function normalizeRoutineAuthTypes(config = {}) {
let types = config.routine_auth_type;
if (Array.isArray(types)) return types.map(item => Number(item));
if (typeof types === 'string') return types.split(',').map(item => Number(item));
return [];
}
function isRoutineWechatAuth(config = {}) {
const authTypes = normalizeRoutineAuthTypes(config);
return Number(config.wechat_auth_switch) === 1 || authTypes.includes(1);
}
function isRoutinePhoneAuth(config = {}) {
const authTypes = normalizeRoutineAuthTypes(config);
return Number(config.phone_auth_switch) === 1 || authTypes.includes(2);
}
function prePage() {
let pages = getCurrentPages();
let prePage = pages[pages.length - 1];
@@ -56,7 +73,7 @@ function _toLogin(push, pathLogin) {
if (!pathLogin)
pathLogin = '/page/users/login/index'
Cache.set('login_back_url', path);
const BASIC_CONFIG = uni.getStorageSync('BASIC_CONFIG');
const BASIC_CONFIG = uni.getStorageSync('BASIC_CONFIG') || {};
// #ifdef H5
if (isWeixin() && BASIC_CONFIG.wechat_status) {
uni.navigateTo({
@@ -72,7 +89,7 @@ function _toLogin(push, pathLogin) {
// #ifdef MP
let url
if (!BASIC_CONFIG.wechat_auth_switch) {
if (!isRoutineWechatAuth(BASIC_CONFIG) && isRoutinePhoneAuth(BASIC_CONFIG)) {
url = '/pages/users/binding_phone/index?pageType=0'
} else {
url = '/pages/users/wechat_login/index'
@@ -121,4 +138,4 @@ export function checkLogin() {
return true;
}
}
}