直播间优化提示,安卓以及ios扫码权限判定

master
lemon橪 2021-06-29 16:26:32 +08:00
parent 73c307173b
commit 4599b02a41
4 changed files with 39 additions and 46 deletions

View File

@ -98,23 +98,14 @@ export default {
* 提交保存 * 提交保存
*/ */
submit() { submit() {
if (this.form.regionId.length != 0 && this.birthday) {
delete this.form.___path; delete this.form.___path;
let params = JSON.parse(JSON.stringify(this.form)); let params = JSON.parse(JSON.stringify(this.form));
saveUserInfo(params).then((res) => { saveUserInfo(params).then((res) => {
if (res.statusCode == 200) { if (res.statusCode == 200) {
storage.setUserInfo(res.data.result); storage.setUserInfo(res.data.result);
uni.navigateBack(); uni.navigateBack();
} }
}); });
} else {
uni.showToast({
title: "请填写生日和城市!",
duration: 2000,
icon: "none",
});
}
}, },
/** /**

View File

@ -104,7 +104,6 @@ export default {
this.params[this.current].pageNumber = 1; this.params[this.current].pageNumber = 1;
this.liveList = []; this.liveList = [];
this.getLives(); this.getLives();
this.getRecommendLives(); this.getRecommendLives();
}, },
onReachBottom() { onReachBottom() {
@ -225,6 +224,7 @@ export default {
* 进入直播间 * 进入直播间
*/ */
handleLivePlayer(val) { handleLivePlayer(val) {
// #ifdef MP-WEIXIN
let roomId = val.roomId; // API let roomId = val.roomId; // API
let customParams = encodeURIComponent( let customParams = encodeURIComponent(
JSON.stringify({ path: "pages/index/index", pid: 1 }) JSON.stringify({ path: "pages/index/index", pid: 1 })
@ -236,6 +236,15 @@ export default {
"&custom_params=" + "&custom_params=" +
customParams, customParams,
}); });
// #endif
// #ifndef MP-WEIXIN
uni.showToast({
title: "请从微信小程序中预览直播功能",
duration: 2000,
icon: "none",
});
// #endif
}, },
}, },
}; };

View File

@ -68,6 +68,7 @@ export default {
return { return {
config, config,
pageData: "", // pageData: "", //
isIos: "",
}; };
}, },
components: { components: {
@ -96,7 +97,7 @@ export default {
this.init(); this.init();
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
// //
uni.showShareMenu({ withShareTicket: true, }); uni.showShareMenu({ withShareTicket: true });
// #endif // #endif
}, },
@ -137,9 +138,6 @@ export default {
}, 100); }, 100);
} }
}); });
// let
// webview
}, },
}); });
}, },
@ -153,9 +151,7 @@ export default {
content: "您已经关闭相机权限,去设置", content: "您已经关闭相机权限,去设置",
success: function (res) { success: function (res) {
if (res.confirm) { if (res.confirm) {
let isIos = plus.os.name == "iOS"; if (this.isIos) {
if (isIos) {
plus.runtime.openURL("app-settings:"); plus.runtime.openURL("app-settings:");
} else { } else {
permision.gotoAppPermissionSetting(); permision.gotoAppPermissionSetting();
@ -171,32 +167,28 @@ export default {
*/ */
async scan() { async scan() {
// #ifdef APP-PLUS // #ifdef APP-PLUS
let isIos = plus.os.name == "iOS"; this.isIos = plus.os.name == "iOS";
// Ios // Ios
if (isIos) { if (this.isIos) {
const iosFirstCamera = uni.getStorageSync("iosFirstCamera"); //
if (iosFirstCamera !== "false") {
uni.setStorageSync("iosFirstCamera", "false"); //false
this.seacnCode();
} else {
if (permision.judgeIosPermission("camera")) { if (permision.judgeIosPermission("camera")) {
this.seacnCode(); this.seacnCode();
} else { } else {
// //
uni.showModal({
title: "提示",
content: "您已经关闭相机权限,去设置",
success: function (res) {
if (res.confirm) {
plus.runtime.openURL("app-settings:");
}
},
});
}
} else {
//
const result = await permision.requestAndroidPermission("CAMERA");
if (result == 1 || result == 0) {
this.seacnCode();
} else {
this.tipsGetSettings(); this.tipsGetSettings();
} }
} }
} else {
/**
* TODO 安卓 权限已经授权了调用api总是显示用户已永久拒绝申请人傻了
* TODO 如果xdm有更好的办法请在 https://gitee.com/beijing_hongye_huicheng/lilishop/issues
*/
this.seacnCode();
}
// #endif // #endif

View File

@ -9,6 +9,7 @@ const FACE_LOGIN = isDev ? "face_login_dev" : "face_login";
const FINGER_LOGIN = isDev ? "finger_login_dev" : "finger_login"; const FINGER_LOGIN = isDev ? "finger_login_dev" : "finger_login";
const CART_BACKBTN = isDev ? "cart_backbtn_dev" : "cart_backbtn"; const CART_BACKBTN = isDev ? "cart_backbtn_dev" : "cart_backbtn";
export default { export default {
// 获取face id登录 // 获取face id登录
getFaceLogin() { getFaceLogin() {
return uni.getStorageSync(FACE_LOGIN); return uni.getStorageSync(FACE_LOGIN);