分享js:
onShareAppMessage: function () {
var c_name = 123;
return {
title: ‘’ + c_name + ‘’,
path: ‘pages/index/index’,
success: function (res) {
wx.showToast({
title: ‘分享成功’,
icon: ‘success’,
duration: 1500
})
},
fail: function (res) {
wx.showToast({
title: ‘分享失败’,
icon: ‘success’,
duration: 1500
})
}
}
},
index 页面js
seachbutton:function(e){
console.info(123131313);
var that = this;
var familyname = inputContent.familyname;
console.log(familyname);
if (familyname!=’’){
wx.request({
url: ‘https://www.xxx.com?xxxxx.xx’, //仅为示例,并非真实的接口地址
method: ‘POST’,
data: {
“familyname”: familyname,
},
header: {
‘content-type’: ‘application/x-www-form-urlencoded’
},
success: function (res) {
var result = res.data;
var state = result.state;
if(state==1){
that.toAddFamilyName(familyname);
}else{
xingshiiserror = 1;
wx.showModal({
title: ‘提示’,
content: ‘请检查该xxx是否正确’,
showCancel: false,
success: function (res) {
if (res.confirm) {
that.setData({
familyname: “”
});
}
}
})
}
}
})
}else{
xingshiiserror = 1;
wx.showModal({
title: ‘提示’,
content: ‘请输入正确的xxx’,
showCancel: false,
success: function (res) {
if (res.confirm) {
that.setData({
familyname: “”
});
}
}
})
}
}