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

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

上级 78a1788c
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
globalData: { globalData: {
searchText: '', searchText: '',
appVersion: {}, appVersion: {},
config:{} config: {}
}, },
onLaunch: function() { onLaunch: function() {
console.log('App Launch') console.log('App Launch')
......
...@@ -78,6 +78,9 @@ uni-starter + uniCloud admin,提供了用户端和管理端的基础模板, ...@@ -78,6 +78,9 @@ uni-starter + uniCloud admin,提供了用户端和管理端的基础模板,
"login": ["username","smsCode","univerify", "weixin", "apple"], "login": ["username","smsCode","univerify", "weixin", "apple"],
} }
``` ```
*** 注意:首页需要强制登陆才能访问的场景
- 这种情况不由路由控制。而是uni-starter的callFunction拦截器,根据响应体决定是否跳转到登陆页。
- uni-starter框架不能将登陆页面设置为首页,否则由拦截器实现的路由管理将生效。
#### 2.登录配置详解 #### 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)因此你可以配置在不同平台下拥有的登录方式。 - 使用方式:在 `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.0.41(2021-07-27)
1. 支持vue3.0 1. 支持vue3.0
2. 去掉App.vue全局样式,避免与非flex布局的页面样式冲突 2. 去掉App.vue全局样式,避免与非flex布局的页面样式冲突
......
...@@ -299,6 +299,7 @@ export default async function() { ...@@ -299,6 +299,7 @@ export default async function() {
login login
} }
} = uniStarterConfig //需要登录的页面 } = uniStarterConfig //需要登录的页面
let list = ["navigateTo", "redirectTo", "reLaunch", "switchTab"]; let list = ["navigateTo", "redirectTo", "reLaunch", "switchTab"];
list.forEach(item => { //用遍历的方式分别为,uni.navigateTo,uni.redirectTo,uni.reLaunch,uni.switchTab这4个路由方法添加拦截器 list.forEach(item => { //用遍历的方式分别为,uni.navigateTo,uni.redirectTo,uni.reLaunch,uni.switchTab这4个路由方法添加拦截器
uni.addInterceptor(item, { uni.addInterceptor(item, {
...@@ -341,7 +342,7 @@ export default async function() { ...@@ -341,7 +342,7 @@ export default async function() {
} }
return url != item return url != item
}) })
console.log({pass}) // console.log({pass})
} }
if (visitor&&!inLoginPage) { if (visitor&&!inLoginPage) {
pass = visitor.some((item) => { pass = visitor.some((item) => {
...@@ -350,7 +351,7 @@ export default async function() { ...@@ -350,7 +351,7 @@ export default async function() {
} }
return url == item return url == item
}) })
console.log({pass}) // console.log({pass})
} }
if (!pass && (token == '' || tokenExpired)) { if (!pass && (token == '' || tokenExpired)) {
...@@ -378,6 +379,7 @@ export default async function() { ...@@ -378,6 +379,7 @@ export default async function() {
} }
}) })
}) })
// #ifdef APP-PLUS // #ifdef APP-PLUS
// 监听并提示设备网络状态变化 // 监听并提示设备网络状态变化
uni.onNetworkStatusChange(res => { uni.onNetworkStatusChange(res => {
......
import App from './App' import App from './App'
import store from './store' import store from './store'
// #ifndef VUE3 // #ifndef VUE3
import Vue from 'vue' import Vue from 'vue'
Vue.config.productionTip = false Vue.config.productionTip = false
...@@ -13,9 +14,15 @@ const app = new Vue({ ...@@ -13,9 +14,15 @@ const app = new Vue({
app.$mount() app.$mount()
// #endif // #endif
// #ifdef VUE3 // #ifdef VUE3
import { createApp } from 'vue' import {
const app = createApp(App,{}) createSSRApp
app.use(store) } from 'vue'
app.mount('#app')
export function createApp() {
const app = createSSRApp(App)
app.use(store)
return {app}
}
// #endif // #endif
{ {
"id": "uni-starter", "id": "uni-starter",
"displayName": "uni-starter", "displayName": "uni-starter",
"version": "1.0.41", "version": "1.0.42",
"description": "云端一体应用快速开发基本项目模版", "description": "云端一体应用快速开发基本项目模版",
"keywords": [ "keywords": [
"login", "login",
......
...@@ -159,7 +159,7 @@ ...@@ -159,7 +159,7 @@
}, { }, {
"path": "pages/ucenter/invite/invite", "path": "pages/ucenter/invite/invite",
"style": { "style": {
"navigationStyle":"custom", "navigationStyle": "custom",
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
......
...@@ -3,20 +3,25 @@ ...@@ -3,20 +3,25 @@
<!-- #ifdef APP-PLUS --> <!-- #ifdef APP-PLUS -->
<status-bar /> <status-bar />
<!-- #endif --> <!-- #endif -->
<!-- banner --> <!-- banner -->
<unicloud-db ref="bannerdb" v-slot:default="{data, loading, error, options}" collection="opendb-banner" <unicloud-db ref="bannerdb" v-slot:default="{data, loading, error, options}" collection="opendb-banner"
field="_id,bannerfile,open_url,title" @load="load"> field="_id,bannerfile,open_url,title" @load="onqueryload">
<uni-swiper-dot class="uni-swiper-dot-box" @clickItem="clickItem" :info="data || bannerFormate(data, loading)" <!-- 当无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"> :current="current" field="content">
<swiper class="swiper-box" @change="changeSwiper" :current="swiperDotIndex"> <swiper class="swiper-box" @change="changeSwiper" :current="swiperDotIndex">
<swiper-item v-for="(item, index) in (data || bannerFormate(data, loading))" :key="item._id"> <swiper-item v-for="(item, index) in data" :key="item._id">
<view :draggable="false" class="swiper-item" @click="clickBannerItem(item)"> <view class="swiper-item" @click="clickBannerItem(item)">
<image class="swiper-image" :src="item.bannerfile.url" mode="aspectFill" :draggable="false" /> <image class="banner-image" :src="item.bannerfile.url" mode="aspectFill" :draggable="false" />
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>
</uni-swiper-dot> </uni-swiper-dot>
</unicloud-db> </unicloud-db>
<!-- 宫格 --> <!-- 宫格 -->
<uni-section title="宫格组件" style="margin: 0;" type="line"></uni-section> <uni-section title="宫格组件" style="margin: 0;" type="line"></uni-section>
<view class="example-body"> <view class="example-body">
...@@ -67,8 +72,7 @@ ...@@ -67,8 +72,7 @@
/** /**
* banner加载后触发的回调 * banner加载后触发的回调
*/ */
load(data) { onqueryload(data) {
}, },
changeSwiper(e) { changeSwiper(e) {
this.current = e.detail.current this.current = e.detail.current
...@@ -90,21 +94,6 @@ ...@@ -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 @@ ...@@ -176,7 +165,7 @@
padding: 15px 0; padding: 15px 0;
} }
.swiper-image { .banner-image {
width: 750rpx; width: 750rpx;
height: 400rpx; height: 400rpx;
} }
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
<uni-search-bar class="uni-search-box" v-model="keyword" ref="searchBar" radius="100" <uni-search-bar class="uni-search-box" v-model="keyword" ref="searchBar" radius="100"
cancelButton="none" /> cancelButton="none" />
</view> </view>
<unicloud-db ref='udb' v-slot:default="{data,pagination,hasMore, loading, error, options}" @error="onqueryerror" <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" :where="where" collection="opendb-news-articles,uni-id-users" :page-size="10"
field="avatar,title,last_modify_date,user_id.username"> field="avatar,title,last_modify_date,user_id.username">
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<uni-send-sms-code ref="shortCode" code-type="bind" :phone="formData.phone"></uni-send-sms-code> <uni-send-sms-code ref="shortCode" code-type="bind" :phone="formData.phone"></uni-send-sms-code>
</template> </template>
</uni-easyinput> </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> </view>
</template> </template>
<script> <script>
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
return `验证码已通过短信发送至${this.currenPhoneArea} ${this.formData.phone}。密码为6 - 20位` return `验证码已通过短信发送至${this.currenPhoneArea} ${this.formData.phone}。密码为6 - 20位`
}, },
canSubmit() { canSubmit() {
return this.isPhone && this.isPwd && this.isCode; return true//this.isPhone() && this.isCode();
} }
}, },
onLoad(event) { onLoad(event) {
...@@ -69,6 +69,16 @@ ...@@ -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 @@ ...@@ -12,7 +12,7 @@
</uni-list-item> </uni-list-item>
<uni-list-item class="item" @click="setNickname('')" title="昵称" :rightText="userInfo.nickname||'未设置'" link> <uni-list-item class="item" @click="setNickname('')" title="昵称" :rightText="userInfo.nickname||'未设置'" link>
</uni-list-item> </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-item>
</uni-list> </uni-list>
<uni-popup ref="dialog" type="dialog"> <uni-popup ref="dialog" type="dialog">
......
...@@ -10,7 +10,7 @@ class Gps { ...@@ -10,7 +10,7 @@ class Gps {
}) { }) {
return new Promise(async (callback) => { return new Promise(async (callback) => {
if (this.lock) { if (this.lock) {
console.log('已锁,已有另一个请求正在执行。无需重复请求'); // console.log('已锁,已有另一个请求正在执行。无需重复请求');
callback(false); callback(false);
return false return false
} }
......
## 1.1.4(2021-07-29)
- 修复 去掉 nvue 不支持css 的 align-self 属性,nvue 下不暂支持 absolute 属性
## 1.1.3(2021-06-24) ## 1.1.3(2021-06-24)
- 优化 示例项目 - 优化 示例项目
## 1.1.1(2021-05-12) ## 1.1.1(2021-05-12)
......
...@@ -155,9 +155,6 @@ ...@@ -155,9 +155,6 @@
$bage-height: 20px; $bage-height: 20px;
.uni-badge--x { .uni-badge--x {
/* #ifdef APP-NVUE */
align-self: flex-start;
/* #endif */
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: inline-block; display: inline-block;
/* #endif */ /* #endif */
......
{ {
"id": "uni-badge", "id": "uni-badge",
"displayName": "uni-badge 数字角标", "displayName": "uni-badge 数字角标",
"version": "1.1.3", "version": "1.1.4",
"description": "数字角标(徽章)组件,在元素周围展示消息提醒,一般用于列表、九宫格、按钮等地方。", "description": "数字角标(徽章)组件,在元素周围展示消息提醒,一般用于列表、九宫格、按钮等地方。",
"keywords": [ "keywords": [
"", "",
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
"HBuilderX": "" "HBuilderX": ""
}, },
"directories": { "directories": {
"example": "../../temps/example" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [ "category": [
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
|max-num |String/Numbuer|99 |展示封顶的数字值,超过 99 显示99+ | |max-num |String/Numbuer|99 |展示封顶的数字值,超过 99 显示99+ |
|custom-style |Object | {} |自定义 Badge 样式, 样式对象语法 | |custom-style |Object | {} |自定义 Badge 样式, 样式对象语法 |
|inverted |Boolean|false |是否无需背景颜色,为 true 时,背景颜色将变为文字的字体颜色 | |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])| |offset |Array[number]| [0, 0]|距定位角中心点的偏移量,[-10, -10] 表示向 absolute 指定的方向偏移 10px,[10, 10] 表示向 absolute 指定的反方向偏移 10px,只有存在 absolute 属性时有效,与absolute 的值一一对应(例如:值为rightTop, 对应 offset 为 [right, Top])|
### Badge Events ### Badge Events
......
...@@ -151,11 +151,6 @@ exports.main = async (event, context) => { ...@@ -151,11 +151,6 @@ exports.main = async (event, context) => {
} }
break; break;
case 'bindMobileBySms': case 'bindMobileBySms':
// console.log({
// uid: params.uid,
// mobile: params.mobile,
// code: params.code
// });
res = await uniID.bindMobile({ res = await uniID.bindMobile({
uid: params.uid, uid: params.uid,
mobile: params.mobile, mobile: params.mobile,
......
...@@ -163,6 +163,7 @@ export default { ...@@ -163,6 +163,7 @@ export default {
} }
}, },
// inject: ['list'], // inject: ['list'],
emits:['click'],
data() { data() {
return { return {
isFirstChild: false isFirstChild: false
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册