小程序
小游戏
企业微信
微信支付
扫描小程序码分享
这是一个外部审批链接的页面
在PC和iphone中没有问题 但在安卓中 这个回调函数中的方法不执行,有遇到同样问题的吗?
2 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
准确的说这里就进不来,但是表单是能获取到选中的数据的
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title></title>
<link href="~/Content/weui.css" rel="stylesheet" />
<link href="~/Content/Vue/vant.css" rel="stylesheet" />
<style>
[v-cloak] {
display: none !important;
}
.weui-label {
color: #666;
font-weight: 100;
font-size: 14px;
}
</style>
</head>
<body data-color-mode="dark">
<div id="app" v-cloak data-color-mode="dark">
<div class="loading-wrapper" v-if="loading">
<div class="weui-mask_transparent"></div>
<div class="weui-toast">
<i class="weui-loading weui-icon_toast"></i>
<p class="weui-toast__content">正在加载,请稍候...</p>
</div>
</div>
<div v-else>
<div style="height:5vh">
</div>
<div class="weui-cells">
<div class="weui-cell__hd" style=" font-weight: 600; margin-left: 4vw;font-size:14px"><label class="weui-label">选择账套</label></div>
<div class="weui-cell">
<div class="weui-cell__bd">
<select class="select" v-model="payee" @@change="handleSelectChange(payee)" name="select" style="width:90vw;height:5.5vh;font-size:14px !important;border-radius: 5px 5px 5px 5px;border-color:#d6d6d6">
<option value="0" disabled selected="">请选择付款账套</option>
<option v-for="option in payeeDataList" :value="option.key">{{option.value}}</option>
</select>
</div>
</div>
</div>
</div>
</body>
</html>
<script src="~/Scripts/jquery-1.10.2.min.js"></script>
<script src="//res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script src="https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script>
<script src="~/Content/Vue/vue.min.js"></script>
<script src="~/Content/Vue/vant.min.js"></script>
<script>
new Vue({
el: '#app',
data: {
payee: "0",
account: "0",
bank: "0",
payeeDataList: [
],
accountDataList1: [
],
bankDataList1: [
],
accountDataList: [],
bankDataList: [],
key1: null,
loading: true,
searchResult: [],
searchData: "",
selectedValue: "",
payeeSelectedValue: "",
payeeSelectedValue1: "",
radioValue: '', // 用于绑定选中的值
wxCode: "未获取到",
wxUserId:"",
},
created() {
var self = this;
let urlLink = "";
var urlParams = new URLSearchParams(window.location.search);
self.key1 = urlParams.get('key');
self.wxCode = urlParams.get('code');
if (self.wxCode == null) {
let encodedRedirectURI = encodeURIComponent(window.location.href);
urlLink = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=@ViewBag.corpid&redirect_uri="
+ encodedRedirectURI + "&response_type=code&scope=snsapi_privateinfo&state=&agentid=@ViewBag.agentid#wechat_redirect";
window.location.href = urlLink;
self.key1 = urlParams.get('key');
self.wxCode = urlParams.get('code');
} else {
self.getUserId();
setTimeout(function () {
self.agentConfig1()
}
, 500)
}
},
methods: {
getUserId() {
let self = this;
$.ajax({
url: '/Test/GetUserId?wxCode=' + this.wxCode, // 请求的URL地址
method: 'GET', // 请求方法为POST
dataType: 'json',
success: function (response) {
// 请求成功的回调函数
if (response.code == 200 && response.data.length > 0) {
self.wxUserId = response.data;
self.onSearch();
}
},
});
},
AddAccounts() {
let self = this;
$.ajax({
url: '/U8CloseBill/AddAccounts?userid=' + self.wxUserId + "&accoutid=" + self.payeeSelectedValue, // 请求的URL地址
method: 'GET', // 请求方法为POST
dataType: 'json',
success: function (response) {
// 请求成功的回调函数
if (response.code != 200) {
alert("用户信息存储失败")
}
},
});
},
onSearch(val) {
let self = this;
$.ajax({
url: '/U8CloseBill/GetAccounts', // 请求的URL地址
method: 'GET', // 请求方法为POST
dataType: 'json',
success: function (response) {
// alert(JSON.stringify(response))
// 请求成功的回调函数
if (response.code == 200 && response.data.length > 0) {
self.payeeDataList = response.data;
}
else {
vant.Toast('💬未请求到相关数据');
}
},
error: function (xhr, status, error) {
// 请求失败的回调函数
vant.Toast('GetAccounts AJAX请求出错: ' + error);
}
});
},
handleSelectChange(val) {
let self = this;
for (let option of self.payeeDataList) {
if (option.key == val) {
self.payeeSelectedValue = option.key;
self.payeeSelectedValue1 = option.value;
break;
}
}
this.confirmSelection();
},
agentConfig1() {
let self = this;
wx.agentConfig({
corpid: '@ViewBag.corpid', // 必填,企业微信的corpid,必须与当前登录的企业一致
agentid: '@ViewBag.agentid', // 必填,企业微信的应用id
timestamp: '@ViewBag.timestamp', // 必填,生成签名的时间戳
nonceStr: '@ViewBag.nonceStr', // 必填,生成签名的随机串
signature: '@ViewBag.signature',// 必填,签名,见附录-JS-SDK使用权限签名算法
jsApiList: ['selectExternalContact', 'saveApprovalSelectedItems', 'getApprovalSelectedItems'],
debug: true,
success: function (res) {
self.loading = false;
self.getApprovalSelectedItems1();
},
fail: function (res) {
self.loading = false;
//alert(res.errMsg);
if (res.errMsg.indexOf('function not exist') > -1) {
alert('版本过低请升级')
}
}
});
},
getApprovalSelectedItems1() {
let self = this;
wx.invoke('getApprovalSelectedItems', {
"key": this.key1, // 字符串,从 URL 中获取到的 key
}, (res) => {
if (res.err_msg === "getApprovalSelectedItems:ok") {
if (res.selectedData != undefined && res.selectedData != null)
{
var selectedDataObj = JSON.parse(res.selectedData);
self.payee = selectedDataObj[0].key;
}
}
});
},
confirmSelection() {
let self = this;
let arr = [{ key: self.payee, value: self.payeeSelectedValue1 }];
const arrToStr = JSON.stringify(arr)
wx.invoke('saveApprovalSelectedItems', {
"key": self.key1,
"selectedData": arrToStr,
}, (res) => {
if (res.err_msg === 'saveApprovalSelectedItems:ok') {
alert(12121)
self.AddAccounts();
}
});
},
}
});
Vue.use(vant.Lazyload);
</script>
准确的说这里就进不来,但是表单是能获取到选中的数据的