Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
f4a39e71
提交
f4a39e71
authored
5月 05, 2019
作者:
sin
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/master'
上级
cf5557bf
67cdefdb
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
82 行增加
和
3 行删除
+82
-3
PicturesWall.js
admin-web/src/components/Image/PicturesWall.js
+2
-1
ProductSpuAddOrUpdate.js
admin-web/src/pages/Product/ProductSpuAddOrUpdate.js
+79
-1
功能列表-管理后台.md
docs/guides/功能列表/功能列表-管理后台.md
+1
-1
没有找到文件。
admin-web/src/components/Image/PicturesWall.js
浏览文件 @
f4a39e71
...
@@ -77,6 +77,7 @@ class PicturesWall extends React.Component {
...
@@ -77,6 +77,7 @@ class PicturesWall extends React.Component {
// });
// });
// 使用 FileReader 将上传的文件转换成二进制流,满足 'application/octet-stream' 格式的要求
// 使用 FileReader 将上传的文件转换成二进制流,满足 'application/octet-stream' 格式的要求
debugger
;
const
reader
=
new
FileReader
();
const
reader
=
new
FileReader
();
reader
.
readAsArrayBuffer
(
file
);
reader
.
readAsArrayBuffer
(
file
);
let
fileData
=
null
;
let
fileData
=
null
;
...
@@ -101,7 +102,7 @@ class PicturesWall extends React.Component {
...
@@ -101,7 +102,7 @@ class PicturesWall extends React.Component {
// })
// })
// .catch(onError);
// .catch(onError);
let
key
=
uuid
.
v4
();
// TODO 芋艿,可能后面要优化。MD5?
let
key
=
uuid
.
v4
();
// TODO 芋艿,可能后面要优化。MD5?
let
observable
=
qiniu
.
upload
(
fil
e
,
key
,
this
.
state
.
token
);
// TODO 芋艿,最后后面去掉 qiniu 的库依赖,直接 http 请求,这样更轻量
let
observable
=
qiniu
.
upload
(
e
,
key
,
this
.
state
.
token
);
// TODO 芋艿,最后后面去掉 qiniu 的库依赖,直接 http 请求,这样更轻量
observable
.
subscribe
(
function
()
{
observable
.
subscribe
(
function
()
{
// next
// next
},
function
()
{
},
function
()
{
...
...
admin-web/src/pages/Product/ProductSpuAddOrUpdate.js
浏览文件 @
f4a39e71
...
@@ -7,6 +7,10 @@ import { connect } from 'dva';
...
@@ -7,6 +7,10 @@ import { connect } from 'dva';
import
moment
from
'moment'
;
import
moment
from
'moment'
;
import
{
Card
,
Form
,
Input
,
Radio
,
Button
,
Modal
,
Select
,
Upload
,
Icon
,
Spin
}
from
'antd'
;
import
{
Card
,
Form
,
Input
,
Radio
,
Button
,
Modal
,
Select
,
Upload
,
Icon
,
Spin
}
from
'antd'
;
import
PageHeaderWrapper
from
'@/components/PageHeaderWrapper'
;
import
PageHeaderWrapper
from
'@/components/PageHeaderWrapper'
;
import
'braft-editor/dist/index.css'
import
BraftEditor
from
'braft-editor'
import
{
ContentUtils
}
from
'braft-utils'
import
{
ImageUtils
}
from
'braft-finder'
// import * as qiniu from 'qiniu-js'
// import * as qiniu from 'qiniu-js'
// import uuid from 'js-uuid';
// import uuid from 'js-uuid';
...
@@ -16,6 +20,9 @@ import ProductAttrSelectFormItem from "../../components/Product/ProductAttrSelec
...
@@ -16,6 +20,9 @@ import ProductAttrSelectFormItem from "../../components/Product/ProductAttrSelec
import
ProductSkuAddOrUpdateTable
from
"../../components/Product/ProductSkuAddOrUpdateTable"
;
import
ProductSkuAddOrUpdateTable
from
"../../components/Product/ProductSkuAddOrUpdateTable"
;
// import {fileGetQiniuToken} from "../../services/admin";
// import {fileGetQiniuToken} from "../../services/admin";
import
PicturesWall
from
"../../components/Image/PicturesWall"
;
import
PicturesWall
from
"../../components/Image/PicturesWall"
;
import
{
fileGetQiniuToken
}
from
"../../services/admin"
;
import
uuid
from
"js-uuid"
;
import
*
as
qiniu
from
"qiniu-js"
;
const
FormItem
=
Form
.
Item
;
const
FormItem
=
Form
.
Item
;
const
RadioGroup
=
Radio
.
Group
;
const
RadioGroup
=
Radio
.
Group
;
...
@@ -40,6 +47,7 @@ class ProductSpuAddOrUpdate extends Component {
...
@@ -40,6 +47,7 @@ class ProductSpuAddOrUpdate extends Component {
// modalVisible: false,
// modalVisible: false,
modalType
:
'add'
,
//add update
modalType
:
'add'
,
//add update
// initValues: {},
// initValues: {},
editorState
:
BraftEditor
.
createEditorState
(
null
),
};
};
componentDidMount
()
{
componentDidMount
()
{
...
@@ -76,6 +84,47 @@ class ProductSpuAddOrUpdate extends Component {
...
@@ -76,6 +84,47 @@ class ProductSpuAddOrUpdate extends Component {
})
})
}
}
handleChange
=
(
editorState
)
=>
{
this
.
setState
({
editorState
})
};
uploadHandler
=
async
(
param
)
=>
{
if
(
!
param
.
file
)
{
return
false
}
debugger
;
const
tokenResult
=
await
fileGetQiniuToken
();
if
(
tokenResult
.
code
!==
0
)
{
alert
(
'获得七牛上传 Token 失败'
);
return
false
;
}
let
token
=
tokenResult
.
data
;
let
that
=
this
;
const
reader
=
new
FileReader
();
const
file
=
param
.
file
;
reader
.
readAsArrayBuffer
(
file
);
let
fileData
=
null
;
reader
.
onload
=
(
e
)
=>
{
let
key
=
uuid
.
v4
();
// TODO 芋艿,可能后面要优化。MD5?
let
observable
=
qiniu
.
upload
(
file
,
key
,
token
);
// TODO 芋艿,最后后面去掉 qiniu 的库依赖,直接 http 请求,这样更轻量
observable
.
subscribe
(
function
()
{
// next
},
function
(
e
)
{
// error
// TODO 芋艿,后续补充
// debugger;
},
function
(
response
)
{
// complete
that
.
setState
({
editorState
:
ContentUtils
.
insertMedias
(
that
.
state
.
editorState
,
[{
type
:
'IMAGE'
,
url
:
'http://static.shop.iocoder.cn/'
+
response
.
key
,
}])
})
});
}
};
handleAddAttr
=
e
=>
{
handleAddAttr
=
e
=>
{
// alert('你猜');
// alert('你猜');
const
{
dispatch
}
=
this
.
props
;
const
{
dispatch
}
=
this
.
props
;
...
@@ -154,6 +203,25 @@ class ProductSpuAddOrUpdate extends Component {
...
@@ -154,6 +203,25 @@ class ProductSpuAddOrUpdate extends Component {
// debugger;
// debugger;
const
{
form
,
skus
,
attrTree
,
allAttrTree
,
loading
,
spu
,
dispatch
}
=
this
.
props
;
const
{
form
,
skus
,
attrTree
,
allAttrTree
,
loading
,
spu
,
dispatch
}
=
this
.
props
;
// const that = this;
// const that = this;
const
controls
=
[
'bold'
,
'italic'
,
'underline'
,
'text-color'
,
'separator'
,
'link'
,
'separator'
];
const
extendControls
=
[
{
key
:
'antd-uploader'
,
type
:
'component'
,
component
:
(
<
Upload
accept
=
"image/*"
showUploadList
=
{
false
}
customRequest
=
{
this
.
uploadHandler
}
>
{
/* 这里的按钮最好加上type="button",以避免在表单容器中触发表单提交,用Antd的Button组件则无需如此 */
}
<
button
type
=
"button"
className
=
"control-item button upload-button"
data
-
title
=
"插入图片"
>
<
Icon
type
=
"picture"
theme
=
"filled"
/>
<
/button
>
<
/Upload
>
)
}
];
// 添加规格
// 添加规格
// debugger;
// debugger;
...
@@ -243,7 +311,17 @@ class ProductSpuAddOrUpdate extends Component {
...
@@ -243,7 +311,17 @@ class ProductSpuAddOrUpdate extends Component {
{
form
.
getFieldDecorator
(
'description'
,
{
{
form
.
getFieldDecorator
(
'description'
,
{
rules
:
[{
required
:
true
,
message
:
'请输入商品描述!'
}],
rules
:
[{
required
:
true
,
message
:
'请输入商品描述!'
}],
initialValue
:
spu
.
description
,
// TODO 修改
initialValue
:
spu
.
description
,
// TODO 修改
})(
<
Input
.
TextArea
placeholder
=
"请输入"
/>
)}
})(
<
div
style
=
{{
border
:
'1px solid #d1d1d1'
,
'border-radius'
:
'5px'
}}
>
<
BraftEditor
value
=
{
this
.
state
.
editorState
}
onChange
=
{
this
.
handleChange
}
controls
=
{
controls
}
extendControls
=
{
extendControls
}
contentStyle
=
{{
height
:
200
}}
/
>
<
/div
>
)}
<
Button
type
=
"primary"
htmlType
=
"submit"
style
=
{{
marginLeft
:
8
}}
onSubmit
=
{
this
.
handleSubmit
}
>
保存
<
/Button
>
<
Button
type
=
"primary"
htmlType
=
"submit"
style
=
{{
marginLeft
:
8
}}
onSubmit
=
{
this
.
handleSubmit
}
>
保存
<
/Button
>
<
/FormItem
>
<
/FormItem
>
<
/Form
>
<
/Form
>
...
...
docs/guides/功能列表/功能列表-管理后台.md
浏览文件 @
f4a39e71
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
-
[
]
商品管理
-
[
]
商品管理
-
[
]
发布商品
-
[
]
发布商品
-
[
]
商品管理
-
[
]
商品管理
-
[
]
展示类目
-
[
x
]
展示类目
-
[
]
品牌管理
-
[
]
品牌管理
-
[
]
订单管理
-
[
]
订单管理
-
[
]
销售单
-
[
]
销售单
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论