diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index d143134..c32d84f 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -5,7 +5,7 @@ import { ACCESS_TOKEN, CURRENT_USER, IS_LOCKSCREEN } from '@/store/mutation-type import { ResultEnum } from '@/enums/httpEnum'; const Storage = createStorage({ storage: localStorage }); -import { getUserInfo, login } from '@/api/system/user'; +import { getUserInfo, login, login2 } from '@/api/system/user'; import { storage } from '@/utils/Storage'; export interface IUserState { @@ -61,7 +61,8 @@ export const useUserStore = defineStore({ async login(userInfo) { try { const response = await login(userInfo); - const {code,data } = response; + // const response = await login2(userInfo); + const { code, data } = response; if (code === ResultEnum.SUCCESS) { const ex = 7 * 24 * 60 * 60 * 1000; storage.set(ACCESS_TOKEN, data.access_token, ex); diff --git a/src/views/content/layout/columns.ts b/src/views/content/layout/columns.ts new file mode 100644 index 0000000..279d618 --- /dev/null +++ b/src/views/content/layout/columns.ts @@ -0,0 +1,41 @@ +import { h } from 'vue'; +import { NTag } from 'naive-ui'; + +export const columns = [ + { + type: 'selection', + width: 50, + fixed: 'left', + }, + { + title: 'ID', + key: 'id', + fixed: 'left', + width: 50, + }, + { + title: '位置编号', + key: 'location', + width: 100, + }, + { + title: '位置描述', + key: 'description', + width: 200, + }, + { + title: '排序', + key: 'sort', + width: 100, + }, + { + title: '创建人', + key: 'createUser', + width: 100, + }, + { + title: '创建时间', + key: 'createTime', + width: 180, + }, +]; diff --git a/src/views/content/layout/edit.vue b/src/views/content/layout/edit.vue new file mode 100644 index 0000000..a39d5df --- /dev/null +++ b/src/views/content/layout/edit.vue @@ -0,0 +1,125 @@ + + diff --git a/src/views/content/layout/index.vue b/src/views/content/layout/index.vue new file mode 100644 index 0000000..9782658 --- /dev/null +++ b/src/views/content/layout/index.vue @@ -0,0 +1,196 @@ + + + + + diff --git a/src/views/content/layout/querySchemas.ts b/src/views/content/layout/querySchemas.ts new file mode 100644 index 0000000..114acfe --- /dev/null +++ b/src/views/content/layout/querySchemas.ts @@ -0,0 +1,11 @@ +import { FormSchema } from '@/components/Form/index'; +export const schemas: FormSchema[] = [ + { + field: 'description', + component: 'NInput', + label: '页面描述', + componentProps: { + placeholder: '请输入页面位置描述', + }, + }, +]; diff --git a/src/views/content/layoutItem/columns.ts b/src/views/content/layoutItem/columns.ts new file mode 100644 index 0000000..9c54447 --- /dev/null +++ b/src/views/content/layoutItem/columns.ts @@ -0,0 +1,54 @@ +import { h } from 'vue'; +import { NTag } from 'naive-ui'; + +export const columns = [ + { + type: 'selection', + width: 50, + fixed: 'left', + }, + { + title: 'ID', + key: 'id', + fixed: 'left', + width: 50, + }, + { + title: '位置描述', + key: 'description', + width: 250, + render(record) { + return record.layoutDescription + '>>' + record.layoutLocation; + }, + }, + { + title: '推荐类型', + key: 'typeText', + width: 100, + }, + { + title: '推荐ID', + key: 'typeId', + width: 100, + }, + { + title: '推荐标题', + key: 'typeTitle', + width: 200, + }, + { + title: '排序', + key: 'sort', + width: 100, + }, + { + title: '创建人', + key: 'createUser', + width: 100, + }, + { + title: '创建时间', + key: 'createTime', + width: 180, + }, +]; diff --git a/src/views/content/layoutItem/edit.vue b/src/views/content/layoutItem/edit.vue new file mode 100644 index 0000000..3a24487 --- /dev/null +++ b/src/views/content/layoutItem/edit.vue @@ -0,0 +1,225 @@ + + diff --git a/src/views/content/layoutItem/index.vue b/src/views/content/layoutItem/index.vue new file mode 100644 index 0000000..4451412 --- /dev/null +++ b/src/views/content/layoutItem/index.vue @@ -0,0 +1,195 @@ + + + + + diff --git a/src/views/content/layoutItem/layout/article/columns.ts b/src/views/content/layoutItem/layout/article/columns.ts new file mode 100644 index 0000000..2dd4c08 --- /dev/null +++ b/src/views/content/layoutItem/layout/article/columns.ts @@ -0,0 +1,54 @@ +import { h } from 'vue'; + +export const columns = [ + { + type: 'selection', + width: 50, + fixed: 'left', + multiple: false, + }, + { + title: 'ID', + key: 'id', + width: 60, + fixed: 'left', + }, + { + title: '文章标题', + key: 'title', + ren(record) { + return h( + 'a', + { + href: 'http://www.baidu.com', + target: '_blank', + }, + record.title, + ); + }, + width: 300, + }, + { + title: '文章分类', + key: 'categoryName', + width: 100, + }, + { + title: '文章状态', + key: 'status', + render(record) { + return h('span', record.status === 1 ? '下架' : '正常'); + }, + width: 100, + }, + { + title: '创建人', + key: 'createUser', + width: 100, + }, + { + title: '创建时间', + key: 'createTime', + width: 180, + }, +]; diff --git a/src/views/content/layoutItem/layout/article/querySchemas.ts b/src/views/content/layoutItem/layout/article/querySchemas.ts new file mode 100644 index 0000000..8bfb15f --- /dev/null +++ b/src/views/content/layoutItem/layout/article/querySchemas.ts @@ -0,0 +1,30 @@ +import { FormSchema } from '@/components/Form/index'; +export const schemas: FormSchema[] = [ + { + field: 'title', + component: 'NInput', + label: '文章标题', + componentProps: { + placeholder: '请输入文章标题', + }, + }, + { + field: 'status', + component: 'NSelect', + label: '文章状态', + componentProps: { + placeholder: '请选择文章状态', + clearable: true, + options: [ + { + label: '下架', + value: '1', + }, + { + label: '正常', + value: '0', + }, + ], + }, + }, +]; diff --git a/src/views/content/layoutItem/layout/index.vue b/src/views/content/layoutItem/layout/index.vue new file mode 100644 index 0000000..d7900b7 --- /dev/null +++ b/src/views/content/layoutItem/layout/index.vue @@ -0,0 +1,191 @@ + + diff --git a/src/views/content/layoutItem/layout/notice/columns.ts b/src/views/content/layoutItem/layout/notice/columns.ts new file mode 100644 index 0000000..cb80410 --- /dev/null +++ b/src/views/content/layoutItem/layout/notice/columns.ts @@ -0,0 +1,69 @@ +import { h } from 'vue'; +import { NTag } from 'naive-ui'; + +export const columns2 = [ + { + type: 'selection', + width: 50, + fixed: 'left', + multiple: false, + }, + { + title: 'ID', + key: 'id', + width: 60, + fixed: 'left', + }, + { + title: '标题', + key: 'title', + width: 200, + }, + { + title: '类型', + key: 'type', + width: 100, + render(record) { + return h( + NTag, + { + type: record.type == 1 ? 'info' : 'success', + }, + { + default: () => (record.type == 1 ? '通知' : '公告'), + }, + ); + }, + }, + { + title: '状态', + key: 'status', + render(record) { + return h( + NTag, + { + type: record.status == 1 ? 'success' : 'error', + }, + { + default: () => (record.status == 1 ? '正常' : '禁用'), + }, + ); + }, + width: 100, + }, + { + title: '点击率', + key: 'clickNum', + width: 100, + }, + { + title: '创建人', + key: 'createUser', + width: 100, + }, + { + title: '创建时间', + key: 'createTime', + width: 180, + }, +]; diff --git a/src/views/content/layoutItem/layout/notice/querySchemas.ts b/src/views/content/layoutItem/layout/notice/querySchemas.ts new file mode 100644 index 0000000..824c1ae --- /dev/null +++ b/src/views/content/layoutItem/layout/notice/querySchemas.ts @@ -0,0 +1,49 @@ +import { FormSchema } from '@/components/Form/index'; +export const schemas2: FormSchema[] = [ + { + field: 'title', + component: 'NInput', + label: '标题', + componentProps: { + placeholder: '请输入标题', + }, + }, + { + field: 'type', + component: 'NSelect', + label: '类型', + componentProps: { + placeholder: '请选择类型', + clearable: true, + options: [ + { + label: '通知', + value: '1', + }, + { + label: '公告', + value: '2', + }, + ], + }, + }, + { + field: 'status', + component: 'NSelect', + label: '状态', + componentProps: { + placeholder: '请选择状态', + clearable: true, + options: [ + { + label: '正常', + value: '1', + }, + { + label: '关闭', + value: '2', + }, + ], + }, + }, +]; diff --git a/src/views/content/layoutItem/querySchemas.ts b/src/views/content/layoutItem/querySchemas.ts new file mode 100644 index 0000000..5957ded --- /dev/null +++ b/src/views/content/layoutItem/querySchemas.ts @@ -0,0 +1,45 @@ +import { FormSchema } from '@/components/Form/index'; +import { getLayoutAllList } from '@/api/content/layout'; +export const loadSelectData = async (res) => { + //这里可以进行数据转换处理 + return (await getLayoutAllList({ ...res })).map((item, index) => { + return { + ...item, + label: item.description, + value: item.id, + index, + }; + }); +}; +export const schemas: FormSchema[] = [ + { + field: 'layoutId', + component: 'BasicSelect', + label: '页面布局', + componentProps: { + placeholder: '请选择页面布局', + clearable: true, + block: true, + request: loadSelectData, + }, + }, + { + field: 'type', + component: 'NSelect', + label: '页面类型', + componentProps: { + placeholder: '请选择页面类型', + clearable: true, + options: [ + { + label: 'CMS文章', + value: '1', + }, + { + label: '通知公告', + value: '2', + }, + ], + }, + }, +];