修改代码库二级改版issue

This commit is contained in:
谢思 2021-09-29 21:04:40 +08:00
parent 68b1e0c704
commit 30512cb4f4
18 changed files with 137 additions and 61 deletions

2
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,2 @@
{
}

13
package-lock.json generated
View File

@ -7286,7 +7286,8 @@
"ansi-regex": { "ansi-regex": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
"optional": true
}, },
"aproba": { "aproba": {
"version": "1.2.0", "version": "1.2.0",
@ -7703,7 +7704,8 @@
"safe-buffer": { "safe-buffer": {
"version": "5.1.2", "version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"optional": true
}, },
"safer-buffer": { "safer-buffer": {
"version": "2.1.2", "version": "2.1.2",
@ -7759,6 +7761,7 @@
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"optional": true,
"requires": { "requires": {
"ansi-regex": "^2.0.0" "ansi-regex": "^2.0.0"
} }
@ -7802,12 +7805,14 @@
"wrappy": { "wrappy": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"optional": true
}, },
"yallist": { "yallist": {
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
"integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
"optional": true
} }
} }
}, },

View File

@ -1,8 +1,8 @@
@font-face { @font-face {
font-family: "iconfont"; /* Project id 2340181 */ font-family: "iconfont"; /* Project id 2340181 */
src: url('iconfont.woff2?t=1632638897939') format('woff2'), src: url('iconfont.woff2?t=1632881251448') format('woff2'),
url('iconfont.woff?t=1632638897939') format('woff'), url('iconfont.woff?t=1632881251448') format('woff'),
url('iconfont.ttf?t=1632638897939') format('truetype'); url('iconfont.ttf?t=1632881251448') format('truetype');
} }
.iconfont { .iconfont {
@ -13,6 +13,18 @@
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
.icon-wenjian7:before {
content: "\e8e0";
}
.icon-xiangyoujiantou:before {
content: "\e8de";
}
.icon-xiangzuojiantou:before {
content: "\e8df";
}
.icon-a-liulanicon2x:before { .icon-a-liulanicon2x:before {
content: "\e8dd"; content: "\e8dd";
} }

File diff suppressed because one or more lines are too long

View File

@ -5,6 +5,27 @@
"css_prefix_text": "icon-", "css_prefix_text": "icon-",
"description": "", "description": "",
"glyphs": [ "glyphs": [
{
"icon_id": "24656750",
"name": "文件",
"font_class": "wenjian7",
"unicode": "e8e0",
"unicode_decimal": 59616
},
{
"icon_id": "630094",
"name": "向右箭头",
"font_class": "xiangyoujiantou",
"unicode": "e8de",
"unicode_decimal": 59614
},
{
"icon_id": "630095",
"name": "向左箭头",
"font_class": "xiangzuojiantou",
"unicode": "e8df",
"unicode_decimal": 59615
},
{ {
"icon_id": "24600282", "icon_id": "24600282",
"name": "浏览icon@2x", "name": "浏览icon@2x",

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -3,7 +3,6 @@ import { AlignTop } from '../Component/layout';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
function Releases({owner,projectsId,releaseVersions , baseOperate , projectType}){ function Releases({owner,projectsId,releaseVersions , baseOperate , projectType}){
return( return(
<div> <div>
<Link to={`/${owner}/${projectsId}/releases`} className="font-16 color-ooo hoverA"> <Link to={`/${owner}/${projectsId}/releases`} className="font-16 color-ooo hoverA">
@ -28,7 +27,7 @@ function Releases({owner,projectsId,releaseVersions , baseOperate , projectType}
}) })
: :
<div className="mt8"> <div className="mt8">
您暂未发布任何版本{baseOperate && projectType !==2 && <Link className="color-blue ml20" to={`/projects/${owner}/${projectsId}/releases/new`}>创建新版本</Link>} 您暂未发布任何版本{baseOperate && projectType !==2 && <Link className="color-blue ml20" to={{pathname:`/${owner}/${projectsId}/releases/new`,state:{stable:true}}}>创建新版本</Link>}
</div> </div>
} }

View File

@ -67,14 +67,14 @@ function CoderDepot(props){
const [ editReadme , setEditReadme ] = useState(false); const [ editReadme , setEditReadme ] = useState(false);
const [ pullsFlag , setPullsFlag ] = useState(true); const [ pullsFlag , setPullsFlag ] = useState(true);
const [ issuesFlag , setIssuesFlag ] = useState(true); const [ issuesFlag , setIssuesFlag ] = useState(true);
const [ releaseVersions , setReleaseVersions] = useState(undefined);
const details = props.projectDetail;
const owner = props.match.params.owner; const owner = props.match.params.owner;
const projectsId = props.match.params.projectsId; const projectsId = props.match.params.projectsId;
let branchName = props.match.params.branchName; let branchName = props.match.params.branchName;
branchName = returnbar(branchName); branchName = returnbar(branchName);
const details = props.projectDetail;
let pathname = props.history.location.pathname; let pathname = props.history.location.pathname;
const { bannerList } = props; const { bannerList } = props;
useEffect(()=>{ useEffect(()=>{
@ -90,7 +90,6 @@ function CoderDepot(props){
} }
},[bannerList]) },[bannerList])
useEffect(()=>{ useEffect(()=>{
if(details){ if(details){
setProjectDetail(details); setProjectDetail(details);
@ -100,7 +99,7 @@ function CoderDepot(props){
setDefaultBranch(details.default_branch); setDefaultBranch(details.default_branch);
setInviteCode(details.invite_code); setInviteCode(details.invite_code);
} }
},[details]) })
useEffect(()=>{ useEffect(()=>{
if(treeValue){ if(treeValue){
@ -127,11 +126,22 @@ function CoderDepot(props){
} }
},[projectsId,owner,pathname,defaultBranch]) },[projectsId,owner,pathname,defaultBranch])
useEffect(()=>{
axios.get(`/${owner}/${projectsId}/releases.json`).then((result)=>{
if(result && result.data && result.data.releases){
const release = {
"list":result.data.releases,
"total_count":result.data.releases.length
}
setReleaseVersions(release);
}
})
},[releaseVersions])
// //
function getDirInfo(branch){ function getDirInfo(branch){
setIsSpin(true); setIsSpin(true);
const url = `/${owner}/${projectsId}/entries.json`; const url = `/${owner}/${projectsId}/entries.json`;
axios.get(url, { axios.get(url, {
params: { ref: branch } params: { ref: branch }
}).then((result) => { }).then((result) => {
@ -521,13 +531,13 @@ function CoderDepot(props){
} }
{/* 发布 */} {/* 发布 */}
{ {
projectDetail && projectDetail.release_versions && releaseVersions &&
<React.Fragment> <React.Fragment>
<Divider /> <Divider />
<Releases <Releases
owner={owner} owner={owner}
projectsId={projectsId} projectsId={projectsId}
releaseVersions={projectDetail.release_versions} releaseVersions={releaseVersions}
history={props.history} history={props.history}
baseOperate={baseOperate} baseOperate={baseOperate}
projectType={projectDetail.type} projectType={projectDetail.type}

View File

@ -1,7 +1,7 @@
import React , { Component } from 'react'; import React , { Component } from 'react';
import { Spin , Pagination, Timeline } from 'antd'; import { Spin , Pagination, Timeline } from 'antd';
import { getImageUrl } from 'educoder'; import { getImageUrl } from 'educoder';
import { truncateCommitId } from '../common/util'; import { truncateCommitId ,timeFormat } from '../common/util';
import { AlignTop } from '../Component/layout'; import { AlignTop } from '../Component/layout';
import SelectBranch from '../Branch/Select'; import SelectBranch from '../Branch/Select';
import Nodata from '../Nodata'; import Nodata from '../Nodata';
@ -21,15 +21,14 @@ function returnbar(str){
return str; return str;
} }
function timeFormat(seconds) {
const time = new Date(seconds*1000);
return time.getFullYear()+"-"+(time.getMonth()+1)+"-"+time.getDate()+" "+(time.getHours()+1)+":"+time.getMinutes();
}
//代码库--提交页面 //代码库--提交页面
class CoderRootCommit extends Component{ class CoderRootCommit extends Component{
constructor(props){ constructor(props){
super(props); super(props);
// const params = new URLSearchParams(location && location.search);
// const [commitPage] = [params.get('commitPage')];
// console.log('111',commitPage);
// commitPage && this.setState({page:commitPage});
this.state={ this.state={
commitDatas:undefined, commitDatas:undefined,
dataCount:undefined, dataCount:undefined,
@ -153,7 +152,7 @@ class CoderRootCommit extends Component{
<div className="commitList-item f-wrap-between"> <div className="commitList-item f-wrap-between">
<div> <div>
<AlignTop> <AlignTop>
<div className="commitDesc"><Link to={{pathname:`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}/${branch}`,query:{page:page}}} className="font-14 color-grey-3 font-bd">{item.message}</Link></div> <div className="commitDesc"><Link to={{pathname:`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}/${branch}`,query:{commitPage:page}}} className="font-14 color-grey-3 font-bd">{item.message}</Link></div>
</AlignTop> </AlignTop>
<p className="f-wrap-alignCenter mt15"> <p className="f-wrap-alignCenter mt15">
<User <User

View File

@ -1,7 +1,7 @@
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import styled from "styled-components"; import styled from "styled-components";
import { Button ,Spin } from "antd"; import { Button ,Spin } from "antd";
import { truncateCommitId } from '../common/util'; import { timeFormat, truncateCommitId } from '../common/util';
import { getImageUrl } from 'educoder'; import { getImageUrl } from 'educoder';
import Files from '../Merge/Files'; import Files from '../Merge/Files';
import Tree from "./img/tree.png"; import Tree from "./img/tree.png";
@ -70,11 +70,6 @@ export default (props) => {
}); });
} }
}, [projectsId , owner, sha]); }, [projectsId , owner, sha]);
function timeFormat(seconds) {
const time = new Date(seconds*1000);
return time.getFullYear()+"-"+(time.getMonth()+1)+"-"+time.getDate()+" "+(time.getHours()+1)+":"+time.getMinutes();
}
return ( return (
<div className="main" style={{padding:"0px",border:"none"}}> <div className="main" style={{padding:"0px",border:"none"}}>

View File

@ -32,9 +32,9 @@ export default Form.create()(
const [fileList, setFileList] = useState(undefined); const [fileList, setFileList] = useState(undefined);
const [attachment, setAttachment] = useState(undefined); const [attachment, setAttachment] = useState(undefined);
const [options , setOptions] = useState(undefined); const [options , setOptions] = useState(undefined);
const stable = history && history.location && history.location.state.stable;
const { projectsId, versionId , owner } = match.params; const { projectsId, versionId , owner } = match.params;
useEffect(()=>{ useEffect(()=>{
if(projectDetail && projectDetail.default_branch){ if(projectDetail && projectDetail.default_branch){
setBranch(projectDetail.default_branch); setBranch(projectDetail.default_branch);
@ -129,6 +129,7 @@ export default Form.create()(
function changeBranch(params) { function changeBranch(params) {
setBranch(params); setBranch(params);
} }
return ( return (
<div className="df pt15"> <div className="df pt15">
<Form className="versionForm"> <Form className="versionForm">
@ -207,7 +208,7 @@ export default Form.create()(
{ rules:[], { rules:[],
validateFirst: true validateFirst: true
})( })(
<Checkbox>这是一个预览版本</Checkbox> <Checkbox defaultChecked={!stable}>这是一个预览版本</Checkbox>
)} )}
</Form.Item> </Form.Item>
<p className="pt20" style={{borderTop:"1px solid #eee"}}> <p className="pt20" style={{borderTop:"1px solid #eee"}}>
@ -216,7 +217,6 @@ export default Form.create()(
</Button> </Button>
<Button <Button
onClick={() =>history.push(`/${owner}/${projectsId}/releases`)} className="btngrey" onClick={() =>history.push(`/${owner}/${projectsId}/releases`)} className="btngrey"
// style={{backgroundColor: "rgba(187,187,187,1)",color: "#fff"}}
>取消</Button> >取消</Button>
</p> </p>
</Form> </Form>

View File

@ -8,6 +8,7 @@ import './version.scss';
import axios from 'axios'; import axios from 'axios';
import Tree from '../img/tree-black.png'; import Tree from '../img/tree-black.png';
import RenderHtml from '../../../components/render-html'; import RenderHtml from '../../../components/render-html';
import User from "../../Component/User";
function version(props) { function version(props) {
console.log(props); console.log(props);
@ -29,6 +30,7 @@ function version(props) {
axios.get(url).then((result) => { axios.get(url).then((result) => {
if (result) { if (result) {
setData(result.data); setData(result.data);
console.log('data',result.data)
const { releases = [] } = result.data; const { releases = [] } = result.data;
//默认第一个展开body参数) //默认第一个展开body参数)
releases.length && (releases[0].bodyshow = true); releases.length && (releases[0].bodyshow = true);
@ -48,7 +50,6 @@ function version(props) {
} }
//删除 //删除
function deleteRelease(releaseId) { function deleteRelease(releaseId) {
console.log(releaseId);
if(releaseId){ if(releaseId){
axios.delete(`/${owner}/${projectsId}/releases/${releaseId}.json`).then((result)=>{ axios.delete(`/${owner}/${projectsId}/releases/${releaseId}.json`).then((result)=>{
if(result){ if(result){
@ -64,28 +65,29 @@ function version(props) {
<span className={`${item.draft === "稳定" ?"versionTag green":"versionTag orange"}`}>{item.draft}</span> <span className={`${item.draft === "稳定" ?"versionTag green":"versionTag orange"}`}>{item.draft}</span>
<span className="color-grey-3 mt15 font-12"> <span className="color-grey-3 mt15 font-12">
<i className="iconfont icon-biaoqianicon mr3 font-14"></i> <i className="iconfont icon-biaoqianicon mr3 font-14"></i>
{item.tag_name}{item.draft === "预发行" ?"(standalone)":""} <Link className="hover" to={`/${owner}/${projectsId}/tree/${item.name}`} >{item.tag_name}</Link>
</span> </span>
<span className="color-grey-3 font-12"> <span className="color-grey-3 font-12">
<img src={Tree} width="16px" color="#333333" className="mr3"/> <img src={Tree} width="16px" color="#333333" className="mr3"/>
{truncateCommitId(item.sha)} <Link className="hover" to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}/${item.branch}`}>{truncateCommitId(item.sha)}</Link>
</span> </span>
</span> </span>
<div className="versionInfo_right"> <div className="versionInfo_right">
<div className="versionName"> <div className="versionName">
<Link to={`/${owner}/${projectsId}/tree/${item.tag_name}`} className="task-hide color-blue hover font-18">发布{item.name}{item.draft === "预发行" ?"(standalone)版本":""}</Link> <Link to={`/${owner}/${projectsId}/tree/${item.tag_name}`} className="task-hide color-blue hover font-18">发布{item.name}</Link>
<span> <span>
{ {data && data.user_admin_permission && <Link to={{pathname:`/${owner}/${projectsId}/releases/${item.version_id}/update`,state:{"stable":item.draft==="稳定"}}} className="ml15"><i className="iconfont icon-a-bianji1 font-16 color-grey-6"></i></Link>}
(isManager || isDeveloper) && type !==2 && {data && data.user_admin_permission && <i className ="iconfont icon-shanchuicon1 font-16 ml15" onClick={()=>{deleteRelease(item.version_id)}}></i>}
<Link to={`/${owner}/${projectsId}/releases/${item.version_id}/update`} className="ml15"><i className="iconfont icon-a-bianji1 font-16 color-grey-6"></i></Link>
}
{current_user_login == owner && <i className ="iconfont icon-shanchuicon1 font-16 ml15" onClick={()=>{deleteRelease(item.version_id)}}></i>}
</span> </span>
</div> </div>
<span className="color-grey-3 mb15"> <span className="color-grey-3 mb15 version-user">
<i className={`${item.bodyshow ? "iconfont icon-sanjiaoxing-down color-grey-8 mr3 font-14":"iconfont icon-triangle color-grey-8 mr3 font-14"}`} onClick={()=>showBody(key,item.bodyshow)}></i> <i className={`${item.bodyshow ? "iconfont icon-sanjiaoxing-down color-grey-8 mr3 font-14":"iconfont icon-triangle color-grey-8 mr3 font-14"}`} onClick={()=>showBody(key,item.bodyshow)}></i>
<img src={getImageUrl(item.image_url)} alt="" className="sendAuthorImg"/> <User
<span className="weight500">{item.user_name}</span> id={item.id}
url={(item.image_url && getImageUrl(`/${item.image_url}`)) || "https://dss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3025493530,1989042357&fm=26&gp=0.jpg"}
name={item.user_name}
login={item.user_name}
/>
<span className="ml5">发布于{item.created_at}</span> <span className="ml5">发布于{item.created_at}</span>
</span> </span>
{ {
@ -96,16 +98,14 @@ function version(props) {
} }
<RenderHtml /> <RenderHtml />
<p className="versionFile"> <p className="versionFile">
<a href={item.tarball_url}><i className="iconfont icon-wenjian7 font-14 mr10 color-grey-3"></i>{item.tag_name}.TAR.gz</a> {/* 发行版附件下载 */}
<a href={item.zipball_url}><i className="iconfont icon-wenjian7 font-14 mr10 color-grey-3"></i>{item.tag_name}.ZIP</a>
</p>
{/* 发行版附件下载 */}
{/* {item.attachments.length !=0 && <p className="versionFile">
<span>附件</span> */}
{item.attachments && item.attachments.map((item)=>{ {item.attachments && item.attachments.map((item)=>{
return(<Link to={`${item.url}`}><i className="iconfont icon-wenjian7 font-14 mr10 color-grey-3"></i>{item.title}</Link>) return(<Link to={`${item.url}`}><i className="iconfont icon-wenjian7 font-14 mr10 color-grey-3"></i> {item.title}</Link>)
})} })}
{/* </p>} */} {/* 发行版下载包 */}
<a href={item.tarball_url}><i className="iconfont icon-wenjian7 font-14 mr10 color-grey-3"></i> {item.tag_name}.TAR.gz</a>
<a href={item.zipball_url}><i className="iconfont icon-wenjian7 font-14 mr10 color-grey-3"></i> {item.tag_name}.ZIP</a>
</p>
</div> </div>
</div> </div>
) )
@ -115,7 +115,7 @@ function version(props) {
return ( return (
<React.Fragment> <React.Fragment>
{ {
data && data.user_permission && type !== 2 && data && data.user_admin_permission &&
<div className="addReleaseBtn"> <div className="addReleaseBtn">
<Button type={"primary"} onClick={addFunc} className="btnblue" style={{height:"36px"}}>发布新版本</Button> <Button type={"primary"} onClick={addFunc} className="btnblue" style={{height:"36px"}}>发布新版本</Button>
</div> </div>
@ -128,7 +128,7 @@ function version(props) {
} else if (releases && releases.length === 0) { } else if (releases && releases.length === 0) {
return ( return (
<Empty <Empty
operation={data && data.user_permission && type !== 2} operation={data && data.user_admin_permission}
addFunc={addFunc} addFunc={addFunc}
/> />
) )
@ -136,7 +136,7 @@ function version(props) {
} }
function addFunc(){ function addFunc(){
props.history.push(`/${owner}/${projectsId}/releases/new`); props.history.push({pathname:`/${owner}/${projectsId}/releases/new`,state:{stable:true}});
} }
return ( return (

View File

@ -26,6 +26,12 @@
flex-direction: column; flex-direction: column;
align-items: flex-end; align-items: flex-end;
padding-right: 15px; padding-right: 15px;
&>.color-grey-3{
max-width: 10rem;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
} }
.versionInfo_right{ .versionInfo_right{
flex: 1; flex: 1;
@ -54,6 +60,13 @@
.body-show{ .body-show{
padding: 5px 10px 10px 10px; padding: 5px 10px 10px 10px;
} }
& .version-user>a>span{
display: inline-block;
& img{
width: 20px;
height: 20px;
}
}
} }
.versionTag{ .versionTag{
display: inline; display: inline;
@ -95,7 +108,7 @@
margin-top: 5px; margin-top: 5px;
padding-top: 20px; padding-top: 20px;
border-top: 1px solid #eee; border-top: 1px solid #eee;
width: 100%; // width: 100%;
a{ a{
display: block; display: block;
color: #333; color: #333;

View File

@ -10,7 +10,21 @@ function Files(props){
const [ files , setFiles ] = useState(data && data.files); const [ files , setFiles ] = useState(data && data.files);
const [ copyfileTipTitle, setCopyfileTipTitle] = useState("复制文件路径"); const [ copyfileTipTitle, setCopyfileTipTitle] = useState("复制文件路径");
const [ isOpen, setIsOpen] = useState(false); const [ isOpen, setIsOpen] = useState(false);
const commitPage = history && history.location && history.location.query && history.location.query.page; const commitPage = history && history.location && history.location.query && history.location.query.commitPage;
// console.log('222',commitPage);
// const nextHref = useRef(null);
// useEffect(()=>{
// const unlisten = history.listen((location)=>{
// if(nextHref.current !== location.pathname){
// nextHref.current = location.pathname;
// history.replace({pathname:location.pathname,search:`commitPage=${commitPage}`});
// // history.replace({pathname:location.pathname, query:{page:commitPage}});
// } else{
// unlisten;
// }
// })
// })
useEffect(()=>{ useEffect(()=>{
if(data){ if(data){

View File

@ -6,3 +6,11 @@ export function truncateCommitId(str) {
return str return str
} }
} }
// 秒数转2021-9-29 01:01
export function timeFormat(SecondsStr){
const time = new Date(SecondsStr*1000);
const hour = time.getHours()<10?"0".concat(time.getHours()):time.getHours();
const minutes = time.getMinutes()<10?"0".concat(time.getMinutes()):time.getMinutes();
return time.getFullYear()+"-"+(time.getMonth()+1)+"-"+time.getDate()+" "+hour+":"+minutes;
}

View File

@ -53,8 +53,6 @@ class CompetitionContentspdfpeopledata extends Component {
let url = `/users/accounts/${id}.json`; let url = `/users/accounts/${id}.json`;
axios.get(url).then((result) => { axios.get(url).then((result) => {
if (result.data) { if (result.data) {
console.log("GetuseridApi");
console.log(result.data);
this.setState({ this.setState({
userdata:result.data userdata:result.data
}) })