Commit ee3c6e9d by zhangleyuan

feat:图片上传接口联调

parent 9e66ce76
...@@ -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();
......
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-10-19 16:30:24 * @LastEditTime: 2020-12-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 { url } = res.result const { fileUrl } = 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' ? url : signInfo return dataType === 'url' ? fileUrl : signInfo
}); });
}) })
}; };
......
...@@ -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-04 17:39:12 * @LastEditTime: 2020-12-07 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);
}
...@@ -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-04 17:08:24 * @LastEditTime: 2020-12-07 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
...@@ -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.sendBizAuthCode(param).then((res) => { BaseService.sendNewPhoneAuthCode(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) => {
......
...@@ -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-04 18:00:20 * @LastEditTime: 2020-12-07 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) => {
......
...@@ -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>;
} }
}} }}
......
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