diff --git a/code/base-project/base-uniapp-main/env/.env b/code/base-project/base-uniapp-main/env/.env new file mode 100644 index 00000000..06135be5 --- /dev/null +++ b/code/base-project/base-uniapp-main/env/.env @@ -0,0 +1,4 @@ +VITE_APP_PORT = 8080 + +VITE_ALIYUN_BUCKET = 'g3xc' + diff --git a/code/base-project/base-uniapp-main/src/App.vue b/code/base-project/base-uniapp-main/src/App.vue index 38bcbfea..6ebe5683 100644 --- a/code/base-project/base-uniapp-main/src/App.vue +++ b/code/base-project/base-uniapp-main/src/App.vue @@ -8,7 +8,7 @@ onLaunch(() => { console.log('App Launch') }) onShow(() => { - // userStore.requireLogin() + userStore.requireLogin() console.log('App Show') }) diff --git a/code/base-project/base-uniapp-main/src/env.d.ts b/code/base-project/base-uniapp-main/src/env.d.ts index d4d74539..8ce9911c 100644 --- a/code/base-project/base-uniapp-main/src/env.d.ts +++ b/code/base-project/base-uniapp-main/src/env.d.ts @@ -13,6 +13,8 @@ interface ImportMetaEnv { readonly VITE_SERVER_PORT: string /** 是否清除console */ readonly VITE_DELETE_CONSOLE: string + + readonly VITE_ALIYUN_BUCKET: string } interface ImportMeta { diff --git a/code/base-project/base-uniapp-main/src/interceptor/router.ts b/code/base-project/base-uniapp-main/src/interceptor/router.ts index 66f76a30..3f8cdcf0 100644 --- a/code/base-project/base-uniapp-main/src/interceptor/router.ts +++ b/code/base-project/base-uniapp-main/src/interceptor/router.ts @@ -1,8 +1,7 @@ import { useUserStore } from '@/store' const whiteList = [ - '/pages-sub/login/index', - '/pages/account/index', + '/pages-sub/login/index' ] export const navigateToInterceptor = { @@ -34,9 +33,9 @@ export const navigateToInterceptor = { export const routeInterceptor = { install() { - // uni.addInterceptor('navigateTo', navigateToInterceptor) - // uni.addInterceptor('reLaunch', navigateToInterceptor) - // uni.addInterceptor('redirectTo', navigateToInterceptor) - // uni.addInterceptor('switchTab', navigateToInterceptor) + uni.addInterceptor('navigateTo', navigateToInterceptor) + uni.addInterceptor('reLaunch', navigateToInterceptor) + uni.addInterceptor('redirectTo', navigateToInterceptor) + uni.addInterceptor('switchTab', navigateToInterceptor) }, } diff --git a/code/base-project/base-uniapp-main/src/pages-sub/file/index.vue b/code/base-project/base-uniapp-main/src/pages-sub/file/index.vue new file mode 100644 index 00000000..c4e44c1a --- /dev/null +++ b/code/base-project/base-uniapp-main/src/pages-sub/file/index.vue @@ -0,0 +1,147 @@ + + + + + diff --git a/code/base-project/base-uniapp-main/src/pages-sub/login/index.vue b/code/base-project/base-uniapp-main/src/pages-sub/login/index.vue index a61c77e3..aa3afe64 100644 --- a/code/base-project/base-uniapp-main/src/pages-sub/login/index.vue +++ b/code/base-project/base-uniapp-main/src/pages-sub/login/index.vue @@ -34,47 +34,35 @@ function onSubmit() { formRef.value ?.validate() .then(() => { - userStore.userInfo.orgid = formModel.orgid - userStore.userInfo.userid = formModel.userid - userStore.userInfo.token = '123' + _loading.value = true + loginOrgApi({ + orgid: formModel.orgid, + userid: formModel.userid, + password: formModel.password, + }).then((res) => { + if (res.data) { + userStore.userInfo.orgid = formModel.orgid + userStore.userInfo.userid = formModel.userid + userStore.userInfo.token = res.data - uni.showToast({ - title: '登录成功', - icon: 'success', + uni.showToast({ + title: '登录成功', + icon: 'success', + }) + + uni.switchTab({ + url: '/pages/home/index', + }) + } + else { + uni.showToast({ + title: '登录失败,请稍后再试', + icon: 'error', + }) + } + }).finally(() => { + _loading.value = false }) - - uni.switchTab({ - url: '/pages/home/index', - }) - // _loading.value = true - // loginOrgApi({ - // orgid: formModel.orgid, - // userid: formModel.userid, - // password: formModel.password, - // }).then((res) => { - // if (res.data) { - // userStore.userInfo.orgid = formModel.orgid - // userStore.userInfo.userid = formModel.userid - // userStore.userInfo.token = res.data - - // uni.showToast({ - // title: '登录成功', - // icon: 'success', - // }) - - // uni.switchTab({ - // url: '/pages/home/index', - // }) - // } - // else { - // uni.showToast({ - // title: '登录失败,请稍后再试', - // icon: 'error', - // }) - // } - // }).finally(() => { - // _loading.value = false - // }) }) .catch((error: FieldValidateError[]) => { toast.fail(error[0].message) diff --git a/code/base-project/base-uniapp-main/src/pages-sub/update-password/index.vue b/code/base-project/base-uniapp-main/src/pages-sub/update-password/index.vue new file mode 100644 index 00000000..c12c26e7 --- /dev/null +++ b/code/base-project/base-uniapp-main/src/pages-sub/update-password/index.vue @@ -0,0 +1,243 @@ + + + + + + + diff --git a/code/base-project/base-uniapp-main/src/pages-sub/xcjin/index.vue b/code/base-project/base-uniapp-main/src/pages-sub/xcjin/index.vue new file mode 100644 index 00000000..c336b0b7 --- /dev/null +++ b/code/base-project/base-uniapp-main/src/pages-sub/xcjin/index.vue @@ -0,0 +1,310 @@ + + + + + diff --git a/code/base-project/base-uniapp-main/src/pages.json b/code/base-project/base-uniapp-main/src/pages.json index 7f586b81..63a2dc42 100644 --- a/code/base-project/base-uniapp-main/src/pages.json +++ b/code/base-project/base-uniapp-main/src/pages.json @@ -52,7 +52,7 @@ "layout": "default", "style": { "navigationBarTitleText": "个人中心", - "navigationStyle": "custom" + "navigationStyle": "default" } } ], @@ -66,6 +66,27 @@ "navigationBarTitleText": "登录", "navigationStyle": "default" } + }, + { + "path": "file/index", + "style": { + "navigationBarTitleText": "附件管理", + "navigationStyle": "default" + } + }, + { + "path": "update-password/index", + "style": { + "navigationBarTitleText": "修改密码", + "navigationStyle": "default" + } + }, + { + "path": "xcjin/index", + "style": { + "navigationBarTitleText": "进场堆高机", + "navigationStyle": "default" + } } ] } diff --git a/code/base-project/base-uniapp-main/src/pages/account/index.vue b/code/base-project/base-uniapp-main/src/pages/account/index.vue index 8d03efb6..0e46a030 100644 --- a/code/base-project/base-uniapp-main/src/pages/account/index.vue +++ b/code/base-project/base-uniapp-main/src/pages/account/index.vue @@ -9,7 +9,6 @@ function handleLoginOut() { title: '提示', message: '确定退出登录?', onConfirm() { - toast.success('退出成功') userStore.reset() uni.navigateTo({ @@ -18,27 +17,75 @@ function handleLoginOut() { }, }) } + +function handleToLogin() { + if (userStore.isLogined) { + return + } + uni.navigateTo({ + url: '/pages-sub/login/index', + }) +} + +function handleToUpdatePassword() { + handleToLogin() + + uni.navigateTo({ + url: '/pages-sub/update-password/index', + }) +} + +const avatarText = computed(() => { + if (!userStore.isLogined) { + return '登' + } + + const id = userStore.userInfo?.userid + if (!id || id.length === 0) + return 'A' + + return id.charAt(0).toUpperCase() +}) @@ -47,34 +94,30 @@ function handleLoginOut() { .account-header { display: flex; align-items: center; - padding: 40rpx 32rpx; - background-color: #2c3e50; /* 工业风深色 */ - border-radius: 2rpx; /* 轻微卡片感 */ - box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.15); + padding: 36rpx 28rpx; + background-color: #fff; .user-info { display: flex; flex-direction: column; justify-content: center; margin-left: 32rpx; - color: #fff; - - .user-account { - font-size: 34rpx; + justify-content: space-between; + .user-userid { + font-size: 36rpx; font-weight: 600; - line-height: 42rpx; + line-height: 36rpx; } .user-orgid { font-size: 28rpx; - margin-top: 6rpx; + margin-top: 12rpx; color: #6b788e; - line-height: 34rpx; } } } -.actions{ +.actions { margin-top: 32rpx; } diff --git a/code/base-project/base-uniapp-main/src/pages/home/index.vue b/code/base-project/base-uniapp-main/src/pages/home/index.vue index 48e4705e..5b787d9e 100644 --- a/code/base-project/base-uniapp-main/src/pages/home/index.vue +++ b/code/base-project/base-uniapp-main/src/pages/home/index.vue @@ -7,6 +7,15 @@ const swiperList = [ {}, {}, ] + +function toLinkUrl(url) { + if (!url) { + return + } + uni.navigateTo({ + url, + }) +}