微信小程序 对接口常用

@import '../expert/expert.wxss';
 
FZ._get('https://didu2.didu86.com/issun/index.php/Home/goodstype/selectGoodsTypeAll')
.then(function (data) {console.log(data)})
.catch(function (data) { console.log(data)});
 
wx.navigateTo({
url: '/pages/detail/detailv?items=' + JSON.stringify(items) +"&&mypic=" +mypic
})
<image class='image-full' src='../../../imgs/index/t_icon.png'></image>
 
<image mode='widthFix' class='img-w' src='../../imgs/wl/wl1.png'></image>
 
setTimeout(function () {console.log() }, 1500)
 
let items = e.currentTarget.dataset.items;
let item = JSON.parse(opt.items);
let myDate = new Date();
 
let val = e.detail.value;
this.setData({})

that.setData({
user: wx.getStorageSync('user')
});
 
 
wx:if="{{==1}}"
 
 
chargeInto: function () {
wx.navigateTo({
url: "/pages/user/chargeintopay/chargeintopay"
})
},

FZ._back({ linkobj: encodeURIComponent(JSON.stringify(linkobj)), type: 1 })

let pData= FZ._pdata();

if (pData){

console.log(pData)

console.log(JSON.parse(decodeURIComponent(pData.linkobj)))

if (pData.type == 1) {

nailItem.link.push(JSON.parse(decodeURIComponent(pData.linkobj)))

console.log(nailItem)

this.setData({ nailItem })

} else {

}

}

wx.switchTab({
url: "/pages/user/index"
})
 
wx.showToast({
title: '登录成功',
icon: 'success',
duration: 1000
})
 
setTimeout(function () {
 
}, 1000);
 
post请求-----------------------------------------
wx.setStorageSync('user', result)
 
let user = wx.getStorageSync('user');
 
let that = this;
 
post请求-----------------------------------------
wx.request({
header: {
"Content-Type": "application/x-www-form-urlencoded"
},
method: "POST",
url: app.globalData.hpUrl + 'User/userAllRegister',
data: {
typenum: selectArr[selectIndex],
phone: loveChe.hphone,
password: loveChe.hpwd
},
success: function (res) {
var result = res.data;

console.log(res)
 
}
}
});
 
 
updateUser:function(){
// 更新数据
wx.request({
url: app.globalData.hpUrl + 'User/userFind', //仅为示例,并非真实的接口地址
header: {
"Content-Type": "application/x-www-form-urlencoded"
},
method: "POST",
data: {
id: result,
},
success: function (res) {
let result = res.data;
// console.log(res)
if (result) {
wx.setStorageSync('user', result)
wx.showToast({
title: '注册成功',
icon: 'success',
duration: 1000
})
setTimeout(function () {
wx.switchTab({
url: "/pages/user/user"
})
}, 1000);
}

}
})
},