master
Lee-1203 2022-03-09 15:06:54 +08:00
commit 948ca2bc67
58 changed files with 2056 additions and 0 deletions

22
.gitignore vendored Normal file
View File

@ -0,0 +1,22 @@
# dependencies
**/node_modules
.idea
.DS_Store
# misc
npm-debug.log*
yarn-error.log
yarn.lock
package-lock.json
*bak
# visual studio code
.vscode
.history
*.log
functions/*
.temp/**
.eslintcache

7
.mini-ide/launch.json Normal file
View File

@ -0,0 +1,7 @@
{
// 使 IntelliSense
//
// 访: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": []
}

135
app.acss Normal file
View File

@ -0,0 +1,135 @@
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
.body{
width: 100vw;
min-height: 100vh;
padding-bottom: 180rpx;
background-color: #edeff2;
font-family: 'Open Sans', sans-serif;
color: #6a859c;
overflow: hidden;
}
input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder{
color: #999999;
font-weight: normal;
}
.header{
line-height: 128rpx;
font-size: 36rpx;
text-align: center;
border-bottom: 4rpx solid #69b9ff;
font-weight: 600;
}
.content{
width: 94%;
margin: 0 auto;
}
.head{
display: flex;
align-items: center;
padding: 0 2%;
line-height: 116rpx;
font-size: 28rpx;
text-align: center;
border-bottom: 4rpx solid #69b9ff;
}
.head>navigator{
width: 10%;
font-weight: normal;
}
.head>text{
font-size: 32rpx;
width: 90%;
text-align: center;
font-weight: 600;
}
.head .head-txt{
display: block;
line-height: 44rpx;
}
.pull-btns{
display: inline-block;
height: 76rpx;
line-height: 76rpx;
padding: 0 30rpx;
margin-left: 50%;
transform: translateX(-50%);
}
checkbox{
width: 0 !important;
height: 0 !important;
border: 0;
background: none;
overflow: hidden;
position: relative;
}
.checkbox-text{
margin-left: 8rpx;
}
.a-checkbox:checked{
background-color: #2e80b6;
}
checkbox+.point{
box-sizing: border-box;
width: 13px;
height: 13px;
border: 1px solid #cccccc;
border-radius: 2px;
background-color: #FFFFFF;
}
checkbox+.point2{
background-color:#2e80b6;
background-image: url(/static/success.png);
background-position: center;
background-repeat: no-repeat;
background-size: 7px 7px;
}
radio{
width: 0 !important;
height: 0 !important;
border: 0;
background: none;
overflow: hidden;
}
label{
flex-shrink: 0;
}
.radio-text{
line-height: 40rpx;
margin-left: 8rpx;
}
.a-radio-checked{
background-color: #2e80b6;
}
radio+.point{
box-sizing: border-box;
width: 14px;
height: 14px;
border: 1px solid #cccccc;
border-radius: 100%;
background-color: #FFFFFF;
position: relative;
}
radio+.point2{
border: 1px solid #2e80b6;
}
radio+.point2>text{
display: block;
width: 8px;
height: 8px;
border-radius: 100%;
background-color:#2e80b6;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
}
.on-click,
.on-click:hover{
background-color: #bcbcbc !important;
}

23
app.js Normal file
View File

@ -0,0 +1,23 @@
// 公共js
import toolAll from './utils/tools'
dd['$toolAll'] = toolAll;
import http from './utils/requst'
dd['$http'] = http;
import utils from '/utils/utils'
dd['utils'] = utils;
// dd['baseUrl'] = 'http://aspiration.scdxtc.cn';
dd['baseUrl'] = 'https://ypzy.emingren.com';
App({
onLaunch(options) {
// 第一次打开
// options.query == {number:1}
console.info('App onLaunch');
},
onShow(options) {
// 从后台被 scheme 重新打开
// options.query == {number:1}
},
onHide(){
dd.removeStorageSync({key:'anliObj'})
},
});

10
app.json Normal file
View File

@ -0,0 +1,10 @@
{
"pages": [
"pages/start/start",
"pages/login/login",
"pages/login/bind/bind",
"pages/login/code/code",
"pages/login/verification/verification",
"pages/home/home"
]
}

View File

View File

@ -0,0 +1,16 @@
<view>
<swiper
style="height:150px"
class="demo-swiper"
autoplay="{{autoplay}}"
vertical="{{vertical}}"
interval="{{interval}}"
circular="{{circular}}"
>
<block a:for="{{bannerList}}">
<swiper-item>
<view><image mode="scaleToFill" src="{{item.src}}" style="width:100%;" /></view>
</swiper-item>
</block>
</swiper>
</view>

View File

@ -0,0 +1,66 @@
Component({
mixins: [],
data: {
indicatorDots: true,
autoplay: true,
vertical: false,
interval: 4000,
circular: true,
bannerList:[]
},
// 轮播事件start
changeIndicatorDots(e) {
this.setData({
indicatorDots: !this.data.indicatorDots,
});
},
changeVertical() {
this.setData({
vertical: !this.data.vertical,
});
},
changeCircular(e) {
this.setData({
circular: !this.data.circular,
});
},
changeAutoplay(e) {
this.setData({
autoplay: !this.data.autoplay,
});
},
intervalChange(e) {
this.setData({
interval: e.detail.value,
});
},
// 轮播事件end
props: {},
didMount() {
this.bannerEv();
},
didUpdate() {},
didUnmount() {},
methods: {
// 获取轮播图
bannerEv(){
dd.$http.get('/api/dictionary/get-slide-list',{position:'customer_home_banner'}).then(res=>{
if(res.code==0){
let arr = [];
res.data.forEach(item=>{
let bannerObj = {
id:item.id,
src:dd.baseUrl + item.src,
url:item.url
}
arr.push(bannerObj);
})
this.setData({
bannerList:arr
})
}
})
},
},
});

View File

@ -0,0 +1,3 @@
{
"component": true
}

View File

@ -0,0 +1,57 @@
.nav-tabs {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
position: fixed;
bottom: 0;
background: #f5f5f5;
}
.tab-list {
width: 34%;
padding: 30rpx 0;
}
.tab-list>view{
display: flex;
align-items: center;
justify-content: center;
}
.nav-tabs .tab-list:nth-of-type(2)>view{
border-left: 2rpx solid #9f9f9f;
border-right: 2rpx solid #9f9f9f;
}
.tab-list>view>view:first-child,
.tab-list>view>view:first-child image{
width: 40rpx;
height: 40rpx;
}
.tab-text {
height: 60rpx;
box-sizing: content-box;
font-size: 30rpx;
line-height: 60rpx;
color: #424652;
margin-left: 6rpx;
}
.active {
background: #e2e2e2;
}
/* tabbar切换选中的文字颜色 */
/* .active text {
color: #2697EB !important;
} */
.show {
display: block;
flex: 1;
}
.hidden {
display: none;
flex: 1;
}

