标签:src rip code yun sts 回调 版本 page tap

wxml文件上
<view class=‘btn‘>
<view bindtap="direct" bindtap=‘gopath‘ data-path="addDirectOrder" >直接下单(40元起)</view>
</view>
js文件上
gopath(e){
if (wx.getStorageSync(‘yunxutongzhi‘)){
let path = e.currentTarget.dataset.path;
wx.navigateTo({
url: ‘/pages/‘ + path + ‘/‘ + path,
})
return;
}
wx.requestSubscribeMessage({
tmplIds: ["hhhhhhhhh"],//这里更换自己订阅的消息模板的id的集合
success: (res) => {//成功回调
let path = e.currentTarget.dataset.path;
wx.navigateTo({
url: ‘/pages/‘ + path + ‘/‘ + path,
})
if (res[‘hhhhhhhhh‘] === "accept"){//‘accept‘表示用户接受;‘reject‘表示用户拒绝;‘ban‘表示已被后台封禁
wx.setStorageSync(‘yunxutongzhi‘,true)
}
},
fail(err) {
console.log(err)
let path = e.currentTarget.dataset.path;
wx.navigateTo({
url: ‘/pages/‘ + path + ‘/‘ + path,
})
}
})
},
标签:src rip code yun sts 回调 版本 page tap
原文地址:https://www.cnblogs.com/guanpingping/p/12784357.html