提交 7c6d5005 编写于 作者: 雪洛's avatar 雪洛 提交者: Anne_LXM

feat: 兼容uni-app-x web端

上级 00389755
......@@ -15,6 +15,6 @@
</head>
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/main.js"></script>
<script type="module" src="/main"></script>
</body>
</html>
......@@ -40,9 +40,9 @@
},
openName():string{
if(this.isLogin){
let nickname = userInfo.getString("nickname")
let username = userInfo.getString("username")
let mobile = userInfo.getString("mobile")
let nickname = this.userInfo.getString("nickname")
let username = this.userInfo.getString("username")
let mobile = this.userInfo.getString("mobile")
if(nickname == null){
nickname = "";
......
......@@ -26,7 +26,7 @@
</template>
<script>
import { state, mutations, UserInfo, AvatarFile } from '@/uni_modules/uni-id-pages-x/store.uts';
import { state, mutations } from '@/uni_modules/uni-id-pages-x/store.uts';
/**
* uni-id-pages-x-avatar
* @description 用户头像组件
......@@ -67,7 +67,7 @@
},
computed: {
hasLogin() : boolean {
return state.isLogin as Boolean
return state.isLogin as boolean
},
userInfo() : UTSJSONObject {
return state.userInfo
......
......@@ -13,8 +13,10 @@ const uniIdCo = uniCloud.importObject('uni-id-co', {
// 用户配置的登录方式、是否打开调试模式
const loginTypes = config.getArray<string>('loginTypes');
const debug = config.getBoolean('debug') as boolean;
// #ifdef APP
import Univerify from '@/uni_modules/uni-id-pages-x/lib/Univerify.uts'
// #endif
export default async function () {
// 有打开调试模式的情况下
......@@ -23,7 +25,7 @@ export default async function () {
// 调用云对象,获取服务端已正确配置的登录方式
uniIdCo.getSupportedLoginType().then(res=>{
// console.log('7777res',res)
let supportedLoginType = res.getArray<string>('supportedLoginType')
let supportedLoginType = res.getArray('supportedLoginType')
if(supportedLoginType == null){
supportedLoginType = []
}
......@@ -59,7 +61,7 @@ export default async function () {
})
}
// #ifdef uniVersion > 3.99 || uniVersion == 3.99
// #ifdef APP
// 如果uni-id-pages配置的登录功能有一键登录,有则执行预登录(异步)
if (loginTypes != null && loginTypes.includes('univerify')) {
const myUniverify = new Univerify()
......@@ -134,7 +136,7 @@ export default async function () {
// needLogin相关代码-start(此代码仅为版本兼容提示使用,如已知晓可删除)
const needLogin = config.getArray<string>('needLogin')
const uniCompileVersionCode = uni.getSystemInfoSync().get('uniCompileVersionCode') as number
const uniCompileVersionCode = uni.getSystemInfoSync().uniCompileVersionCode as number
if(needLogin != null && (uniCompileVersionCode > 3.99 || uniCompileVersionCode == 3.99) ){
const tipText = "uni-id-pages x v1.0.4+ 不再支持配置项config.needLogin,请升级HBuilderX 版本为3.99+,使用更强大 uni-id-router替代。详情查看:https://uniapp.dcloud.net.cn/uniCloud/uni-id/summary.html#uni-id-router"
console.error(tipText)
......
......@@ -21,7 +21,7 @@ const loginTypes = config.getArray<string>('loginTypes');
// #endif
// #ifdef uniVersion > 3.99 || uniVersion == 3.99
// #ifdef APP && (uniVersion > 3.99 || uniVersion == 3.99)
const univerifyManager = uni.getUniverifyManager();
export default class Univerify {
......
......@@ -17,7 +17,7 @@ const reportPushClientId = () => {
fail(e) {
// console.log(e)
}
})
} as GetPushClientIdOptions)
}
export default reportPushClientId;
......
......@@ -33,7 +33,9 @@
<script>
import { state } from '@/uni_modules/uni-id-pages-x/store.uts';
import config from '@/uni_modules/uni-id-pages-x/config.uts';
// #ifdef APP
import Univerify from '@/uni_modules/uni-id-pages-x/lib/Univerify.uts'
// #endif
export default {
computed: {
//大快捷登录按钮图
......@@ -62,7 +64,7 @@
methods: {
login(){},
verify(){
// #ifdef uniVersion > 3.99 || uniVersion == 3.99
// #ifdef APP
const univerifyManager = new Univerify()
univerifyManager.verify(true)
// #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册