View File

@ -0,0 +1,26 @@
<view class="nav-tabs">
<view class="tab-list {{currentTab == 0 || currentTab == 1 ? 'active' : 'default' }}" onTap="toConsultant">
<view>
<view>
<image mode="scaleToFill" src="/static/menu01.png" />
</view>
<view class="tab-text">专家列表</view>
</view>
</view>
<view class="tab-list {{currentTab == 2 ? 'active' : 'default' }}" onTap="toSupervisor">
<view>
<view>
<image mode="scaleToFill" src="/static/menu02.png" />
</view>
<view class="tab-text">付费咨询</view>
</view>
</view>
<view class="tab-list {{currentTab == 3 ? 'active' : 'default' }}" onTap="toExaminee">
<view>
<view>
<image mode="scaleToFill" src="/static/menu03.png" />
</view>
<view class="tab-text">个人中心</view>
</view>
</view>
</view>

View File

@ -0,0 +1,40 @@
Component({
mixins: [],
data: {
currentTab: 1
},
props: {
currentTab: String
},
didMount() {
this.setData({
currentTab: this.props.currentTab
})
},
didUpdate() {},
didUnmount() {},
methods: {
toConsultant(){
dd.reLaunch({
url: '/pages/consultant/list/list'
})
},
toSupervisor(){
dd.reLaunch({
url: '/pages/supervisor/index/index'
})
},
toExaminee(){
if(dd.$toolAll.getCache('roleType')){
// 前往咨询师资料页
dd.reLaunch({
url: '/pages/consultant/user/user'
})
} else {
dd.reLaunch({
url: '/pages/examinee/user/user'
})
}
}
},
});

View File

@ -0,0 +1,3 @@
{
"component": true
}

4
config/config.js Normal file
View File

@ -0,0 +1,4 @@
export default {
// BASE_URL: 'http://aspiration.scdxtc.cn' // api接口服务器地址
BASE_URL: 'https://ypzy.emingren.com' // api接口服务器地址
}

6
package.json Normal file
View File

@ -0,0 +1,6 @@
{
"dependencies": {
"@antv/f2": "^3.8.10-beta.1",
"@antv/my-f2": "^2.1.7"
}
}

0
pages/home/home.acss Normal file
View File

3
pages/home/home.axml Normal file
View File

@ -0,0 +1,3 @@
<view>
<web-view src="{{url}}" onMessage="test"></web-view>
</view>

19
pages/home/home.js Normal file
View File

@ -0,0 +1,19 @@
Page({
data: {
url:''
},
onLoad() {
let userData = JSON.stringify(dd.$toolAll.getCache('userData'));
let userType = dd.$toolAll.getCache('userData').userType;
console.log(userType,123)
if(userType==1){
this.setData({
url: 'http://aspevel.scdxtc.cn/#/consultant?userData='+userData
})
}else if(userType==0){
this.setData({
url: 'http://aspevel.scdxtc.cn/#/index?userData='+userData
})
}
},
});

3
pages/home/home.json Normal file
View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

139
pages/login/bind/bind.acss Normal file
View File

