提交 001ce67b 编写于 作者: DCloud_JSON's avatar DCloud_JSON

新增绑定手机号码页面前端校验

上级 78a1788c
......@@ -5,36 +5,36 @@
globalData: {
searchText: '',
appVersion: {},
config:{}
config: {}
},
onLaunch: function() {
console.log('App Launch')
initApp();
// #ifdef APP-PLUS
//checkIsAgree(); APP端暂时先用原生默认生成的。目前,自定义方式启动vue界面时,原生层已经请求了部分权限这并不符合国家的法规
// #endif
// #ifdef H5
// checkIsAgree(); 默认不开启。目前全球,仅欧盟国家有网页端同意隐私权限的需要。如果需要
// #endif
// #ifdef H5
// checkIsAgree(); 默认不开启。目前全球,仅欧盟国家有网页端同意隐私权限的需要。如果需要
// #endif
// #ifdef APP-PLUS
//idfa有需要的用户在应用首次启动时自己获取存储到storage中
//https://ask.dcloud.net.cn/article/36107
/*if(~plus.storage.getItem('idfa')){
plus.device.getInfo({//需要勾选IDFA
success:function(e){
console.log('idfa = '+JSON.stringify(e.idfa));
},
fail:function(e){
console.log('getDeviceInfo failed: '+JSON.stringify(e));
}
});
}*/
//idfa有需要的用户在应用首次启动时自己获取存储到storage中
//https://ask.dcloud.net.cn/article/36107
/*if(~plus.storage.getItem('idfa')){
plus.device.getInfo({//需要勾选IDFA
success:function(e){
console.log('idfa = '+JSON.stringify(e.idfa));
},
fail:function(e){
console.log('getDeviceInfo failed: '+JSON.stringify(e));
}
});
}*/
// #endif
},
onShow: function() {
console.log('App Show')
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
......@@ -44,4 +44,4 @@
<style>
/*每个页面公共css */
</style>
</style>
......@@ -78,6 +78,9 @@ uni-starter + uniCloud admin,提供了用户端和管理端的基础模板,
"login": ["username","smsCode","univerify", "weixin", "apple"],
}
```
*** 注意:首页需要强制登陆才能访问的场景
- 这种情况不由路由控制。而是uni-starter的callFunction拦截器,根据响应体决定是否跳转到登陆页。
- uni-starter框架不能将登陆页面设置为首页,否则由拦截器实现的路由管理将生效。
#### 2.登录配置详解
- 使用方式:在 `uni-starter.config.js`->`router`->`login`下完全列举你需要的登录方式。这里支持用[条件编译](https://uniapp.dcloud.io/platform?id=%e6%9d%a1%e4%bb%b6%e7%bc%96%e8%af%91)因此你可以配置在不同平台下拥有的登录方式。
......
## 1.0.42(2021-07-29)
新增绑定手机号码页面前端校验
## 1.0.41(2021-07-27)
1. 支持vue3.0
2. 去掉App.vue全局样式,避免与非flex布局的页面样式冲突
......
......@@ -298,7 +298,8 @@ export default async function() {
visitor,
login
}
} = uniStarterConfig //需要登录的页面
} = uniStarterConfig //需要登录的页面
let list = ["navigateTo", "redirectTo", "reLaunch", "switchTab"];
list.forEach(item => { //用遍历的方式分别为,uni.navigateTo,uni.redirectTo,uni.reLaunch,uni.switchTab这4个路由方法添加拦截器
uni.addInterceptor(item, {
......@@ -310,7 +311,7 @@ export default async function() {
//获取要跳转的页面路径(url去掉"?"和"?"后的参数)
url = e.url.split('?')[0],
//获取要前往的页面路径(即url去掉"?"和"?"后的参数)
pages = getCurrentPages(),
pages = getCurrentPages(),
fromUrl = pages[pages.length - 1].route;
......@@ -341,7 +342,7 @@ export default async function() {
}
return url != item
})
console.log({pass})
// console.log({pass})
}
if (visitor&&!inLoginPage) {
pass = visitor.some((item) => {
......@@ -350,7 +351,7 @@ export default async function() {
}
return url == item
})
console.log({pass})
// console.log({pass})
}
if (!pass && (token == '' || tokenExpired)) {
......@@ -377,7 +378,8 @@ export default async function() {
}
}
})
})
})
// #ifdef APP-PLUS
// 监听并提示设备网络状态变化
uni.onNetworkStatusChange(res => {
......
import App from './App'
import store from './store'
import App from './App'
import store from './store'
// #ifndef VUE3
import Vue from 'vue'
Vue.config.productionTip = false
Vue.prototype.$store = store
App.mpType = 'app'
const app = new Vue({
store,
...App
})
app.$mount()
// #endif
// #ifndef VUE3
import Vue from 'vue'
Vue.config.productionTip = false
Vue.prototype.$store = store
App.mpType = 'app'
const app = new Vue({
store,
...App
})
app.$mount()
// #endif
// #ifdef VUE3
import { createApp } from 'vue'
const app = createApp(App,{})
app.use(store)
app.mount('#app')
// #endif
\ No newline at end of file
// #ifdef VUE3
import {
createSSRApp
} from 'vue'
export function createApp() {
const app = createSSRApp(App)
app.use(store)
return {app}
}
// #endif
{
"id": "uni-starter",
"displayName": "uni-starter",
"version": "1.0.41",
"version": "1.0.42",
"description": "云端一体应用快速开发基本项目模版",
"keywords": [
"login",
......
......@@ -158,8 +158,8 @@
}
}, {
"path": "pages/ucenter/invite/invite",
"style": {
"navigationStyle":"custom",
"style": {
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
......
......@@ -2,21 +2,26 @@
<view class="warp">
<!-- #ifdef APP-PLUS -->
<status-bar />
<!-- #endif -->
<!-- banner -->
<unicloud-db ref="bannerdb" v-slot:default="{data, loading, error, options}" collection="opendb-banner"
field="_id,bannerfile,open_url,title" @load="load">
<uni-swiper-dot class="uni-swiper-dot-box" @clickItem="clickItem" :info="data || bannerFormate(data, loading)"
:current="current" field="content">
<swiper class="swiper-box" @change="changeSwiper" :current="swiperDotIndex">
<swiper-item v-for="(item, index) in (data || bannerFormate(data, loading))" :key="item._id">
<view :draggable="false" class="swiper-item" @click="clickBannerItem(item)">
<image class="swiper-image" :src="item.bannerfile.url" mode="aspectFill" :draggable="false" />
</view>
</swiper-item>
</swiper>
</uni-swiper-dot>
</unicloud-db>
<!-- #endif -->
<!-- banner -->
<unicloud-db ref="bannerdb" v-slot:default="{data, loading, error, options}" collection="opendb-banner"
field="_id,bannerfile,open_url,title" @load="onqueryload">
<!-- 当无banner数据时显示占位图 -->
<image v-if="!(loading||data.length)" class="banner-image" src="/static/grid/empty.png" mode="aspectFill" :draggable="false" />
<uni-swiper-dot v-else class="uni-swiper-dot-box" @clickItem="clickItem" :info="data"
:current="current" field="content">
<swiper class="swiper-box" @change="changeSwiper" :current="swiperDotIndex">
<swiper-item v-for="(item, index) in data" :key="item._id">
<view class="swiper-item" @click="clickBannerItem(item)">
<image class="banner-image" :src="item.bannerfile.url" mode="aspectFill" :draggable="false" />
</view>
</swiper-item>
</swiper>
</uni-swiper-dot>
</unicloud-db>
<!-- 宫格 -->
<uni-section title="宫格组件" style="margin: 0;" type="line"></uni-section>
<view class="example-body">
......@@ -67,8 +72,7 @@
/**
* banner加载后触发的回调
*/
load(data) {
onqueryload(data) {
},
changeSwiper(e) {
this.current = e.detail.current
......@@ -90,21 +94,6 @@
});
}
// 其余业务处理
},
/**
* banner数据过滤
*/
bannerFormate(bannerList, loading) {
if (loading) return [];
if (bannerList.length > 0) return bannerList;
// 无数据添加默认值
let list = [{
"_id": -1,
"bannerfile": "/static/grid/empty.png",
"open_url": "https://www.dcloud.io/",
"title": "内容 A",
}]
return list;
}
}
}
......@@ -176,7 +165,7 @@
padding: 15px 0;
}
.swiper-image {
.banner-image {
width: 750rpx;
height: 400rpx;
}
......
......@@ -8,7 +8,6 @@
<uni-search-bar class="uni-search-box" v-model="keyword" ref="searchBar" radius="100"
cancelButton="none" />
</view>
<unicloud-db ref='udb' v-slot:default="{data,pagination,hasMore, loading, error, options}" @error="onqueryerror"
:where="where" collection="opendb-news-articles,uni-id-users" :page-size="10"
field="avatar,title,last_modify_date,user_id.username">
......
<template>
<view class="center">
<uni-sign-in ref="signIn"></uni-sign-in>
<view class="userInfo" @click.capture="toUserInfo">
<view class="userInfo" @click.capture="toUserInfo">
<uni-file-picker v-if="userInfo.avatar_file&&userInfo.avatar_file.url" v-model="userInfo.avatar_file"
fileMediatype="image" :del-icon="false" return-type="object" :image-styles="listStyles" disablePreview
disabled />
......
......@@ -9,7 +9,7 @@
<uni-send-sms-code ref="shortCode" code-type="bind" :phone="formData.phone"></uni-send-sms-code>
</template>
</uni-easyinput>
<button class="send-btn-box" type="primary" @click="submit">提交</button>
<button class="send-btn-box" :disabled="!canSubmit" :type="canSubmit?'primary':'default'" @click="submit">提交</button>
</view>
</template>
<script>
......@@ -32,7 +32,7 @@
return `验证码已通过短信发送至${this.currenPhoneArea} ${this.formData.phone}。密码为6 - 20位`
},
canSubmit() {
return this.isPhone && this.isPwd && this.isCode;
return true//this.isPhone() && this.isCode();
}
},
onLoad(event) {
......@@ -69,6 +69,16 @@
}
}
})
},
isPhone() {
let reg_phone = /^1\d{10}$/;
let isPhone = reg_phone.test(this.formData.phone);
return isPhone;
},
isCode() {
let reg_code = /^\d{6}$/;
let isCode = reg_code.test(this.formData.code);
return isCode;
}
}
}
......
......@@ -12,8 +12,8 @@
</uni-list-item>
<uni-list-item class="item" @click="setNickname('')" title="昵称" :rightText="userInfo.nickname||'未设置'" link>
</uni-list-item>
<uni-list-item class="item" @click="bindMobile" title="手机号" :rightText="userInfo.mobile||'未绑定'" link>
</uni-list-item>
<uni-list-item class="item" @click="bindMobileBySmsCode" title="手机号" :rightText="userInfo.mobile||'未绑定'" link>
</uni-list-item>
</uni-list>
<uni-popup ref="dialog" type="dialog">
<uni-popup-dialog mode="input" :value="userInfo.nickname" @confirm="setNickname" title="设置昵称"
......@@ -63,7 +63,7 @@
}
}
},
methods: {
methods: {
...mapMutations({
setUserInfo: 'user/login'
}),
......
......@@ -10,7 +10,7 @@ class Gps {
}) {
return new Promise(async (callback) => {
if (this.lock) {
console.log('已锁,已有另一个请求正在执行。无需重复请求');
// console.log('已锁,已有另一个请求正在执行。无需重复请求');
callback(false);
return false
}
......
## 1.1.4(2021-07-29)
- 修复 去掉 nvue 不支持css 的 align-self 属性,nvue 下不暂支持 absolute 属性
## 1.1.3(2021-06-24)
- 优化 示例项目
## 1.1.1(2021-05-12)
- 新增 组件示例地址
## 1.1.0(2021-05-12)
- 新增 uni-badge 的 absolute 属性,支持定位
- 新增 uni-badge 的 offset 属性,支持定位偏移
- 新增 uni-badge 的 is-dot 属性,支持仅显示有一个小点
- 新增 uni-badge 的 max-num 属性,支持自定义封顶的数字值,超过 99 显示99+
- 优化 uni-badge 属性 custom-style, 支持以对象形式自定义样式
## 1.0.7(2021-05-07)
- 修复 uni-badge 在 App 端,数字小于10时不是圆形的bug
- 修复 uni-badge 在父元素不是 flex 布局时,宽度缩小的bug
- 新增 uni-badge 属性 custom-style, 支持自定义样式
## 1.0.6(2021-02-04)
- 调整为uni_modules目录规范
## 1.1.1(2021-05-12)
- 新增 组件示例地址
## 1.1.0(2021-05-12)
- 新增 uni-badge 的 absolute 属性,支持定位
- 新增 uni-badge 的 offset 属性,支持定位偏移
- 新增 uni-badge 的 is-dot 属性,支持仅显示有一个小点
- 新增 uni-badge 的 max-num 属性,支持自定义封顶的数字值,超过 99 显示99+
- 优化 uni-badge 属性 custom-style, 支持以对象形式自定义样式
## 1.0.7(2021-05-07)
- 修复 uni-badge 在 App 端,数字小于10时不是圆形的bug
- 修复 uni-badge 在父元素不是 flex 布局时,宽度缩小的bug
- 新增 uni-badge 属性 custom-style, 支持自定义样式
## 1.0.6(2021-02-04)
- 调整为uni_modules目录规范
......@@ -155,9 +155,6 @@
$bage-height: 20px;
.uni-badge--x {
/* #ifdef APP-NVUE */
align-self: flex-start;
/* #endif */
/* #ifndef APP-NVUE */
display: inline-block;
/* #endif */
......
{
"id": "uni-badge",
"displayName": "uni-badge 数字角标",
"version": "1.1.3",
"description": "数字角标(徽章)组件,在元素周围展示消息提醒,一般用于列表、九宫格、按钮等地方。",
"keywords": [
"",
"badge",
"uni-ui",
"uniui",
"数字角标",
"徽章"
],
"repository": "https://github.com/dcloudio/uni-ui",
"engines": {
"HBuilderX": ""
},
"directories": {
"example": "../../temps/example"
},
"dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"App": {
"app-vue": "y",
"app-nvue": "y"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "y",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "y",
"阿里": "y",
"百度": "y",
"字节跳动": "y",
"QQ": "y"
},
"快应用": {
"华为": "y",
"联盟": "y"
}
}
}
}
{
"id": "uni-badge",
"displayName": "uni-badge 数字角标",
"version": "1.1.4",
"description": "数字角标(徽章)组件,在元素周围展示消息提醒,一般用于列表、九宫格、按钮等地方。",
"keywords": [
"",
"badge",
"uni-ui",
"uniui",
"数字角标",
"徽章"
],
"repository": "https://github.com/dcloudio/uni-ui",
"engines": {
"HBuilderX": ""
},
"directories": {
"example": "../../temps/example_temps"
},
"dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"App": {
"app-vue": "y",
"app-nvue": "y"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "y",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "y",
"阿里": "y",
"百度": "y",
"字节跳动": "y",
"QQ": "y"
},
"快应用": {
"华为": "y",
"联盟": "y"
}
}
}
}
}
\ No newline at end of file
......@@ -41,7 +41,7 @@
|max-num |String/Numbuer|99 |展示封顶的数字值,超过 99 显示99+ |
|custom-style |Object | {} |自定义 Badge 样式, 样式对象语法 |
|inverted |Boolean|false |是否无需背景颜色,为 true 时,背景颜色将变为文字的字体颜色 |
|absolute |String| rightTop|开启绝对定位, 角标将定位到其包裹的标签的四个角上,可选值: rightTop(右上角)、rightBottom(右下角)、leftBottom(左下角) 、leftTop(左上角) |
|absolute (不支持 nvue) |String| rightTop|开启绝对定位, 角标将定位到其包裹的标签的四个角上,可选值: rightTop(右上角)、rightBottom(右下角)、leftBottom(左下角) 、leftTop(左上角) |
|offset |Array[number]| [0, 0]|距定位角中心点的偏移量,[-10, -10] 表示向 absolute 指定的方向偏移 10px,[10, 10] 表示向 absolute 指定的反方向偏移 10px,只有存在 absolute 属性时有效,与absolute 的值一一对应(例如:值为rightTop, 对应 offset 为 [right, Top])|
### Badge Events
......
......@@ -151,11 +151,6 @@ exports.main = async (event, context) => {
}
break;
case 'bindMobileBySms':
// console.log({
// uid: params.uid,
// mobile: params.mobile,
// code: params.code
// });
res = await uniID.bindMobile({
uid: params.uid,
mobile: params.mobile,
......
......@@ -162,7 +162,8 @@ export default {
default: true
}
},
// inject: ['list'],
// inject: ['list'],
emits:['click'],
data() {
return {
isFirstChild: false
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册