Commit 2d535161 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix: 处理商品描述上传文件没token问题

parent ff8b7fea
...@@ -9,12 +9,14 @@ import ImgCrop from 'antd-img-crop'; ...@@ -9,12 +9,14 @@ import ImgCrop from 'antd-img-crop';
import { inject, observer } from 'mobx-react' import { inject, observer } from 'mobx-react'
import { store } from '@/store' import { store } from '@/store'
import { getAuth } from '@/utils/auth'
const ProductDescFormDefualt: React.FC<{}> = (props) => { const ProductDescFormDefualt: React.FC<{}> = (props) => {
const [fileImageList, setFileImageList] = useState<any>([]) const [fileImageList, setFileImageList] = useState<any>([])
const [videoList, setVideoList] = useState<any>([]) const [videoList, setVideoList] = useState<any>([])
const flagRef = useRef<boolean>(false) const flagRef = useRef<boolean>(false)
const [isLoading, setIsLoading] = useState<boolean>(false) // 上传的加载状态 const [isLoading, setIsLoading] = useState<boolean>(false) // 上传的加载状态
const { userId, memberId, token } = getAuth() || {}
const { ProductStore } = store const { ProductStore } = store
const { productInfoByEdit, setProductDescription, selectCategoryId } = ProductStore const { productInfoByEdit, setProductDescription, selectCategoryId } = ProductStore
...@@ -56,6 +58,7 @@ const ProductDescFormDefualt: React.FC<{}> = (props) => { ...@@ -56,6 +58,7 @@ const ProductDescFormDefualt: React.FC<{}> = (props) => {
name: 'file', name: 'file',
action: '/api/file/file/upload', action: '/api/file/file/upload',
showUploadList: false, showUploadList: false,
headers: { token },
data: { fileType: UPLOAD_TYPE }, data: { fileType: UPLOAD_TYPE },
beforeUpload(file) { beforeUpload(file) {
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/jpg' || file.type === 'image/png' || file.type === 'image/gif'; const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/jpg' || file.type === 'image/png' || file.type === 'image/gif';
...@@ -91,6 +94,7 @@ const ProductDescFormDefualt: React.FC<{}> = (props) => { ...@@ -91,6 +94,7 @@ const ProductDescFormDefualt: React.FC<{}> = (props) => {
name: 'file', name: 'file',
action: '/api/file/file/upload', action: '/api/file/file/upload',
showUploadList: false, showUploadList: false,
headers: { token },
data: { fileType: UPLOAD_TYPE }, data: { fileType: UPLOAD_TYPE },
beforeUpload(file) { beforeUpload(file) {
const isVideo = file.type === 'video/mp4'; const isVideo = file.type === 'video/mp4';
......
...@@ -303,7 +303,7 @@ const DirectChannel: React.FC<{}> = () => { ...@@ -303,7 +303,7 @@ const DirectChannel: React.FC<{}> = () => {
PublicApi.getTemplateWebMemberChannelWebFindCurrMemberChannel().then(res => { PublicApi.getTemplateWebMemberChannelWebFindCurrMemberChannel().then(res => {
if(res.data.id){ if(res.data.id){
setCheckedValues(values) setCheckedValues(values)
setShopId(res.data.id) setShopId(res?.data?.id)
}else{ }else{
message.error('您还没有开通店铺,无法上下架商品!') message.error('您还没有开通店铺,无法上下架商品!')
} }
......
...@@ -84,7 +84,7 @@ const FirstApprovedOrder:React.FC<FirstApprovedOrderProps> = (props) => { ...@@ -84,7 +84,7 @@ const FirstApprovedOrder:React.FC<FirstApprovedOrderProps> = (props) => {
}} }}
formilyChilds={{ formilyChilds={{
children: <Space> children: <Space>
<Button onClick={handleSubmitBatch} loading={loading}>批量提交审核</Button> <Button onClick={handleSubmitBatch} loading={loading}>批量归档</Button>
</Space>, </Space>,
layouts: { layouts: {
span: 8 span: 8
......
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