@ -0,0 +1,139 @@
input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder{
color: #dedede;
}
.phone-txt{
padding: 1.2rem .4rem 0;
border-top: .02rem solid #FAFAFA;
}
.phone-title{
font-size: .4rem;
line-height: 1.5;
}
.phone-txt input{
width: 100%;
height: .9rem;
line-height: .9rem;
font-size: .32rem;
border-bottom: .02rem solid #e2e4e6;
}
.flex{
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.flex .span-02{
width: 100%;
font-size: .3rem;
line-height: 1.5;
margin-top: .2rem;
}
.flex .span-01{
width: auto;
font-size: .3rem;
line-height: 1.5;
margin-top: .2rem;
color: #348bff;
}
.login-btns{
margin-top: 1rem;
}
.login-btns>view{
display: flex;
justify-content: center;
align-items: center;
height: .8rem;
background-color: #3440c9;
border-radius: .16rem;
font-size: .32rem;
color: #FFFFFF;
}
.addr-select-bg{
width: 100vw;
height: 100%;
background-color: rgba(0,0,0,.5);
position: fixed;
top: 0;
left: 0;
z-index: 998;
}
/* 授权按钮 */
.nail-popup-btns view{
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: .8rem;
margin-top: .4rem;
background-color: #348bff;
border-radius: .16rem;
font-size: .32rem;
color: #FFFFFF;
}
.nail-popup-btns view:last-child{
margin-top: .15rem;
background-color: rgba(0,0,0,0);
color: #333333;
}
/* 提示框 */
.toast{
width: 3rem;
padding: .2rem .25rem;
background-color: rgba(255,255,255,.8);
color: #333333;
border-radius: .1rem;
font-size: .28rem;
line-height: 1.4;
text-align: center;
position: fixed;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
z-index: 999;
}
.my-confirm-bg{
width: 100vw;
height: 100%;
background-color: rgba(0,0,0,.5);
position: fixed;
top: 0;
left: 0;
z-index: 998;
}
.my-confirm{
width: 5rem;
padding: .4rem .3rem;
background-color: #FFFFFF;
border-radius: .3rem;
box-shadow: 0 0 .13rem rgba(29,47,67,.1);
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
z-index: 999;
}
.my-confirm>text{
display: block;
font-size: .28rem;
line-height: 1.5;
text-align: center;
}
.confirm-btns{
display: flex;
justify-content: space-around;
margin-top: .4rem;
}
.confirm-btns>view{
width: 1.6rem;
line-height: .5rem;
border-radius: .25rem;
border: .02rem solid #333fc9;
background-color: #FFFFFF;
font-size: .26rem;
color: #333fc9;
text-align: center;
}
.confirm-btns>view:first-child{
background-color: #333fc9;
color: #FFFFFF;
}

View File

@ -0,0 +1,27 @@
<view>
<view class="verification pull-content list-section">
<view class="phone-txt">
<view class="phone-title">手机号</view>
<view class="flex">
<input type="input" onInput="bindKeyInput" placeholder="请输入需要绑定的手机号"/>
</view>
<view class="login-btns">
<view onTap="checkPhone">获取验证码</view>
</view>
</view>
</view>
<!-- 提示框 -->
<view class="addr-select-bg" a:if="{{isToast}}"></view>
<view class="toast" a:if="{{isToast}}">
<view>{{toastText}}</view>
</view>
<!-- 手机验证弹窗 -->
<view class="my-confirm-bg" a:if="{{openPhoneTips}}"></view>
<view class="my-confirm" a:if="{{openPhoneTips}}">
<text>{{tipsMsg}}</text>
<view class="confirm-btns">
<view onTap="modePhone">手机登录</view>
<view onTap="clearPhone">更换号码</view>
</view>
</view>
</view>

88
pages/login/bind/bind.js Normal file
View File

@ -0,0 +1,88 @@
Page({
data: {
isToast: false,
openPhoneTips: false, //验证手机号弹出框
tipsMsg: '',
toastText: '',
phoneNumber: ''
},
onLoad() {
dd.setNavigationBar({
title: '绑定手机号',
backgroundColor: '#FFFFFF',
});
},
// 获取电话号码
bindKeyInput(e) {
this.setData({
phoneNumber: e.detail.value,
});
},
// 手机号登录
// 验证手机号是否存在
checkPhone(){
console.log(this.data.phoneNumber,123)
let reg_tel = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
if (this.data.phoneNumber == "") {
this.setData({
toastText: '请填写您的手机号!',
isToast: true
})
setTimeout(()=> {
this.setData({
isToast: false
})
}, 1000)
return false;
} else if (!reg_tel.test(this.data.phoneNumber)) {
this.setData({
toastText: '请正确填写您的手机号!',
isToast: true
})
setTimeout(()=> {
this.setData({
isToast: false
})
}, 1000)
return false;
}
let params = {
phone: this.data.phoneNumber
}
dd.$http.post('/api/user/has-phone-user',params).then(res=>{
console.log(res,'登录认证数据')
if(res.data.registered == 0){
this.bindPhone();
}else if(res.data.registered == 1){
this.setData({
openPhoneTips: true,
tipsMsg: '该手机号已注册,请使用手机号登录或换绑其他手机号录'
})
}
})
},
// 手机号绑定
bindPhone() {
let params = {
phone: this.data.phoneNumber,
type: "bind",
}
dd.$http.post('/api/common/send-sms-captcha',params).then(res=>{
console.log(res,'验证码数据')
// 跳转页面
dd.navigateTo ({
url: '/pages/logins/code/code?phone='+this.data.phoneNumber+'&code='+res.data.code
})
})
},
// 关闭弹窗
clearPhone(){
this.setData({
openPhoneTips: false,
})
},
});

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@ -0,0 +1,97 @@
input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder{
color: #dedede;
}
/* 手机验证码 */
.verification-txt{
padding: 1.2rem .4rem 0;
border-top: .02rem solid #FAFAFA;
}
.verification-txt>.p{
font-size: .4rem;
line-height: 1.5;
}
.verification-txt>.span{
display: block;
font-size: .26rem;
line-height: 1.5;
color: #999999;
margin-top: .2rem;
}
/* 输入验证码 */
.security-code-wrap {
overflow: hidden;
padding: .2rem 0;
position: relative;
}
.security-code-container {
display: flex;
justify-content: space-between;
width: 5.32rem;
}
.field-wrap {
list-style: none;
display: block;
width: .72rem;
height: 1rem;
line-height: 1rem;
font-size: .64rem;
background-color: #fff;
border-bottom: .02rem solid #e0e2e4;
}
.char-field {
display: block;
width: 100%;
text-align: center;
font-style: normal;
}
.input-code {
position: absolute;
left: 0;
top: 0;
width: 5.32rem;
height: 1rem;
opacity: 0;
overflow: visible;
z-index: 1;
}
/* 重获验证码 */
.getCode{
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: .8rem;
margin-top: .4rem;
background-color: #348bff;
border-radius: .16rem;
font-size: .32rem;
color: #FFFFFF;
}
/* 提示框 */
.toast{
width: 3rem;
padding: .2rem .25rem;
background-color: rgba(255,255,255,.8);
color: #333333;
border-radius: .1rem;
font-size: .28rem;
line-height: 1.4;
text-align: center;
position: fixed;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
z-index: 999;
}
.addr-select-bg{
width: 100vw;
height: 100%;
background-color: rgba(0,0,0,.5);
position: fixed;
top: 0;
left: 0;
z-index: 998;
}

View File

@ -0,0 +1,27 @@
<view>
<view class="verification pull-content list-section">
<view class="verification-txt">
<view class="p">输入验证码</view>
<view class="span">验证码已发送至 +86 {{ phoneData }}</view>
<view class="result">
<view class="security-code-wrap">
<view class="code" for="code">
<view class="security-code-container">
<view class="field-wrap" a:for="{{number}}" a:for-index="index">
<text class="char-field">{{ value[index] || placeholder }}</text>
</view>
</view>
</view>
<input class="input-code" onBlur="handleInput" onInput="bindValueInput" id="code" type="text" maxlength="6"/>
</view>
</view>
<view class="span" a:if="{{show}}">{{count}}秒后可重新获取验证码</view>
<view a:else @click="getCode()" class="getCode">获取验证码</view>
</view>
</view>
<!-- 提示框 -->
<view class="addr-select-bg" a:if="{{isToast}}"></view>
<view class="toast" a:if="{{isToast}}">
<view>{{toastText}}</view>
</view>
</view>

94
pages/login/code/code.js Normal file
View File

@ -0,0 +1,94 @@
Page({
data: {
phoneData: "", //手机号
verification: "", //验证码
value: "",
show: false, //显示获取验证码
count: "", //剩余时间
timer: null,
userType: 0,
placeholder:'-',
number:6,
code:'',
isToast: false,
},
onLoad(options) {
this.setData({
phoneData: options.phone,
code: options.code,
})
dd.setNavigationBar({
title: '手机验证码',
backgroundColor: '#FFFFFF',
});
if (!this.data.timer) {
this.setData({
count: 60,
show: true
})
let that = this;
const countDown = setInterval(() => {
if(that.data.count <= 1){
that.setData({
count:60,
show: false
})
clearInterval(countDown)
return
}
that.data.count --
that.setData({
count: that.data.count,
show: true
})
},1000);
}
},
// 获取验证码
bindValueInput(e){
this.setData({
value: e.detail.value,
});
},
// 输入完成获取数据
handleInput() {
console.log(this.data.code,this.data.value,25252525)
if(this.data.code == this.data.value){
this.hideKeyboard();
}else{
this.setData({
value: '',
toastText: '验证码错误',
isToast: true
});
setTimeout(()=> {
this.setData({
isToast: false
})
}, 1000)
}
},
// 登录
hideKeyboard() {
let params = {
phone: this.data.phoneData,
sms_code: this.data.value,
}
dd.$http.post('/api/user/bind-phone',params).then(res=>{
console.log(res,'绑定数据')
if (res.code == 0) {
// 跳转页面
dd.navigateTo ({
url: '/pages/home/home'
})
}
})
},
});

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

361
pages/login/login.acss Normal file
View File

@ -0,0 +1,361 @@
input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder{
color: #dedede;
}
.content{
border-top: .02rem solid #FAFAFA;
}
.addr-select-bg{
width: 100vw;
height: 100%;
background-color: rgba(0,0,0,.5);
position: fixed;
top: 0;
left: 0;
z-index: 998;
}
.login-txt{
padding: 0.4rem;
min-height: 6.6rem;
}
.login-txt .logo{
width: 1.4rem;
height: 1.4rem;
background-color: #e70012;
border-radius: .1rem;
overflow: hidden;
margin: .5rem auto .1rem;
}
.login-txt .logo>view{
width: 1.2rem;
height: 1.2rem;
margin: .1rem auto;
}
.login-txt .logo>view image{
width: 100%;
}
.login-txt .company{
font-size: .48rem;
line-height: 1.5;
text-align: center;
margin-bottom: .7rem;
}
.login-txt .phone-number{
padding-top: .2rem;
}
.login-txt .phone-number>view{
display: block;
font-size: .28rem;
line-height: 1.5;
color: #666;
}
.login-txt .phone-number>input{
width: 100%;
height: .9rem;
line-height: .9rem;
font-size: .32rem;
border-bottom: .02rem solid #e2e4e6;
}
.login-txt .agreement{
padding-top: .2rem;
overflow: hidden;
}
.login-txt .agreement>.img{
display: block;
width: .26rem;
height: .26rem;
border-radius: .04rem;
background-color: #FFFFFF;
border: .02rem solid #999999;
margin: .07rem .08rem 0 0;
float: left;
}
.login-txt .agreement>.img>image{
display: none;
width: .18rem;
height: .13rem;
margin: .045rem auto 0;
}
.login-txt .agreement>.img.checked{
border: .02rem solid #3440c9;
background-color: #3440c9;
}
.login-txt .agreement>.img.checked>image{
display: block;
}
.login-txt .agreement>.txt{
width: calc(100% - .34rem);
font-size: .28rem;
line-height: 1.5;
float: left;
}
.login-txt .agreement>.txt text{
word-break: break-all;
color: #3440c9;
}
.login-btns{
margin-top: .3rem;
}
.login-btns>view{
display: flex;
justify-content: center;
align-items: center;
height: .8rem;
background-color: #3440c9;
border-radius: .16rem;
font-size: .32rem;
color: #FFFFFF;
}
.login-btns>view.nail-btn{
display: flex;
justify-content: center;
background-color: #348bff;
}
.login-btns>view.nail-btn>.img{
width: .4rem;
height: .52rem;
margin-right: .08rem;
}
.login-btns>view.nail-btn>.img image{
width: 100%;
}
/* 登录方式 */
.login-mode{
width: 100%;
margin-top: 2rem;
background-color: #FFFFFF;
position: fixed;
bottom: .4rem;
left: 0;
}
.login-mode.noPositin{
position: static;
}
.mode-title{
display: flex;
justify-content: center;
align-items: center;
font-size: .32rem;
line-height: 1.5;
}
.mode-title>view{
width: .9rem;
height: .02rem;
background-color: #d3d3d3;
margin: 0 .1rem;
}
.mode-item{
display: flex;
justify-content: center;
align-items: center;
margin-top: .3rem;
}
.mode-item>view{
width: 1.8rem;
}
.mode-item>view>.img{
display: flex;
justify-content: center;
align-items: center;
width: 1.2rem;
height: 1.2rem;
margin: 0 auto;
border-radius: 100%;
background-color: #348bff;
}
.mode-item>view>.img view{
width: .58rem;
height: .76rem;
}
.mode-item>view>.img view image{
width: 100%;
}
.mode-item>view:last-child>view{
background-color: #ff9834;
}
.mode-item>view:last-child>.img view{
width: .51rem;
height: .72rem;
}
.mode-item>view>text{
display: block;
width: 1.8rem;
height: .44rem;
line-height: .44rem;
background-color: #dbeaff;
border-radius: .1rem;
border: .02rem solid #3440c9;
font-size: .24rem;
margin-top: .12rem;
text-align: center;
opacity: 0;
}
.mode-item>view>text.active{
opacity: 1;
transition: all .6s;
}
/* 弹窗 */
.my-confirm-bg{
width: 100%;
height: 100%;
background-color: rgba(0,0,0,.5);
position: fixed;
top: 0;
z-index: 998;
}
/* 阅读授权弹窗 */
.my-confirm2>p{
text-align: center !important;
font-size: .32rem;
}
.my-confirm-bg{
width: 100vw;
height: 100%;
background-color: rgba(0,0,0,.5);
position: fixed;
top: 0;
left: 0;
z-index: 998;
}
.my-confirm{
width: 4rem;
padding: .4rem .3rem;
background-color: #FFFFFF;
border-radius: .3rem;
box-shadow: 0 0 .13rem rgba(29,47,67,.1);
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
z-index: 999;
}
.my-confirm>text{
display: block;
font-size: .28rem;
line-height: 1.5;
text-align: center;
}
.confirm-btns{
display: flex;
justify-content: space-around;
margin-top: .4rem;
}
.confirm-btns>view{
width: 1.6rem;
line-height: .5rem;
border-radius: .25rem;
border: .02rem solid #333fc9;
background-color: #FFFFFF;
font-size: .26rem;
color: #333fc9;
text-align: center;
}
.confirm-btns>view:first-child{
background-color: #333fc9;
color: #FFFFFF;
}
/* 钉钉授权登录弹窗 */
.nail-popup{
width: 100%;
padding: .65rem;
background-color: #FFFFFF;
position: fixed;
left: 0;
bottom: 0;
z-index: 999;
}
.nail-popup-title{
display: flex;
align-items: center;
height: .64rem;
}
.nail-popup-title>.img{
display: flex;
justify-content: center;
align-items: center;
width: .64rem;
height: .64rem;
border-radius: .12rem;
background-color: #e70012;
}
.nail-popup-title>.img view{
width: .55rem;
height: .55rem;
}
.nail-popup-title>.img view image{
width: 100%;
}
.nail-popup-title>.txt{
font-size: .48rem;
line-height: .64rem;
margin: 0 .08rem;
}
.nail-popup-title>text{
font-size: .32rem;
}
.nail-popup>text{
display: block;
font-size: .42rem;
line-height: 1.5;
margin: .2rem 0;
}
.nick-name>view{
font-size: .28rem;
line-height: 1.5;
color: #999999;
}
.nick-name>view{
display: flex;
justify-content: space-between;
align-items: center;
font-size: .32rem;
line-height: 1.5;
padding: .15rem 0;
border-bottom: .02rem solid #e1e3e5;
}
.nick-name>view>view{
width: .35rem;
height: .24rem;
}
.nick-name>view>view image{
width: 100%;
}
/* 授权按钮 */
.nail-popup-btns view{
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: .8rem;
margin-top: .4rem;
background-color: #348bff;
border-radius: .16rem;
font-size: .32rem;
color: #FFFFFF;
}
.nail-popup-btns view:last-child{
margin-top: .15rem;
background-color: rgba(0,0,0,0);
color: #333333;
}
/* 提示框 */
.toast{
width: 3rem;
padding: .2rem .25rem;
background-color: rgba(255,255,255,.8);
color: #333333;
border-radius: .1rem;
font-size: .28rem;
line-height: 1.4;
text-align: center;
position: fixed;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
z-index: 999;
}

104
pages/login/login.axml Normal file
View File

@ -0,0 +1,104 @@
<view>
<view class="content">
<view class="login pull-content list-section">
<view class="login-txt">
<view class="logo">
<view>
<image mode="widthFix" src="/static/login/logo.png" />
</view>
</view>
<view class="company">有谱志愿</view>
<view class="phone-number" a:if="{{!isMode}}">
<view>手机号</view>
<input type="input" onInput="bindKeyInput" onBlur="myBlur" onFocus="myFocus" placeholder="请输入手机号"/>
</view>
<view class="agreement">
<view class="{{isChecked?'img checked':'img'}}" onTap="changeChecked">
<image mode="widthFix" src="/static/login/yes.png" />
</view>
<view class="txt">
我已阅读并同意<text>《有谱志愿用户协议》</text>、<text>《隐私政策》</text>,未注册将引导完成账号注册
</view>
</view>
<view class="login-btns">
<view onTap="nailLogin" class="nail-btn" a:if="{{isMode}}">
<view class="img">
<image mode="widthFix" src="/static/login/nail.png" />
</view>
<view>钉钉授权登录</view>
</view>
<view onTap="checkPhone" a:if="{{!isMode}}">获取验证码</view>
</view>
</view>
<view class="{{noPositin ?'login-mode noPositin':'login-mode'}}">
<view class="mode-title"><view></view>其他登录方式<view></view></view>
<view class="mode-item">
<view onTap="changeMode">
<view class="img">
<view>
<image mode="widthFix" src="/static/login/nail.png" />
</view>
</view>
<text class="{{isMode?'active':''}}">当前登录方式</text>
</view>
<view onTap="changeMode">
<view class="img">
<view>
<image mode="widthFix" src="/static/login/phone.png" />
</view>
</view>
<text class="{{isMode?'':'active'}}">当前登录方式</text>
</view>
</view>
</view>
</view>
<!-- 提示框 -->
<view class="addr-select-bg" a:if="{{openAgreement}}"></view>
<view class="toast" a:if="{{openAgreement}}">
<text>您还未阅读并同意授权!</text>
</view>
<!-- 钉钉授权登录弹窗 -->
<view class="addr-select-bg" a:if="{{openEmpower}}"></view>
<view class="nail-popup" a:if="{{openEmpower}}">
<view class="nail-popup-title">
<view class="img">
<view>
<image mode="widthFix" src="/static/login/logo.png" />
</view>
</view>
<view class="txt">有谱志愿</view>
<text>申请</text>
</view>
<text>获取您的钉钉昵称</text>
<view class="nick-name">
<text>钉钉昵称</text>
<view>
{{nickName}}
<view>
<image a:if="{{nickName}}" mode="widthFix" src="/static/login/green-yes.png" />
</view>
</view>
</view>
<view class="nail-popup-btns">
<view onTap="isEmpower">同意</view>
<view onTap="noEmpower">拒绝</view>
</view>
</view>
<!-- 提示框 -->
<view class="addr-select-bg" a:if="{{isToast}}"></view>
<view class="toast" a:if="{{isToast}}">
<view>{{toastText}}</view>
</view>
<!-- 手机验证弹窗 -->
<view class="my-confirm-bg" a:if="{{openPhoneTips}}"></view>
<view class="my-confirm my-confirm2" a:if="{{openPhoneTips}}">
<text>{{tipsMsg}}</text>
<view class="confirm-btns">
<view onTap="phoneLogin">是</view>
<view onTap="closePhone">否</view>
</view>
</view>
</view>
</view>

201
pages/login/login.js Normal file
View File

@ -0,0 +1,201 @@
Page({
data: {
tipsMsg: '',
toastText: '',
isChecked: true,
isToast: false,
isMode: true, //登录方式
openAgreement: false, //阅读协议弹窗
isAgreement: true, //阅读协议状态
openEmpower: false, //钉钉授权状态
openPhoneTips: false, //验证手机号弹出框
phoneNumber: "",
phone: "",
noPositin: false,
defaultPhoneHeight : '0', //默认屏幕高度
nowPhoneHeight : '0', //实时屏幕高度
},
onLoad() {
dd.setNavigationBar({
title: '登录',
backgroundColor: '#FFFFFF',
});
},
changeChecked(){
if(this.data.isChecked == false){
this.setData({
isChecked: true
})
}else{
this.setData({
isChecked: false
})
}
},
changeMode(){
if(this.data.isMode == false){
this.setData({
isMode: true
})
}else{
this.setData({
isMode: false
})
}
},
nailLogin(){
if(this.data.isChecked){
this.setData({
openEmpower: true
})
// 获取免登码
dd.getAuthCode({
success:(res)=>{
// 登录
let params = {
code: res.authCode,
}
dd.$http.post('/api/user/login',params).then(res=>{
console.log(res,'登录认证数据')
this.setData({
nickName: res.data.nickName,
phoneNumber: res.data.mobile
})
// 缓存token
dd.$toolAll.setCache('token',res.data.token);
// 缓存用户信息
dd.$toolAll.setCache('userinfo',res.data);
dd.$toolAll.setCache('centerUserData',res.data);
dd.$toolAll.setCache('userData',res.data);
})
},
fail: (err)=>{
dd.alert({
content: JSON.stringify(err)
})
}
})
}else{
this.setData({
openAgreement: true
})
setTimeout(()=> {
this.setData({
openAgreement: false
})
}, 1500)
}
},
isEmpower(){
this.setData({
openEmpower: false
})
if(dd.$toolAll.getCache('userinfo').mobile !== ''){
// 跳转页面
dd.navigateTo ({
url: '/pages/home/home'
})
}else{
// 跳转到绑定手机号页面
dd.navigateTo ({
url: '/pages/login/bind/bind'
})
}
},
noEmpower(){
//删除缓存
dd.$toolAll.removeCache('token');
dd.$toolAll.removeCache('userinfo');
dd.$toolAll.removeCache('centerUserData');
dd.$toolAll.removeCache('userData');
this.setData({
openEmpower: false
})
},
closePhone(){
this.setData({
phoneNumber: '',
openPhoneTips: false,
})
},
bindKeyInput(e) {
this.setData({
phoneNumber: e.detail.value,
});
},
myFocus(){
this.setData({
noPositin: true,
});
},
myBlur(){
this.setData({
noPositin: false,
});
},
// 手机号登录
// 验证手机号是否存在
checkPhone(){
console.log(this.data.phoneNumber,123)
let reg_tel = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
if (this.data.phoneNumber == "") {
this.setData({
toastText: '请填写您的手机号!',
isToast: true
})
setTimeout(()=> {
this.setData({
isToast: false
})
}, 1000)
return false;
} else if (!reg_tel.test(this.data.phoneNumber)) {
this.setData({
toastText: '请正确填写您的手机号!',
isToast: true
})
setTimeout(()=> {
this.setData({
isToast: false
})
}, 1000)
return false;
}
let params = {
phone: this.data.phoneNumber
}
dd.$http.post('/api/user/has-phone-user',params).then(res=>{
console.log(res,'登录认证数据')
if(res.data.registered == 0){
this.phoneLogin();
}else if(res.data.registered == 1){
this.setData({
openPhoneTips: true,
tipsMsg: '账号已存在,是否继续登录'
})
}
})
},
// 手机号登录
phoneLogin() {
let params = {
phone: this.data.phoneNumber,
type: "login",
}
dd.$http.post('/api/common/send-sms-captcha',params).then(res=>{
console.log(res,'验证码数据')
// 跳转页面
dd.navigateTo ({
url: '/pages/login/verification/verification?phone='+this.data.phoneNumber+'&code='+res.data.code
})
})
}
});

3
pages/login/login.json Normal file
View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@ -0,0 +1,97 @@
input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder{
color: #dedede;
}
/* 手机验证码 */
.verification-txt{
padding: 1.2rem .4rem 0;
border-top: .02rem solid #FAFAFA;
}
.verification-txt>.p{
font-size: .4rem;
line-height: 1.5;
}
.verification-txt>.span{
display: block;
font-size: .26rem;
line-height: 1.5;
color: #999999;
margin-top: .2rem;
}
/* 输入验证码 */
.security-code-wrap {
overflow: hidden;
padding: .2rem 0;
position: relative;
}
.security-code-container {
display: flex;
justify-content: space-between;
width: 5.32rem;
}
.field-wrap {
list-style: none;
display: block;
width: .72rem;
height: 1rem;
line-height: 1rem;
font-size: .64rem;
background-color: #fff;
border-bottom: .02rem solid #e0e2e4;
}
.char-field {
display: block;
width: 100%;
text-align: center;
font-style: normal;
}
.input-code {
position: absolute;
left: 0;
top: 0;
width: 5.32rem;
height: 1rem;
opacity: 0;
overflow: visible;
z-index: 1;
}
/* 重获验证码 */
.getCode{
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: .8rem;
margin-top: .4rem;
background-color: #348bff;
border-radius: .16rem;
font-size: .32rem;
color: #FFFFFF;
}
/* 提示框 */
.toast{
width: 3rem;
padding: .2rem .25rem;
background-color: rgba(255,255,255,.8);
color: #333333;
border-radius: .1rem;
font-size: .28rem;
line-height: 1.4;
text-align: center;
position: fixed;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
z-index: 999;
}
.addr-select-bg{
width: 100vw;
height: 100%;
background-color: rgba(0,0,0,.5);
position: fixed;
top: 0;
left: 0;
z-index: 998;
}

View File

@ -0,0 +1,27 @@
<view>
<view class="verification pull-content list-section">
<view class="verification-txt">
<view class="p">输入验证码</view>
<view class="span">验证码已发送至 +86 {{ phoneData }}</view>
<view class="result">
<view class="security-code-wrap">
<view class="code" for="code">
<view class="security-code-container">
<view class="field-wrap" a:for="{{number}}" a:for-index="index">
<text class="char-field">{{ value[index] || placeholder }}</text>
</view>
</view>
</view>
<input class="input-code" onBlur="handleInput" onInput="bindValueInput" id="code" type="text" maxlength="6"/>
</view>
</view>
<view class="span" a:if="{{show}}">{{count}}秒后可重新获取验证码</view>
<view a:else @click="getCode()" class="getCode">获取验证码</view>
</view>
</view>
<!-- 提示框 -->
<view class="addr-select-bg" a:if="{{isToast}}"></view>
<view class="toast" a:if="{{isToast}}">
<view>{{toastText}}</view>
</view>
</view>

View File

@ -0,0 +1,99 @@
Page({
data: {
phoneData: "", //手机号
verification: "", //验证码
value: "",
show: false, //显示获取验证码
count: "", //剩余时间
timer: null,
userType: 0,
placeholder:'-',
number:6,
code:'',
isToast: false,
},
onLoad(options) {
this.setData({
phoneData: options.phone,
code: options.code,
})
dd.setNavigationBar({
title: '手机验证码',
backgroundColor: '#FFFFFF',
});
if (!this.data.timer) {
this.setData({
count: 60,
show: true
})
let that = this;
const countDown = setInterval(() => {
if(that.data.count <= 1){
that.setData({
count:60,
show: false
})
clearInterval(countDown)
return
}
that.data.count --
that.setData({
count: that.data.count,
show: true
})
},1000);
}
},
// 获取验证码
bindValueInput(e){
this.setData({
value: e.detail.value,
});
},
// 输入完成获取数据
handleInput() {
if(this.data.code == this.data.value){
this.hideKeyboard();
}else{
this.setData({
value: '',
toastText: '验证码错误',
isToast: true
});
setTimeout(()=> {
this.setData({
isToast: false
})
}, 1000)
}
},
// 登录
hideKeyboard() {
let params = {
phone: this.data.phoneData,
sms_code: this.data.value,
}
dd.$http.post('/api/user/login-by-Phone',params).then(res=>{
console.log(res,'登录认证数据')
if (res.code == 0) {
// 缓存token
dd.$toolAll.setCache('token',res.data.token);
// 缓存用户信息
dd.$toolAll.setCache('userinfo',res.data);
dd.$toolAll.setCache('centerUserData',res.data);
dd.$toolAll.setCache('userData',res.data);
// 跳转页面
dd.navigateTo ({
url: '/pages/home/home'
})
}
})
},
});

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

View File

@ -0,0 +1,3 @@
<view>
New Page
</view>

View File

@ -0,0 +1,4 @@
Page({
data: {},
onLoad() {},
});

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

View File

@ -0,0 +1,3 @@
<view>
New Page
</view>

View File

@ -0,0 +1,4 @@
Page({
data: {},
onLoad() {},
});

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

25
pages/start/start.acss Normal file
View File

@ -0,0 +1,25 @@
.start {
width: 100%;
min-height: 100vh;
position: relative;
z-index: 999;
}
.start>image {
width: 100%;
min-height: 100vh;
}
.start>text {
display: block;
width: 1rem;
line-height: .54rem;
text-align: center;
color: #FFFFFF;
font-size: .28rem;
border-radius: .27rem;
background-color: #3f5ee0;
position: fixed;
left: .24rem;
top: 1.14rem;
}

6
pages/start/start.axml Normal file
View File

@ -0,0 +1,6 @@
<view>
<view class="start">
<image mode="widthFix" src="/static/start.jpg" />
<text>{{timeNumber}} 秒</text>
</view>
</view>

24
pages/start/start.js Normal file
View File

@ -0,0 +1,24 @@
Page({
data: {
timeNumber: 3
},
onShow(){
setTimeout(() => {
this.setData({
timeNumber:2
})
}, 1000);
setTimeout(() => {
this.setData({
timeNumber:1
})
}, 2000);
setTimeout(() => {
// 前往登录页
dd.redirectTo({url:'/pages/login/login'});
}, 3000);
},
onLoad() {
},
});

3
pages/start/start.json Normal file
View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

BIN
snapshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
static/login/green-yes.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
static/login/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
static/login/nail.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

BIN
static/login/phone.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
static/login/yes.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
static/start.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 456 KiB

1
utils/f2.min.js vendored Normal file

File diff suppressed because one or more lines are too long

106
utils/requst.js Normal file
View File

@ -0,0 +1,106 @@
import config from '/config/config'
const request = (method, url, options) => {
let methods = '';
let headers = {};
// console.log(dd.$toolAll.getCache('token'),'token数据');
switch (method) {
case 'get':
methods = 'GET'
headers = {
'Content-Type': 'application/json; charset=UTF-8',
'Authorization': 'Bearer '+ dd.$toolAll.getCache('token') || ''
}
break;
case 'post':
methods = 'POST'
headers = {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Authorization': 'Bearer '+ dd.$toolAll.getCache('token') || ''
}
break;
case 'postForm':
methods = 'POST'
headers = {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Authorization': 'Bearer '+ dd.$toolAll.getCache('token') || ''
}
break;
}
return new Promise((resolve, reject) => {
dd.httpRequest({
url: config.BASE_URL+url,
method: methods,
data: options,
headers:headers,
success: (res) => {
if (res.status == 200) {
// 返回成功结果
resolve(res.data);
} else {
// 结果失败返回
reject(res);
}
},
fail: (err) => {
// 接口调取失败返回
reject(err);
},
complete: rest => {
// 不管成功与否都要返回
resolve(rest);
}
})
})
}
// 上传文件 封装请求
const uploadFile = (url, options) => {
console.log(options)
return new Promise((resolve, reject) => {
dd.uploadFile({
url: config.BASE_URL+url,
filePath: options.image,
name: 'image',
fileType:'image',
formData: options,
header: {
'Content-Type': 'multipart/form-data;charset=UTF-8',
'Authorization': 'Bearer '+ dd.$toolAll.getCache('token') || ''
},
success: res => {
if (res.statusCode == 200) {
let temp = JSON.parse(res.data)
if (temp.code == 0) {
resolve(temp)
} else {
reject(temp)
}
} else {
reject(res)
}
},
fail(e) {
},
complete: () => {
}
});
})
}
export default {
get: (url, options) => {
return request('get', url, options)
},
// JOSN格式
post: (url, options) => {
return request('post', url, options)
},
// form-data格式
postForm: (url, options) => {
return request('postForm', url, options)
},
// 上传
upload: (url, options) => {
return uploadFile(url, options)
}
}

29
utils/tools.js Normal file
View File

@ -0,0 +1,29 @@
const toolAll = {
// 设置缓存
setCache(key,value){
dd.setStorageSync({
key: key,
data: value,
success: (res)=> {}
});
},
// 执行获取缓存
getCache(key){
return dd.getStorageSync({key}).data;
},
//执行删除缓存
removeCache(key){
return dd.removeStorage({key}).data;
},
// 手机号验证
isPhone(phone){
// 手机号正则表达式
let reg_tel = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
if(!reg_tel.test(phone)){
return true
}
return false
},
}
export default toolAll;

26
utils/utils.js Normal file
View File

@ -0,0 +1,26 @@
import config from '/config/config'
export default {
$http(url, method, data,token) {
return new Promise(function(resolve, reject) {
dd.httpRequest({
url: config.BASE_URL+url,
method: method,
data: data,
headers:{
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Authorization': 'Bearer '+token || ''
},
success: (res) => {
if (res.status == 200) {
resolve(res);
} else {
reject(res);
}
},
fail: () => {
reject();
}
})
})
}
}