mirror of
https://gitee.com/h_mo/uniapp-vue3-vite-ts-template
synced 2025-04-05 06:12:44 +08:00
style: 格式化代码
This commit is contained in:
parent
6585c1bdbe
commit
36d036e086
@ -7,9 +7,9 @@ const WeappTailwindcssDisabled = isH5 || isApp;
|
||||
const isMp = !isH5 && !isApp;
|
||||
|
||||
export {
|
||||
isH5,
|
||||
isApp,
|
||||
WeappTailwindcssDisabled,
|
||||
isMp,
|
||||
currentPlatform,
|
||||
isApp,
|
||||
isH5,
|
||||
isMp,
|
||||
WeappTailwindcssDisabled,
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
import tailwindcss from 'tailwindcss';
|
||||
import autoprefixer from 'autoprefixer';
|
||||
import type { AcceptedPlugin } from 'postcss';
|
||||
import autoprefixer from 'autoprefixer';
|
||||
import tailwindcss from 'tailwindcss';
|
||||
import cssMacro from 'weapp-tailwindcss/css-macro/postcss';
|
||||
|
||||
const plugins: AcceptedPlugin[] = [tailwindcss(), autoprefixer()];
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { createAlovaMockAdapter } from '@alova/mock';
|
||||
import { uniappMockResponse, uniappRequestAdapter } from '@alova/adapter-uniapp';
|
||||
import { mockGroupV1 } from '@/mock/v1';
|
||||
import { uniappMockResponse, uniappRequestAdapter } from '@alova/adapter-uniapp';
|
||||
import { createAlovaMockAdapter } from '@alova/mock';
|
||||
|
||||
/**
|
||||
* 模拟数据请求适配器
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ResultEnum } from '@/enums/httpEnum';
|
||||
import type { API } from '@/services/model/baseModel';
|
||||
import { ResultEnum } from '@/enums/httpEnum';
|
||||
|
||||
interface MockResponseOptions<T = any> {
|
||||
status: number
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { defineMock } from '@alova/mock';
|
||||
import { join, random, sampleSize } from 'lodash-es';
|
||||
import multiavatar from '@multiavatar/multiavatar';
|
||||
import { createMock } from '@/mock/utils';
|
||||
import { ResultEnum } from '@/enums/httpEnum';
|
||||
import { createMock } from '@/mock/utils';
|
||||
import { getRandomChsString } from '@/utils/character';
|
||||
import { defineMock } from '@alova/mock';
|
||||
import multiavatar from '@multiavatar/multiavatar';
|
||||
import { join, random, sampleSize } from 'lodash-es';
|
||||
|
||||
function createRandomToken(len = 36 * 6) {
|
||||
const token = join(sampleSize('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._-', len), '');
|
||||
|
@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { omit } from 'lodash-es';
|
||||
import { useUserStore } from '@/stores/modules/user';
|
||||
import { Toast } from '@/utils/uniapi/prompt';
|
||||
import { omit } from 'lodash-es';
|
||||
|
||||
const pageQuery = ref<Record<string, any> | undefined>(undefined);
|
||||
onLoad((query) => {
|
||||
@ -25,7 +25,7 @@ function submit(e: any) {
|
||||
const params = omit(unref(pageQuery), ['redirect', 'tabBar']);
|
||||
if (unref(pageQuery)) {
|
||||
// 这里replace方法无法跳转tabbar页面故改为replaceAll
|
||||
// eslint-disable-next-line ts/no-unused-expressions
|
||||
|
||||
unref(pageQuery)?.tabBar === 'true'
|
||||
? router.replaceAll({ name: unref(pageQuery)?.redirect, params })
|
||||
: router.replace({ name: unref(pageQuery)?.redirect, params });
|
||||
|
@ -1,6 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import BasicButton from '@/components/BasicButton/index.vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
|
||||
const go = ref<string>('');
|
||||
const router = useRouter();
|
||||
|
@ -1,9 +1,9 @@
|
||||
import type { App } from 'vue';
|
||||
/**
|
||||
* router
|
||||
* @see https://gitee.com/fant-mini/uni-mini-router
|
||||
*/
|
||||
import { createRouter } from 'uni-mini-router';
|
||||
import type { App } from 'vue';
|
||||
import { createRouterGuard } from './guard';
|
||||
|
||||
const router = createRouter({
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { request } from '@/utils/http';
|
||||
import type { UserInfoModel } from '@/services/model/userModel';
|
||||
import { request } from '@/utils/http';
|
||||
|
||||
enum Api {
|
||||
GET_USER_INFO = '/users',
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { getUserInfoApi } from '@/services/api/user';
|
||||
import type { UserInfoModel } from '@/services/model/userModel';
|
||||
import { TOKEN_KEY } from '@/enums/cacheEnum';
|
||||
import { login as loginApi } from '@/services/api/auth';
|
||||
import { getUserInfoApi } from '@/services/api/user';
|
||||
import { getToken, isLogin, setToken } from '@/utils/auth';
|
||||
import { removeCache } from '@/utils/cache';
|
||||
import { TOKEN_KEY } from '@/enums/cacheEnum';
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
export const useUserStore = defineStore('UserStore', () => {
|
||||
const token = ref<string | null>(null);
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { getCache, setCache } from '@/utils/cache';
|
||||
import { TOKEN_KEY } from '@/enums/cacheEnum';
|
||||
import { getCache, setCache } from '@/utils/cache';
|
||||
|
||||
const authenticationScheme = 'Bearer';
|
||||
|
||||
|
2
src/utils/cache/index.ts
vendored
2
src/utils/cache/index.ts
vendored
@ -1,6 +1,6 @@
|
||||
import type { CreateStorageParams } from './storageCache';
|
||||
import { cacheCipher, DEFAULT_CACHE_TIME, DEFAULT_PREFIX_KEY, enableStorageEncryption } from '@/settings/encryptionSetting';
|
||||
import { createStorage } from './storageCache';
|
||||
import { DEFAULT_CACHE_TIME, DEFAULT_PREFIX_KEY, cacheCipher, enableStorageEncryption } from '@/settings/encryptionSetting';
|
||||
|
||||
const options: Partial<CreateStorageParams> = {
|
||||
prefixKey: DEFAULT_PREFIX_KEY,
|
||||
|
2
src/utils/cache/storageCache.ts
vendored
2
src/utils/cache/storageCache.ts
vendored
@ -1,5 +1,5 @@
|
||||
import { cacheCipher } from '@/settings/encryptionSetting';
|
||||
import type { EncryptionParams } from '@/utils/cipher';
|
||||
import { cacheCipher } from '@/settings/encryptionSetting';
|
||||
import { AesEncryption } from '@/utils/cipher';
|
||||
import { isNullOrUnDef } from '@/utils/is';
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { random } from 'lodash-es';
|
||||
import multiavatar from '@multiavatar/multiavatar';
|
||||
import { random } from 'lodash-es';
|
||||
|
||||
const CHS_RANGE_START = 0x4E00; // 简体中文编码范围开始
|
||||
const CHS_RANGE_END = 0x9FA5; // 简体中文编码范围结束
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { decrypt, encrypt } from 'crypto-js/aes';
|
||||
import UTF8, { parse } from 'crypto-js/enc-utf8';
|
||||
import pkcs7 from 'crypto-js/pad-pkcs7';
|
||||
import ECB from 'crypto-js/mode-ecb';
|
||||
import md5 from 'crypto-js/md5';
|
||||
|
||||
import Base64 from 'crypto-js/enc-base64';
|
||||
import UTF8, { parse } from 'crypto-js/enc-utf8';
|
||||
import md5 from 'crypto-js/md5';
|
||||
import ECB from 'crypto-js/mode-ecb';
|
||||
|
||||
import pkcs7 from 'crypto-js/pad-pkcs7';
|
||||
|
||||
export interface EncryptionParams {
|
||||
key: string
|
||||
|
@ -1,5 +1,5 @@
|
||||
import pkg from '../../package.json';
|
||||
import { isH5 } from '@/utils/platform';
|
||||
import pkg from '../../package.json';
|
||||
|
||||
/**
|
||||
* @description: Generate cache key according to version
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Toast } from '@/utils/uniapi/prompt';
|
||||
import { ResultEnum } from '@/enums/httpEnum';
|
||||
import { Toast } from '@/utils/uniapi/prompt';
|
||||
|
||||
/**
|
||||
* Http错误处理
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { createAlova } from 'alova';
|
||||
import type { API } from '@/services/model/baseModel';
|
||||
import { ContentTypeEnum, ResultEnum } from '@/enums/httpEnum';
|
||||
import { mockAdapter } from '@/mock';
|
||||
import { getAuthorization } from '@/utils/auth';
|
||||
import { getBaseUrl, isUseMock } from '@/utils/env';
|
||||
import AdapterUniapp from '@alova/adapter-uniapp';
|
||||
import { createAlova } from 'alova';
|
||||
import { assign } from 'lodash-es';
|
||||
import { handleHttpStatus, handleLogicError } from './faultTolerance';
|
||||
import { getBaseUrl, isUseMock } from '@/utils/env';
|
||||
import { mockAdapter } from '@/mock';
|
||||
import { ContentTypeEnum, ResultEnum } from '@/enums/httpEnum';
|
||||
import type { API } from '@/services/model/baseModel';
|
||||
import { getAuthorization } from '@/utils/auth';
|
||||
|
||||
const BASE_URL = getBaseUrl();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user