提交 de4a3734 编写于 作者: 芊里

Merge branch 'master' of https://gitee.com/dcloud/base-app

{
"name" : "云端一体搜索模板",
"name" : "base-app",
"appid" : "__UNI__BC54A00",
"description" : "",
"versionName" : "1.0.0",
......@@ -15,29 +15,63 @@
"autoclose" : true,
"delay" : 0
},
"modules" : {},
"modules" : {
"OAuth" : {},
"Share" : {}
},
"distribute" : {
"android" : {
"permissions" : [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
]
},
"ios" : {},
"sdkConfigs" : {}
/* ios打包配置 */
"ios" : {
"capabilities" : {
"plists" : {
"DCloudConfig" : {
"miniServer" : true
}
},
"entitlements" : {
"com.apple.developer.associated-domains" : [ "applinks:uniapp.dcloud.io" ]
}
},
"privacyDescription" : {
"NSLocalNetworkUsageDescription" : "展示游戏页面"
}
},
"sdkConfigs" : {
"oauth" : {
"apple" : {},
"weixin" : {
"appid" : "wx0411fa6a39d61297",
"appsecret" : "",
"UniversalLinks" : "https://uniapp.dcloud.io/ulink-catgame/"
}
},
"share" : {
"weixin" : {
"appid" : "wx0411fa6a39d61297",
"UniversalLinks" : "https://uniapp.dcloud.io/ulink-catgame/"
}
},
"payment" : {}
}
}
},
"quickapp" : {},
......
{
"pages": [{
"path": "pages/list/list",
"style": {
"navigationStyle":"custom",
"enablePullDownRefresh":true
}
}, {
"path":"pages/grid/grid",
"style":{
"navigationStyle":"custom"
}
}, {
"path": "pages/search/search",
"style": {
"navigationBarTitleText": ""
}
}, {
"path": "pages/list/detail",
"style": {
"app-plus": {
"titleNView": {
"buttons": [{
"type": "share"
}],
"type": "transparent"
}
},
"h5": {
"titleNView": {
"buttons": [],
"type": "transparent"
"path": "pages/list/list",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/grid/grid",
"style": {
"navigationStyle": "custom"
}
}, {
"path": "uni_modules/uni-login-page/pages/index/index",
"style": {
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#FFFFFF",
"app-plus": {
"titleNView": {
"buttons": [{
"text": "帮助",
"type": "none",
"fontSize": "16px",
"width": "60px"
}]
}
}
},
"navigationBarTitleText": "文章详情"
}
}
}, {
"path": "pages/search/search",
"style": {
"navigationBarTitleText": ""
}
}, {
"path": "pages/list/detail",
"style": {
"app-plus": {
"titleNView": {
"buttons": [{
"type": "share"
}],
"type": "transparent"
}
},
"h5": {
"titleNView": {
"buttons": [],
"type": "transparent"
}
},
"navigationBarTitleText": "文章详情"
}
}, {
"path": "pages/ucenter/ucenter",
"style":{
"navigationBarTitleText": "个人中心",
"navigationBarBackgroundColor":"#2F85FC",
"navigationBarTextStyle":"white"
}
},{
"path":"pages/uni-feedback/uni-feedback",
"style":{
"navigationBarTitleText":"问题反馈"
}
} ,{
"path" : "pages/about/about",
"style" :
{
"navigationBarTitleText": "关于"
}
},{
"path" : "pages/agree-list/agree-list",
"style" :
{
"navigationBarTitleText": "政策与协议"
}
}
,{
"path" : "pages/agree-list/privacy/privacy",
"style" :
{
"navigationBarTitleText": "隐私政策"
}
}
,{
"path" : "pages/agree-list/service/service",
"style" :
{
"navigationBarTitleText": "服务协议"
}
},{
}, {
"path": "pages/ucenter/ucenter",
"style": {
"navigationBarTitleText": "个人中心",
"navigationBarBackgroundColor": "#2F85FC",
"navigationBarTextStyle": "white"
}
}, {
"path": "pages/uni-feedback/uni-feedback",
"style": {
"navigationBarTitleText": "问题反馈"
}
}, {
"path": "pages/about/about",
"style": {
"navigationBarTitleText": "关于"
}
}, {
"path": "pages/agree-list/agree-list",
"style": {
"navigationBarTitleText": "政策与协议"
}
}, {
"path": "pages/agree-list/privacy/privacy",
"style": {
"navigationBarTitleText": "隐私政策"
}
}, {
"path": "pages/agree-list/service/service",
"style": {
"navigationBarTitleText": "服务协议"
}
}, {
"path": "uni_modules/uni-upgrade-center-app/pages/upgrade-popup",
"style": {
"disableScroll": true,
......@@ -92,92 +102,72 @@
}
}
}
,{
"path" : "pages/settings/settings",
"style" :
{
"navigationBarTitleText": "设置"
}
}
,{
"path" : "pages/ucenter/edit/edit",
"style" :
{
"navigationBarTitleText": "编辑资料"
}
},{
"path":"pages/ucenter/edit/uploadCutImageToUnicloud",
"style":{
"navigationStyle":"custom"
}
},{
"path":"uni_modules/uni-login-page/pages/index/index",
"style":{
"navigationBarTitleText":"",
"navigationBarBackgroundColor":"#FFFFFF",
"app-plus":{
"titleNView":{
"buttons":[{
"text":"帮助",
"type":"none",
"fontSize":"16px",
"width":"60px"
}]
}
}
}, {
"path": "pages/settings/settings",
"style": {
"navigationBarTitleText": "设置"
}
}, {
"path": "pages/ucenter/edit/edit",
"style": {
"navigationBarTitleText": "编辑资料"
}
},{
"path":"uni_modules/uni-login-page/pages/index/phone-login",
"style":{
"navigationBarTitleText":"",
"navigationBarBackgroundColor":"#FFFFFF",
"app-plus":{
"titleNView":{
"buttons":[{
"text":"帮助",
"type":"none",
"fontSize":"16px",
"width":"60px"
}, {
"path": "pages/ucenter/edit/uploadCutImageToUnicloud",
"style": {
"navigationStyle": "custom"
}
}, {
"path": "uni_modules/uni-login-page/pages/index/phone-login",
"style": {
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#FFFFFF",
"app-plus": {
"titleNView": {
"buttons": [{
"text": "帮助",
"type": "none",
"fontSize": "16px",
"width": "60px"
}]
}
}
}
},{
"path":"uni_modules/uni-login-page/pages/index/pwd-login",
"style":{
"navigationBarTitleText":"",
"navigationBarBackgroundColor":"#FFFFFF",
"app-plus":{
"titleNView":{
"buttons":[{
"text":"帮助",
"type":"none",
"fontSize":"16px",
"width":"60px"
}, {
"path": "uni_modules/uni-login-page/pages/index/pwd-login",
"style": {
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#FFFFFF",
"app-plus": {
"titleNView": {
"buttons": [{
"text": "帮助",
"type": "none",
"fontSize": "16px",
"width": "60px"
}]
}
}
}
},{
"path":"uni_modules/uni-login-page/pages/index/pwd-retrieve",
"style":{
"navigationBarTitleText":"",
"navigationBarBackgroundColor":"#FFFFFF",
"app-plus":{
"titleNView":{
"buttons":[{
"text":"帮助",
"type":"none",
"fontSize":"16px",
"width":"60px"
}, {
"path": "uni_modules/uni-login-page/pages/index/pwd-retrieve",
"style": {
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#FFFFFF",
"app-plus": {
"titleNView": {
"buttons": [{
"text": "帮助",
"type": "none",
"fontSize": "16px",
"width": "60px"
}]
}
}
}
}
],
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "base-app",
......
......@@ -96,7 +96,7 @@
if (!this.login) {
console.log('点击前往登录');
uni.navigateTo({
url: '/uni_modules/login-page/pages/index/index'
url: '/uni_modules/uni-login-page/pages/index/index'
});
}
else {
......
'use strict';
const uniID = require('uni-id')
const uniCaptcha = require('uni-captcha')
const db = uniCloud.database()
const dbCmd = db.command
exports.main = async (event, context) => {
let params = event.params || {}
// 登录记录
const loginLog = async (res = {}, type = 'login') => {
const now = Date.now()
......
// 本文件中的json内容将在云函数【运行】时作为参数传给云函数。
// 配置教程参考:https://uniapp.dcloud.net.cn/uniCloud/quickstart?id=runparam
{
"action": "quickLogin",
"params": {
"access_token": "43_Ga0tBbkdkFxu746Ub2njRpyR49M7kf4XxtV9InxFoCWOjyR9m7a43akiQyzuqverhi1qCfKj2j6SOOvDHwfyphSYcvIC7tUXe4bJRLZ7n7g",
"expires_in": 7200,
"refresh_token": "43_B7KJlMrcAnr2Hq6hMUgBVGSO8pgJpnAaFAANu7wP17FJC2chJ1tqdaeBrLDrDN1osRAf0RNBjv0yIp2muUOl9bqzrKeIp0TL4AfOcY1mdMM",
"openid": "oRrdQty-Zb6VwWjru6RV81_HwW4k",
"scope": "snsapi_userinfo",
"unionid": "oU5Yyt4zSdenNh8ZcwSNtzoXgAkM",
"type": "weixin"
}
}
......@@ -14,6 +14,9 @@
"weixin" : {
"appid": "wx0411fa6a39d61297",
"appsecret": "fdc6251421d3d688a563b4f00dd540e7"
},
"apple": {
"bundleId": "io.dcloud.game.cat"
}
}
},
......@@ -37,8 +40,8 @@
"sms": {
"name": "DCloud",
"codeExpiresIn": 300,
"smsKey": "your sms key",
"smsSecret": "your sms secret"
"smsKey": "71a19f38c954f7d768d68a050486bf15",
"smsSecret": "d6c424b702d73baa3b6e1a1452469213"
},
"univerify":{
"appid": "__UNI__GameCat",
......
{
"name": "uni-id",
"version": "3.0.8",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"version": "3.0.8",
"license": "Apache-2.0",
"dependencies": {
"uni-config-center": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
}
},
"../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center": {
"version": "0.0.1",
"license": "Apache-2.0"
},
"node_modules/uni-config-center": {
"resolved": "../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center",
"link": true
"name": "uni-id",
"version": "3.0.8",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"version": "3.0.8",
"license": "Apache-2.0"
}
}
},
"dependencies": {
"uni-config-center": {
"version": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
}
}
}
<template>
<view class="flex flex-column flex-1 w-750 bg-white">
<!-- 登录主体 -->
<view class="flex flex-column flex-1 w-750 justify-center align-center">
<view class="flex justify-center align-center show-phone">
<text class="font-28">登陆后即可展示自己</text>
<text class="font-50">{{phoneNumberShow}}</text>
<text class="font-26 text-sub">认证服务由(某服务商)提供</text>
</view>
<view class="">
<button type="primary" class="w-630 round">本机号码一键登录</button>
<button type="default" class="w-630 round my-2" @click="toOtherPhone">其他手机号码登陆</button>
</view>
<view class="w-400 py-2 justify-center align-center flex">
<login-ikonw :link="link" text="登录即表示同意用户协议和隐私政策以及(某服务商)认证服务条款"></login-ikonw>
</view>
</view>
<!-- 第三方登陆 -->
<view class="py-2">
<auth-btn @login="authLogin"></auth-btn>
<view class="flex flex-column flex-1 w-750 bg-white">
<view class="flex-1 flex flex-column justify-start align-center">
<view class="w-630 flex flex-column">
<!-- 顶部文字 -->
<text class="font-32 font-blod pt-5">登陆后即可展示自己</text>
<login-ikonw class="lgnin-iknow" :link="link" text="登录即表示同意用户协议和隐私政策"></login-ikonw>
<!-- 登录框 (选择手机号所属国家和地区需要另行实现) -->
<view class="phone-input-box round flex flex-row flex-nowrap align-center justify-center">
<picker mode="selector" :range="phoneArea" @change="selectPhoneArea">
<text class="px-2 font-30">{{currenPhoneArea}}</text>
</picker>
<input type="number" class="flex-1 phone-input px-2 font-30" placeholder="请输入手机号"
v-model="phoneNumber" />
</view>
<!-- tip -->
<text class="text-sub font-26 tip-text">未注册的手机号验证通过后蒋自动注册</text>
<!-- 发送按钮 -->
<view class="send-btn-box flex w-630 justify-center align-center round" hover-class="hover"
@click="sendShortMsg" :class="canGetShortMsg?'send-btn-active':''">
<text class="text-white">获取短信验证码</text>
</view>
<!-- 其他登录方式 -->
<view class="w-630 flex flex-row align-center justify-between">
<text class="font-26 login-text" hover-class="hover" @click="toPwdLogin">密码登录</text>
<text class="font-26 login-text" hover-class="hover" @click="openLoginList">其他登录方式</text>
</view>
</view>
</view>
<!-- 登录按钮弹窗 -->
<login-action-sheet ref="loginActionSheet"></login-action-sheet>
<uni-quick-login></uni-quick-login>
</view>
</template>
<script>
export default {
data() {
return {
phoneNumber:'',
link:[{
text:'用户协议',
to:'/baidu.com'
}, {
text:'隐私政策',
to:'baidu'
}, {
text:'(某服务商)认证服务条款',
to:'baidu'
}]
return {
link: [{
text: '用户协议',
to: '/baidu.com'
}, {
text: '隐私政策',
to: 'baidu'
}],
phoneArea: ['+86', '+87'],
currenPhoneArea: '+86',
phoneNumber: ''
}
},
computed: {
canGetShortMsg() {
let reg = /^1\d{10}$/;
return reg.test(this.phoneNumber);
}
},
onLoad() {
this.phoneNumber = '17731252731';
},
computed:{
// 手机号中间隐藏
phoneNumberShow(){
let phone = this.phoneNumber;
if(phone == '')return '';
return phone.replace(/^(\d{3})\d{4}(\d{4})$/, '$1****$2');
}
},
methods: {
/**
* @param {Object} auth 第三方登录回调
* value
* image
methods: {
selectPhoneArea(event) {
this.currenPhoneArea = this.phoneArea[event.detail.value];
},
sendShortMsg() {
if (!this.canGetShortMsg) return;
/**
* 发送验证吗
*/
},
/**
* 去密码登录页
*/
authLogin(auth){
console.log('auth_', auth);
},
/**
* 其他手机号码登陆
*/
toOtherPhone(){
uni.navigateTo({
url:'./phone-login'
})
toPwdLogin() {
uni.navigateTo({
url: './pwd-login'
})
},
openLoginList() {
this.$refs.loginActionSheet.open();
}
}
}
</script>
<style>
@import url("../../common/myStyle.css");
.show-phone{
padding-bottom: 120rpx;
<style>
@import url("../../common/myStyle.css");
.lgnin-iknow {
padding-top: 24rpx;
padding-bottom: 48rpx;
}
.phone-input-box {
height: 85rpx;
background-color: #f9f9f9;
}
.phone-input {
border-left-width: 1px;
border-left-color: #d7d9d8;
}
.tip-text {
padding-top: 20rpx;
padding-bottom: 36rpx;
}
.send-btn-box {
height: 85rpx;
background-color: #d8d8da;
margin-bottom: 50rpx;
}
.send-btn-active {
background-color: #007aff;
}
.login-text {
color: #1c436e;
}
</style>
</style>
\ No newline at end of file
......@@ -32,7 +32,8 @@
</view>
</view>
<!-- 登录按钮弹窗 -->
<login-action-sheet ref="loginActionSheet"></login-action-sheet>
<login-action-sheet ref="loginActionSheet"></login-action-sheet>
<uni-quick-login></uni-quick-login>
</view>
</template>
......
<template>
<view class="quick-login-box">
<view class="item" v-for="({text,logo,name},index) in providerList" :key="index" @click="login(name)">
<image class="logo" :src="logo" mode="widthFix"></image>
<text class="login-title">{{text}}</text>
</view>
</view>
</template>
<script>
export default {
data() {
return {
config: {
"weixin": {
"text": "微信登陆",
"logo": "../../static/login/img/weixin.png"
},
"qq": {
"text": "QQ登陆",
"logo": "../../static/login/img/qq.png"
},
"xiaomi": {
"text": "小米登陆",
"logo": "../../static/login/img/qq.png"
},
"apple": {
"text": "苹果登陆",
"logo": "../../static/login/img/apple.png"
},
"sinaweibo": {
"text": "微博登录",
"logo": "../../static/login/img/sinaweibo.png"
},
"univerify": {
"text": "一键登陆",
"logo": "../../static/login/img/univerify.png"
}
},
providerList: [],
univerifyStyle: {
"fullScreen": false, // 是否全屏显示,true表示全屏模式,false表示非全屏模式,默认值为false。
"backgroundColor": "#ffffff", // 授权页面背景颜色,默认值:#ffffff
}
}
},
mounted() {
uni.getProvider({
"service": "oauth",
success: res => {
this.providerList = res.provider.map((name) => {
return {...this.config[name],name}
})
this.login('univerify')
},
fail: (err) => {
console.error('获取服务供应商失败:' + JSON.stringify(err));
}
})
},
methods: {
login(type) {
uni.showLoading({mask: true});
uni.login({
"provider": type,
"univerifyStyle":this.univerifyStyle,
success:async e => {
console.log(e);
if(type=='apple'){
let res = await this.getUserInfo({provider:"apple"})
Object.assign(e.authResult,res.userInfo)
}
this.quickLogin(e.authResult,type)
},
fail: (err) => {
uni.hideLoading()
console.log(err);
if(err.errCode===30002){
console.log('你手动关闭了,一键登陆');
}
}
})
},
quickLogin(authResult,type){
//请勿直接使用authResult中的unionid或openid直接用于登陆,前端的数据都是不可靠的
console.log({...authResult,type});
uniCloud.callFunction({//联网验证登陆
"name": "user",
"data": {
"action": "quickLogin",
"params": {...authResult,type}
},
success: (e) => {
console.log(e.result);
uni.showModal({
content: JSON.stringify(e.result),
showCancel: false
});
if(type=='univerify'){
uni.closeAuthView()
}
},
fail: (err) => {
console.log(err);
if(err.errCode===30002){
}
},
complete: () => {
uni.hideLoading()
}
})
},
async getUserInfo(e){
return new Promise((resolve, reject)=>{
uni.getUserInfo({
...e,
success: (res) => {
resolve(res);
},
fail: (err) => {
uni.showModal({
content: JSON.stringify(err),
showCancel: false
});
reject(err);
}
})
})
}
}
}
</script>
<style scoped>
.quick-login-box {
flex-direction: row;
width: 750rpx;
justify-content: space-around;
}
.item {
flex-direction: column;
justify-content: center;
align-items: center;
height: 200rpx;
}
.logo {
width: 60rpx;
height: 60rpx;
}
.login-title {
font-size: 26rpx;
}
</style>
\ No newline at end of file
{
"id": "quick-login",
"displayName": "quick-login",
"version": "1.0.0",
"description": "quick-login",
"keywords": [
"quick-login"
],
"repository": "",
"engines": {
"HBuilderX": "^3.1.0"
},
"dcloudext": {
"category": [
"uniCloud",
"云端一体页面模板"
],
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "",
"data": "",
"permissions": ""
},
"npmurl": ""
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "u",
"aliyun": "u"
},
"client": {
"App": {
"app-vue": "u",
"app-nvue": "u"
},
"H5-mobile": {
"Safari": "u",
"Android Browser": "u",
"微信浏览器(Android)": "u",
"QQ浏览器(Android)": "u"
},
"H5-pc": {
"Chrome": "u",
"IE": "u",
"Edge": "u",
"Firefox": "u",
"Safari": "u"
},
"小程序": {
"微信": "u",
"阿里": "u",
"百度": "u",
"字节跳动": "u",
"QQ": "u"
},
"快应用": {
"华为": "u",
"联盟": "u"
}
}
}
}
}
\ No newline at end of file
# uni-quick-login
\ No newline at end of file
......@@ -21,59 +21,14 @@ class User {
case 'univerify':
return uniID.loginByUniverify({access_token,openid})
break;
case 'apple':
return await uniID.loginByApple(params)
break;
default:
return {"code":100,"msg":"暂不提供"+type+"登陆的云端接口演示"}
break;
}
}
/*
async loginLog(){
const now = Date.now()
const uniIdLogCollection = db.collection('uni-id-log')
let logData = {
deviceId: params.deviceId || context.DEVICEID,
ip: params.ip || context.CLIENTIP,
type:"login",
ua: context.CLIENTUA,
create_date: now
};
Object.assign(logData,
res.code === 0 ? {
user_id: res.uid,
state: 1
} : {
state: 0
})
return await uniIdLogCollection.add(logData)
}
async register(){
return await uniID.register(params);
}
async login(){
let passed = false;
let needCaptcha = await getNeedCaptcha();
if (needCaptcha) {
res = await uniCaptcha.verify(params)
if (res.code === 0) passed = true;
}
if (!needCaptcha || passed) {
res = await uniID.login(params);
await loginLog(res);
needCaptcha = await getNeedCaptcha();
}
res.needCaptcha = needCaptcha;
}
async loginByWeixin(){
}
async checkToken(){
return uniID.checkToken(event.uniIdToken);
}
async logout(){
return await uniID.logout(event.uniIdToken)
}
async sendSmsCode(){
// 简单限制一下客户端调用频率
const ipLimit = await db.collection('uni-verify').where({
......@@ -86,7 +41,7 @@ class User {
msg: '请求过于频繁'
}
}
const templateId = '' // 替换为自己申请的模板id
const templateId = '11753' // 替换为自己申请的模板id
if (!templateId) {
return {
code: 500,
......@@ -102,67 +57,6 @@ class User {
templateId
})
}
async loginBySms(){
if (!params.code) {
return {
code: 500,
msg: '请填写验证码'
}
}
if (!/^1\d{10}$/.test(params.mobile)) {
return {
code: 500,
msg: '手机号码填写错误'
}
}
res = await uniID.loginBySms(params)
loginLog(res)
}
async inviteLogin(){
if (!params.code) {
return {
code: 500,
msg: '请填写验证码'
}
}
res = await uniID.loginBySms({
...params,
type: 'register'
})
}
async getInviteCode(){
let res = await uniID.getUserInfo({
uid: params.uid,
field: ['my_invite_code']
})
if (res.code === 0) {
res.myInviteCode = res.userInfo.my_invite_code
delete res.userInfo
}
}
async getInvitedUser(){
return uniID.getInvitedUser(params)
}
async loginByUniverify(){
return await uniID.loginByUniverify(params)
}
async loginByApple(){
res = await uniID.loginByApple(params)
loginLog(res)
}
async updatePwd(){
return await uniID.updatePwd({
uid: params.uid,
...params
})
}
async createCaptcha(){
return await uniCaptcha.create(params)
}
async refreshCaptcha(){
return await uniCaptcha.refresh(params)
}
*/
}
const userClass = new User();
exports.main = async (event, ctx) => {
......
......@@ -8,20 +8,20 @@
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"uni-captcha": "file:../../../uni_modules/uni-captcha/uniCloud/cloudfunctions/common/uni-captcha",
"uni-config-center": "file:../../../uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center",
"uni-id": "file:../../../uni_modules/uni-id/uniCloud/cloudfunctions/common/uni-id"
"uni-captcha": "file:../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha",
"uni-config-center": "file:../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center",
"uni-id": "file:../../../../uni-id/uniCloud/cloudfunctions/common/uni-id"
}
},
"../../../uni_modules/uni-captcha/uniCloud/cloudfunctions/common/uni-captcha": {
"../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha": {
"version": "0.1.0",
"license": "Apache-2.0"
},
"../../../uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center": {
"../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center": {
"version": "0.0.1",
"license": "Apache-2.0"
},
"../../../uni_modules/uni-id/uniCloud/cloudfunctions/common/uni-id": {
"../../../../uni-id/uniCloud/cloudfunctions/common/uni-id": {
"version": "3.0.8",
"license": "Apache-2.0",
"dependencies": {
......@@ -29,27 +29,27 @@
}
},
"node_modules/uni-captcha": {
"resolved": "../../../uni_modules/uni-captcha/uniCloud/cloudfunctions/common/uni-captcha",
"resolved": "../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha",
"link": true
},
"node_modules/uni-config-center": {
"resolved": "../../../uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center",
"resolved": "../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center",
"link": true
},
"node_modules/uni-id": {
"resolved": "../../../uni_modules/uni-id/uniCloud/cloudfunctions/common/uni-id",
"resolved": "../../../../uni-id/uniCloud/cloudfunctions/common/uni-id",
"link": true
}
},
"dependencies": {
"uni-captcha": {
"version": "file:../../../uni_modules/uni-captcha/uniCloud/cloudfunctions/common/uni-captcha"
"version": "file:../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha"
},
"uni-config-center": {
"version": "file:../../../uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
"version": "file:../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
},
"uni-id": {
"version": "file:../../../uni_modules/uni-id/uniCloud/cloudfunctions/common/uni-id",
"version": "file:../../../../uni-id/uniCloud/cloudfunctions/common/uni-id",
"requires": {
"uni-config-center": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
}
......
......@@ -9,8 +9,8 @@
"author": "",
"license": "ISC",
"dependencies": {
"uni-captcha": "file:../../../uni_modules/uni-captcha/uniCloud/cloudfunctions/common/uni-captcha",
"uni-config-center": "file:../../../uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center",
"uni-id": "file:../../../uni_modules/uni-id/uniCloud/cloudfunctions/common/uni-id"
"uni-captcha": "file:../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha",
"uni-config-center": "file:../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center",
"uni-id": "file:../../../../uni-id/uniCloud/cloudfunctions/common/uni-id"
}
}
// 本文件中的json内容将在云函数【运行】时作为参数传给云函数。
// 配置教程参考:https://uniapp.dcloud.net.cn/uniCloud/quickstart?id=runparam
{
"action": "sendSmsCode",
"params": {
"mobile":"17769516081",
"type":"register"
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册