Commit 249bed34 by zhangquan

dev:注册成功页面开发

1 parent 9b6ff7ee
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
"pages/tab/mine/mine", "pages/tab/mine/mine",
"pages/webView/webView", "pages/webView/webView",
"pages/login/login/login", "pages/login/login/login",
"pages/login/register/register" "pages/login/register/register",
"pages/login/registerSuccess/registerSuccess"
], ],
"requiredPrivateInfos": [ "requiredPrivateInfos": [
"getLocation" "getLocation"
......
.container{ .container{
height: 100vh; height: 100vh;
background-color: #fff; background-color: #fff;
display: flex;
flex-direction: column;
.salutation-wrap{ .salutation-wrap{
padding: 112rpx 96rpx 0; padding: 112rpx 96rpx 0;
flex: 1;
.salutation{ .salutation{
height: 88rpx; height: 88rpx;
line-height: 88rpx; line-height: 88rpx;
...@@ -23,18 +26,16 @@ ...@@ -23,18 +26,16 @@
} }
} }
.footer{ .footer{
top: 544rpx;
width: 100%; width: 100%;
position: fixed; height: 850rpx;
background-size: 100% 100%; background-size: 100% 100%;
bottom: 0;
.login-wrap{ .login-wrap{
width: 100%; width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
flex-wrap: nowrap; flex-wrap: nowrap;
margin-top: 528rpx; margin-top: 500rpx;
.login-btn{ .login-btn{
width: 590rpx; width: 590rpx;
height: 88rpx; height: 88rpx;
......
...@@ -5,7 +5,7 @@ Page({ ...@@ -5,7 +5,7 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
padHeight:0
}, },
/** /**
...@@ -23,9 +23,26 @@ Page({ ...@@ -23,9 +23,26 @@ Page({
}, },
inputBindFocus(e){ inputBindFocus(e){
console.log(e.detail.height,2222,888) if(this.data.padHeight) return;
this.setData({
padHeight: e.detail.height
})
this.pageScrollToBottom()
},
inputBindBlur(){
this.setData({
padHeight: 0
})
},
pageScrollToBottom() {
wx.createSelectorQuery().select('.container').boundingClientRect(function(rect) {
// 使页面滚动到底部
wx.pageScrollTo({
scrollTop: rect.height
})
}).exec()
}, },
login(){ handleLogin(){
console.log(111) console.log(111)
}, },
/** /**
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
color: #333333; color: #333333;
} }
.login-input-wrap{ .login-input-wrap{
margin-top: 486rpx !important; margin-top: 450rpx !important;
.phone, .code{ .phone, .code{
background-color: #fff; background-color: #fff;
display: flex; display: flex;
...@@ -29,11 +29,10 @@ ...@@ -29,11 +29,10 @@
height: 52rpx; height: 52rpx;
line-height: 52rpx; line-height: 52rpx;
text-align: center; text-align: center;
opacity: 0.2;
background: #F1F1F1; background: #F1F1F1;
border-radius: 28rpx; border-radius: 28rpx;
font-size: 24rpx; font-size: 24rpx;
color: #707070; color: #666666;
} }
.placeholderClass,.placeholder{ .placeholderClass,.placeholder{
color: #BCBCBC; color: #BCBCBC;
......
<!--pages/login.wxml--> <!--pages/login.wxml-->
<view class="container"> <view class="container" style="padding-bottom: {{padHeight}}px;">
<view class="salutation-wrap"> <view class="salutation-wrap">
<view class="salutation">您好</view> <view class="salutation">您好</view>
<view class="welcome">欢迎登录门店助手</view> <view class="welcome">欢迎登录门店助手</view>
...@@ -11,13 +11,13 @@ ...@@ -11,13 +11,13 @@
</view> --> </view> -->
<view class="login-wrap login-input-wrap"> <view class="login-wrap login-input-wrap">
<view class="login-btn phone"> <view class="login-btn phone">
<input adjust-position="{{false}}" bindfocus="inputBindFocus" placeholder-class="placeholderClass" placeholder="请输入手机号码"/> <input maxlength="{{11}}" adjust-position="{{false}}" bindfocus="inputBindFocus" bindblur="inputBindBlur" placeholder-class="placeholderClass" placeholder="请输入手机号码"/>
</view> </view>
<view class="login-btn code"> <view class="login-btn code">
<input placeholder-class="placeholder" placeholder="请输入验证码"/> <input adjust-position="{{false}}" bindfocus="inputBindFocus" bindblur="inputBindBlur" placeholder-class="placeholder" placeholder="请输入验证码"/>
<view class="code-btn">获取验证码</view> <view class="code-btn">获取验证码</view>
</view> </view>
<view class="login-btn wx-btn" bindtap="login">登录</view> <view class="login-btn wx-btn" bindtap="handleLogin">登录</view>
</view> </view>
</view> </view>
<popup show="{{false}}" confirmText="联系客服" title="提示" height="560rpx"> <popup show="{{false}}" confirmText="联系客服" title="提示" height="560rpx">
......
...@@ -8,6 +8,13 @@ Page({ ...@@ -8,6 +8,13 @@ Page({
}, },
toRegister(){
wx.$router.go('/pages/login/registerSuccess/registerSuccess',{type:0})
},
toLoginPage(){
wx.$router.reLaunch('/pages/login/login/login')
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
</view> </view>
<view class="footer" style="background-image: url('{{IMGURL}}register.png');"> <view class="footer" style="background-image: url('{{IMGURL}}register.png');">
<view class="login-wrap"> <view class="login-wrap">
<view class="wx-btn login-btn">微信授权一键注册</view> <view class="wx-btn login-btn" bindtap="toRegister">微信授权一键注册</view>
<view class="phone-btn login-btn">已有账号,返回登录</view> <view class="phone-btn login-btn" bindtap="toLoginPage">已有账号,返回登录</view>
</view> </view>
</view> </view>
</view> </view>
// pages/login/registerSuccess/registerSuccess.js
Page({
/**
* 页面的初始数据
*/
data: {
type: 1,
time: 5,
interval:null
},
onRoute(options){
console.log(options,111)
this.setData({
type: options.type
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.data.interval = setInterval(() => {
if(this.data.time>1){
let time = this.data.time -1
this.setData({
time
})
}else{
this.goLogin()
}
console.log(this.data.interval,888)
},1000)
},
goLogin(){
wx.$router.reLaunch('/pages/login/login/login')
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
clearInterval(this.data.interval)
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file \ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* pages/login/registerSuccess/registerSuccess.wxss */
.container{
display: flex;
background-color: #fff;
flex-direction: column;
align-items: center;
padding: 64rpx 0;
height: 100vh;
box-sizing: border-box;
}
.title{
font-weight: 600;
font-size: 40rpx;
color: #1B233D;
text-align: center;
margin: 16rpx 0 24rpx;
}
.content{
font-weight: 400;
font-size: 28rpx;
color: #7A8299;
}
.back{
width: 316rpx;
height: 88rpx;
background-image: linear-gradient(-60deg, #556AF5 0%, #7197FF 100%);
border-radius: 20rpx;
line-height: 88rpx;
font-weight: 500;
font-size: 32rpx;
text-align: center;
color: #FFFFFF;
letter-spacing: 0;
margin: 120rpx 0 24rpx;
}
.tip{
font-weight: 400;
font-size: 28rpx;
color: #999999;
}
\ No newline at end of file \ No newline at end of file
<!--pages/login/registerSuccess/registerSuccess.wxml-->
<view class="container">
<image style="width: 400rpx;height: 400rpx;" src="{{IMGURL}}register_success.png"></image>
<view class="title">{{type==1? '注册成功' : '已注册'}}</view>
<view class="content">{{type==1? '您的信息已注册成功,请前往登录':'您的信息已注册过账号,可直接前往登录'}}</view>
<view class="back" bindtap="goLogin">返回登录</view>
<view class="tip">{{time}}S后自动跳转</view>
</view>
...@@ -76,6 +76,13 @@ ...@@ -76,6 +76,13 @@
"query": "", "query": "",
"launchMode": "default", "launchMode": "default",
"scene": null "scene": null
},
{
"name": "",
"pathName": "pages/login/registerSuccess/registerSuccess",
"query": "",
"launchMode": "default",
"scene": null
} }
] ]
} }
......
const _routeHooks = Symbol('_routeHooks') const _routeHooks = Symbol('_routeHooks')
const _query = Symbol('_query') const _query = Symbol('_query')
const _routerList = Symbol('_routerList') const _routerList = Symbol('_routerList')
import { wxOnAppRouteFn, generateRoutList } from './wxOnAppRoute.js' import {
import { getNavigationBarTitleText } from '~/utils/cache/storageApi' generateRoutList
import { getUserInfo } from '~/utils/cache/userInfo' } from './wxOnAppRoute.js'
import {
getNavigationBarTitleText
} from '~/utils/cache/storageApi'
import {
getUserInfo
} from '~/utils/cache/userInfo'
class Router { class Router {
[_query] = {}; [_query] = {};
[_routeHooks] = []; [_routeHooks] = [];
[_routerList] = [] [_routerList] = []
constructor(router) { constructor(router) {
this[_routerList] = generateRoutList(router) this[_routerList] = generateRoutList(router)
let obj = { wx.onAppRoute &&
query: this[_query], wx.onAppRoute(e => {
routeHooks: this[_routeHooks], let thisPage = this.getPageInstance()
routerList: this[_routerList], if (thisPage) {
getPageInstance: this.getPageInstance, thisPage.options = this[_query]
getRootName: this.getRootName, this.setNavigationBarTitleText(thisPage)
setNavigationBarTitleText: this.setNavigationBarTitleText, let onRoute = thisPage.onRoute
getRouterList: this.getRouterList typeof onRoute === 'function' && onRoute(this[_query])
} }
wxOnAppRouteFn(obj) this[_routeHooks].forEach(fn => {
try {
typeof fn === 'function' && fn(e, this[_query], this[_routerList])
} catch (err) {
console.log(err)
}
})
this[_query] = {}
})
} }
/**设置标题栏 */ /**设置标题栏 */
setNavigationBarTitleText = thisPage => { setNavigationBarTitleText = thisPage => {
...@@ -27,8 +41,11 @@ class Router { ...@@ -27,8 +41,11 @@ class Router {
if (getUserInfo()) title = getUserInfo().merchantName if (getUserInfo()) title = getUserInfo().merchantName
const router = `${thisPage.__route__}.html` const router = `${thisPage.__route__}.html`
if (__wxConfig && __wxConfig.page && __wxConfig.page[router]) { if (__wxConfig && __wxConfig.page && __wxConfig.page[router]) {
let { navigationBarTitleText, navigationStyle } = __wxConfig.page[router].window let {
if (!title) title = '广汇车生活' navigationBarTitleText,
navigationStyle
} = __wxConfig.page[router].window
if (!title) title = '生意助手'
if (!navigationBarTitleText && !navigationStyle) if (!navigationBarTitleText && !navigationStyle)
wx.setNavigationBarTitle({ wx.setNavigationBarTitle({
title title
...@@ -39,12 +56,6 @@ class Router { ...@@ -39,12 +56,6 @@ class Router {
getRouterList = () => { getRouterList = () => {
return this[_routerList] return this[_routerList]
} }
/**获取当前分包名 */
getRootName = () => {
let router = `/${this.getPageInstance().__route__}`
let { rootName } = this.getRouterList().find(item => router === item.url)
return rootName
}
/**获取页面对象实例 */ /**获取页面对象实例 */
getPageInstance = (size = 1) => { getPageInstance = (size = 1) => {
const pages = getCurrentPages() const pages = getCurrentPages()
...@@ -67,15 +78,15 @@ class Router { ...@@ -67,15 +78,15 @@ class Router {
parent = _parent parent = _parent
} }
/**只传页面名 默认跳转当前包下的页面,相同名称默认第一个 */ /**只传页面名 默认跳转当前包下的页面,相同名称默认第一个 */
if (!_name && !last_name) { if (!_name && !last_name) name = _parent
name = _parent
parent = this.getRootName() || parent
}
const routerMapItem = this[_routerList].find(item => { const routerMapItem = this[_routerList].find(item => {
if (last_name) { if (route.includes('/')) return item.url === route
return item.parent === parent && item.name === last_name && item.subPages === name else {
} else { if (last_name) {
return item.parent === parent && item.name === name return item.parent === parent && item.name === last_name && item.subPages === name
} else {
return item.parent === parent && item.name === name
}
} }
}) })
if (!routerMapItem) { if (!routerMapItem) {
...@@ -89,11 +100,8 @@ class Router { ...@@ -89,11 +100,8 @@ class Router {
} }
/**跳转至H5 */ /**跳转至H5 */
jumpH5(url) { jumpH5(url) {
this.intercept().then(response => { wx.navigateTo({
if (response) return url: `/pages/webView/webView?url=${encodeURIComponent(url)}`
wx.navigateTo({
url: `/pages/webView/webView?url=${encodeURIComponent(url)}`
})
}) })
} }
/**页面跳转 /**页面跳转
...@@ -108,46 +116,39 @@ class Router { ...@@ -108,46 +116,39 @@ class Router {
* 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 $router.back() 可以返回到原页面。小程序中页面栈最多十层 * 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 $router.back() 可以返回到原页面。小程序中页面栈最多十层
*/ */
go(route, events) { go(route, events) {
let { routerMapItem, query } = this.checkRouter(route, events) let {
routerMapItem,
query
} = this.checkRouter(route, events)
if (routerMapItem.isTab) { if (routerMapItem.isTab) {
wx.switchTab({ wx.switchTab({
url: routerMapItem.url url: routerMapItem.url
}) })
} else { } else {
if (events && events.notIntercept) { wx.navigateTo({
wx.navigateTo({ url: `${routerMapItem.url}${query}`,
url: `${routerMapItem.url}${query}`, success: res => events && res.eventChannel.emit('getData', events)
success: res => events && res.eventChannel.emit('getData', events) })
})
} else {
this.intercept().then(response => {
if (response) return
wx.navigateTo({
url: `${routerMapItem.url}${query}`,
success: res => events && res.eventChannel.emit('getData', events)
})
})
}
} }
} }
/**关闭所有页面,打开到应用内的某个页面 */ /**关闭所有页面,打开到应用内的某个页面 */
reLaunch(route, events) { reLaunch(route, events) {
let { routerMapItem, query } = this.checkRouter(route, events) let {
this.intercept().then(response => { routerMapItem,
if (response) return query
wx.reLaunch({ } = this.checkRouter(route, events)
url: `${routerMapItem.url}${query}` wx.reLaunch({
}) url: `${routerMapItem.url}${query}`
}) })
} }
/**关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。 */ /**关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。 */
redirectTo(route, events) { redirectTo(route, events) {
let { routerMapItem, query } = this.checkRouter(route, events) let {
this.intercept().then(response => { routerMapItem,
if (response) return query
wx.redirectTo({ } = this.checkRouter(route, events)
url: `${routerMapItem.url}${query}` wx.redirectTo({
}) url: `${routerMapItem.url}${query}`
}) })
} }
/**prevPageSize = 1 /**prevPageSize = 1
...@@ -164,7 +165,7 @@ class Router { ...@@ -164,7 +165,7 @@ class Router {
} }
goHome() { goHome() {
let [index] = this[_routerList] let [index] = this[_routerList]
wx.switchTab({ wx.reLaunch({
url: index.url url: index.url
}) })
} }
...@@ -180,18 +181,6 @@ class Router { ...@@ -180,18 +181,6 @@ class Router {
if (i > -1) list.splice(i, 1) if (i > -1) list.splice(i, 1)
} }
} }
async intercept() {
const authStatus = wx.$authStatus
if (authStatus) {
const thisPage = this.getPageInstance()
thisPage.setData({
showLogin: true
})
return await true
} else {
return await false
}
}
} }
export default Router export default Router
\ No newline at end of file \ No newline at end of file
import { IMG_URL } from '~/utils/constantData'
/** /**
* 执行路由前的准备工作 * 执行路由前的准备工作
*/ */
/**处理前置钩子逻辑 */ /**处理前置钩子逻辑 */
const routerBefore = (next) => { const routerBefore = next => {
// console.log("处理前置钩子逻辑"); // console.log("处理前置钩子逻辑");
// 配置图片全局路径
let page = wx.$router.getPageInstance()
page && (page.data.IMGURL = IMG_URL)
next(); // page && page.setData({ IMG_URL })
}; // console.log()
// console.log(next)
next()
}
/**处理后置钩子逻辑 */ /**处理后置钩子逻辑 */
const routerAfter = (next) => { const routerAfter = next => {
// console.log("处理后置钩子逻辑"); // console.log("处理后置钩子逻辑");
next(); next()
}; }
// 重写Page方法 // 重写Page方法
const OldPage = Page; const OldPage = Page
Page = function (options) { Page = function (options) {
const oldShow = options.onShow; const oldShow = options.onShow
const oldHide = options.onHide; const oldHide = options.onHide
options.onShow = function () { options.onShow = function () {
routerBefore(() => { routerBefore(() => {
oldShow.apply(this, arguments); oldShow.apply(this, arguments)
}); })
}; }
options.onHide = function () { options.onHide = function () {
routerAfter(() => { routerAfter(() => {
oldHide.apply(this, arguments); oldHide.apply(this, arguments)
}); })
}; }
OldPage(options); OldPage(options)
}; }
export default routerBefore; export default routerBefore
import util from '../utils/util.js' // import util from '../utils/util.js'
import { getUserInfo } from '~/utils/cache/userInfo' // import {
import { IMG_URL } from '~/utils/constantData' // getUserInfo
// } from '~/utils/cache/userInfo'
/** /**
* wx.onAppRoute钩子方法, * wx.onAppRoute钩子方法,
...@@ -13,74 +14,6 @@ import { IMG_URL } from '~/utils/constantData' ...@@ -13,74 +14,6 @@ import { IMG_URL } from '~/utils/constantData'
* @param {*} obj.setNavigationBarTitleText * @param {*} obj.setNavigationBarTitleText
* @param {*} obj.getRouterList * @param {*} obj.getRouterList
*/ */
export const wxOnAppRouteFn = obj => {
wx.onAppRoute &&
wx.onAppRoute(e => {
let thisPage = obj.getPageInstance()
const rootName = obj.getRootName()
if (rootName) {
const selectedColor = rootName == 'packageEquity' ? '#f7dcbc' : '#FC5B32'
wx.setTabBarStyle({
selectedColor,
color: '#979899',
backgroundColor: '#FFFFFF',
borderStyle: 'white'
})
}
if (thisPage) {
obj.setNavigationBarTitleText(thisPage)
let onRoute = thisPage.onRoute
thisPage.$query = obj.query
typeof onRoute === 'function' && onRoute(obj.query)
thisPage.rootName = rootName
obj.getRouterList().find(item => {
if (`/${thisPage.__route__}` === item.url) {
const authStatus = wx.$authStatus
// if (item.isTab) thisPage.setData({
// showLogin: authStatus
// })
}
})
if (!wx.$version)
util.getImgVersion().then(({ version }) => {
wx.$version = version || '1.0.0'
thisPage.setData({
img_version: wx.$version
})
})
else
thisPage.setData({
img_version: wx.$version
})
// console.log(app)
thisPage.setData({
IMGURL: IMG_URL
})
let userInfo = getUserInfo()
if (userInfo && userInfo.phone) {
if (wx.$authStatus) {
thisPage.setData({
userInfo: null
})
} else {
thisPage.setData({
userInfo
})
if (thisPage.init) thisPage.init(userInfo)
}
}
}
obj.routeHooks.forEach(fn => {
try {
typeof fn === 'function' && fn(e, obj.query, obj.routerList)
} catch (err) {
console.log(err)
}
})
obj.query = {}
})
}
/** /**
* 生成特定格式路由 * 生成特定格式路由
* *
...@@ -107,11 +40,6 @@ export const generateRoutList = routerList => { ...@@ -107,11 +40,6 @@ export const generateRoutList = routerList => {
obj.subPages = item.url.split(`/${item.parent}/pages/`)[1].split('/')[0] obj.subPages = item.url.split(`/${item.parent}/pages/`)[1].split('/')[0]
} }
} }
if (obj.isTab) {
__wxConfig.tabBar.list.map(e => {
if (obj.url === `/${e.pagePath.replace('.html', '')}`) obj.rootName = e.rootName
})
}
} }
return obj return obj
})) }))
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!