Commit 2de77c37 authored by 前端-许佳敏's avatar 前端-许佳敏

fix: 修复书写bug

parent 8acdcc76
...@@ -86,8 +86,8 @@ export function render(oldRender: Function) { ...@@ -86,8 +86,8 @@ export function render(oldRender: Function) {
PublicApi.getMemberLoginReget().then(res => { PublicApi.getMemberLoginReget().then(res => {
const { data, code } = res const { data, code } = res
if (code === 1000) { if (code === 1000) {
setAuth(data) setAuth(data as any)
setRouters(data.urls) setRouters(data.auth as any)
} else { } else {
removeAuth() removeAuth()
removeRouters() removeRouters()
...@@ -113,7 +113,6 @@ export function render(oldRender: Function) { ...@@ -113,7 +113,6 @@ export function render(oldRender: Function) {
* @param {*} { routes, matchedRoutes, location, action } * @param {*} { routes, matchedRoutes, location, action }
*/ */
export function onRouteChange({ routes, matchedRoutes, location, action }) { export function onRouteChange({ routes, matchedRoutes, location, action }) {
console.log('onRouteChange')
// 路由切换时, 自动回到顶部 // 路由切换时, 自动回到顶部
document.body.scrollTop = document.documentElement.scrollTop = 0; document.body.scrollTop = document.documentElement.scrollTop = 0;
if (location.pathname.includes("memberCenter")) { if (location.pathname.includes("memberCenter")) {
...@@ -183,31 +182,5 @@ export function onRouteChange({ routes, matchedRoutes, location, action }) { ...@@ -183,31 +182,5 @@ export function onRouteChange({ routes, matchedRoutes, location, action }) {
* @returns * @returns
*/ */
export function rootContainer(container: any) { export function rootContainer(container: any) {
// return React.createElement(MobxProvider, null, container);
return <MobxProvider>{container}</MobxProvider> return <MobxProvider>{container}</MobxProvider>
} }
/**
* 用于个性化接口数据返回格式
* @todo 由于要开启useRequest hooks 目前没找到应用该请求的最佳实践,建议不用开启这个配置
*/
// export const request: RequestConfig = {
// errorConfig: {
// adaptor(resData) {
// return {
// ...resData,
// code: resData.ok,
// }
// }
// },
// middlewares: [
// async function printRequest(ctx, next) {
// console.log('发起了请求')
// console.log(ctx)
// await next()
// }
// ],
// requestInterceptors: [],
// responseInterceptors: []
// }
import * as LogisticsApi from './LogisticsApi' import * as LogisticsApi from './LogisticsApi'
import * as PassApi from './PassApi' import * as PassApi from './PassApi'
import * as WarehouseApi from './WarehouseApi' import * as WarehouseApi from './WarehouseApi'
import * as MemberApi from './memberApi' import * as MemberApi from './MemberApi'
import * as ProductApi from './ProductApi' import * as ProductApi from './ProductApi'
import * as TemplateApi from './TemplateApi' import * as TemplateApi from './TemplateApi'
import * as PayApi from './PayApi' import * as PayApi from './PayApi'
......
...@@ -16,6 +16,7 @@ export interface IApiRequest extends RequestOptionsInit { ...@@ -16,6 +16,7 @@ export interface IApiRequest extends RequestOptionsInit {
// 可以用于扩展请求配置 // 可以用于扩展请求配置
extendsOptions?: RequestOptionsInit extendsOptions?: RequestOptionsInit
} }
/** /**
* *
* umi-request文档 https://github.com/umijs/umi-request/blob/master/README_zh-CN.md * umi-request文档 https://github.com/umijs/umi-request/blob/master/README_zh-CN.md
......
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