提交 56f8588b 编写于 作者: DCloud_JSON's avatar DCloud_JSON

升级预置的`uni_modules`->`uni-captcha`版本为:0.6.0。[详情](https://ext.dcloud.net.cn/plugin?name=uni-captcha)

上级 60c2ced4
此差异已折叠。
## 1.2.5(2022-05-29)
升级预置的`uni_modules`->`uni-captcha`版本为:0.6.0。[详情](https://ext.dcloud.net.cn/plugin?name=uni-captcha)
## 1.2.4(2022-05-20)
- 修改`uni-starter.config.js`->`debug`的默认值为`false`
## 1.2.3(2022-05-20)
- 默认关闭`manifest.json`中的扩展配置
- `uni-starter.config.js` 新增debug,用于配置是否开启调试模式
## 1.2.2(2022-05-19) ## 1.2.2(2022-05-19)
- 优化登陆体验,账号密码登陆错误超过2次,再显示图形验证码进行人机校验。 - 优化登陆体验,账号密码登陆错误超过2次,再显示图形验证码进行人机校验。
## 1.2.1(2022-05-18) ## 1.2.1(2022-05-18)
......
...@@ -8,7 +8,8 @@ import interceptorChooseImage from '@/uni_modules/json-interceptor-chooseImage/j ...@@ -8,7 +8,8 @@ import interceptorChooseImage from '@/uni_modules/json-interceptor-chooseImage/j
// #endif // #endif
const db = uniCloud.database() const db = uniCloud.database()
export default async function() { export default async function() {
let loginConfig = uniStarterConfig.router.login let loginConfig = uniStarterConfig.router.login;
const debug = uniStarterConfig.debug;
//清除有配置但设备环境不支持的登录项 //清除有配置但设备环境不支持的登录项
// #ifdef APP-PLUS // #ifdef APP-PLUS
await new Promise((callBack) => { await new Promise((callBack) => {
...@@ -152,7 +153,6 @@ export default async function() { ...@@ -152,7 +153,6 @@ export default async function() {
} }
}) })
const Debug = false;
//拦截器封装callFunction //拦截器封装callFunction
let callFunctionOption; let callFunctionOption;
uniCloud.addInterceptor('callFunction', { uniCloud.addInterceptor('callFunction', {
...@@ -200,7 +200,7 @@ export default async function() { ...@@ -200,7 +200,7 @@ export default async function() {
}, },
fail(e) { // 失败回调拦截 fail(e) { // 失败回调拦截
console.error('网络请求错误码:',JSON.stringify(e)); console.error('网络请求错误码:',JSON.stringify(e));
if (Debug) { if (debug) {
uni.showModal({ uni.showModal({
content: JSON.stringify(e), content: JSON.stringify(e),
showCancel: false showCancel: false
...@@ -375,7 +375,7 @@ export default async function() { ...@@ -375,7 +375,7 @@ export default async function() {
}, },
fail(err) { // 失败回调拦截 fail(err) { // 失败回调拦截
console.log(err); console.log(err);
if (Debug) { if (debug) {
console.log(err); console.log(err);
uni.showModal({ uni.showModal({
content: JSON.stringify(err), content: JSON.stringify(err),
......
{ {
"name": "", "name" : "uni-starter",
"appid": "请点击重新获取", "appid" : "__UNI__EC87F46",
"description": "云端一体应用快速开发模版", "description" : "",
"versionName": "1.0.0", "versionName" : "1.0.0",
"versionCode": "100", "versionCode" : "100",
"transformPx": false, "transformPx" : false,
"app-plus": { /* 5+App特有相关 */
"locales": { "app-plus" : {
"en": { "usingComponents" : true,
"name": "uni-starter", "nvueStyleCompiler" : "uni-app",
"android": { "compilerVersion" : 3,
"strings": { "splashscreen" : {
"CustomKey": "CustomValue" "alwaysShowBeforeRender" : true,
} "waiting" : true,
"autoclose" : true,
"delay" : 0
}, },
"ios": { /* 模块配置 */
"privacyDescription": { "modules" : {},
"NSPhotoLibraryUsageDescription": "access to the user’s photo library(read)" /* 应用发布信息 */
}, "distribute" : {
"infoPlist": { /* android打包配置 */
"CustomKey": "CustomValue" "android" : {
} "permissions" : [
} "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
}, "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"zh": { "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"name": "统一应用基本项目" "<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
} "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
}, "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"privacy": { "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"prompt": "template", "<uses-permission android:name=\"android.permission.CAMERA\"/>",
"template": { "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"title": "服务协议和隐私政策", "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"message": "  请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。<br/>  你可阅读<a href=\"https://ask.dcloud.net.cn/protocol.html\">《服务协议》</a>和<a href=\"https://ask.dcloud.net.cn/protocol.html\">《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。", "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"buttonAccept": "同意", "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"buttonRefuse": "暂不同意" "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
} "<uses-feature android:name=\"android.hardware.camera\"/>",
}, "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
"compatible": { ]
"ignoreVersion": true
},
"usingComponents": true,
"nvueStyleCompiler": "uni-app",
"compilerVersion": 3,
"splashscreen": {
"alwaysShowBeforeRender": false,
"waiting": true,
"autoclose": true,
"delay": 0
},
"modules": {
"Fingerprint": {
},
"Share": {
},
"OAuth": {
},
"FaceID": {
},
"Geolocation": {
},
"Bluetooth": {
},
"Push": {
},
"Maps": {
}
},
"distribute": {
"android": {
"permissions": [
"<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.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<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.USE_FINGERPRINT\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
],
"abiFilters": [
"armeabi-v7a",
"arm64-v8a",
"x86"
]
},
"ios": {
"capabilities": {
"entitlements": {
"com.apple.developer.associated-domains": [
"applinks:static-76ce2c5e-31c7-4d81-8fcf-ed1541ecbc6e.bspapp.com"
]
}
}
},
"sdkConfigs": {
"oauth": {
"apple": {
},
"weixin": {
"appid": "",
"appsecret": "",
"UniversalLinks": ""
},
"univerify": {
}
},
"ad": {
},
"share": {
"weixin": {
"appid": "",
"UniversalLinks": ""
}
},
"geolocation": {
"baidu": {
"__platform__": [
"ios",
"android"
],
"appkey_ios": "请填写地图的key",
"appkey_android": "请填写地图的key"
}
},
"push": {
"unipush": {
"version": "2",
"offline": true,
"meizu": {
},
"mi": {
},
"vivo": {
}, },
"oppo": { /* ios打包配置 */
}, "ios" : {},
"hms": { /* SDK配置 */
} "sdkConfigs" : {}
}
},
"payment": {
},
"maps": {
} }
}, },
"icons": { /* 快应用特有相关 */
"android": { "quickapp" : {},
"hdpi": "", /* 小程序特有相关 */
"xhdpi": "", "mp-weixin" : {
"xxhdpi": "", "appid" : "",
"xxxhdpi": "" "setting" : {
"urlCheck" : false
}, },
"ios": { "usingComponents" : true
"appstore": "",
"ipad": {
"app": "",
"app@2x": "",
"notification": "",
"notification@2x": "",
"proapp@2x": "",
"settings": "",
"settings@2x": "",
"spotlight": "",
"spotlight@2x": ""
},
"iphone": {
"app@2x": "",
"app@3x": "",
"notification@2x": "",
"notification@3x": "",
"settings@2x": "",
"settings@3x": "",
"spotlight@2x": "",
"spotlight@3x": ""
}
}
},
"splashscreen": {
"iosStyle": "common",
"androidStyle": "common",
"useOriginalMsgbox": true
}
}, },
"nvueLaunchMode": "" "mp-alipay" : {
}, "usingComponents" : true
"quickapp": {
},
"mp-weixin": {
"appid": "",
"setting": {
"urlCheck": false,
"es6": false
}, },
"usingComponents": true, "mp-baidu" : {
"betterScopedSlots": true, "usingComponents" : true
"permission": { },
"scope.userLocation": { "mp-toutiao" : {
"desc": "演示在onShow生命周期获取地理位置" "usingComponents" : true
}
}
},
"mp-alipay": {
"usingComponents": true
},
"mp-baidu": {
"usingComponents": true
},
"mp-toutiao": {
"usingComponents": true
},
"uniStatistics": {
"enable": false
},
"h5": {
"template": "",
"sdkConfigs": {
"maps": {
"qqmap": {
"key": ""
}
}
}, },
"router": { "uniStatistics" : {
"base": "" "enable" : false
}, },
"uniStatistics": { "vueVersion" : "2"
"enable": true }
}
},
"_spaceID": "",
"vueVersion": "2"
}
\ No newline at end of file
{ {
"id": "uni-starter", "id": "uni-starter",
"displayName": "uni-starter", "displayName": "uni-starter",
"version": "1.2.2", "version": "1.2.5",
"description": "云端一体应用快速开发基本项目模版", "description": "云端一体应用快速开发基本项目模版",
"keywords": [ "keywords": [
"login", "login",
...@@ -39,7 +39,8 @@ ...@@ -39,7 +39,8 @@
}, },
"uni_modules": { "uni_modules": {
"dependencies": [ "dependencies": [
"uni-id-cf" "uni-id-cf",
"uni-captcha"
], ],
"encrypt": [], "encrypt": [],
"platforms": { "platforms": {
......
{ {
"pages": [{ "pages": [
{
"path": "pages/list/list", "path": "pages/list/list",
"style": { "style": {
// #ifndef APP-PLUS // #ifndef APP-PLUS
......
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
} else { } else {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: this.$t('listDetail').newsErr title: this.$t('listDetail.newsErr')
}) })
} }
}, },
...@@ -193,7 +193,7 @@ ...@@ -193,7 +193,7 @@
*/ */
followClick() { followClick() {
uni.showToast({ uni.showToast({
title:this.$t('listDetail').follow, title:this.$t('listDetail.follow'),
icon: 'none' icon: 'none'
}); });
}, },
...@@ -224,7 +224,7 @@ ...@@ -224,7 +224,7 @@
}, },
menus: [{ menus: [{
"img": "/static/app-plus/sharemenu/wechatfriend.png", "img": "/static/app-plus/sharemenu/wechatfriend.png",
"text": this.$t('common').wechatFriends, "text": this.$t('common.wechatFriends'),
"share": { "share": {
"provider": "weixin", "provider": "weixin",
"scene": "WXSceneSession" "scene": "WXSceneSession"
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
}, },
{ {
"img": "/static/app-plus/sharemenu/wechatmoments.png", "img": "/static/app-plus/sharemenu/wechatmoments.png",
"text": this.$t('common').wechatBbs, "text": this.$t('common.wechatBbs'),
"share": { "share": {
"provider": "weixin", "provider": "weixin",
"scene": "WXSceneTimeline" "scene": "WXSceneTimeline"
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
}, },
{ {
"img": "/static/app-plus/sharemenu/mp_weixin.png", "img": "/static/app-plus/sharemenu/mp_weixin.png",
"text": this.$t('common').wechatApplet, "text": this.$t('common.wechatApplet'),
"share": { "share": {
provider: "weixin", provider: "weixin",
scene: "WXSceneSession", scene: "WXSceneSession",
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
}, },
{ {
"img": "/static/app-plus/sharemenu/weibo.png", "img": "/static/app-plus/sharemenu/weibo.png",
"text": this.$t('common').weibo, "text": this.$t('common.weibo'),
"share": { "share": {
"provider": "sinaweibo" "provider": "sinaweibo"
} }
...@@ -270,16 +270,16 @@ ...@@ -270,16 +270,16 @@
}, },
{ {
"img": "/static/app-plus/sharemenu/copyurl.png", "img": "/static/app-plus/sharemenu/copyurl.png",
"text": this.$t('common').copy, "text": this.$t('common.copy'),
"share": "copyurl" "share": "copyurl"
}, },
{ {
"img": "/static/app-plus/sharemenu/more.png", "img": "/static/app-plus/sharemenu/more.png",
"text": this.$t('common').more, "text": this.$t('common.more'),
"share": "shareSystem" "share": "shareSystem"
} }
], ],
cancelText: this.$t('common').cancelShare, cancelText: this.$t('common.cancelShare'),
}, e => { //callback }, e => { //callback
console.log(e); console.log(e);
}) })
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
</template> </template>
<script> <script>
var cdbRef, currentWebview; let cdbRef;
import statusBar from "@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-status-bar"; import statusBar from "@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-status-bar";
import Gps from '@/uni_modules/json-gps/js_sdk/gps.js'; import Gps from '@/uni_modules/json-gps/js_sdk/gps.js';
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
} }
} }
}, },
async onReady() { async onReady() {
// #ifdef APP-NVUE // #ifdef APP-NVUE
/* 可用窗口高度 - 搜索框高 - 状态栏高 */ /* 可用窗口高度 - 搜索框高 - 状态栏高 */
this.listHight = uni.getSystemInfoSync().windowHeight - uni.getSystemInfoSync().statusBarHeight - 50 + 'px'; this.listHight = uni.getSystemInfoSync().windowHeight - uni.getSystemInfoSync().statusBarHeight - 50 + 'px';
......
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
}, },
menus: [{ menus: [{
"img": "/static/app-plus/sharemenu/wechatfriend.png", "img": "/static/app-plus/sharemenu/wechatfriend.png",
"text": this.$t('common').wechatFriends, "text": this.$t('common.wechatFriends'),
"share": { "share": {
"provider": "weixin", "provider": "weixin",
"scene": "WXSceneSession" "scene": "WXSceneSession"
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
}, },
{ {
"img": "/static/app-plus/sharemenu/wechatmoments.png", "img": "/static/app-plus/sharemenu/wechatmoments.png",
"text": this.$t('common').wechatBbs, "text": this.$t('common.wechatBbs'),
"share": { "share": {
"provider": "weixin", "provider": "weixin",
"scene": "WXSceneTimeline" "scene": "WXSceneTimeline"
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
}, },
{ {
"img": "/static/app-plus/sharemenu/weibo.png", "img": "/static/app-plus/sharemenu/weibo.png",
"text": this.$t('common').weibo, "text": this.$t('common.weibo'),
"share": { "share": {
"provider": "sinaweibo" "provider": "sinaweibo"
} }
...@@ -106,16 +106,16 @@ ...@@ -106,16 +106,16 @@
}, },
{ {
"img": "/static/app-plus/sharemenu/copyurl.png", "img": "/static/app-plus/sharemenu/copyurl.png",
"text": this.$t('common').copy, "text": this.$t('common.copy'),
"share": "copyurl" "share": "copyurl"
}, },
{ {
"img": "/static/app-plus/sharemenu/more.png", "img": "/static/app-plus/sharemenu/more.png",
"text": this.$t('common').more, "text": this.$t('common.more'),
"share": "shareSystem" "share": "shareSystem"
} }
], ],
cancelText: this.$t('common').cancelShare, cancelText: this.$t('common.cancelShare'),
}, e => { //callback }, e => { //callback
console.log(e); console.log(e);
}) })
......
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
sendShortMsg() { sendShortMsg() {
if (!this.agree) { if (!this.agree) {
return uni.showToast({ return uni.showToast({
title: this.$t('common').noAgree, title: this.$t('common.noAgree'),
icon: 'none' icon: 'none'
}); });
} }
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
pwdLogin() { pwdLogin() {
if (!this.agree) { if (!this.agree) {
return uni.showToast({ return uni.showToast({
title: this.$t('common').noAgree, title: this.$t('common.noAgree'),
icon: 'none' icon: 'none'
}); });
} }
...@@ -84,10 +84,10 @@ ...@@ -84,10 +84,10 @@
// this.createCaptcha() // this.createCaptcha()
}else{ }else{
uni.showModal({ uni.showModal({
title: this.$t('common').error, title: this.$t('common.error'),
content: result.msg, content: result.msg,
showCancel: false, showCancel: false,
confirmText: this.$t('common').gotIt confirmText: this.$t('common.gotIt')
}); });
} }
} }
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<uni-captcha scene="register" v-model="formData.captcha"></uni-captcha> <uni-captcha scene="register" v-model="formData.captcha"></uni-captcha>
</uni-forms-item> </uni-forms-item>
<uni-agreements @setAgree="agree = $event"></uni-agreements> <uni-agreements @setAgree="agree = $event"></uni-agreements>
<button class="send-btn" type="primary" @click="submit">{{$t('register.registerAndLogin')}}</button> <button class="send-btn" :disabled="!canSubmit" :type="canSubmit?'primary':'default'" @click="submit">{{$t('register.registerAndLogin')}}</button>
</uni-forms> </uni-forms>
</view> </view>
</template> </template>
...@@ -34,12 +34,17 @@ import mixin from '../common/login-page.mixin.js'; ...@@ -34,12 +34,17 @@ import mixin from '../common/login-page.mixin.js';
"nickname": "", "nickname": "",
"password":"", "password":"",
"pwd2":"", "pwd2":"",
"captcha":false "captcha":""
}, },
rules, rules,
agree:false agree:false,
} }
}, },
computed:{
canSubmit(){
return this.formData.username.length && this.formData.password.length && this.formData.captcha.length == 4 && this.agree
}
},
onReady() { onReady() {
this.$refs.form.setRules(this.rules) this.$refs.form.setRules(this.rules)
}, },
...@@ -55,7 +60,7 @@ import mixin from '../common/login-page.mixin.js'; ...@@ -55,7 +60,7 @@ import mixin from '../common/login-page.mixin.js';
submit() { submit() {
if(!this.agree){ if(!this.agree){
return uni.showToast({ return uni.showToast({
title: this.$t('common').noAgree, title: this.$t('common.noAgree'),
icon: 'none' icon: 'none'
}); });
} }
......
...@@ -295,7 +295,7 @@ ...@@ -295,7 +295,7 @@
}, },
menus: [{ menus: [{
"img": "/static/app-plus/sharemenu/wechatfriend.png", "img": "/static/app-plus/sharemenu/wechatfriend.png",
"text": this.$t('common').wechatFriends, "text": this.$t('common.wechatFriends'),
"share": { "share": {
"provider": "weixin", "provider": "weixin",
"scene": "WXSceneSession" "scene": "WXSceneSession"
...@@ -303,7 +303,7 @@ ...@@ -303,7 +303,7 @@
}, },
{ {
"img": "/static/app-plus/sharemenu/wechatmoments.png", "img": "/static/app-plus/sharemenu/wechatmoments.png",
"text": this.$t('common').wechatBbs, "text": this.$t('common.wechatBbs'),
"share": { "share": {
"provider": "weixin", "provider": "weixin",
"scene": "WXSceneTimeline" "scene": "WXSceneTimeline"
...@@ -311,7 +311,7 @@ ...@@ -311,7 +311,7 @@
}, },
{ {
"img": "/static/app-plus/sharemenu/weibo.png", "img": "/static/app-plus/sharemenu/weibo.png",
"text": this.$t('common').weibo, "text": this.$t('common.weibo'),
"share": { "share": {
"provider": "sinaweibo" "provider": "sinaweibo"
} }
...@@ -325,16 +325,16 @@ ...@@ -325,16 +325,16 @@
}, },
{ {
"img": "/static/app-plus/sharemenu/copyurl.png", "img": "/static/app-plus/sharemenu/copyurl.png",
"text": this.$t('common').copy, "text": this.$t('common.copy'),
"share": "copyurl" "share": "copyurl"
}, },
{ {
"img": "/static/app-plus/sharemenu/more.png", "img": "/static/app-plus/sharemenu/more.png",
"text": this.$t('common').more, "text": this.$t('common.more'),
"share": "shareSystem" "share": "shareSystem"
} }
], ],
cancelText: this.$t('common').cancelShare, cancelText: this.$t('common.cancelShare'),
}, e => { //callback }, e => { //callback
console.log(e); console.log(e);
}) })
......
//这是应用的配置页面,App.vue挂载到getApp().globalData.config //这是应用的配置页面,App.vue挂载到getApp().globalData.config
export default { export default {
//是否打开调试模式
"debug":false,
"h5": { "h5": {
"url": "https://uni-starter.dcloud.net.cn", // 前端网页托管的域名 "url": "https://uni-starter.dcloud.net.cn", // 前端网页托管的域名
// 在h5端全局悬浮引导用户下载app的功能 更多自定义要求在/common/openApp.js中修改 // 在h5端全局悬浮引导用户下载app的功能 更多自定义要求在/common/openApp.js中修改
......
## 0.6.0(2022-05-27)
- 新增:支持在`uni-config-center`中根据场景值配置
- 修复:弹窗式验证码,输入内容后点击取消,重新打开验证码的值仍然存在的问题
## 0.5.2(2022-05-19) ## 0.5.2(2022-05-19)
- 修复在Vue3的兼容问题 - 修复在Vue3的兼容问题
## 0.5.1(2022-05-18) ## 0.5.1(2022-05-18)
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
scene: { scene: {
handler(scene) { handler(scene) {
if (scene) { if (scene) {
this.getImageCaptcha(false) this.getImageCaptcha(this.focus)
} else { } else {
uni.showToast({ uni.showToast({
title: 'scene不能为空', title: 'scene不能为空',
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<view class="popup-captcha"> <view class="popup-captcha">
<view class="content"> <view class="content">
<text class="title">{{title}}</text> <text class="title">{{title}}</text>
<uni-captcha :scene="scene" v-model="val"></uni-captcha> <uni-captcha :focus="focus" :scene="scene" v-model="val"></uni-captcha>
</view> </view>
<view class="button-box"> <view class="button-box">
<view @click="close" class="btn">取消</view> <view @click="close" class="btn">取消</view>
...@@ -15,6 +15,11 @@ ...@@ -15,6 +15,11 @@
<script> <script>
export default { export default {
data() {
return {
focus: false
}
},
props: { props: {
modelValue:String, modelValue:String,
value:String, value:String,
...@@ -51,14 +56,17 @@ ...@@ -51,14 +56,17 @@
} }
}, },
methods: { methods: {
open() { open() {
this.focus = true
this.val = ""
this.$refs.popup.open() this.$refs.popup.open()
}, },
close() { close() {
this.focus = false
this.$refs.popup.close() this.$refs.popup.close()
}, },
confirm() { confirm() {
if(this.val.length < 4){ if(!this.val||this.val.length < 4){
return uni.showToast({ return uni.showToast({
title: '请填写验证码', title: '请填写验证码',
icon: 'none' icon: 'none'
......
{ {
"id": "uni-captcha", "id": "uni-captcha",
"displayName": "uni-captcha", "displayName": "uni-captcha",
"version": "0.5.2", "version": "0.6.0",
"description": "云端一体图形验证码组件", "description": "云端一体图形验证码组件",
"keywords": [ "keywords": [
"uniCloud", "uniCloud",
......
...@@ -11,9 +11,9 @@ module.exports = { ...@@ -11,9 +11,9 @@ module.exports = {
}) { }) {
//获取设备id //获取设备id
let { let {
deviceId, deviceId,
platform platform
} = this.getClientInfo(); } = this.getClientInfo();
//根据:设备id、场景值、状态,查找记录是否存在 //根据:设备id、场景值、状态,查找记录是否存在
let res = await verifyCodes.where({ let res = await verifyCodes.where({
scene, scene,
...@@ -24,13 +24,9 @@ module.exports = { ...@@ -24,13 +24,9 @@ module.exports = {
let action = res.data.length ? 'refresh' : 'create' let action = res.data.length ? 'refresh' : 'create'
//执行并返回结果 //执行并返回结果
//导入配置,配置优先级说明:此处配置 > uni-config-center //导入配置,配置优先级说明:此处配置 > uni-config-center
const config = require('./config') return await uniCaptcha[action]({
return await uniCaptcha[action](Object.assign( scene, //来源客户端传递,表示:使用场景值,用于防止不同功能的验证码混用
config, // 配置优先级说明:此配置 > uni-config-center uniPlatform: platform
{ })
scene,//来源客户端传递,表示:使用场景值,用于防止不同功能的验证码混用
uniPlatform:platform
},
))
} }
} }
// 在本文件中可配置云数据库初始化,数据格式见:https://uniapp.dcloud.io/uniCloud/hellodb?id=db-init
// 编写完毕后对本文件点右键,可按配置规则创建表和添加数据
{
"opendb-verify-codes":{}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册