96 lines
2.6 KiB
Vue
96 lines
2.6 KiB
Vue
<template>
|
||
<ciy-header ref="header" title="ciy-auth组件"></ciy-header>
|
||
<view>
|
||
<view class="ciy-card">
|
||
<view class="title">注册登录</view>
|
||
<view class="content">
|
||
<view class="tip">
|
||
实现登录、注册、找回密码功能。<br />
|
||
微信小程序下,自动注册登录。<br />
|
||
H5/APP下,手机号密码手动注册。<br />
|
||
协议链接一般在lang中配置login.xieyi。<br />
|
||
</view>
|
||
|
||
<view class="txt-wb">原理</view>
|
||
<view class="tip">
|
||
通用组件,每个页面在vite阶段自动补全。<br />
|
||
用户信息保存到localstorage的me中。<br />
|
||
登录后其他信息包括字典、积分埋点等。<br />
|
||
在app.globalData中配置:<br />
|
||
1、是否支持微信快捷登录/注册功能。<br />
|
||
2、顶部装饰图和高度。<br />
|
||
</view>
|
||
<view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="ciy-card">
|
||
<view class="title">属性</view>
|
||
<view class="content">
|
||
无
|
||
</view>
|
||
</view>
|
||
<view class="ciy-card">
|
||
<view class="title">方法</view>
|
||
<view class="content">
|
||
<view class="fun">Open</view>
|
||
<view class="tip">
|
||
已被getauth封装<br />
|
||
自动微信登录注册,未登录则打开界面
|
||
</view>
|
||
<view class="hr"></view>
|
||
<view class="fun">this.getauth(type)</view>
|
||
<view class="tip">
|
||
调取登录状态<br />
|
||
type: 空 静默登录(默认)
|
||
type: relogin 强制打开登录界面(换号登录)
|
||
type: info 需填写个人信息
|
||
type: real 需实名认证。前提info
|
||
type: bank 需填写银行。前提real
|
||
type: cciy 需有全球众识码。前提real
|
||
</view>
|
||
<button class="btn sm" @tap="demo">调用</button>
|
||
<button class="btn sm def" @tap="logout">登出</button>
|
||
</view>
|
||
</view>
|
||
<view class="ciy-card">
|
||
<view class="title">事件</view>
|
||
<view class="content">
|
||
无
|
||
<!-- <view class="evt">@change</view> -->
|
||
<view class="log" v-for="(item, index) in eventlog" :key="index">
|
||
<text class="code">{{eventlog.length - index}}</text>
|
||
{{item}}
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="hr"></view>
|
||
</view>
|
||
</template>
|
||
|
||
<style>
|
||
@import '@/pages/demo/zdemo.css';
|
||
</style>
|
||
|
||
<script>
|
||
import zmixin from '@/pages/demo/zmixin.js';
|
||
export default {
|
||
mixins: [zmixin],
|
||
data() {
|
||
return {}
|
||
},
|
||
onLoad() {},
|
||
methods: {
|
||
async demo(b) {
|
||
var auth = await this.getauth();
|
||
if (auth.me.id == 0)
|
||
return this.toast('尚未登录');
|
||
console.log(auth);
|
||
this.toast('已登录');
|
||
},
|
||
logout(b) {
|
||
this.removestorage('me');
|
||
}
|
||
}
|
||
}
|
||
</script> |