diff --git a/admin/package.json b/admin/package.json
index c3e0b54..bd2bae2 100644
--- a/admin/package.json
+++ b/admin/package.json
@@ -78,6 +78,7 @@
"nzh": "^1.0.3",
"omit.js": "^2.0.2",
"react": "^17.0.0",
+ "react-cookies": "^0.1.1",
"react-dev-inspector": "^1.1.1",
"react-dom": "^17.0.0",
"react-fittext": "^1.0.0",
diff --git a/admin/src/app.tsx b/admin/src/app.tsx
index b062996..6ad7a30 100644
--- a/admin/src/app.tsx
+++ b/admin/src/app.tsx
@@ -4,11 +4,12 @@ import type { RunTimeLayoutConfig } from 'umi';
import { history, Link } from 'umi';
import RightContent from '@/components/RightContent';
import Footer from '@/components/Footer';
-import { currentUser as queryCurrentUser } from './services/ant-design-pro/api';
+import { currentUser as queryCurrentUser, queryPersonTxByYw } from './services/ant-design-pro/api';
import { BookOutlined, LinkOutlined } from '@ant-design/icons';
import { RequestConfig } from 'umi';
import { ResponseError } from 'umi-request';
import { notification } from 'antd';
+import cookie from 'react-cookies';
const isDev = process.env.NODE_ENV === 'development';
const loginPath = '/user/login';
@@ -28,8 +29,20 @@ export async function getInitialState(): Promise<{
}> {
const fetchUserInfo = async () => {
try {
- const msg = await queryCurrentUser();
- return msg.data;
+ const msg = await queryCurrentUser({
+ person_id: cookie.load('person_id'),
+ identity_id: cookie.load('identity_id'),
+ u_type: 1, // 用户类型
+ random_num: new Date().getTime(),
+ });
+ const tx = await queryPersonTxByYw({
+ person_id: cookie.load('person_id'),
+ identity_id: cookie.load('identity_id'),
+ u_type: 1, // 用户类型
+ random_num: new Date().getTime(),
+ });
+ console.log('avatar: ',`/dsideal_yy/html/thumb/Material/${tx?.file_id?.substr(0,2)}/${tx?.file_id}.${tx?.extension}`)
+ return {name: msg?.person_name, userid: msg?.person_id, avatar: `/dsideal_yy/html/thumb/Material/${tx?.file_id?.substr(0,2)}/${tx?.file_id}.${tx?.extension}`};
} catch (error) {
history.push(loginPath);
}
diff --git a/admin/src/pages/course/option/index.tsx b/admin/src/pages/course/option/index.tsx
index 8a67619..1734d9b 100644
--- a/admin/src/pages/course/option/index.tsx
+++ b/admin/src/pages/course/option/index.tsx
@@ -25,7 +25,6 @@ const uuid = uuidv4();
*/
const handleAdd = async (fields: TableListItem) => {
const hide = message.loading('正在添加');
-
try {
await saveCourse({ ...fields, attachment_filesize:0, attachment_json: `{"img":"", "url": "down/M3u8/${uuid?.substr(0,2)}/${uuid}.m3u8"}` });
hide();
@@ -109,6 +108,15 @@ const CourseList: React.FC = () => {
title: '序号',
key: 'index',
valueType: 'indexBorder',
+ render: (text: React.ReactNode, _: any, index: number) => {
+ if (actionRef && actionRef?.current && actionRef?.current?.pageInfo) {
+ return `${
+ (actionRef?.current?.pageInfo?.current - 1) * actionRef.current.pageInfo?.pageSize + (index + 1)
+ }`;
+ } else {
+ return '';
+ }
+ },
width: 48,
},
{
@@ -161,7 +169,7 @@ const CourseList: React.FC = () => {
dataIndex: 'course_minutes',
valueType: 'text',
sorter: false,
- hideInTable: false,
+ hideInTable: true,
hideInForm: false,
hideInSearch: true,
renderText: (val: string) => `${val}`,
@@ -202,15 +210,6 @@ const CourseList: React.FC = () => {
],
}, // 传递给 Form.Item 的配置
},
- {
- title: '标签',
- dataIndex: 'tag_name',
- sorter: false,
- valueType: 'select',
- hideInForm: true,
- renderText: (val: string) => `${val}`,
-
- },
{
title: '标签',
dataIndex: 'tag_id',
@@ -239,6 +238,7 @@ const CourseList: React.FC = () => {
title: '视频',
dataIndex: 'attachment_filesize',
sorter: false,
+ hideInTable: true,
hideInForm: false,
hideInSearch: true,
renderFormItem: () => (
@@ -252,7 +252,6 @@ const CourseList: React.FC = () => {
const index = file?.name.lastIndexOf(".");
// 获取后缀
SetUploadFileExt(file?.name.substr(index+1));
-
}}
data={{
name: uploadFileName,
@@ -382,12 +381,23 @@ const CourseList: React.FC = () => {
,
]}
request={async (value) => {
- const _data = await queryCourseList(value);
+ console.log('value', value)
+ const { create_time } = value;
+ if(create_time){
+ value['begin_time'] = create_time[0]
+ value['end_time'] = create_time[1]
+ }
+ const {data} = await queryCourseList({
+ ...value,
+ page_number: value?.current || 1,
+ page_size: value?.pageSize,
+ });
return {
- current: _data?.page_number,
- data: _data?.data?.list,
- pageSize: _data?.page_size,
- total: _data?.total_row || 0,
+ current: data?.page_number,
+ data: data?.list,
+ pageSize: data?.page_size,
+ success: true,
+ total: data?.total_row || 0,
};
}}
// dataSource={list}
@@ -539,7 +549,9 @@ const CourseList: React.FC = () => {
// 表单处理
//console.log('columns:', columns);
//console.log('values:', values);
- handleAdd(values);
+ await handleAdd(values);
+ handleCreateModalVisible(false);
+ actionRef.current?.reloadAndRest?.();
}}
submitter={{
render: (props, doms) => (
diff --git a/admin/src/pages/user/Login/index.tsx b/admin/src/pages/user/Login/index.tsx
index 5560d23..5424b10 100644
--- a/admin/src/pages/user/Login/index.tsx
+++ b/admin/src/pages/user/Login/index.tsx
@@ -43,7 +43,7 @@ const Login: React.FC = () => {
try {
// 登录
const msg = await login({ ...values, type });
- if (msg.status === 'ok') {
+ if (msg.success === true) {
const defaultLoginSuccessMessage = '登录成功!';
message.success(defaultLoginSuccessMessage);
await fetchUserInfo();
@@ -79,7 +79,7 @@ const Login: React.FC = () => {
}}
actions={[]}
onFinish={async (values) => {
- await handleSubmit(values as API.LoginParams);
+ await handleSubmit({user: values.username, pwd: values.password} as API.LoginParams);
}}
>
{status === 'error' && loginType === 'account' && (
@@ -89,12 +89,12 @@ const Login: React.FC = () => {
<>