Bläddra i källkod

feat:将 pages 非 tabbar 页面,全部迁移到 pages-core,降低主包大小

YunaiV 4 månader sedan
förälder
incheckning
54585c4cde

+ 1 - 1
src/pages/auth/code-login.vue

@@ -54,7 +54,6 @@
 <script lang="ts" setup>
 import { reactive, ref } from 'vue'
 import { useToast } from 'wot-design-uni'
-import { Verify } from '@/components/verifition'
 import { FORGET_PASSWORD_PAGE, LOGIN_PAGE } from '@/router/config'
 import { useTokenStore } from '@/store/token'
 import { ensureDecodeURIComponent, redirectAfterLogin } from '@/utils'
@@ -62,6 +61,7 @@ import { isMobile } from '@/utils/validator'
 import CodeInput from './components/code-input.vue'
 import Header from './components/header.vue'
 import TenantPicker from './components/tenant-picker.vue'
+import { Verify } from './components/verifition'
 
 defineOptions({
   name: 'SmsLoginPage',

src/pages/auth/components/code-input.vue → src/pages-core/auth/components/code-input.vue


src/pages/auth/components/header.vue → src/pages-core/auth/components/header.vue


src/pages/auth/components/tenant-picker.vue → src/pages-core/auth/components/tenant-picker.vue


src/components/verifition/index.ts → src/pages-core/auth/components/verifition/index.ts


src/components/verifition/utils/ase.ts → src/pages-core/auth/components/verifition/utils/ase.ts


src/components/verifition/verify.vue → src/pages-core/auth/components/verifition/verify.vue


src/components/verifition/verify/verify-points.vue → src/pages-core/auth/components/verifition/verify/verify-points.vue


src/components/verifition/verify/verify-slide.vue → src/pages-core/auth/components/verifition/verify/verify-slide.vue


src/pages/auth/forget-password.vue → src/pages-core/auth/forget-password.vue


+ 1 - 1
src/pages/auth/login.vue

@@ -82,7 +82,6 @@
 <script lang="ts" setup>
 import { reactive, ref } from 'vue'
 import { useToast } from 'wot-design-uni'
-import { Verify } from '@/components/verifition'
 import {
   CODE_LOGIN_PAGE,
   FORGET_PASSWORD_PAGE,
@@ -92,6 +91,7 @@ import { useTokenStore } from '@/store/token'
 import { ensureDecodeURIComponent, redirectAfterLogin } from '@/utils'
 import Header from './components/header.vue'
 import TenantPicker from './components/tenant-picker.vue'
+import { Verify } from './components/verifition'
 
 defineOptions({
   name: 'LoginPage',

+ 3 - 3
src/pages/auth/register.vue

@@ -94,12 +94,12 @@
 <script lang="ts" setup>
 import { reactive, ref } from 'vue'
 import { useToast } from 'wot-design-uni'
-import { Verify } from '@/components/verifition'
 import { LOGIN_PAGE } from '@/router/config'
 import { useTokenStore } from '@/store/token'
 import { redirectAfterLogin } from '@/utils'
 import Header from './components/header.vue'
 import TenantPicker from './components/tenant-picker.vue'
+import { Verify } from './components/verifition'
 
 defineOptions({
   name: 'RegisterPage',
@@ -197,12 +197,12 @@ function goToLogin() {
 
 /** 跳转到用户协议 */
 function goToUserAgreement() {
-  uni.navigateTo({ url: '/pages/user/settings/agreement/index' })
+  uni.navigateTo({ url: '/pages-core/user/settings/agreement/index' })
 }
 
 /** 跳转到隐私政策 */
 function goToPrivacyPolicy() {
-  uni.navigateTo({ url: '/pages/user/settings/privacy/index' })
+  uni.navigateTo({ url: '/pages-core/user/settings/privacy/index' })
 }
 </script>
 

src/pages/auth/styles/auth.scss → src/pages-core/auth/styles/auth.scss


src/pages/error/404.vue → src/pages-core/error/404.vue


src/pages/error/pc-only.vue → src/pages-core/error/pc-only.vue


+ 3 - 3
src/pages/user/contact/index.vue

@@ -55,7 +55,7 @@
 import { ref } from 'vue'
 import { useToast } from 'wot-design-uni'
 import { navigateBackPlus } from '@/utils'
-import { saveImageToAlbum } from '@/utils/download'
+import { saveImageToAlbum, staticUrl } from '@/utils/download'
 
 definePage({
   style: {
@@ -66,7 +66,7 @@ definePage({
 
 const toast = useToast()
 
-const qrCodeUrl = ref('/static/images/qrcode.png') // 客服二维码图片地址
+const qrCodeUrl = ref(staticUrl('/static/qrcode.png')) // 客服二维码图片地址
 const servicePhone = ref('18818818818') // 客服电话号码
 
 /** 返回上一页 */
@@ -78,7 +78,7 @@ function handleBack() {
 function handleCallPhone() {
   uni.makePhoneCall({
     phoneNumber: servicePhone.value,
-    fail: (err) => {
+    fail: (_err) => {
       toast.show('拨打失败')
     },
   })

src/pages/user/faq/data.ts → src/pages-core/user/faq/data.ts


src/pages/user/faq/index.vue → src/pages-core/user/faq/index.vue


src/pages/user/feedback/index.vue → src/pages-core/user/feedback/index.vue


src/pages/user/profile/components/form.vue → src/pages-core/user/profile/components/form.vue


src/pages/user/profile/index.vue → src/pages-core/user/profile/index.vue


src/pages/user/security/components/password-form.vue → src/pages-core/user/security/components/password-form.vue


src/pages/user/security/index.vue → src/pages-core/user/security/index.vue


src/pages/user/settings/agreement/index.vue → src/pages-core/user/settings/agreement/index.vue


+ 2 - 2
src/pages/user/settings/index.vue

@@ -125,12 +125,12 @@ function handleClearCache() {
 
 /** 跳转到用户协议 */
 function handleGoAgreement() {
-  uni.navigateTo({ url: '/pages/user/settings/agreement/index' })
+  uni.navigateTo({ url: '/pages-core/user/settings/agreement/index' })
 }
 
 /** 跳转到隐私协议 */
 function handleGoPrivacy() {
-  uni.navigateTo({ url: '/pages/user/settings/privacy/index' })
+  uni.navigateTo({ url: '/pages-core/user/settings/privacy/index' })
 }
 
 /** 初始化 */

src/pages/user/settings/privacy/index.vue → src/pages-core/user/settings/privacy/index.vue


+ 6 - 6
src/pages/user/index.vue

@@ -102,32 +102,32 @@ onMounted(async () => {
 
 /** 跳转到个人资料 */
 function handleGoProfile() {
-  uni.navigateTo({ url: '/pages/user/profile/index' })
+  uni.navigateTo({ url: '/pages-core/user/profile/index' })
 }
 
 /** 跳转到账号安全 */
 function handleGoSecurity() {
-  uni.navigateTo({ url: '/pages/user/security/index' })
+  uni.navigateTo({ url: '/pages-core/user/security/index' })
 }
 
 /** 跳转到常见问题 */
 function handleGoFaq() {
-  uni.navigateTo({ url: '/pages/user/faq/index' })
+  uni.navigateTo({ url: '/pages-core/user/faq/index' })
 }
 
 /** 跳转到意见反馈 */
 function handleGoFeedback() {
-  uni.navigateTo({ url: '/pages/user/feedback/index' })
+  uni.navigateTo({ url: '/pages-core/user/feedback/index' })
 }
 
 /** 跳转联系客服 */
 function handleGoContact() {
-  uni.navigateTo({ url: '/pages/user/contact/index' })
+  uni.navigateTo({ url: '/pages-core/user/contact/index' })
 }
 
 /** 跳转到应用设置 */
 function handleGoSettings() {
-  uni.navigateTo({ url: '/pages/user/settings/index' })
+  uni.navigateTo({ url: '/pages-core/user/settings/index' })
 }
 
 /** 退出登录 */

+ 5 - 5
src/router/config.ts

@@ -9,11 +9,11 @@ export const LOGIN_STRATEGY = LOGIN_STRATEGY_MAP.DEFAULT_NEED_LOGIN // edit by 
 export const isNeedLoginMode
   = LOGIN_STRATEGY === LOGIN_STRATEGY_MAP.DEFAULT_NEED_LOGIN
 
-export const LOGIN_PAGE = '/pages/auth/login' // edit by 芋艿:自定义了登录页路径
-export const REGISTER_PAGE = '/pages/auth/register' // edit by 芋艿:自定义了注册页路径
-export const CODE_LOGIN_PAGE = '/pages/auth/code-login' // edit by 芋艿:自定义了短信登录页路径
-export const FORGET_PASSWORD_PAGE = '/pages/auth/forget-password' // edit by 芋艿:自定义了忘记密码页路径
-export const NOT_FOUND_PAGE = '/pages/error/404' // edit by 芋艿:调整 404 页面路径
+export const LOGIN_PAGE = '/pages-core/auth/login' // edit by 芋艿:自定义了登录页路径
+export const REGISTER_PAGE = '/pages-core/auth/register' // edit by 芋艿:自定义了注册页路径
+export const CODE_LOGIN_PAGE = '/pages-core/auth/code-login' // edit by 芋艿:自定义了短信登录页路径
+export const FORGET_PASSWORD_PAGE = '/pages-core/auth/forget-password' // edit by 芋艿:自定义了忘记密码页路径
+export const NOT_FOUND_PAGE = '/pages-core/error/404' // edit by 芋艿:调整 404 页面路径
 
 // TODO @芋艿:【优化】貌似 unibest 这个变量没用?!
 export const LOGIN_PAGE_LIST = [

BIN
src/static/images/qrcode.png


+ 1 - 1
vite.config.ts

@@ -73,7 +73,7 @@ export default defineConfig(({ command, mode }) => {
         // pages 目录为 src/pages,分包目录不能配置在pages目录下!!
         // 是个数组,可以配置多个,但是不能为pages里面的目录!!
         subPackages: [
-          'src/pages-fg', // 这个是相对必要的路由,尽量留着(登录页、注册页、404页等)
+          'src/pages-core', // 这个是相对必要的路由,尽量留着(登录页、注册页、404页等)
           'src/pages-system', // “系统管理”模块
           'src/pages-infra', // “基础设施”模块
           'src/pages-bpm', // “工作流程”模块