Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xiaomai-cloud-class-web
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiaomai-cloud-class
xiaomai-cloud-class-web
Commits
ee3c6e9d
Commit
ee3c6e9d
authored
Dec 07, 2020
by
zhangleyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:图片上传接口联调
parent
9e66ce76
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
44 additions
and
26 deletions
+44
-26
src/components/CropperModal.tsx
+1
-1
src/core/upload.js
+12
-6
src/data-source/base/request-apis.ts
+8
-4
src/domains/basic-domain/baseService.ts
+6
-3
src/modules/personalInfo/ChangePhoneModal.tsx
+3
-3
src/modules/personalInfo/index.tsx
+4
-3
src/modules/store-manege/CourseCatalogPage.tsx
+10
-6
No files found.
src/components/CropperModal.tsx
View file @
ee3c6e9d
...
@@ -43,7 +43,6 @@ const CropperModal = (props: CropperModalProps) => {
...
@@ -43,7 +43,6 @@ const CropperModal = (props: CropperModalProps) => {
ready
:
()
=>
{
ready
:
()
=>
{
const
$clone
=
$image
.
clone
().
removeClass
(
'cropper-hidden'
)
as
any
;
const
$clone
=
$image
.
clone
().
removeClass
(
'cropper-hidden'
)
as
any
;
$previews
.
html
(
$clone
);
$previews
.
html
(
$clone
);
},
},
crop
:
_
.
throttle
(
function
(
e
:
any
)
{
crop
:
_
.
throttle
(
function
(
e
:
any
)
{
const
imageData
=
(
$image
as
any
).
cropper
(
'getImageData'
);
const
imageData
=
(
$image
as
any
).
cropper
(
'getImageData'
);
...
@@ -66,6 +65,7 @@ const CropperModal = (props: CropperModalProps) => {
...
@@ -66,6 +65,7 @@ const CropperModal = (props: CropperModalProps) => {
function
_handleSave
():
any
{
function
_handleSave
():
any
{
const
$image
=
$
(
'#image'
);
const
$image
=
$
(
'#image'
);
(
$image
as
any
).
cropper
(
'getCroppedCanvas'
).
toBlob
((
blob
:
any
)
=>
{
(
$image
as
any
).
cropper
(
'getCroppedCanvas'
).
toBlob
((
blob
:
any
)
=>
{
console
.
log
(
"blob"
,
blob
);
Upload
.
uploadBlobToOSS
(
blob
,
'avatar'
+
(
new
Date
()).
valueOf
()).
then
((
imgAddress
:
string
)
=>
{
Upload
.
uploadBlobToOSS
(
blob
,
'avatar'
+
(
new
Date
()).
valueOf
()).
then
((
imgAddress
:
string
)
=>
{
save
(
imgAddress
);
save
(
imgAddress
);
close
();
close
();
...
...
src/core/upload.js
View file @
ee3c6e9d
import
{
func
}
from
"prop-types"
;
import
{
func
}
from
"prop-types"
;
import
Service
from
'@/common/js/service'
;
import
Service
from
'@/common/js/service'
;
import
User
from
'@/common/js/user'
;
/*
/*
* @Author: 吴文洁
* @Author: 吴文洁
* @Date: 2020-08-11 11:47:14
* @Date: 2020-08-11 11:47:14
* @LastEditors:
wangyixi
* @LastEditors:
zhangleyuan
* @LastEditTime: 2020-1
0-19 16:30:24
* @LastEditTime: 2020-1
2-07 15:53:10
* @Description:
* @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
*/
class
Upload
{
class
Upload
{
static
uploadBlobToOSS
(
Blob
,
name
,
dir
,
dataType
=
'url'
)
{
static
uploadBlobToOSS
(
Blob
,
name
,
dir
,
dataType
=
'url'
)
{
// 上传图片和视频
// 上传图片和视频
return
Service
.
Hades
(
'/public/store/commonOssAuthority'
,
{
resourceName
:
name
,
instId
:
'0'
}).
then
((
res
)
=>
{
const
param
=
{
console
.
log
(
0
)
accessTypeEnum
:
"PUBLIC"
,
bizCode
:
'CLOUD_CLASS_COMMON'
,
instId
:
User
.
getStoreId
(),
resourceName
:
name
}
return
Service
.
Hades
(
'public/store/commonOssAuthority'
,
param
).
then
((
res
)
=>
{
const
signInfo
=
res
.
result
;
const
signInfo
=
res
.
result
;
const
{
u
rl
}
=
res
.
result
const
{
fileU
rl
}
=
res
.
result
return
this
.
uploadBlobToNewOSS
(
Blob
,
name
,
dir
,
signInfo
.
signatureVO
||
signInfo
).
then
(()
=>
{
return
this
.
uploadBlobToNewOSS
(
Blob
,
name
,
dir
,
signInfo
.
signatureVO
||
signInfo
).
then
(()
=>
{
return
dataType
===
'url'
?
u
rl
:
signInfo
return
dataType
===
'url'
?
fileU
rl
:
signInfo
});
});
})
})
};
};
...
...
src/data-source/base/request-apis.ts
View file @
ee3c6e9d
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: wufan
* @Author: wufan
* @Date: 2020-12-01 17:21:21
* @Date: 2020-12-01 17:21:21
* @LastEditors: zhangleyuan
* @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-0
4 17:39:12
* @LastEditTime: 2020-12-0
7 11:08:03
* @Description: Description
* @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
*/
...
@@ -25,9 +25,13 @@ export function getStoreUser(params: object) {
...
@@ -25,9 +25,13 @@ export function getStoreUser(params: object) {
export
function
sendBizAuthCode
(
params
:
object
)
{
export
function
sendBizAuthCode
(
params
:
object
)
{
return
Service
.
Hades
(
"public/store/sendBizAuthCode"
,
params
);
return
Service
.
Hades
(
"public/store/sendBizAuthCode"
,
params
);
}
}
export
function
editUserPhone
(
params
:
object
)
{
return
Service
.
Hades
(
"public/store/editUserPhone"
,
params
);
}
export
function
checkBizAuthCode
(
params
:
object
)
{
export
function
checkBizAuthCode
(
params
:
object
)
{
return
Service
.
Hades
(
"public/store/checkBizAuthCode"
,
params
);
return
Service
.
Hades
(
"public/store/checkBizAuthCode"
,
params
);
}
}
export
function
sendNewPhoneAuthCode
(
params
:
object
)
{
return
Service
.
Hades
(
"public/store/sendNewPhoneAuthCode"
,
params
);
}
export
function
editUserPhone
(
params
:
object
)
{
return
Service
.
Hades
(
"public/store/editUserPhone"
,
params
);
}
src/domains/basic-domain/baseService.ts
View file @
ee3c6e9d
...
@@ -2,12 +2,12 @@
...
@@ -2,12 +2,12 @@
* @Author: wufan
* @Author: wufan
* @Date: 2020-12-01 17:20:49
* @Date: 2020-12-01 17:20:49
* @LastEditors: zhangleyuan
* @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-0
4 17:08:24
* @LastEditTime: 2020-12-0
7 11:08:23
* @Description: Description
* @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
*/
import
{
getUserStore
,
getUserPermission
,
logout
,
getStoreUser
,
sendBizAuthCode
,
editUserPhone
,
checkBizAuthCode
}
from
'@/data-source/base/request-apis'
;
import
{
getUserStore
,
getUserPermission
,
logout
,
getStoreUser
,
sendBizAuthCode
,
editUserPhone
,
checkBizAuthCode
,
sendNewPhoneAuthCode
}
from
'@/data-source/base/request-apis'
;
export
default
class
StoreService
{
export
default
class
StoreService
{
// 获取员工列表
// 获取员工列表
...
@@ -37,5 +37,7 @@ export default class StoreService {
...
@@ -37,5 +37,7 @@ export default class StoreService {
static
checkBizAuthCode
(
params
:
any
){
static
checkBizAuthCode
(
params
:
any
){
return
checkBizAuthCode
(
params
);
return
checkBizAuthCode
(
params
);
}
}
static
sendNewPhoneAuthCode
(
params
:
any
){
return
sendNewPhoneAuthCode
(
params
);
}
}
}
\ No newline at end of file
src/modules/personalInfo/ChangePhoneModal.tsx
View file @
ee3c6e9d
...
@@ -54,13 +54,13 @@ function ChangePhoneModal(props: changePhoneModalProps) {
...
@@ -54,13 +54,13 @@ function ChangePhoneModal(props: changePhoneModalProps) {
let
timer
:
any
;
let
timer
:
any
;
const
param
=
{
const
param
=
{
phone
:
newPhone
,
phone
:
newPhone
,
serverType
:
'CLOUD_CLASS_
MODIFY
_PHONE'
,
serverType
:
'CLOUD_CLASS_
NEW
_PHONE'
,
sig
:
checkData
.
sig
,
sig
:
checkData
.
sig
,
sessionId
:
checkData
.
csessionid
,
sessionId
:
checkData
.
csessionid
,
token
:
checkData
.
token
,
token
:
checkData
.
token
,
scene
:
'nc_login'
scene
:
'nc_login'
}
}
BaseService
.
send
Biz
AuthCode
(
param
).
then
((
res
)
=>
{
BaseService
.
send
NewPhone
AuthCode
(
param
).
then
((
res
)
=>
{
timeSub
(
60
,
0
);
timeSub
(
60
,
0
);
});
});
function
timeSub
(
waitTime
:
number
,
unit
:
number
):
any
{
function
timeSub
(
waitTime
:
number
,
unit
:
number
):
any
{
...
@@ -97,7 +97,7 @@ function ChangePhoneModal(props: changePhoneModalProps) {
...
@@ -97,7 +97,7 @@ function ChangePhoneModal(props: changePhoneModalProps) {
}
}
const
param
=
{
const
param
=
{
authCode
:
phoneVerify
,
authCode
:
phoneVerify
,
phone
:
"string"
,
phone
:
newPhone
,
storeUserId
:
0
storeUserId
:
0
}
}
BaseService
.
editUserPhone
(
param
).
then
((
res
)
=>
{
BaseService
.
editUserPhone
(
param
).
then
((
res
)
=>
{
...
...
src/modules/personalInfo/index.tsx
View file @
ee3c6e9d
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: zhangleyuan
* @Author: zhangleyuan
* @Date: 2020-11-27 15:06:31
* @Date: 2020-11-27 15:06:31
* @LastEditors: zhangleyuan
* @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-0
4 18:00:20
* @LastEditTime: 2020-12-0
7 15:59:26
* @Description: 描述一下
* @Description: 描述一下
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
*/
...
@@ -42,10 +42,11 @@ function PersonalInfoPage() {
...
@@ -42,10 +42,11 @@ function PersonalInfoPage() {
storeUserId
:
User
.
getStoreUserId
()
storeUserId
:
User
.
getStoreUserId
()
}
}
BaseService
.
getStoreUser
(
param
).
then
((
res
)
=>
{
BaseService
.
getStoreUser
(
param
).
then
((
res
)
=>
{
const
{
nickName
,
phone
,
roleCodes
}
=
res
.
result
;
const
{
nickName
,
phone
,
roleCodes
,
avatar
}
=
res
.
result
;
setNickName
(
nickName
);
setNickName
(
nickName
);
setPhone
(
phone
);
setPhone
(
phone
);
setRoleCodes
(
roleCodes
)
setRoleCodes
(
roleCodes
)
setAvatar
(
avatar
)
});
});
}
}
function
_handleUpdateAvatar
(
e
:
any
):
any
{
function
_handleUpdateAvatar
(
e
:
any
):
any
{
...
@@ -77,7 +78,7 @@ function PersonalInfoPage() {
...
@@ -77,7 +78,7 @@ function PersonalInfoPage() {
nickName
,
nickName
,
phone
:
String
(
phone
),
phone
:
String
(
phone
),
roleCodes
:
roleCodes
,
roleCodes
:
roleCodes
,
//
avatar,
avatar
,
storeUserId
:
User
.
getStoreUserId
()
storeUserId
:
User
.
getStoreUserId
()
};
};
StoreService
.
editEmployee
(
params
).
then
((
res
)
=>
{
StoreService
.
editEmployee
(
params
).
then
((
res
)
=>
{
...
...
src/modules/store-manege/CourseCatalogPage.tsx
View file @
ee3c6e9d
...
@@ -157,9 +157,15 @@ function CourseCatalogPage() {
...
@@ -157,9 +157,15 @@ function CourseCatalogPage() {
parentId
,
parentId
,
}
}
StoreService
.
getAllSonCategory
(
param
).
then
((
res
:
any
)
=>
{
StoreService
.
getAllSonCategory
(
param
).
then
((
res
:
any
)
=>
{
record
.
children
=
res
.
result
||
[];
record
.
children
=
res
.
result
||
[];
const
_courseCatalogList
=
[...
courseCatalogList
]
record
.
children
.
map
((
item
:
any
,
index
:
any
)
=>
{
setCourseCatalogList
(
_courseCatalogList
)
item
.
key
=
item
.
id
return
item
})
const
_courseCatalogList
=
[...
courseCatalogList
];
console
.
log
(
"_courseCatalogList"
,
_courseCatalogList
);
setCourseCatalogList
(
_courseCatalogList
)
});
});
}
}
...
@@ -186,9 +192,7 @@ function CourseCatalogPage() {
...
@@ -186,9 +192,7 @@ function CourseCatalogPage() {
if
(
!
record
.
children
){
if
(
!
record
.
children
){
return
return
}
}
if
(
record
.
children
.
length
!==
0
){
if
(
record
.
children
.
length
===
0
){
return
<
div
>
{
record
.
children
[
0
].
categoryName
}
</
div
>;
}
else
{
return
<
div
>
还未添加任何子分类
</
div
>;
return
<
div
>
还未添加任何子分类
</
div
>;
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment