Commit e40e259b by 姜雷

统一传递userId

parent 6a02cfe6
......@@ -14,6 +14,7 @@ const service = axios.create({
service.interceptors.request.use(
conf => {
let userId = store.getUserId();
if (/post/.test(conf.method.toLocaleLowerCase())) {
let data = userId
? {
......
......@@ -15,6 +15,7 @@ import NoMatch from './NoMatch';
import { wxAuth } from '../api/index';
import { Toast } from 'antd-mobile';
import store from '../store/index';
class App extends Component {
constructor(props) {
......@@ -72,6 +73,7 @@ class App extends Component {
console.log(res);
const { firstLogin, user, author } = res.data;
this.updateUserInfo({ ...user, login: true, author });
store.updateUserId(user.userId);
if (firstLogin) {
history.replace('/login');
} else {
......
......@@ -43,7 +43,7 @@ export class Index extends React.Component {
}
export default props => (
<UserInfoContext>
<UserInfoContext.Consumer>
{({ userinfo }) => <Index userinfo={userinfo} {...props} />}
</UserInfoContext>
</UserInfoContext.Consumer>
);
......@@ -72,7 +72,6 @@ class PublicCarApply extends Component {
}))
);
const entity = {
userId: this.state.userId,
department: this.state.department,
name: this.state.name,
categoryName: categoryName,
......
......@@ -13,6 +13,7 @@ import Select from '../../components/Input/Select/Select';
import { fetchRepairArea, fetchRepairTerm } from '../../api/index';
import { reportRepair } from '../../api/repairAdd';
import Perview from '../../components/Perview/Perview';
import store from '../../store/index';
class ReprtRepair extends Component {
constructor(props) {
......@@ -22,7 +23,6 @@ class ReprtRepair extends Component {
termList: [],
applyForm: {
name: '',
userId: '',
repairCellphone: '',
applyIdentity: '学生',
area: '',
......@@ -72,7 +72,6 @@ class ReprtRepair extends Component {
this.setState({
applyForm: {
name: '',
userId: '',
repairCellphone: '',
applyIdentity: '学生',
area: '',
......@@ -167,7 +166,7 @@ class ReprtRepair extends Component {
let term = this.state.termList.find(
i => i.value === this.state.applyForm.termId[0]
).label;
formData.append('userId', '1');
formData.append('userId', store.getUserId());
// product 需要登陆后的用户ID
formData.append('applyIdentity', this.state.applyForm.applyIdentity);
formData.append('area', area);
......
......@@ -100,7 +100,6 @@ class RepairDeal extends Component {
onPress: () =>
dealRepair({
id: id,
userId: '',
})
.then(res => {
Toast.fail(res.msg || '处理成功!');
......
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