Appcan使用遇到问题和方法整理

1、抽屉页面效果注意点
退回上一页(抽屉里面的返回上一页)
<div class=”umw4 ub ub-ac ub-pc” ontouchstart=”zy_touch(‘btn-act’)” onclick=”closeWin();”>
<div class=”t-btn-a1 ub-img uwh-tBtn”></div>
</div>
抽屉页面(修改完毕后,只能放在连接内部有用)
Ⅰ. right.html(首页)
Root要改掉 window.uexOnload = function(type){
if (!type) {
//uescript(‘root’,’openPover()’);
uescript(‘right_drawer’,’openPover()’);
zy_con(“content”, “right_content.html”, 0, $$(“header”).offsetHeight);
var plat = uexWidgetOne.getPlatform();
Ⅱ. right_drawer.html(可以预览的抽屉效果,内容是清除条件和确认。)
Ⅲ. right_content.html(right的content内容)
Ⅳ. Filer.html(抽屉内的选项)
当出现抽屉里面的效果有滚动条的时候,变header为
<!DOCTYPE html>
<html class=”um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px”>
<head>
<title></title>
<meta charset=”utf-8″>
<meta name=”viewport” content=”target-densitydpi=device-dpi,initial-scale=1″>
<link rel=”stylesheet” href=”css/ui-on.css”>
2、一般页面返回上一页(系统默认)
<!–按钮开始–>
<div class=”ub btn btn-l”>
<div class=”btn-al”>
</div>
<div class=”btn-ac ub ub-ac ulim uinn1″ onmousedown=”zy_touch(”);” ontouchstart=”zy_touch(”)” onclick=”winClose();”>
返回
</div>
<div class=”btn-ar”>
</div>
</div>
3、修改页面内的元素名字,调取数据,可以直接F5预览,修改样式图片之类的,需要重新加载预览
4、鼠标按下去的效果用
<div class=”umw4 ub ub-ac ub-pc” ontouchstart=”zy_touch(‘btn-act’)” onmousedown=”zy_touch(‘btn-act’);” onclick=”winClose();”>
<div class=”t-btn-a1 ub-img uwh-tBtn”></div>
</div>
加class名,可以修改在按下去瞬间的样式,可以改变颜色和大小等。
5、get获取json值
zy_init();
var pageSize = 10;
var pageLen = 1;
var isLoading = false;
window.uexOnload = function(type){
if (!type) {
sortList();
// uexWindow.setBounce(“1”);
setPageBounce(1, function(){
//刷新
pageLen = 1;
sortList();
}, function(){ //加载更多
pageLen++;
sortList();
// alert(pageLen);
});
}
}

function sortList(){
$toast(‘数据加载中…’);
$.getJSON(‘http://10.1.97.139:18080/10000000/public/BDP/bdpservice?func=listAllProjects&body={“arg0″:”UN0366″,”arg1″:’ + pageSize + ‘,”arg2″:’ + pageLen + ‘,”arg3″:0}’, function(data){
$closeToast();
//$.getJSON(http://10.1.97.139:18080/10000000/public/PBD/”)
// $.getJSON(‘http://10.1.2.206:9090/xxxx/xxxx/default/soap?loginName=040021genglm&pass=ss’,function(data){
// alert(data.netLoginInfo.loginName);
isLoading = false;
resetBV(0);
resetBV(1);
if (data.status == ‘0’ && data.data && data.data.projectBasicInfoList.length) {
$closeToast();
var dataLen = data.data.projectBasicInfoList;
var tmpl = ‘<div class=”ub t-bla ulev0 ubb b-gra uinn5″ ontouchstart=”zy_touch(\’\’)” onclick=”openGoods(event);”>’ +
‘<div class=” b-gra ub-f1 uc-l1″>’ +
‘<div class=”ub ub-ver t-bla”>’ +
‘<div class=”b-gra uc-t1 umar-t”>${serialno}</div>’ +
‘<div class=”b-gra “>${money}3323</div>’ +
‘</div>’ +
‘</div>’ +
‘<div class=”ub-f1 ulev0″>’ +
‘ <div class=”ub ub-ver”>’ +
‘ <div class=” b-gra uc-t1″> U${countryCode}</div>’ +
‘<div class=” b-gra ulev0 t-orgs”>${projectWorkUserId}</div>’ +
‘<div class=” uc-b1 ulev-1″>${style}OA ${deathline}56天 USD</div>’ +
‘</div>’ +
‘</div>’ +
‘<div class=”ub-f1 uc-r1 ulev0″>’ +
‘<div class=”ub ub-ver t-bla”>’ +
‘<div class=” b-gra uc-t1″>部分收匯</div>’ +
‘<div class=” b-gra ulev-1 “>${statusDate}</div>’ +
‘<div class=” uc-b1 ulev-1″> ${projectWorkcorpId}</div>’ +
‘</div>’ +
‘</div>’ +
‘</div>’
var s = zy_tmpl(tmpl, dataLen, zy_tmpl_count(dataLen));
var d = document.createElement(‘DIV’);
d.innerHTML = s;
$$(‘sortList’).appendChild(d);
}
else {
if (pageLen == 1) {
$$(‘sortList’).innerHTML = ‘<div class=”ub ub-ac ub-pc uinn”>暂时没有数据</div>’
}
else {
$toast(‘没有更多数据’, 2000);
}
}
});
}

function toFront(){
uexWidnow.bringToFront();
}

function openGoods(e){
if (isPhone && e.type == ‘click’)
return;
openNewWin(‘r_content’, ‘r_content.html’);
}
Post取值
function List(){
var tmpl;
$toast(“正在加载中”);
//浏览器http协议缓过来的关键字
var j=[
{‘key’:’questiontitle’,’type’:’0′,’value’:$$(“KeyWord”).value},
{‘key’:’currentPage’,’type’:’0′,’value’:pageLen},
{‘key’:’pageSize’,’type’:’0′,’value’:15}
];
$.getJSON(Lurl,function(data){
$closeToast();
isLoading = false;
resetBV(0);resetBV(1);
if (data.type == ‘0’ && data.data.items&&data.data.items.length){
var dataLen = data.data.items;
for(var i=0;i<dataLen.length;i++){
tmpl +='<ul ontouchstart=”zy_touch(\’btn-act\’)” onmousedown=”zy_touch(\’btn-act\’)” onclick=”openDetail(\”+dataLen[i].questionid+’\’)” class=”uc-t ubb ub b-gra t-bla ub-ac lis”>’
+'<li class=”ub-f1 ut-s”>’+dataLen[i].questiontitle+'</li>’
+'<li class=”tx-r t-dgra ulev-1″>’+dataLen[i].state+'</li>’
+'<li class=”listIcon lis-sw ub-img”></li>’
+'</ul>’
}
if(pageLen==1){
$$(“content0″).innerHTML=tmpl;
}else{
var child = document.createElement(‘div’);
child.innerHTML = tmpl;
$$(‘content0’).appendChild(child);
}
}else{
if(data.data.pageCount==0){
$$(‘content0’).innerHTML = ‘<div class=”ub ub-ac ub-pc uinn”>暂时没有数据</div>’
}else{
$toast(“没有更多数据”,2000)
}
}
},’json’,function(e){
alert(“输入异常”);
},’POST’,j)}
6、应用生成地址D:\appcan\AppCanStudioEnterprise\Mobile-Applications
7、Svn导入文件要有.project dssam10013 打包才能成功
设置搜索引擎 安卓 sdksuit_3.0_0820_01
8、产品服务代码 列表-列表-详情
①function openDetails(i){
var Arr=[‘短期出口信用保险’,’中长期出口信用保险’,’海外投资/租赁保险’,’国内贸易信用保险’,’资信服务’,’担保’,’信保融资’,’理赔服务’]
setLocVal(‘pName’,JSON.stringify(Arr[i]));
setLocVal(‘pNo’,JSON.stringify(i)); //传值
openNewWin(‘adCon_list’, ‘adCon_list.html’);
}
②列表页面
var hNo = JSON.parse(getLocVal(“pNo”));//获得传值
function openDetails(i){
var ArrNo=[‘du’,’zh’,’h’,’g’,’z’,’d’,’x’,’l’];
//中小企业综合险无 短期出口信用保险 出口买方信贷保险无 中长期出口信用保险
var ArrTit=[
[‘index’,’zhbx’,’tdmfbx’,’tdhtbx’,’mfwybx’,’ckxybx-yx-bxd’,’ckxybx-fft-bxd’],
[‘index’,’ckmfxdbx’,’ckmfxdbx’,’zrzbx’],
[‘index’,’hwtz-gq-bx’,’hwtz-zq-bx’,’hwzlbx’],
[‘index’],
[”],
[‘index’],
[”],
[‘index’,’dxal’,’ywdy’]
];
if(hNo==4||hNo==6){
alert(“信保融资为空和资信服务为空”);
return “信保融资为空和资信服务为空”;
}
//setLocVal(‘href’,JSON.stringify(‘http://10.1.97.139:9090/dssam10007/public/product/’+ArrNo[hNo]+’_’+e));
setLocVal(‘href’,JSON.stringify(‘http://127.0.0.1:8087/xxx/xxx/product/’+ArrNo[hNo]+’_’+ArrTit[hNo][i]));
openNewWin(‘adCon_detail’, ‘adCon_detail.html’);
}
③详情页
var liPath = JSON.parse(getLocVal(“href”)); //获得传值
function sortList(){
$$(‘Info’).innerHTML=””;
$toast(‘数据加载中…’);
$.getJSON(liPath, function(data){
if (data!=0) {
$closeToast();
tmpl = ‘<div class=”ubb b-gra ub uinn3″>’
+'<div class=”t-org ulev-app2″>${title}</div>’
+'</div>’
+'<div class=”uinnh1 t-gra1 ulev-app2″>’
+'<span>${text}</span>’
+'</div>’;
var s = zy_tmpl(tmpl, data, zy_tmpl_count(data));
$$(‘Info’).innerHTML=s;
}
else {
$toast(‘无数据’);
}
});
}
9、传值
setLocVal(‘path’,JSON.stringify(e)); 设置传值 变成JSON字符串 双引号
var liPath = JSON.parse(getLocVal(“path”)); 获取传值 变成对象
10、省略class
Ub ut-s
11、附件下载常用代码
function Down(e){
var Durl=’http://10.1.97.139:9090/dssam10007/public/BMsg/OpenSoldsPdfWS?path=’;
//Console.Log(Durl+e);
alert(Durl+e);
downloadFile(Durl,”1111.pdf”);
}

12、Zy-tmpl.js 截取字段

var ar=c.split(‘.’);
var res=d;
for(var key in ar)
if(ar[key].match(/.*sub:.*/)){
var ts = ar[key];
var tsar = ts.split(“:”);

if(tsar.length > 1){
var num = tsar[1];
var numar = num.split(‘-‘);
if(numar.length > 1){
res = res.substring(numar[0],numar[1]);
}else if(numar.length == 1){
res = res.substring(numar[0]);
}
}
}else{
res=res[ar[key]];
}
${workDate.sub:0-10} 0到10索引值
${workDate.sub:11} 索引值11之后
13、IOS android取值
var sVal=encodeURIComponent($$(“search”).value);
if(!isAndroid){
var sVal=$$(“search”).value;
}
14、文本分散对齐
iOS
.tx-w{text-align:justify;text-justify:distribute-all-lines; text-align-last:justify; display:inline-block;}
Android
15、如果打包成功后,仅在iOS上面安装验证失败,则考虑上传代码中,页面name有汉字或者有不可识别文件格式,例如.psd文件

发表评论

电子邮件地址不会被公开。