diff --git a/src/components/Home/Password/PasswordCard.vue b/src/components/Home/Password/PasswordCard.vue new file mode 100644 index 0000000..ce8e7ba --- /dev/null +++ b/src/components/Home/Password/PasswordCard.vue @@ -0,0 +1,76 @@ + + + + + diff --git a/src/components/Home/Password/PasswordQuery.vue b/src/components/Home/Password/PasswordQuery.vue new file mode 100644 index 0000000..69c16cf --- /dev/null +++ b/src/components/Home/Password/PasswordQuery.vue @@ -0,0 +1,56 @@ + + + diff --git a/src/components/Home/Product/MobileProductQuery.vue b/src/components/Home/Product/MobileProductQuery.vue deleted file mode 100644 index b0e7c8d..0000000 --- a/src/components/Home/Product/MobileProductQuery.vue +++ /dev/null @@ -1,52 +0,0 @@ - - - diff --git a/src/components/Home/Product/ProductCard.vue b/src/components/Home/Product/ProductCard.vue index b2e3808..248aa5e 100644 --- a/src/components/Home/Product/ProductCard.vue +++ b/src/components/Home/Product/ProductCard.vue @@ -67,10 +67,8 @@ import { Edit, DeleteFilled } from '@element-plus/icons-vue' import { useProductStore } from '@/store/product.ts' import { defineProps, onMounted, PropType } from 'vue' -import { deepCopyObject } from 'vue3-common/utils/dataUtil' import { commonElMessageBox } from 'vue3-common/utils/elUtil' import { IProduct } from '@/types/product.ts' -import { isMobile } from 'vue3-common/utils/layoutUtil' import { useRouter } from 'vue-router' import { serviceFileRootPath } from '@/utils' @@ -92,16 +90,8 @@ const editClick = async () => { const id = props.productItem?.id productStore.productApiType = 'UPDATE' - if (isMobile()) { - productStore.currentProduct = props.productItem as IProduct - await router.push({ name: 'MobileHomeProductDetailId', params: { id } }) - } else { - productStore.productDialog = { - title: '编辑物品', - visible: true, - data: deepCopyObject(props.productItem) - } - } + productStore.currentProduct = props.productItem as IProduct + await router.push({ name: 'MobileHomeProductDetailId', params: { id } }) } const deleteClick = () => { diff --git a/src/components/Home/Product/ProductQuery.vue b/src/components/Home/Product/ProductQuery.vue index 8f52086..60770a3 100644 --- a/src/components/Home/Product/ProductQuery.vue +++ b/src/components/Home/Product/ProductQuery.vue @@ -1,5 +1,5 @@ diff --git a/src/layout/mobile-home/TabBar.vue b/src/layout/mobile-home/TabBar.vue index d76bc16..a6bca0f 100644 --- a/src/layout/mobile-home/TabBar.vue +++ b/src/layout/mobile-home/TabBar.vue @@ -111,6 +111,12 @@ 清单 + + + 清单 + + diff --git a/src/store/password.ts b/src/store/password.ts new file mode 100644 index 0000000..7f19b43 --- /dev/null +++ b/src/store/password.ts @@ -0,0 +1,94 @@ +import { defineStore } from 'pinia' +import type { IHandleApi } from 'vue3-common/types' +import { ElMessage } from 'element-plus' +import { IPassword } from '@/types/password.ts' + +export const usePasswordStore = defineStore('password', { + state: () => ({ + passwordList: [] as IPassword[], + queryInfo: { + category: '', + owner: '哥哥' + }, + passwordApiType: 'ADD' as IHandleApi, + categoryList: [] as string[], + currentPassword: { + title: '', + website: '', + username: '', + password: '', + category: '', + owner: '', + remark: '' + } as IPassword, + isScrollEnd: false, + isRefresh: false + }), + actions: { + async queryPasswordList() { + const password: IPassword = { + id: 1, + category: '生活', + owner: '哥哥', + password: '123123', + remark: '12', + title: '支付宝', + username: '13814079242', + website: '' + } + const password2: IPassword = { + id: 2, + category: '生活', + owner: '哥哥', + password: '123123', + remark: '12', + title: '支付宝', + username: '13814079242', + website: '' + } + + this.passwordList = [] + this.passwordList.push(password) + this.passwordList.push(password2) + // this.productList = await queryProductListApi(this.queryInfo) + }, + async queryPasswordCategory() { + // this.categoryList = await queryProductCategoryApi() + this.categoryList = ['生活', '工作'] + }, + async handlePasswordApi(password: IPassword) { + switch (this.passwordApiType) { + case 'ADD': + // await addProductApi(product) + ElMessage.success('新增密码记录成功') + break + case 'UPDATE': + // await updateProductApi(product.id as number, product) + ElMessage.success('更新密码记录成功') + break + case 'DELETE': + // await deleteProductApi(product.id as number) + ElMessage.success('删除密码记录成功') + break + default: + break + } + await this.refreshInfo() + }, + async refreshInfo() { + await this.queryPasswordList() + this.isRefresh = !this.isRefresh + }, + getEmptyPassword(): IPassword { + return { + category: '', + owner: '', + password: '', + remark: '', + title: '', + username: '', + website: '' + } + } + } +}) diff --git a/src/store/product.ts b/src/store/product.ts index 86c0b15..4b8721a 100644 --- a/src/store/product.ts +++ b/src/store/product.ts @@ -1,5 +1,5 @@ import { defineStore } from 'pinia' -import type { IDialog, IHandleApi } from 'vue3-common/types' +import type { IHandleApi } from 'vue3-common/types' import { ElMessage } from 'element-plus' import { IProduct } from '@/types/product' import { @@ -30,11 +30,6 @@ export const useProductStore = defineStore('product', { name: '', imageUrl: '' } as IProduct, - productDialog: { - visible: false, - title: '', - data: {} - } as IDialog, productImagePath: ImagePathEnum.PRODUCT, pageInfo: { currentPage: 1, @@ -68,7 +63,6 @@ export const useProductStore = defineStore('product', { default: break } - this.productDialog.visible = false await this.refreshInfo() }, async refreshInfo() { diff --git a/src/styles/index.module.scss b/src/styles/index.module.scss index 3e6fbdb..61a48b0 100644 --- a/src/styles/index.module.scss +++ b/src/styles/index.module.scss @@ -82,4 +82,4 @@ span, input { font-style: normal; } -@import "//at.alicdn.com/t/c/font_4793264_rlx9eslbk6o.css"; +@import "//at.alicdn.com/t/c/font_4793264_befv3sf3zdg.css"; diff --git a/src/types/password.ts b/src/types/password.ts new file mode 100644 index 0000000..f4694f5 --- /dev/null +++ b/src/types/password.ts @@ -0,0 +1,31 @@ +export interface IPassword { + id?: number; + /** + * 标题 + */ + title: string; + /** + * 网站 + */ + website: string; + /** + * 账号 + */ + username: string; + /** + * 密码 + */ + password: string; + /** + * 分类 + */ + category: string; + /** + * 所属人 + */ + owner: string; + /** + * 备注 + */ + remark: string; +} diff --git a/src/utils/element/elRules.ts b/src/utils/element/elRules.ts index 02071cd..6fb6db7 100644 --- a/src/utils/element/elRules.ts +++ b/src/utils/element/elRules.ts @@ -313,6 +313,21 @@ export const ledgerRules = { ] } +export const passwordRules = { + title: [ + { required: true, message: '请输入标题', trigger: 'blur' } + ], + username: [ + { required: true, message: '请输入账号', trigger: 'blur' } + ], + password: [ + { required: true, message: '请输入密码', trigger: 'blur' } + ], + owner: [ + { required: true, message: '请选择所属人', trigger: 'change' } + ] +} + export const accountRules = { accountName: [ { required: true, message: '请输入账号名称', trigger: 'blur' } diff --git a/src/views/mobile-home/meta.ts b/src/views/mobile-home/meta.ts index 3753847..ed6e2cc 100644 --- a/src/views/mobile-home/meta.ts +++ b/src/views/mobile-home/meta.ts @@ -239,10 +239,20 @@ export const mobileHomeMeta: IRouteMetaConfig = { title: '内容', icon: '' }, + '/mobile-home/password': { + title: '密码', + icon: 'home-password', + order: 14, + redirect: '/mobile-home/password/list' + }, + '/mobile-home/password/list': { + title: '清单', + icon: '' + }, '/mobile-home/profile': { title: '个人信息', icon: '', - order: 14, + order: 15, hidden: true, redirect: '/mobile-home/profile/index' }, diff --git a/src/views/mobile-home/password/detail[id].vue b/src/views/mobile-home/password/detail[id].vue new file mode 100644 index 0000000..f8c37af --- /dev/null +++ b/src/views/mobile-home/password/detail[id].vue @@ -0,0 +1,112 @@ + + + + + diff --git a/src/views/mobile-home/password/list.vue b/src/views/mobile-home/password/list.vue new file mode 100644 index 0000000..43a5b86 --- /dev/null +++ b/src/views/mobile-home/password/list.vue @@ -0,0 +1,50 @@ + + + + + diff --git a/src/views/mobile/index.vue b/src/views/mobile/index.vue index 17b4056..fd96557 100644 --- a/src/views/mobile/index.vue +++ b/src/views/mobile/index.vue @@ -68,6 +68,10 @@ title="家庭账本" sub-title="守护家庭财富" router="/mobile-home/ledger/list"/> + +