This commit is contained in:
杜恒
2021-04-21 15:09:39 +08:00
parent 7a0e201284
commit 8056d8c0e8
16 changed files with 173 additions and 26 deletions

File diff suppressed because one or more lines are too long

View File

@@ -892,9 +892,56 @@ body.fullscreen {
display: block;
}
}
.joe_detail__article-progress {
width: 100%;
display: flex;
align-items: center;
.strip {
height: 12px;
border-radius: 6px;
overflow: hidden;
background: #ebeef5;
min-width: 0;
flex: 1;
margin-right: 10px;
.percent {
position: relative;
display: block;
height: 100%;
border-radius: 6px;
transition: width 0.35s;
&::before{
content: "";
opacity: 0;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #fff;
border-radius: 6px;
animation: progress-active 3s ease-in-out infinite;
}
}
}
.percentage {
color: #909399;
}
}
@media (max-width: 768px) {
.cm-modal__wrapper {
width: 90%;
}
}
@keyframes progress-active {
0% {
opacity: .3;
width: 0
}
to {
opacity: 0;
width: 100%
}
}

View File

@@ -638,4 +638,27 @@ export default class JoeAction {
}
});
}
handleProgress(cm) {
this._openModal({
title: '进度条',
innerHtml: `
<div class="fitem">
<label>百分比数</label>
<input autocomplete="off" name="percentage" placeholder="请输入百分比最大100%"/>
</div>
<div class="fitem">
<label>自定义色</label>
<input style="width: 44px;padding: 0 2px;flex: none" autocomplete="off" value="#ff6c6c" name="color" type="color"/>
</div>
`,
confirm: () => {
const percentage = $(".cm-modal input[name='percentage']").val();
const color = $(".cm-modal input[name='color']").val();
const str = `\n{progress percentage="${percentage}" color="${color}"/}\n\n`;
if (this._getLineCh(cm)) this._replaceSelection(cm, '\n' + str);
else this._replaceSelection(cm, str);
cm.focus();
}
});
}
}

View File

@@ -25,6 +25,7 @@ export default function createPreviewHtml(str) {
str = str.replace(/{anote([^}]*)\/}/g, '<joe-anote $1></joe-anote>');
str = str.replace(/{dotted([^}]*)\/}/g, '<joe-dotted $1></joe-dotted>');
str = str.replace(/{message([^}]*)\/}/g, '<joe-message $1></joe-message>');
str = str.replace(/{progress([^}]*)\/}/g, '<joe-progress $1></joe-progress>');
str = str.replace(/{hide[^}]*}([\s\S]*?){\/hide}/g, '<joe-hide></joe-hide>');
str = str.replace(/{card-default([^}]*)}([\s\S]*?){\/card-default}/g, '<section style="margin-bottom: 15px"><joe-card-default $1><span class="_temp" style="display: none">$2</span></joe-card-default></section>');

View File

@@ -170,6 +170,11 @@ export default [
title: '消息提示',
innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M195.181 164.694c-13.024-13.029-34.144-13.029-47.159 0-13.029 13.019-13.029 34.134 0 47.163l47.159 47.158c13.024 13.024 34.129 13.024 47.162 0 13.019-13.019 13.019-34.129 0-47.158l-47.162-47.163zm633.634 0l-47.162 47.163c-13.02 13.029-13.02 34.139 0 47.158 13.009 13.024 34.129 13.024 47.162 0l47.148-47.158c13.029-13.029 13.029-34.139 0-47.163-13.019-13.024-34.124-13.024-47.148 0zM111.809 428.626H45.115c-18.416 0-33.352 14.928-33.352 33.342 0 18.419 14.933 33.351 33.352 33.351h66.698c18.415 0 33.347-14.931 33.347-33.351 0-18.415-14.933-33.342-33.347-33.342h-.004zm867.072 0h-66.698c-18.416 0-33.352 14.928-33.352 33.342 0 18.419 14.933 33.351 33.352 33.351h66.693c18.419 0 33.361-14.931 33.361-33.351 0-18.415-14.941-33.342-33.361-33.342h.005zM478.648 45.108v66.698c0 18.42 14.928 33.347 33.347 33.347 18.41 0 33.351-14.928 33.351-33.347V45.108c0-18.415-14.941-33.347-33.351-33.347-18.419 0-33.347 14.933-33.347 33.347zM278.557 511.993c0-128.923 104.506-233.438 233.438-233.438 128.927 0 233.442 104.516 233.442 233.438 0 128.926-104.515 233.447-233.442 233.447-128.932 0-233.438-104.52-233.438-233.447zm-66.698 0c0 165.78 134.365 300.155 300.137 300.155 165.766 0 300.141-134.375 300.141-300.155 0-165.767-134.376-300.137-300.141-300.137-165.767.001-300.137 134.371-300.137 300.137zm233.437 466.895c0 18.405 14.933 33.351 33.352 33.351h66.698c18.419 0 33.347-14.946 33.347-33.351 0-18.429-14.928-33.347-33.347-33.347h-66.698c-18.419 0-33.352 14.918-33.352 33.347zm-66.693-100.045c0 18.405 14.933 33.346 33.342 33.346h200.096c18.419 0 33.351-14.941 33.351-33.346 0-18.434-14.931-33.357-33.351-33.357H411.945c-18.414 0-33.342 14.923-33.342 33.357zm0 0"/></svg>'
},
{
type: 'progress',
title: '进度条',
innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="22" height="22"><path d="M757.76 323.482a188.518 188.518 0 0 1 0 377.036H266.24a188.518 188.518 0 1 1 0-377.036h491.52zm0 66.56H502.63l-72.96 243.814H757.71a121.958 121.958 0 0 0 8.397-243.558l-8.397-.308z"/></svg>'
},
/* --------------------------- 短代码结束 --------------------------- */
{
type: 'clean',

File diff suppressed because one or more lines are too long

View File

@@ -298,6 +298,9 @@ class Joe extends JoeAction {
case 'message':
super.handleMessage(this.cm);
break;
case 'progress':
super.handleProgress(this.cm);
break;
}
});
$('.cm-tools').append(el);