提交 598b3c87 编写于 作者: A Anne_LXM

feat: 兼容uni-app-x web端

上级 c76aede3
......@@ -3,7 +3,7 @@ import config from '@/uni_modules/uni-id-pages-x/config.uts';
export const loginSuccess = (_ : UTSJSONObject) => {
// console.log('loginSuccess', e);
// console.log("新用户uid", e["uid"]);
// state.currentUserInfo = uniCloud.getCurrentUserInfo()
// state.currentUserInfo = uniCloud.getCurrentUserInfo()
mutations.updateUserInfo(null)
// state.userInfo["_id"] = e["uid"]
state.isLogin = true
......@@ -13,7 +13,7 @@ export const loginSuccess = (_ : UTSJSONObject) => {
function loginAfterToPage() {
const pages = getCurrentPages()
const currentPage = pages[pages.length - 1]
const uniIdRedirectUrl = currentPage.options.get("uniIdRedirectUrl");
const uniIdRedirectUrl = currentPage.options["uniIdRedirectUrl"];
if (uniIdRedirectUrl != null) {
// console.log('uniIdRedirectUrl', uniIdRedirectUrl);
uni.redirectTo({
......
......@@ -143,7 +143,7 @@
// console.log('res', res);
let tempFiles = res.tempFiles as UTSJSONObject[];
let tempFile = tempFiles[0];
let tempFileName = tempFile.getString('name')
let tempFileName = tempFile.getString('name')
let tempFilePath = tempFile.getString('path')
if (tempFileName == null) {
tempFileName = ""
......@@ -151,26 +151,26 @@
if (tempFilePath == null) {
tempFilePath = ""
}
// console.log(9527,tempFileName.length);
// console.error('tempFileName',tempFileName);
// console.error('tempFilePath',tempFilePath);
console.log(9527,tempFileName.length);
console.log('tempFileName',tempFileName);
console.log('tempFilePath',tempFilePath);
let avatar_file = {
// #ifdef H5
// #ifdef WEB
extname: tempFileName.split(".")[tempFileName.split(".").length - 1],
// #endif
// #ifndef H5
// #ifndef WEB
extname: tempFilePath.split(".")[tempFilePath.split(".").length - 1],
// #endif
name: tempFileName,
url: tempFilePath
} as UTSJSONObject
console.error('avatar_file', avatar_file);
console.log('avatar_file', avatar_file);
let filePath = res.tempFilePaths[0]
//非app端剪裁头像,app端用内置的原生裁剪
// #ifndef UNI-APP-X
filePath = await new Promise((callback) => {
// #ifdef H5
// #ifdef WEB
if (!this.isPC) {
callback(filePath)
}
......@@ -192,7 +192,13 @@
})
// #endif
console.log("state",state)
console.log("state.userInfo",state.userInfo)
console.log("this.userInfo",this.userInfo)
let _id = this.userInfo["_id"] as string
console.log("id",_id)
// if(_id != null){
// _id = "" as string
// }
......
......@@ -28,6 +28,9 @@
},
mounted() {
this.smsCodeRef = (this.$refs["smsCode"] as UniIdPagesXSmsCodeComponentPublicInstance)
uni.$on('uni-id-pages-x-loginBySmsCode-showPopupCaptcha',(callback : () => void)=>{
this.showPopupCaptcha(callback)
})
},
methods: {
sendSmsCode() {
......
......@@ -133,15 +133,22 @@
// console.log('reset');
},
sendSmsCode() {
// console.log("state.pendingAgreements", state.pendingAgreements);
console.log("state.pendingAgreements", state.pendingAgreements);
if (state.pendingAgreements) {
// uni.hideKeyboard();
this.sendSmsCaptchaCP!.setFocus(false);
(this.$parent as ComponentPublicInstance).$callMethod("showPopupCaptcha", () => {
if (!state.pendingAgreements) {
this.sendSmsCode()
}
});
// web端尚未完全支持
// (this.$parent as ComponentPublicInstance).$callMethod("showPopupCaptcha", () => {
// if (!state.pendingAgreements) {
// this.sendSmsCode()
// }
// });
// 临时方案
uni.$emit('uni-id-pages-x-loginBySmsCode-showPopupCaptcha',()=>{
if (!state.pendingAgreements) {
this.sendSmsCode()
}
})
uni.showToast({
title: '未同意隐私政策协议',
icon: 'none'
......
......@@ -5,9 +5,9 @@
<script>
export default {
onLoad(param : Map<string, string>) {
const url = param.get("url") as string;
let title = param.get("title") as string;
onLoad(param) {
const url = param["url"] as string;
let title = param["title"] as string;
// console.log('url', url);
if (url.substring(0, 4) != 'http') {
uni.showModal({
......@@ -40,4 +40,4 @@
flex: 1;
height: 100%;
}
</style>
\ No newline at end of file
</style>
......@@ -32,12 +32,11 @@
mounted() {
this.smsCodeRef = (this.$refs["smsCode"] as UniIdPagesXSmsCodeComponentPublicInstance)
},
onLoad(param : Map<string, string>) {
const mobile = param.get("mobile")
onLoad(param) {
const mobile = param["mobile"]
// const email = param.get("email")
// console.log('mobile--', mobile);
// console.log('email--', email);
if (mobile != null) {
this.$nextTick(() => {
this.smsCodeRef!.mobile = mobile
......
......@@ -34,7 +34,7 @@ type Mutations = {
updateUserInfo(param: null | UTSJSONObject): void
}
export const mutations = {
updateUserInfo(param: null | UTSJSONObject) {
updateUserInfo: function (param: null | UTSJSONObject) {
console.log('updateUserInfo', param); // param为 null 时从云端获取数据更新,为UTSJSONObject时直接根据传入的值来更新
function afterUpdateUserInfo() {
// console.log('afterUpdateUserInfo', state.userInfo);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册