欢迎来到258分享网,纯净的网络源码分享基地!

258资源分享网

全部作品
全部作品
网站源码
微信源码
素材特效
源码插件
视频教程
建站学院
热门搜索: 织梦  农业种植  农业  安全设置  官方
258资源分享 > 建站学院 > 微信开发 > 微信小程序接受asp.net 返回的json值处理,判断是否是手机号,文字超过行后隐藏

推荐下载

HTML5响应式自适应网咯设计

2020-05-12   浏览:740

高端HTML5响应式企业通用网

2020-05-06   浏览:521

html5响应式外贸网站英文版

2020-05-08   浏览:510

HTML5自适应律师工作室类网

2020-04-04   浏览:504

HTML5影视传媒文化公司类网

2020-05-12   浏览:502

微信小程序接受asp.net 返回的json值处理,判断是否是手机号,文字超过行后隐藏

发布时间:2020-12-20  

 

 

 

wx.request({

url:'https://l网址er.aspx',

data:{

openId: wx.getStorageSync('openId'),

requestType:"query"

},

success:function(response){

//

//console.log(response)

//console.log(response.data)

//console.log(response.statusCode)

if(response.statusCode =='200'){

var count = response.data.indexOf("\r\n\r\n<!DOC");

var str = response.data.substring(0, count)

var json = JSON.parse(str)

//保存信息

console.log(str+"长度"+ json.length)

}else{

wx.showToast({

title:'信息读取失败,请联系客服!',

icon:'success',

duration:1500

})

}

}

});

 

二:判断是否是手机号

 

validatemobile:function(mobile){

if(mobile.length ==0){

wx.showToast({

title:'请输入手机号!',

icon:'success',

duration:1500

})

returnfalse;

}

if(mobile.length !=11){

wx.showToast({

title:'手机号长度有误!',

icon:'success',

duration:1500

})

returnfalse;

}

var myreg =/^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$/;

if(!myreg.test(mobile)){

wx.showToast({

title:'手机号有误!',

icon:'success',

duration:1500

})

returnfalse;

}

returntrue;

}

 

三:文字超过行后隐藏显示省略号

 

text{

 

overflow:hidden;

//超出一行文字自动隐藏

 

text-overflow:ellipsis;//文字隐藏后添加省略号

 

white-space:nowrap;

//强制不换行

 

}

或者多行的用这些:

 

display:-webkit-box;

 

word-break:break-all;

 

text-overflow: ellipsis;

 

font-size:32rpx;

 

overflow: hidden;

 

-webkit-box-orient: vertical;

 

-webkit-line-clamp:2;