Skip to content

Commit

Permalink
optimize sth.
Browse files Browse the repository at this point in the history
  • Loading branch information
KangSpace committed Apr 25, 2021
1 parent ae0881e commit 7c24a60
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 47 deletions.
14 changes: 13 additions & 1 deletion pages/biz/webview/webview.acss
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
@import '../error-view/index.acss';
@import '../error-view/index.acss';

.loading-wrapper{
padding-top: 2.4rem;
display: block;
height: 100%;
text-align: center;
}

.loading{
color: #bdbebf;
padding:8rpx 0;
}
6 changes: 6 additions & 0 deletions pages/biz/webview/webview.axml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<import src="/pages/biz/error-view/index.axml"/>

<!-- loading.... page -->
<view a:if="{{url!='error'}}" class="loading-wrapper">
<view class="loading">
正在跳转...
</view>
</view>

<!-- 页面刷新 -->
<block a:if="{{url=='refresh'}}">
Expand Down
3 changes: 3 additions & 0 deletions pages/biz/webview/webview.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,7 @@ Page({
this.refreshRedirectTo(url);
},

bindLoad(e){
console.info(e);
}
});
25 changes: 16 additions & 9 deletions pages/components/messsage-tab-swaper/message-tab-swaper.acss
Original file line number Diff line number Diff line change
Expand Up @@ -206,16 +206,23 @@
position: relative;
padding-bottom: 100rpx;
}
.msg-markdown .markdown-help{
position: absolute;
/* .msg-markdown */
.markdown-help{
/* position: absolute;
right: 0;
z-index: 99;
margin-top: 16rpx;
z-index: 99; */
/* margin-top: 16rpx; */
border-top: 1px solid #e1e0e4;
padding: 6rpx !important;
filter: grayscale(100%);
}
/* .msg-markdown */
.markdown-help icon{
vertical-align: top;
margin-right: 8rpx;
}
.msg-markdown .msg-markdown-title{
/* width: 90%; */
width :calc(100% - 30px);
/* width :calc(100% - 30px); */
margin-bottom: 20rpx;
border-radius: 6px;
border: 1px solid #e1e0e4;
Expand Down Expand Up @@ -459,7 +466,7 @@
border-top: 2rpx solid #e6e5e6;
}
.msg-actioncard .msg-actioncard-btn-orient{
padding: 20rpx 0;
padding-top: 20rpx;
}
.msg-actioncard .msg-actioncard-btn-orient radio-group{
display: inline-block;
Expand Down Expand Up @@ -489,11 +496,11 @@
width: 50%;
}
.msg-actioncard .msg-actioncard-btns .msg-actioncard-btn input{
width: 45%;
width: 48%;
}
.msg-actioncard .msg-actioncard-btns .msg-actioncard-btn input:nth-child(even){
border-left: 1rpx solid #e6e5e6;
padding-left: 10rpx;
/* padding-left: 10rpx; */
}
.msg-actioncard .msg-actioncard-addmove-btns{
display: block;
Expand Down
70 changes: 38 additions & 32 deletions pages/components/messsage-tab-swaper/message-tab-swaper.axml

Large diffs are not rendered by default.

16 changes: 11 additions & 5 deletions pages/components/messsage-tab-swaper/message-tab-swaper.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ Component({
markdown.title = this.getTitleFromContent(markdown.content);
}
let title = markdown.title;
let content = markdown.content;
let content = util.optimizeMarkdown(markdown.content);
console.log("markdownMsgSubmitHandle markdown:",markdown);
let msg={
"msgtype": "markdown",
Expand Down Expand Up @@ -353,10 +353,13 @@ Component({
actionCardMsgSubmitHandle(){
let actionCard = this.data.messageInfo.actionCard;
//校验参数
if(!actionCard.title || !actionCard.content){
if(!actionCard.content){
util.ui.toast("请输入消息标题和内容~");
return 0;
}
if(!actionCard.title){
actionCard.title = this.getTitleFromContent(actionCard.content);
}
if(!actionCard.msgBtn.msgUrl){
util.ui.toast("请输入跳转链接~");
return 0;
Expand All @@ -366,7 +369,7 @@ Component({
}
console.log("actionCardMsgSubmitHandle actionCard:",actionCard);
let title = actionCard.title;
let content = actionCard.content;
let content = util.optimizeMarkdown(actionCard.content);
let singleTitle = actionCard.msgBtn.title;
//URL做统一跳转样式处理
let singleUrl = util.toDTalkClientUrl(actionCard.msgBtn.msgUrl);
Expand All @@ -384,10 +387,13 @@ Component({
actionCard2MsgSubmitHandle(){
let actionCard2 = this.data.messageInfo.actionCard2;
//校验参数
if(!actionCard2.title || !actionCard2.content){
if(!actionCard2.content){
util.ui.toast("请输入消息标题和内容~");
return 0;
}
if(!actionCard2.title){
actionCard2.title = this.getTitleFromContent(actionCard2.content);
}
if(!actionCard2.msgBtns.length){
util.ui.toast("请输入链接文本和跳转链接~");
return 0;
Expand All @@ -407,7 +413,7 @@ Component({
}
console.log("actionCard2MsgSubmitHandle actionCard2:",actionCard2," ,btnJsonList:",btnJsonList);
let title = actionCard2.title;
let content = actionCard2.content;
let content = util.optimizeMarkdown(actionCard2.content);
let btnOrient = btnCount==2?actionCard2.btnOrient:0;
var msg={
"msgtype": "action_card",
Expand Down
17 changes: 17 additions & 0 deletions utils/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,23 @@ export default{
//有/无序列表不处理
return str;

},
/**优化Markdown */
optimizeMarkdown(str){
if(!str){
return str;
}
// 换行前没有双空格的自动补充双空格
let substrs = str.split("\n");
let result = "";
for(let idx in substrs){
let sub = substrs[idx];
if(!sub.endsWith(" ")){
sub+=" ";
}
result+=sub+"\n";
}
return result;
}

}

0 comments on commit 7c24a60

Please sign in to comment.