var weuiJsAlterMap = {};
function addWeuiJsAlter(htmlString,alterId) {
AddElement('body', htmlString);
addWeuiJsAlterOtherDeal(alterId);
// commonJs.commonConsole(weuiJsAlterMap, "addWeuiJsAlter weuiJsAlterMap");
}
function closeWeuiJsAlter(alterId) {
removeElement("#" + alterId);
closeWeuiJsAlterOtherDeal(alterId);
//==========
delete weuiJsAlterMap[alterId]; //true
// commonJs.commonConsole(weuiJsAlterMap, "weuiJsAlterMap");
}
function addWeuiJsAlterOtherDeal(alterId) {
var scrollTopValue = weuiJsAlterGetscrollTopValue(alterId);
weuiJsAlterMap[alterId].scrollTopValue = scrollTopValue;
window.document.body.style.overflow='hidden';
window.document.body.style.top=-1*scrollTopValue+"px";
}
function weuiJsAlterGetscrollTopValue(alterId) {
var scrollTopValue = window.pageYOffset;
return scrollTopValue;
}
function closeWeuiJsAlterOtherDeal(alterId) {
var scrollTopValue = weuiJsAlterMap[alterId].scrollTopValue;
window.document.body.style.overflow='auto';
window.document.body.style.position=null;
window.document.body.style.top=null;
window.scrollTo(0,scrollTopValue);
}
function getAlterId() {
var alterId = 'alterId_' + new Date().getTime();
var alterIdTemp = alterId;
var count = 0;
while(1){
if(weuiJsAlterMap[alterIdTemp]){
count = count +1;
alterIdTemp= alterId + "_" + count;
}else{
return alterIdTemp;
}
}
}
//=============================================Alert
var weuiJsAlertTemplate = `
<div id="{{alterId}}">
<div class="weui-mask"></div>
<div class="weui-dialog" :style="{ width:width }">
<div class="weui-dialog__hd">
<div class="weui-dialog__title">{{title}}</div>
</div>
<div class="weui-dialog__bd">
{{content}}
</div>
<div class="weui-dialog__ft">
<a onclick="okClickWeuiJsAlterFun('{{alterId}}')" class="weui-dialog__btn weui-dialog__btn_primary">{{confirmButtonText}}</a>
</div>
</div>
</div>
`;
function openWeuiJsAlter(content, title, fun, confirmButtonText) {
var temp = weuiJsAlertTemplate;
var alterId = getAlterId();
temp = replaceAll(temp, "{{title}}", title);
temp = replaceAll(temp, "{{content}}", content);
temp = replaceAll(temp, "{{alterId}}", alterId);
temp = replaceAll(temp, "{{confirmButtonText}}", confirmButtonText);
var obj = {
callBackFun: fun
};
weuiJsAlterMap[alterId] = obj;
// weuiJsAlterMap[alterId].callBackFun=fun;
addWeuiJsAlter(temp,alterId);
return alterId;
}
function okClickWeuiJsAlterFun(alterId) {
commonJs.commonConsole(alterId, "okClickFun alterId");
var callBackFun = weuiJsAlterMap[alterId]['callBackFun'];
if (callBackFun) {
callBackFun('ok');
}
closeWeuiJsAlter(alterId);
}
//=============================================confirm
var weuiJsConfirmTemplate = `
<div id="{{alterId}}">
<div class="weui-mask"></div>
<div class="weui-dialog" :style="{ width:width }">
<div class="weui-dialog__hd">
<div class="weui-dialog__title">{{title}}</div>
</div>
<div class="weui-dialog__bd">
{{content}}
</div>
<div class="weui-dialog__ft">
<a onclick="cancelClickWeuiJsAlterFun('{{alterId}}')" class="weui-dialog__btn weui-dialog__btn_default">{{cancelButtonText}}</a>
<a onclick="okClickWeuiJsAlterFun('{{alterId}}')" class="weui-dialog__btn weui-dialog__btn_primary">{{confirmButtonText}}</a>
</div>
</div>
</div>
`;
function openWeuiJsConfirm(content, title, fun, confirmButtonText,cancelButtonText) {
var temp = weuiJsConfirmTemplate;
var alterId = getAlterId();
temp = replaceAll(temp, "{{title}}", title);
temp = replaceAll(temp, "{{content}}", content);
temp = replaceAll(temp, "{{alterId}}", alterId);
temp = replaceAll(temp, "{{confirmButtonText}}", confirmButtonText);
temp = replaceAll(temp, "{{cancelButtonText}}", cancelButtonText);
var obj = {
callBackFun: fun
};
weuiJsAlterMap[alterId] = obj;
// weuiJsAlterMap[alterId].callBackFun=fun;
addWeuiJsAlter(temp,alterId);
return alterId;
}
function cancelClickWeuiJsAlterFun(alterId) {
commonJs.commonConsole(alterId, "okClickFun alterId");
var callBackFun = weuiJsAlterMap[alterId]['callBackFun'];
if (callBackFun) {
callBackFun('no');
}
closeWeuiJsAlter(alterId);
}
//=============================================Loading
var weuiJsLoadingTemplate = `
<div id="{{alterId}}">
<div class="weui-mask"></div>
<div class="weui-toast">
<i class="weui-loading weui-icon_toast"></i>
<p class="weui-toast__content">{{content}}</p>
</div>
</div>
`;
function openWeuiJsLoading(content) {
var temp = weuiJsLoadingTemplate;
var alterId = getAlterId();
// temp = replaceAll(temp, "{{title}}", title);
temp = replaceAll(temp, "{{content}}", content);
temp = replaceAll(temp, "{{alterId}}", alterId);
// temp = replaceAll(temp, "{{confirmButtonText}}", confirmButtonText);
// temp = replaceAll(temp, "{{cancelButtonText}}", cancelButtonText);
var obj = {
// callBackFun: fun
};
weuiJsAlterMap[alterId] = obj;
// weuiJsAlterMap[alterId].callBackFun=fun;
addWeuiJsAlter(temp,alterId);
return alterId;
}
function closeWeuiJsLoading(index) {
closeWeuiJsAlter(index)
}
//=============================================Toast
var weuiJsToastTemplate = `
<div id="{{alterId}}">
<div class="weui-mask_transparent"></div>
<div class="weui-toast">
<p class="weui-toast__content weui-toast__text">{{content}}</p>
</div>
</div>
`;
function openWeuiJsToast(content, msTime) {
var temp = weuiJsToastTemplate;
var alterId = getAlterId();
// temp = replaceAll(temp, "{{title}}", title);
temp = replaceAll(temp, "{{content}}", content);
temp = replaceAll(temp, "{{alterId}}", alterId);
// temp = replaceAll(temp, "{{confirmButtonText}}", confirmButtonText);
// temp = replaceAll(temp, "{{cancelButtonText}}", cancelButtonText);
var obj = {
// callBackFun: fun
};
weuiJsAlterMap[alterId] = obj;
// weuiJsAlterMap[alterId].callBackFun=fun;
addWeuiJsAlter(temp,alterId);
window.setTimeout(function () {
closeWeuiJsAlter(alterId)
}, msTime);
return alterId;
}
分享到:
相关推荐
1基于蓝牙的项目开发--蓝牙温度监测器.docx
AppDynamics:性能瓶颈识别与优化
xtrabackup银河麒麟v10rpm安装包
2024年全球产品经理大会(脱敏)PPT合集,共34份。 1、AI 原生产品设计的 7 个反共识 2、AI 时代的策略产品与内容社区推荐实践 3、AI时代的用户界面设计 4、AI智能陪练:大模型赋能销售成长 5、AI浪潮中的应用主义者 6、AI驱动下的B端产品的思考与创新 7、AI驱动业务增长的探索与实践 8、Al Native 生产力工具的发展、价值与商业落地 9、B端产品设计避坑指南 10、GenAl驱动的xGen电商AI平台产品实践与思考 11、Kwaipilot 在快手的落地实践 12、OPPO AI的探索新交互到新生态 13、RPA + AI打造大模型驱动的领先数字员工 14、产品AI化重塑的思考与实践 15、产品分析:通过关键指标助力团队与企业成功 16、从RPA到Al Agent,高价值、可落地的智能助手 17、从流量运营到AI驱动的机器增长 18、做穿越时代的产品 19、创造好工具,创造世界一流产品力 20、医疗健康场景的大模型产品探索 21、即时零售柔性供应链体系建设与AIGC在零售数字化的探索 22、向量数据库的出海实践与未来展望 23、大模型在B端落地思考实践
基于物联网技术的停车场智能管理系统设计用户有单独APP
Adobe XD:AdobeXD高级技巧与最佳实践.docx
ARKit(iOS的增强现实):ARKit的多人AR场景实现
1python自动化脚本.docx
河北省、市、区县及街镇可编辑SVG图
金融工程之量化交易算法:均值回归:时间序列分析与预测.docx
技术资料分享ADV7123非常好的技术资料.zip
Sawmill_cn.ppt
使用LabVIEW输入数字n,然后计算n的阶乘
1无人值守灌溉系统--stm.docx
金融工程之量化交易算法:动量交易:金融数据获取与处理.docx
基于SSM的毕业设计源码
头像图片调试使用用来调试
GITS_sawmill8.5.8.1_x64_linux-ubuntu11.tar.gz
Newspaper 是一个专为新闻、杂志和内容丰富网站设计的 WordPress 主题。它非常适合博客、在线出版和内容展示,具备多种强大功能。以下是 Newspaper 的主要特点: 响应式设计:确保网站在各种设备上(手机、平板、桌面)都能良好显示,优化用户体验。 丰富的预建模板:提供多个专业设计的预建布局和页面模板,用户可以快速导入并根据需求进行修改。 强大的页面构建器:内置的 TagDiv Composer 允许用户通过拖放功能轻松创建和自定义页面,无需编写代码。 SEO 优化:主题经过优化,有助于提升网站在搜索引擎中的排名,增加流量。 多种内容展示选项:提供多种文章格式和布局选项,如网格、列表、视频和画廊,方便展示不同类型的内容。 社交媒体集成:支持社交媒体分享功能,帮助用户轻松与观众互动并提高网站的曝光度。 实时自定义:支持实时预览功能,用户可以在更改设置时即时查看效果。 持续更新和支持:定期更新主题,确保用户获得最新功能和安全性,同时提供专业的技术支持。
国内市场:功能化脂质市场现状研究分析与发展前景预测报告(2024版).docx