提交 675f1da3 编写于 作者: study夏羽's avatar study夏羽

删除多余文件

上级 721bf925
<template>
<view class="root">
<checkbox-group @change="setAgree" class="checkbox-group">
<checkbox :checked="isAgree" style="transform: scale(0.7);" />
<text>{{$t('common.agree')}}</text>
</checkbox-group>
<view class="item" v-for="(agreement,index) in agreements" :key="index">
<text class="agreement" @click="navigateTo(agreement)">{{agreement.title}}</text>
<text class="hint" v-if="hasAnd(agreements,index)">&</text>
</view>
</view>
</template>
<script>
export default {
name:"uni-agreements",
computed:{
agreements(){
return getApp().globalData.config.about.agreements||[]
}
},
methods:{
navigateTo({url,title}){
uni.navigateTo({
url: '/pages/common/webview/webview?url='+url+'&title='+title,
success: res => {},
fail: () => {},
complete: () => {}
});
},
hasAnd(agreements,index){
return agreements.length-1>index
},
setAgree(e){
this.isAgree = !this.isAgree
this.$emit('setAgree',this.isAgree)
}
},
created() {
uni.$on('setAgreementsAgree',state=>{
console.log('setAgreementsAgree',state);
this.isAgree = state
this.$emit('setAgree',state)
})
},
data() {
return {
isAgree:false
};
}
}
</script>
<style lang="scss" scoped>
/* #ifndef APP-NVUE */
view{
display: flex;
box-sizing: border-box;
flex-direction: column;
}
/* #endif */
.root{
flex-direction: row;
align-items: center;
font-size: 28rpx;
color: #8a8f8b;
}
.checkbox-group{
align-items: center;
display: flex;
flex-direction: row;
}
.item{
flex-direction: row;
}
.agreement{
color:#04498c;
}
</style>
// jest官方文档: https://www.jestjs.cn/
// uniapp自动化测试教程: https://uniapp.dcloud.io/collocation/auto/quick-start
describe('pages/ucenter/login-page/index/index.vue', () => {
let page
beforeAll(async () => {
try {
page = await program.navigateTo('/pages/ucenter/login-page/index/index?type=smsCode')
await page.waitFor(500)
console.log("await program.pageStack(): ",await program.pageStack());
} catch (e) {
console.log("e: ",e);
}
})
it('smsCode-login', async () => {
const perPage = await page.$('.content')
const getTitle = await perPage.$('.title')
// console.log(await getTitle.text());
if ((await program.currentPage()).path == 'pages/ucenter/login-page/index/index') {
console.log(await getTitle.text(),"1-------------");
// expect(await getTitle.text()).toBe('登录后即可展示自己')
const setInput = await page.setData({
"phone": '17769516019',
"agree": true,
// "type":"smsCode"
})
await page.waitFor(300)
console.log(await page.data('phone'), "phone----------");
console.log(await page.data('agree'), "agree-----------");
console.log(await page.data('type'), "type----------");
const agreeTrue = await page.waitFor(async () => {
return await page.data('agree')
})
await page.callMethod('sendShortMsg')
await page.waitFor(300)
//pages/ucenter/login-page/phone-code/phone-code
}
if ((await program.currentPage()).path == 'pages/ucenter/login-page/pwd-login/pwd-login') {
console.log(await getTitle.text(),"2-------------");
// expect(await getTitle.text()).toBe('用户名密码登录')
}
console.log("currentPage:---------- ",await program.currentPage());
})
})
// jest官方文档: https://www.jestjs.cn/
// uniapp自动化测试教程: https://uniapp.dcloud.io/collocation/auto/quick-start
describe('pages/ucenter/login-page/phone-code/phone-code.vue', () => {
let page
beforeAll(async () => {
page = await program.navigateTo('/pages/ucenter/login-page/phone-code/phone-code')
await page.waitFor(500)
})
// ?phoneNumber=17769516019
it('获取短信验证码', async () => {
const initClickRes = await page.callMethod('initClick')
console.log("initClickRes: ",initClickRes);
console.log(await page.data('count'));
await page.waitFor(500)
await page.setData({
"code":"123456"
})
expect(await page.data('code').length).toBe(6)
const submitRes = await page.callMethod('submit')
console.log("submitRes: ",submitRes);
// expect(submitRes.msg).toBe('注册成功')
console.log(await program.currentPage());
// 登录成功后,/pages/ucenter/settings/settings
})
})
// jest官方文档: https://www.jestjs.cn/
// uniapp自动化测试教程: https://uniapp.dcloud.io/collocation/auto/quick-start
describe('pages/ucenter/login-page/pwd-login/pwd-login.vue', () => {
let page
beforeAll(async () => {
page = await program.navigateTo('/pages/ucenter/login-page/pwd-login/pwd-login')
await page.waitFor(500)
console.log("program.pageStack: ",await program.pageStack());
})
it('前往注册页', async () => {
// expect.assertions(2);
const resReg = await page.callMethod('toRegister')
await page.waitFor(300)
// expect((await program.currentPage()).path).toBe(
// 'pages/ucenter/login-page/register/register')
await program.navigateBack()
// await page.waitFor(500)
// 执行 navigateBack 验证是否返回navigateTo
// expect((await program.navigateBack()).path).toBe(
// 'pages/ucenter/login-page/pwd-login/pwd-login')
// console.log(await program.currentPage(),"22222222222");
})
it('用户名密码登录', async () => {
// expect.assertions(1);
const setForm = await page.setData({
"username": "数字天堂",
"password": "111111",
// "captcha":"test",
"agree": true
})
const needCaptcha = await page.data('needCaptcha')
console.log("needCaptcha---1: : ",needCaptcha);
if(needCaptcha){
await page.setData({
"captcha":"test"
})
console.log("needCaptcha---2: ",await page.data('needCaptcha'));
}
const resLogin = await page.callMethod('pwdLogin')
console.log("resLogin: ", resLogin.code);
switch (resLogin.code){
case 0:
console.log('登录成功')
expect(resLogin.uid).toHaveLength(24);
console.log(await program.currentPage(),"currentPage---------");
break;
case 10102:
expect(resLogin.msg).toBe("密码错误");
await page.setData({
"username": "数字天堂",
"password": "222222",
"agree": true,
})
await page.callMethod('pwdLogin')
break;
case 10103:
expect(resLogin.msg).toBe("密码错误次数过多");
break;
case 10002:
expect(resLogin.msg).toBe("验证码不可为空");
break;
case "SYS_ERR":
console.log("未知错误---SYS_ERR",resLogin)
break;
default:
// console.log(await program.currentPage(),"22222222222");
break;
}
})
})
// jest官方文档: https://www.jestjs.cn/
// uniapp自动化测试教程: https://uniapp.dcloud.io/collocation/auto/quick-start
describe('pages/ucenter/login-page/pwd-retrieve/pwd-retrieve.vue', () => {
let page,abled;
beforeAll(async () => {
try {
page = await program.navigateTo(
'/pages/ucenter/login-page/pwd-retrieve/pwd-retrieve?phoneNumber=17769516019')
await page.waitFor(500)
console.log("await program.pageStack(): ", await program.pageStack());
} catch (e) {
console.log("e: ", e);
}
})
it('重置密码之前', async () => {
const element = await page.$('.send-btn-box')
abled = await element.attribute('disabled')
await page.setData({
formData: {
"phone": "17769516019",
'code': '123456',
'pwd': '222222',
'pwd2': '222222',
}
})
});
it('重置密码', async () => {
if(abled){
const submitRes = await page.callMethod('submit')
console.log("submitRes: ", submitRes);
if (submitRes) {
switch (submitRes.code) {
case 0:
console.log("密码重置成功")
expect(submitRes.errCode).toBe(0)
// expect(submitRes.errMsg).toBe('密码重置成功')
break;
case 10202:
expect(submitRes.errMsg).toBe('此账号尚未注册')
break;
case 50202:
expect(submitRes.errCode).toBe("uni-id-invalid-verify-code")
expect(submitRes.errMsg).toBe("短信验证码错误或已失效")
console.log("process.env.UNI_PLATFORM",process.env.UNI_PLATFORM)
break;
default:
break;
}
}else{
console.log("err")
}
}
})
})
// jest官方文档: https://www.jestjs.cn/
// uniapp自动化测试教程: https://uniapp.dcloud.io/collocation/auto/quick-start
describe('pages/ucenter/login-page/register/register.vue', () => {
let page
beforeAll(async () => {
page = await program.redirectTo('/pages/ucenter/login-page/register/register')
await page.waitFor(500)
console.log("program.pageStack: ",await program.pageStack());
})
it('注册账号', async () => {
let username = "数字天堂"
let nickname = "DCloud"
let password = "111111"
let pwd2 = "111111"
const setInput = await page.setData({
formData: {
"username": username,
"nickname": nickname,
'password': password,
'pwd2': pwd2,
"captcha": "1234"
},
})
console.log(await page.data('formData'),"setData----formData");
expect(username).toMatch(/^.{3,20}$/);
expect(password).toMatch(/^.{6,20}$/);
expect(pwd2).toMatch(/^.{6,20}$/);
expect(pwd2).toEqual(password);
await page.setData({
agree: true
})
const resRegister = await page.waitFor(async () => {
return await page.callMethod('submit')
})
console.log("resRegister: ",resRegister);
switch (resRegister.code){
case 0:
console.log('注册成功')
// expect(resRegister.userInfo.username).toBe("数字天堂");
// await program.navigateTo('/pages/ucenter/settings/settings')
break;
case 20102:
expect(resRegister.errMsg).toBe("此账号已注册");
// expect(getUid.msg).toBe("此用户名已注册");
// expect(getUid.msg).toBe("Account exists");
// await program.navigateTo('/pages/ucenter/login-page/pwd-login/pwd-login')
break;
default:
break;
}
})
})
## 1.0.15(2022-05-11)
- loginBySms、bindMobileBySms新增防刷机制(当短信验证码输入错误2次以上,弹出图形验证码进行人机校验)
- 更改loginLog为uniIdLog 记录各类uni-id操作,并新增action字段记录操作的行为名称
- register新增校验图形验证码逻辑
## 1.0.14(2022-01-26)
- 修复 uni-admin 的 'registerUser' 接口,注册用户含有多余字段 uid
## 1.0.13(2022-01-26)
- 新增逻辑:调用logout接口后刷新设备信息中token的有效期
## 1.0.12(2022-01-24)
- 优化设备信息存储逻辑
- 新增刷新设备信息token有效期的API `renewDeviceTokenExpired`
## 1.0.11(2022-01-19)
- 新增 getNeedCaptcha 接口
- 优化 调整 login 接口的代码结构
## 1.0.10(2022-01-08)
- 修复 限制只有 admin 用户可管理用户标签(不支持非 admin 用户操作managerMultiTag 接口)
## 1.0.9(2021-12-01)
- 新增 uni-admin 用户标签管理接口 managerTags
## 1.0.8(2021-11-29)
新增 `closeAccount`注销账号
## 1.0.7(2021-10-20)
新增bindMobileByMpWeixin,一键获取微信绑定的手机号
## 1.0.6(2021-09-23)
修复微信登录成功后没有添加日志的问题
## 1.0.5(2021-08-10)
- 修复登录成功后响应体包含userInfo.password的问题
- 新增微信登录成功后,自动获取用户的微信昵称和头像完善用户个人资料
## 1.0.4(2021-07-31)
- 修复 登录日志在登录失败时不写入记录的 bug
- 修复 写入记录登录是未传递 type 参数的 bug
## 1.0.3(2021-07-02)
- 框架设定非 admin 不能创建用户, 用户可自定义
## 1.0.2(2021-07-01)
- 发送短信验证码api,默认注释掉:虚拟发送短信验证码的代码块。
- 统一action名称为驼峰法
## 1.0.1(2021-06-28)
修复resetPwdBySmsCode接口,未注册过的用户也能调用的问题
## 1.0.0(2021-06-21)
1.0.0版发布
\ No newline at end of file
{
"id": "uni-id-cf",
"displayName": "uni-id-cf",
"version": "1.0.14",
"description": "封装uni-id常用接口的云函数,快速实现简单、统一、可扩展的用户管理功能",
"keywords": [
"uni-id-cf",
"uni-id的云函数"
],
"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": ["uni-config-center","uni-captcha","uni-id"],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"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"
},
"Vue": {
"vue2": "y",
"vue3": "u"
}
}
}
}
}
#### uni-id-cf是uni-id-uniCloudFunction的缩写。
#### 直接调用他内置的云函数,即可直接使用uni-id的各类api。
含:登录注册(含用户名密码登录、手机号验证码登录、app一键登录、微信登录、Apple登录、微信小程序登录)、修改密码、忘记密码、退出登录等
> 详细的使用方式见[uni-starter](https://ext.dcloud.net.cn/plugin?id=5057)
\ No newline at end of file
{
"name": "uni-id-cf",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"uni-captcha": {
"version": "file:../../../../uni-captcha/uniCloud/cloudfunctions/common/uni-captcha"
},
"uni-config-center": {
"version": "file:../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
},
"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"
},
"dependencies": {
"uni-config-center": {
"version": "file:../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
}
}
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册