详细问题描述
(DCloud产品不会有明显的bug,所以你遇到的问题大都是在特定环境下才能重现的问题,请仔细描述你的环境和重现方式,否则DCloud很难排查解决你的问题)
[使用mui post方式登录App,在用mui.openWindow打开页面时System.Web.HttpCookie 部分数据丢失]
重现步骤
1.post登录请求
var url = GetRootUrl() + 'MobileOffice/Phone/UserLogin';
plus.nativeUI.showWaiting('',{style:'black',modal:false,background:'rgba(0,0,0,0)'});
mui.ajax(url, {
data: parameters,
dataType: 'json',
type: 'POST', //HTTP请求类型
timeout: 100000, //超时时间设置为10秒;
success: function (data) {
plus.nativeUI.closeWaiting();
switch(data.code){
case '0':
plus.nativeUI.alert('账号或者密码错误');
break;
case '1':
plus.storage.setItem("clientLoginSign", data.data.LoginSign);
openHomePage(data.data.UserLang);
break;
case '-1':
plus.nativeUI.alert(data.error);
break;
case "-2":
plus.nativeUI.alert("数据初始化...请关闭此应用并重新打开!");
break;
}
},
error: function (xhr, type, errorThrown) {
plus.nativeUI.closeWaiting();
plus.nativeUI.alert('服务器异常');
}
});
});
-
C#网站写入HttpCookie
System.Web.HttpCookie cookieUserId = new System.Web.HttpCookie("LogUserId", EncryptCookie(user.UserId.ToString()));
cookieUserId.HttpOnly = true;
3.mui.openWindow打开页面
mui.openWindow({
url:url,
id:menueCode,
createNew:true,//是否重复创建同样id的webview,默认为false:不重复创建,直接显示
show:{
autoShow:true,//页面loaded事件发生后自动显示,默认为true
},
waiting:{
autoShow:true,//自动显示等待框,默认为true} });[ System.Web.HttpCookie cookieUserId 获取不到,注:原来在hbuilder中开发时正常]
[hbuilderX能继续支持此操作]
[如果语言难以表述清晰,拍一个视频或截图,有图有真相]
IDE运行环境说明
[ HBuilderX出错。 hbuilder正常]
[2.3.7.20191024]
[win10]
App运行环境说明
[iOS ]
[iphone8 plus]
[可重现代码片段]
[QQ:497781893]
0 个回复