Просмотр исходного кода

h5 短信相关修改

西昌分支
yxq 4 месяцев назад
Родитель
Сommit
e95e9c8e04
9 измененных файлов: 269 добавлений и 123 удалений
  1. +1
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json
  2. +98
    -17
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/firstLogin.vue
  3. +4
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/home.vue
  4. +0
    -1
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/login.vue
  5. +1
    -1
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/my.vue
  6. +39
    -32
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/my/changePhone.vue
  7. +1
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/my/newpassword.vue
  8. +35
    -57
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/my/unboundwx.vue
  9. +90
    -15
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/wxLogin.vue

+ 1
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json Просмотреть файл

@@ -79,6 +79,7 @@
"path": "pages/firstLogin",
"style": {
"navigationBarTitleText": "首次登录",
"navigationStyle": "custom",
"disableScroll": true
}
},


+ 98
- 17
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/firstLogin.vue Просмотреть файл

@@ -1,22 +1,39 @@
<template>
<view class="page">
<view class="content">
<l-input v-model="phone" placeholder="请输入手机号" left :disabled="type != 'sendCode'">
<!-- 标题文字 -->
<view class="main-title">
数字化智慧校园
<!-- <text v-if="DEV" class="margin-left-sm text-red">(开发模式)</text> -->
<text class="text-gray margin-left-sm" style="font-size: 0.7em;">{{ APP_VERSION }}</text>
</view>
<!-- 首页 Logo -->
<view mode="aspectFit" class="logo">
<image src="~@/static/logo.png" mode="widthFix" class="logoImg"></image>
</view>
<l-input v-model="phone" placeholder="请输入手机号" left :disabled="hasSendCode">
<l-icon slot="title" type="phone" />
</l-input>
<view class="inputBtn">
<l-input v-model="verifycode" placeholder="请输入验证码" left password>
<l-input v-model="verifycode" placeholder="请输入验证码" left>
<l-icon slot="title" type="lock" />
</l-input>
<view class="btn" style="margin: 0 0;" @click="sendCode" v-if="type == 'sendCode'">
<view class="btn" @click="sendCode" v-if="!hasSendCode">
发送验证码
</view>
<view class="btn" @click="()=>{time==0&&sendCode()}" v-if="type != 'sendCode'" :style="{opacity:time==0?1:0.5}">
<view class="btn" @click="()=>{time==0&&sendCode()}" v-if="hasSendCode" :style="{opacity:time==0?1:0.5}">
<text>重新发送{{time?'( '+time+ 's'+' )' :''}}</text>
</view>
</view>
<view class="btn" style="width: 100%;margin-top: 24px;" @click="checkverifycode">登录</view>
<view class="btn" style="width: 100%;margin-top: 24px;margin-bottom: 8px;" @click="checkverifycode">登 录</view>
<view class="otherLogin">
<!-- 首次手机号登录 -->
<navigator url="/pages/login">常规登录</text></navigator>
</view>
</view>
<!-- 页面底部版权文字 -->
<view class="footer">{{ copyRightDisplay }}</view>
</view>
</template>

