Commit 3fedbcb5 authored by 熊成伟's avatar 熊成伟

debug

parents f124542a 896aa567
......@@ -3,9 +3,10 @@
<component name="ChangeListManager">
<list default="true" id="a6d092de-b4f8-454d-99f5-4dac3ce112e5" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/Backlog/Backlog.jsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/Backlog/Backlog.jsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/Notice/Notice.jsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/Notice/Notice.jsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/Login/index.jsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/Login/index.jsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/Work/Work.jsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/Work/Work.jsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/utils/instance.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/utils/instance.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/utils/request.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/utils/request.js" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/.tmp/" />
<ignored path="$PROJECT_DIR$/temp/" />
......@@ -30,7 +31,7 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/pages/Backlog/Backlog.jsx">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="375">
......@@ -54,8 +55,8 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/utils/instance.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="350">
<caret line="41" column="32" selection-start-line="41" selection-start-column="32" selection-end-line="41" selection-end-column="32" />
<state relative-caret-position="125">
<caret line="29" column="22" selection-start-line="29" selection-start-column="13" selection-end-line="29" selection-end-column="22" />
<folding>
<element signature="e#0#26#0" expanded="true" />
</folding>
......@@ -63,6 +64,24 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/utils/request.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="250">
<caret line="22" column="13" selection-start-line="22" selection-start-column="13" selection-end-line="22" selection-end-column="13" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/pages/Login/index.jsx">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="25">
<caret line="1" column="40" selection-start-line="1" selection-start-column="35" selection-end-line="1" selection-end-column="40" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/package.json">
<provider selected="true" editor-type-id="text-editor">
......@@ -72,13 +91,13 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/pages/Work/Work.jsx">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="100">
<caret line="37" column="29" lean-forward="true" selection-start-line="37" selection-start-column="29" selection-end-line="37" selection-end-column="29" />
<state relative-caret-position="175">
<caret line="13" column="11" lean-forward="true" selection-start-line="13" selection-start-column="11" selection-end-line="13" selection-end-column="11" />
<folding>
<element signature="e#0#40#0" expanded="true" />
<element signature="e#0#51#0" expanded="true" />
</folding>
</state>
</provider>
......@@ -141,7 +160,6 @@
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/src/Pages/EventProcessing/Adjunct.jsx" />
<option value="$PROJECT_DIR$/src/Pages/EventProcessing/Option.jsx" />
<option value="$PROJECT_DIR$/src/Pages/EventProcessing/Flow.jsx" />
<option value="$PROJECT_DIR$/src/Pages/Backlog/Backlog.jsx" />
......@@ -188,10 +206,11 @@
<option value="$PROJECT_DIR$/src/components/WorkCard/CardItem.jsx" />
<option value="$PROJECT_DIR$/src/components/LogCard/index.jsx" />
<option value="$PROJECT_DIR$/src/layout/CommonLayout.jsx" />
<option value="$PROJECT_DIR$/src/pages/Work/Work.jsx" />
<option value="$PROJECT_DIR$/src/utils/urlQuery.js" />
<option value="$PROJECT_DIR$/src/pages/Notice/Notice.jsx" />
<option value="$PROJECT_DIR$/src/pages/Backlog/Backlog.jsx" />
<option value="$PROJECT_DIR$/src/pages/Work/Work.jsx" />
<option value="$PROJECT_DIR$/src/pages/Login/index.jsx" />
</list>
</option>
</component>
......@@ -266,6 +285,20 @@
<item name="pages" type="462c0819:PsiDirectoryNode" />
<item name="EventProcessing" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="create-react-app" type="b2602c69:ProjectViewProjectNode" />
<item name="create-react-app" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="pages" type="462c0819:PsiDirectoryNode" />
<item name="Login" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="create-react-app" type="b2602c69:ProjectViewProjectNode" />
<item name="create-react-app" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="pages" type="462c0819:PsiDirectoryNode" />
<item name="Work" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="create-react-app" type="b2602c69:ProjectViewProjectNode" />
<item name="create-react-app" type="462c0819:PsiDirectoryNode" />
......@@ -326,12 +359,12 @@
<workItem from="1591406085733" duration="5474000" />
<workItem from="1591419899087" duration="268000" />
<workItem from="1591493817957" duration="11217000" />
<workItem from="1591579020550" duration="31796000" />
<workItem from="1591579020550" duration="32431000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="134611000" />
<option name="totallyTimeSpent" value="135246000" />
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1382" height="784" extended-state="6" />
......@@ -362,16 +395,6 @@
<option name="version" value="1" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/components/Adjunct/index.jsx">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-125">
<caret line="10" column="34" selection-start-line="10" selection-start-column="34" selection-end-line="10" selection-end-column="34" />
<folding>
<element signature="e#0#43#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/pages/EventProcessing/Adjunct.jsx">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="25">
......@@ -648,16 +671,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/pages/Work/Work.jsx">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="100">
<caret line="37" column="29" lean-forward="true" selection-start-line="37" selection-start-column="29" selection-end-line="37" selection-end-column="29" />
<folding>
<element signature="e#0#40#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/utils/urlQuery.js">
<provider selected="true" editor-type-id="text-editor" />
</entry>
......@@ -671,23 +684,6 @@
<entry file="file://$PROJECT_DIR$/src/utils/utils.jsx">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/src/utils/request.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="350">
<caret line="14" column="15" selection-start-line="14" selection-start-column="15" selection-end-line="14" selection-end-column="15" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/utils/instance.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="350">
<caret line="41" column="32" selection-start-line="41" selection-start-column="32" selection-end-line="41" selection-end-column="32" />
<folding>
<element signature="e#0#26#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/pages/Notice/Notice.jsx">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="225">
......@@ -735,5 +731,39 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/utils/instance.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="125">
<caret line="29" column="22" selection-start-line="29" selection-start-column="13" selection-end-line="29" selection-end-column="22" />
<folding>
<element signature="e#0#26#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/utils/request.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="250">
<caret line="22" column="13" selection-start-line="22" selection-start-column="13" selection-end-line="22" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/pages/Login/index.jsx">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="25">
<caret line="1" column="40" selection-start-line="1" selection-start-column="35" selection-end-line="1" selection-end-column="40" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/pages/Work/Work.jsx">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="175">
<caret line="13" column="11" lean-forward="true" selection-start-line="13" selection-start-column="11" selection-end-line="13" selection-end-column="11" />
<folding>
<element signature="e#0#51#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component>
</project>
\ No newline at end of file
......@@ -2,29 +2,28 @@ import React, { useEffect } from 'react';
import { useRequest } from "@umijs/hooks";
import axios from 'axios';
import {withRouter} from 'react-router-dom'
import axiosRequest, { loading } from '../../utils/request';
// import { postRequest } from '../../utils/request';
// import './index.less'
const Login = (props) => {
// axios.post('/dgbg/mobileLogin.view?userName=2012012099&password=1&clientFlag=123456')
// .then(function (response) {
// // handle success
// console.log(response);
// })
// .catch(function (error) {
// // handle error
// console.log(error);
// })
// .finally(function () {
// // always executed
// });
const { data, error, loading } = useRequest({
url: '/dgbg/mobileLogin.view?userName=2012012099&password=1&clientFlag=123456',
method: 'post'
axiosRequest({
method: 'post',
url: '/dgbg/mobileLogin.view?userName=2012012099&clientFlag=123456&password=1',
}).then(res => {
// setOperates(res.operate || []);
});
// const { data, error, loading } = useRequest({
// url: '/dgbg/mobileLogin.view',
// method: 'post',
// // data: {
// // userName: '2012012099',
// // password: '1',
// // clientFlag: 12345
// // },
// });
return (
<div>
......
import React, { useState } from 'react';
import { useRequest } from "@umijs/hooks";
import React, { useState, useEffect } from 'react';
import {ActivityIndicator, WhiteSpace, WingBlank} from "antd-mobile";
import axiosRequest, { loading } from '../../utils/request';
import TopSearch from '../../components/TopSearch'
import WorkCard from '../../components/WorkCard'
const Work = () => {
const [addStatus, setAddStatus] = useState(false);
const [operates, setOperates] = useState([]);
const { data, error, loading } = useRequest({
useEffect(() => {
loadOperates();
}, []);
const loadOperates = () => {
axiosRequest({
method: 'post',
url: '/dgbg/mobileGetOperates.view?userName=2012012099&clientFlag=123456',
method: 'post'
}).then(res => {
setOperates(res.operate || []);
});
}
const commonEdit = () => {
setAddStatus(!addStatus);
......@@ -30,7 +39,6 @@ const Work = () => {
// const index = arr.findIndex(item => item.id == id);
// index > -1 && arr.splice(index, 1);
};
return (
<WingBlank>
<ActivityIndicator
......@@ -45,7 +53,7 @@ const Work = () => {
title="事物管理"
addCommon={ commonEdit }
addStatus={addStatus}
data={data && data.operate.map(item => ({ icon: '', text: item.NODENAME })) || []}
data={ operates.map(item => ({ icon: '', text: item.NODENAME }))}
iconAction={ itemAdd }
/>
</WingBlank>
......
import axios from 'axios';
import { parse, stringify } from 'qs';
import { Toast } from 'antd-mobile';
const instance = axios.create();
const token = 'bearer ' + localStorage.getItem("token");
......@@ -46,7 +47,12 @@ export const createAPI = (baseURL) => {
headers,
}, conf.opts))
.then(function (response) {
if (!response || response.data === false) { console.log('response出错!', response); return false; }
if (!response || !response.data) { console.log('response出错, 无返回数据!', response); return false; };
if (response.data && response.data.errorMessage) {
Toast.fail(response.data.errorMessage);
return false;
}
// 保存到本地
if (response && response.data && response.data.access_token) {
defaultHeaders = {
......@@ -55,32 +61,24 @@ export const createAPI = (baseURL) => {
localStorage.setItem("token", response.data.access_token);
}
if (response.data && response.data.success || response.data && (response.data.success === undefined && response.data.error === undefined)) {
if (response.data) {
return response.data;
} else {
message.error(response.data && (response.data.mesg || response.data.message) || '操作出现错误!')
return response.data;
return false;
}
})
.catch(error => {
if (error.response) {
const { status, statusText, url } = error.response;
const errortext = codeMessage[status] || statusText;
// notification.error({
// key: status,
// message: `请求错误 ${status}`,
// description: errortext,
// });
if (status === 401) {
// @HACK
/* eslint-disable no-underscore-dangle */
history.push('/user/login');
message.error('登录过期或用户名密码错误!')
if (status === 401) {
// TODO 重新登录
// history.push('/user/login');
Toast.fail(errortext);
return false;
} else if (status === 400 || status > 401) {
history.push(`/exception/${status}`);
Toast.fail(errortext);
}
}
return false;
......
import { createAPI } from './instance';
export const apiUrl = 'http://124.93.101.8:9988/dgbg/';
// export const apiUrl = 'http://124.93.101.8:9988/dgbg/';
export const apiUrl = '/';
// mobileLogin.view
// 测试账户:2012012099
// 密码:1
const instance = createAPI(apiUrl);
const loadingCounter = () => {
let count = 0;
const startLoading = () => {
count++;
}
const endLoading = () => {
count--;
}
const getCount = () => count;
return {
startLoading,
endLoading,
getCount
}
};
const instance = createAPI(apiUrl);
let loadingCount = loadingCounter();
export function postRequest(url, params = {}) {
return instance({
method: 'post',
url: url,
opts: params,
async function axiosRequest(option = {}) {
loadingCount.startLoading();
const res = await instance({
method: option.method || 'get',
url: option.url,
opts: option.body || null,
});
loadingCount.endLoading();
return res;
}
export let loading = loadingCount.getCount() > 0;
export default axiosRequest;
// export function postRequest(url, params = {}) {
// return instance({
// method: 'post',
// url: url,
// opts: params,
// });
// }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment