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

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

上级 78a1788c
......@@ -5,7 +5,7 @@
globalData: {
searchText: '',
appVersion: {},
config:{}
config: {}
},
onLaunch: function() {
console.log('App Launch')
......
......@@ -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布局的页面样式冲突
......
......@@ -299,6 +299,7 @@ export default async function() {
login
}
} = uniStarterConfig //需要登录的页面
let list = ["navigateTo", "redirectTo", "reLaunch", "switchTab"];
list.forEach(item => { //用遍历的方式分别为,uni.navigateTo,uni.redirectTo,uni.reLaunch,uni.switchTab这4个路由方法添加拦截器
uni.addInterceptor(item, {
......@@ -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)) {
......@@ -378,6 +379,7 @@ export default async function() {
}
})
})
// #ifdef APP-PLUS
// 监听并提示设备网络状态变化
uni.onNetworkStatusChange(res => {
......
import App from './App'
import store from './store'
// #ifndef VUE3
import Vue from 'vue'
Vue.config.productionTip = false
......@@ -13,9 +14,15 @@ const app = new Vue({
app.$mount()
// #endif
// #ifdef VUE3
import { createApp } from 'vue'
const app = createApp(App,{})
app.use(store)
app.mount('#app')
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",
......
......@@ -159,7 +159,7 @@
}, {
"path": "pages/ucenter/invite/invite",
"style": {
"navigationStyle":"custom",
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
......
......@@ -3,20 +3,25 @@
<!-- #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)"
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 || 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" />
<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">
......
......@@ -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,7 +12,7 @@
</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 class="item" @click="bindMobileBySmsCode" title="手机号" :rightText="userInfo.mobile||'未绑定'" link>
</uni-list-item>
</uni-list>
<uni-popup ref="dialog" type="dialog">
......
......@@ -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)
......
......@@ -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",
"version": "1.1.4",
"description": "数字角标(徽章)组件,在元素周围展示消息提醒,一般用于列表、九宫格、按钮等地方。",
"keywords": [
"",
......@@ -16,7 +16,7 @@
"HBuilderX": ""
},
"directories": {
"example": "../../temps/example"
"example": "../../temps/example_temps"
},
"dcloudext": {
"category": [
......
......@@ -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,
......
......@@ -163,6 +163,7 @@ export default {
}
},
// 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.
先完成此消息的编辑!
想要评论请 注册