@@ -25,7 +42,7 @@
export default{
data() {
return {
type:'sendCode',
hasSendCode:false,
phone:'',
verifycode:'',
time: 0,
@@ -34,6 +51,15 @@ export default{
codeType:'firstlogin',
}
},
computed: {
// 页面底部公司名、版权信息
copyRightDisplay() {
const year = new Date().getFullYear()
const company = this.CONFIG('company')
return `Copyright © ${year} ${company}`
},
},
destroyed() {
this.timeT && clearInterval(this.timeT)
},
@@ -53,13 +79,14 @@ export default{
if(!res){
return
}
this.type = 'checkCode'
this.TOAST('短信已发送!')
this.hasSendCode = true
this.time = 60
this.timeT = setInterval(() => {
this.time--
if (this.time == 0) {
this.type = 'sendCode'
this.hasSendCode = false
clearInterval(this.timeT)
this.timeT = ''
return
@@ -81,18 +108,24 @@ export default{
return
}
this.LOADING('正在校验...')
let codeResult = await this.HTTP_POST('learun/adms/usernologin/logincodeverify', {
mobile: this.phone,
// 登录
let result = await this.HTTP_POST('learun/adms/user/loginByMobile',{
username:this.phone,
codeType: this.codeType,
verifycode: this.verifycode,
codeType: this.codeType
})
this.HIDE_LOADING()
if(!codeResult)return
// 登录
let result = await this.HTTP_POST('learun/adms/user/loginByMobile',{username:this.phone})
if(!result)return
this.SET_STORAGE("token",result.baseinfo.token)
location.href = "http://" + window.location.host
// location.href = "http://" + window.location.host
if (success.pwd === true) {
this.SET_STORAGE('pwd', true);
this.TOAST("绑定失败!您的密码不满足强度要求,请您先修改密码后再执行系统其他操作");
}
setTimeout(()=>{
location.href = "http://" + window.location.host + "/#/pages/my/newpassword";
},500)
},
},
}
@@ -107,12 +140,60 @@ export default{
align-items: center;
}
.content{
width: 80%;
padding-bottom: 60px;
width: 100%;
padding: 0 18px;
/* padding-bottom: 60px; */
text-align: center;
}
.inputBtn{
background-color: #fff;
display: flex;
align-items: center;
.btn{
margin: 0;
}
}
.otherLogin{
display: flex;
justify-content: right;
color: #2e82ff;
.textBtn{
width: 100px;
color: #606266;
}
}
.logo {
background-size: contain;
height: 120rpx;
width: 120rpx;
text-align: center;
display: inline-block;
border-radius: 5px;
margin-bottom: 20px;
}
.logoImg {
width: 100%;
}
.main-title {
display: block;
margin: 20rpx 0;
color: #555;
font-size: 1.4em;
margin-bottom: 30rpx;
}
.footer {
position: absolute;
left: 0;
right: 0;
bottom: 10px;
bottom: calc(10px + env(safe-area-inset-bottom));
text-align: center;
font-size: 14px;
color: #555;
/* #ifdef MP-ALIPAY */
bottom: 10px;
/* #endif */
}
</style>

+ 4
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/home.vue Просмотреть файл

@@ -193,6 +193,10 @@ export default {
},

async onLoad(param) {
if(this.GET_STORAGE('pwd')){
location.href = "http://" + window.location.host + "/#/pages/my/newpassword";
return
}
await this.init(param);
},



+ 0
- 1
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/login.vue Просмотреть файл

@@ -280,7 +280,6 @@ page {
display: flex;
justify-content: space-between;
margin-top: 4px;
// color: #606266;
color: #2e82ff;
.textBtn{
width: 100px;


+ 1
- 1
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/my.vue Просмотреть файл

@@ -172,7 +172,7 @@ export default {
setTimeout(()=>{
this.CLEAR_GLOBAL()
this.RELAUNCH_TO('/pages/login')
},1000)
},500)
});
}
});


+ 39
- 32
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/my/changePhone.vue Просмотреть файл

@@ -1,42 +1,35 @@
<template>
<view class="page">
<view class="content" v-if="type == 'sendCode'">
<l-input v-model="phone" placeholder="请输入手机号" left>
<view class="content">
<l-input v-model="phone" placeholder="请输入将绑定的手机号" left :disabled="hasSendCode">
<l-icon slot="title" type="phone" />
</l-input>
<view class="btn" @click="sendCode">发送验证码</view>
</view>
<view class="content" v-if="type == 'checkCode'">
<l-input v-model="phone" placeholder="请输入手机号" left disabled>
<l-icon slot="title" type="phone" />
</l-input>
<l-input v-model="verifycode" placeholder="请输入验证码" left password>
<l-icon slot="title" type="lock" />
</l-input>
<view style="margin-top: 4px;color: color: #606266;">
未收到验证码?<text :style="{color:time==0?'#409EFF':'#999'}" @click="()=>{if(time==0)type='sendCode'}">重新发送</text>
{{time?'( '+time+ 's'+' )' :''}}
<view class="inputBtn">
<l-input v-model="verifycode" placeholder="请输入验证码" left>
<l-icon slot="title" type="lock" />
</l-input>
<view class="btn" @click="sendCode" v-if="!hasSendCode">
发送验证码
</view>
<view class="btn" @click="()=>{time==0&&sendCode()}" v-if="hasSendCode" :style="{opacity:time==0?1:0.5}">
<text>重新发送{{time?'( '+time+ 's'+' )' :''}}</text>
</view>
</view>
<view class="btn" @click="checkverifycode">下一步</view>
<view class="btn" style="width: 100%;margin-top: 24px;margin-bottom: 8px;" @click="changePhone">确认更换手机号</view>
</view>
</view>
</template>

<script>
// import moment from 'moment';
export default{
data() {
return {
type:'sendCode',
hasSendCode:false,
phone:'',
verifycode:'',
time: 0,
timeT: '',
form:{
newpassword:'',
newpassword1:'',
},
codeType:'modifymobile',
}
},
@@ -59,12 +52,14 @@ export default{
if(!res){
return
}
this.type = 'checkCode'
this.TOAST('短信已发送!')
this.hasSendCode = true
this.time = 60
this.timeT = setInterval(() => {
this.time--
if (this.time == 0) {
this.hasSendCode = false
clearInterval(this.timeT)
this.timeT = ''
return
@@ -73,26 +68,29 @@ export default{
})
},
// 验证码校验
async checkverifycode() {
async changePhone() {
if(!this.phone){
this.TOAST('请输入手机号!')
return
}else if(!/^1[0-9]{10}$/.test(this.phone)){
this.TOAST('手机号格式不正确!')
return
}
if (!this.verifycode) {
this.TOAST('请输入验证码');
return
}
this.LOADING('正在校验...')
let codeResult = await this.HTTP_POST('learun/adms/user/logincodeverify', {
this.LOADING('正在修改...')
let res = this.HTTP_POST('learun/adms/user/updateMobile',{
mobile: this.phone,
verifycode: this.verifycode,
codeType: this.codeType
})
this.HIDE_LOADING()
if(!codeResult)return
// this.type = 'modifymobile'
let result = await this.HTTP_POST('learun/adms/user/updateMobile?data='+this.phone)
if(!result)return
this.TOAST('修改成功')
if(!res)return
this.TOAST('修改手机号成功!');
setTimeout(()=>{
this.CLEAR_STORAGE()
this.NAV_TO('/pages/login')
this.NAV_BACK()
},500)
},
},
@@ -110,5 +108,14 @@ export default{
.content{
width: 80%;
padding-bottom: 60px;
text-align: center;
}
.inputBtn{
background-color: #fff;
display: flex;
align-items: center;
.btn{
margin: 0;
}
}
</style>

+ 1
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/my/newpassword.vue Просмотреть файл

@@ -69,6 +69,7 @@
this.TOAST('密码修改成功')
setTimeout(() => {
this.CLEAR_GLOBAL()
this.CLEAR_STORAGE()
this.RELAUNCH_TO('/pages/login')
}, 100)
}


+ 35
- 57
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/my/unboundwx.vue Просмотреть файл

@@ -1,42 +1,33 @@
<template>
<view class="page">
<view class="content" v-if="type == 'sendCode'">
<l-input v-model="phone" placeholder="请输入手机号" left>
<l-icon slot="title" type="phone" />
</l-input>
<view class="btn" @click="sendCode">发送验证码</view>
</view>
<view class="content" v-if="type == 'checkCode'">
<l-input v-model="phone" placeholder="请输入手机号" left disabled>
<l-icon slot="title" type="phone" />
</l-input>
<l-input v-model="verifycode" placeholder="请输入验证码" left password>
<l-icon slot="title" type="lock" />
</l-input>
<view style="margin-top: 4px;color: color: #606266;">
未收到验证码?<text :style="{color:time==0?'#409EFF':'#999'}" @click="()=>{if(time==0)type='sendCode'}">重新发送</text>
{{time?'( '+time+ 's'+' )' :''}}
<view class="content">
<view class="inputBtn">
<l-input v-model="verifycode" placeholder="请输入验证码" left>
<l-icon slot="title" type="lock" />
</l-input>
<view class="btn" @click="sendCode" v-if="!hasSendCode">
发送验证码
</view>
<view class="btn" @click="()=>{time==0&&sendCode()}" v-if="hasSendCode" :style="{opacity:time==0?1:0.5}">
<text>重新发送{{time?'( '+time+ 's'+' )' :''}}</text>
</view>
</view>
<view class="btn" @click="checkverifycode">解绑微信</view>
<view class="btn" style="width: 100%;margin-top: 24px;margin-bottom: 8px;" @click="unbindwx">确认解绑</view>
</view>
<!-- 页面底部版权文字 -->
<view class="footer">{{ copyRightDisplay }}</view>
</view>
</template>

<script>
// import moment from 'moment';
export default{
data() {
return {
type:'sendCode',
phone:'',
hasSendCode:false,
verifycode:'',
time: 0,
timeT: '',
form:{
newpassword:'',
newpassword1:'',
},
codeType:'unbindwx',
}
},
@@ -46,25 +37,20 @@ export default{
methods:{
// 发送验证码
sendCode(){
if(!this.phone){
this.TOAST('请输入手机号!')
return
}else if(!/^1[0-9]{10}$/.test(this.phone)){
this.TOAST('手机号格式不正确!')
return
}
this.LOADING()
this.HTTP_POST('learun/adms/user/sendcode',{username:this.phone,codeType:this.codeType}).then(res=>{
this.HTTP_POST('learun/adms/user/sendcode',{codeType:this.codeType}).then(res=>{
this.HIDE_LOADING()
if(!res){
return
}
this.type = 'checkCode'
this.TOAST('短信已发送!')
this.hasSendCode = true
this.time = 60
this.timeT = setInterval(() => {
this.time--
if (this.time == 0) {
this.hasSendCode = false
clearInterval(this.timeT)
this.timeT = ''
return
@@ -73,39 +59,22 @@ export default{
})
},
// 验证码校验
async checkverifycode() {
async unbindwx() {
if (!this.verifycode) {
this.TOAST('请输入验证码');
return
}
this.LOADING('正在校验...')
let codeResult = await this.HTTP_POST('learun/adms/user/logincodeverify', {
mobile: this.phone,
this.LOADING('正在解绑...')
let codeResult = await this.HTTP_POST('learun/adms/user/unbundWeiXin', {
verifycode: this.verifycode,
codeType: this.codeType
})
this.HIDE_LOADING()
if(!codeResult)return
this.unbound()
},
// 解绑微信
unbound(){
this.CONFIRM('提示', '确定要解绑微信账号?', true).then(res => {
if (res) {
this.LOADING('正在解绑…');
this.HTTP_POST('learun/adms/user/unbundWeiXin', null, '解绑失败').then(success => {
this.HIDE_LOADING();
if (!success) {
return
}
this.TOAST("解绑成功")
setTimeout(()=>{
this.CLEAR_GLOBAL()
this.RELAUNCH_TO('/pages/login')
},1000)
});
}
});
this.TOAST('解绑成功!');
setTimeout(()=>{
this.NAV_BACK()
},500)
},
},
}
@@ -122,5 +91,14 @@ export default{
.content{
width: 80%;
padding-bottom: 60px;
text-align: center;
}
.inputBtn{
background-color: #fff;
display: flex;
align-items: center;
.btn{
margin: 0;
}
}
</style>

+ 90
- 15
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/wxLogin.vue Просмотреть файл

@@ -31,12 +31,20 @@
<l-input v-if="ready" v-model="password" placeholder="密码" password left>
<l-icon slot="title" type="lock" />
</l-input>
<l-input v-if="ready" v-model="verifycode" placeholder="请输入验证码" left password>
<l-icon slot="title" type="lock" />
</l-input>
<view class="inputBtn">
<l-input v-model="verifycode" placeholder="请输入验证码" left>
<l-icon slot="title" type="lock" />
</l-input>
<view class="btn" @click="sendCode" v-if="!hasSendCode">
发送验证码
</view>
<view class="btn" @click="()=>{time==0&&sendCode()}" v-if="hasSendCode" :style="{opacity:time==0?1:0.5}">
<text>重新发送{{time?'( '+time+ 's'+' )' :''}}</text>
</view>
</view>
<l-button v-if="ready" @click="loginClick(null)" size="lg" color="blue" class="margin-top-sm block" block>确 认</l-button>
<view class="otherLogin">
<navigator url="/pages/login" class="textBtn">常规登陆</text></navigator>
<navigator url="/pages/login">常规登陆</text></navigator>
</view>
<!-- <l-button v-if="enableSignUp" @click="signUp" size="lg" line="blue" class="margin-top-sm block" block>
教师注册
@@ -78,10 +86,14 @@ export default {
username: '',
password: '',
verifycode:'',
time: 0,
timeT: '',
codeType:'bindwx',
hasSendCode:false,
code:'',

ready: true,
ready: false,
showApiRootSelector: false,

currentApiRoot: '',
@@ -162,24 +174,27 @@ export default {
if(!success){
return
}
// window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + success.appid + "&redirect_uri=" + encodeURIComponent('http://' + window.location.host + '/#/pages/wxLogin') + "&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";
window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + success.appid + "&redirect_uri=" + encodeURIComponent('http://' + window.location.host + '/#/pages/wxLogin') + "&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";
})
}
},
loginClick(){
async loginClick(){
// 点击登录
// 账号密码登录时,验证输入,输入有误则返回
if (!this.check()) {
return
}
// if(!await this.checkverifycode())return
let up = true
var postData = {
username: this.username,
password: this.MD5(this.password),
openid: this.openid,
up: up
up: up,
codeType: this.codeType,
verifycode: this.verifycode,
};
this.LOADING("正在登录,请稍后")
this.HTTP_POST("weixinapi/login", postData).then(success=>{
@@ -192,8 +207,11 @@ export default {
// token: success.baseinfo.token,
// date: moment().format('yyyy-MM-dd hh:mm:ss')
// };
this.SET_STORAGE("token",success.baseinfo.token)
location.href = "http://" + window.location.host
this.TOAST('登陆成功!')
setTimeout(()=>{
this.SET_STORAGE("token",success.baseinfo.token)
location.href = "http://" + window.location.host
},600)
// this.SET_STORAGE('logininfo', logininfo);
// this.SET_STORAGE('userinfo', success);
// this.username = ""
@@ -207,6 +225,54 @@ export default {
// location.href = "http://" + window.location.host + "/#/pages/my/newpassword";
})
},
// 发送验证码
sendCode(){
if(!this.username){
this.TOAST('请输入账号!')
return
}
this.LOADING()
this.HTTP_POST('learun/adms/usernologin/sendcode',{username:this.username,codeType:this.codeType}).then(res=>{
this.HIDE_LOADING()
if(!res){
return
}
this.hasSendCode = true
this.time = 60
this.timeT = setInterval(() => {
this.time--
if (this.time == 0) {
this.hasSendCode = false
clearInterval(this.timeT)
this.timeT = ''
return
}
}, 1000);
})
},
// 验证码校验
async checkverifycode() {
return new Promise(async (resolve)=>{
if (!this.verifycode) {
this.TOAST('请输入验证码');
resolve(false)
return
}
this.LOADING('正在校验...')
let codeResult = await this.HTTP_POST('learun/adms/usernologin/logincodeverify', {
username: this.username,
verifycode: this.verifycode,
codeType: this.codeType
})
this.HIDE_LOADING()
if(!codeResult){
resolve(false)
return
}
resolve(true)
})
},
// 切换后台地址
changeApiRoot(newIndex) {
@@ -282,9 +348,9 @@ export default {

// 验证用户输入
check() {
const { username, password } = this
if (username.length <= 0 || password.length <= 0) {
this.CONFIRM('输入错误', '账号或密码不能为空,请重新输入')
const { username, password, verifycode } = this
if (username.length <= 0 || password.length <= 0 || verifycode.length <= 0) {
this.CONFIRM('输入错误', '账号/密码/验证码不能为空,请重新输入')
return false
}
return true
@@ -370,9 +436,10 @@ page {
.otherLogin{
display: flex;
justify-content: flex-end;
justify-content: right;
margin-top: 4px;
color: #2e82ff;
.textBtn{
width: 100px;
color: #606266;
}
}
@@ -400,4 +467,12 @@ page {
/* #endif */
}
}
.inputBtn{
background-color: #fff;
display: flex;
align-items: center;
.btn{
margin: 0;
}
}
</style>

Загрузка…
Отмена
Сохранить