Commit cb9d1183 by 李伟康

commit 修改登录

1 parent 19e91f69
......@@ -22,8 +22,8 @@
</view>
</view>
<view class="btn-box">
<!-- v-if="accountLength" -->
<view
v-if="accountLength > 1"
class="btn flex"
@click="changeAccount"
>
......@@ -88,7 +88,8 @@ export default {
_this.stopAudio();
try {
uni.showLoading()
const { code, message } = await uni.$api.userApi.logout()
const { code, message } = await uni.$api.userApi.logout(),
userInfo = uni.$storage.get("userInfo")
console.log(code)
if (code == 0) {
uni.$storage.rm("userInfo");
......@@ -97,7 +98,7 @@ export default {
setTimeout(() => {
uni.hideLoading()
uni.reLaunch({
url: "/pages/common/login",
url: `/pages/common/login?mobile=${userInfo.phone}`,
});
}, 500)
} else throw message
......@@ -149,7 +150,7 @@ export default {
color: #333333;
.sprite-icon {
margin-bottom: 12rpx;
box-shadow:0 0 24rpx 0 #3682ef33;
box-shadow: 0 0 24rpx 0 #3682ef33;
border-radius: 40rpx;
}
.version {
......
......@@ -6,6 +6,7 @@ export default {
try {
let { merchantId, isSuper, uuid } = loginUserObj
if (isSuper) {
uni.$storage.set('accountLength', Date.now())
this.$emit('chooseAccount', loginUserObj)
return
}
......@@ -33,12 +34,14 @@ export default {
merchantName: merchantName
}
})
uni.$storage.set('accountLength', null)
} else if (!result?.length) {
return uni.showToast({
title: '园区店关联的4s店商户账号无效,请联系总部管理员',
icon: 'none',
})
} else {
uni.$storage.set('accountLength', Date.now())
this.$emit('chooseAccount', loginUserObj)
}
})
......
......@@ -17,6 +17,7 @@
<view
:class="['step-item',{'active-item':stepIndex >= index}]"
:key="index"
@click="setStep(index)"
>
<view class="num">
<view class="border"></view>
......@@ -127,6 +128,12 @@ export default {
chooseMerchant (userInfo) {
this.stepIndex = 2
this.$refs.scene.init(userInfo)
},
setStep(index){
let {stepIndex} = this
if(index == 2) return
if(stepIndex > index) this.stepIndex = index
}
}
}
......
......@@ -65,16 +65,21 @@ export default {
uni.$api.userApi.getListSelectAccount().then(res => {
uni.hideLoading()
let { code, data, message } = res
if (code == 0) {
let { loginUserInfoList, sessionId } = data
uni.$storage.set('sessionId', sessionId);
this.loginUserInfoList = loginUserInfoList
this.copyLoginUserInfoList = loginUserInfoList
} else uni.showToast({
title: message,
icon: 'none',
});
this.flag = true
if (code == 21) uni.reLaunch({
url: "/pages/common/login",
})
else {
if (code == 0) {
let { loginUserInfoList, sessionId } = data
uni.$storage.set('sessionId', sessionId);
this.loginUserInfoList = loginUserInfoList
this.copyLoginUserInfoList = loginUserInfoList
} else uni.showToast({
title: message,
icon: 'none',
});
this.flag = true
}
})
},
chooseAccount (item) {
......@@ -117,14 +122,10 @@ export default {
let { data, message } = res,
[userInfo] = data.loginUserInfoList
if (data && userInfo) this.get4SStoreList(userInfo)
// {
// uni.$storage.set('userInfo', userInfo);
//
// }
else uni.showToast({
title: message,
icon: 'none',
});
})
})
},
// 搜索过滤
......
<template>
<view class="layout">
<view class="bg"></view>
<view class="login" :key="dateKey">
<view
class="login"
:key="dateKey"
>
<view class="title">登录</view>
<view class="sub-title">手机号码登录</view>
<view class="input">
......@@ -13,8 +16,15 @@
@blur="input($event, 'mobile')"
/>
<template v-if="mobile">
<view class="icon" @click="mobile = ''">
<icon type="clear" size="16" color="#000"> </icon>
<view
class="icon"
@click="mobile = ''"
>
<icon
type="clear"
size="16"
color="#000"
> </icon>
</view>
</template>
</view>
......@@ -27,19 +37,31 @@
@blur="input($event, 'code')"
/>
<template v-if="code">
<view class="icon" @click="code = ''">
<icon type="clear" size="16" color="#000"> </icon>
<view
class="icon"
@click="code = ''"
>
<icon
type="clear"
size="16"
color="#000"
> </icon>
</view>
</template>
<view
:class="['code-btn', `${count ? 'code-disabled' : ''}`]"
@click="getSmsCode"
>{{ count ? `重新发送(${count}s)` : "获取验证码" }}</view
>
>{{ count ? `重新发送(${count}s)` : "获取验证码" }}</view>
</view>
<button class="btn" @click="login">登录</button>
<button
class="btn"
@click="login"
>登录</button>
<view class="form-footer">
<view class="autoLogin" @click="readingStatus = !readingStatus">
<view
class="autoLogin"
@click="readingStatus = !readingStatus"
>
<uni-icons
:type="`${readingStatus ? 'checkbox-filled' : 'circle'}`"
:size="18"
......@@ -47,7 +69,10 @@
></uni-icons>
我已阅读并同意<text @click.stop="jumpUrl()">《用户隐私协议》</text>
</view>
<view class="autoLogin" @click="noSignIn = !noSignIn">
<view
class="autoLogin"
@click="noSignIn = !noSignIn"
>
<uni-icons
:type="`${noSignIn ? 'checkbox-filled' : 'circle'}`"
:size="18"
......@@ -66,15 +91,16 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/;
export default {
data () {
return {
mobile: '18372203315',
code: '1',
mobile: '',
code: '',
count: '',
noSignIn: true,
readingStatus:true,
dateKey:null
readingStatus: true,
dateKey: null
};
},
onLoad (options) {
if (options.mobile) this.mobile = options.mobile
uni.$storage.rm('accountLength')
const noSignInUuid = uni.$storage.get('noSignInUuid')
if (noSignInUuid) this.autoLogin(noSignInUuid)
......@@ -122,12 +148,13 @@ export default {
}, 1e3);
},
async login () {
const { mobile, code: smsCode, noSignIn,readingStatus } = this;
const { mobile, code: smsCode, noSignIn, readingStatus } = this;
try {
if(!mobile) throw '请输入手机号'
if(!smsCode) throw '请输入验证码'
if(!readingStatus) throw '请阅读用户隐私协议'
if (!mobile) throw '请输入手机号'
if (!phoneRex.test(mobile)) throw '请输入正确的手机号';
if (!smsCode) throw '请输入验证码'
if (!readingStatus) throw '请阅读用户隐私协议'
let params = {
mobile,
code: smsCode
......@@ -156,14 +183,13 @@ export default {
},
// 获取登录账号下园区店列表
getAccountLoginList (loginUserInfoList) {
uni.$storage.set('accountLength', loginUserInfoList?.length)
let stepIndex = loginUserInfoList?.length == 1 ? 1 : 0
uni.navigateTo({
url: `/pages/common/accountItems?stepIndex=${stepIndex}`
})
},
jumpUrl () {
let url = 'https://img01.glsx.com.cn/weapp/resource/saas/app/privacy.html'
let url = 'https://img01.glsx.com.cn/weapp/resource/saas/app/privacy.html'
uni.navigateTo({
url: `/pages/common/webview?url=${url}`
})
......
<template>
<uni-popup
ref="popup"
type="bottom"
border-radius="16px"
>
<view class="kf-box">
<view
class="close flex"
@click="close"
>
<uni-icons
type="closeempty"
:size="18"
color="#1A1A1A"
></uni-icons>
</view>
<view class="title flex">
<view class="sprite-icon icon-qw"></view>
嘀加智慧云
</view>
<view class="info flex">
<view class="text">
<view class="name flex">
云小白 <view class="duty">产品经理</view>
</view>
<view class="content">嘀加智慧云|产品中心</view>
<view class="tool">
<template v-for="(i,index) in tool">
<view
class="tool-item flex"
:key="index"
>
<view :class="['sprite-icon',`icon-kf-${index}`]"></view>
{{i}}
</view>
</template>
</view>
</view>
<view class="qr-box flex">
<image
class="qr"
:src="qr"
/>
使用企业微信扫码
</view>
</view>
</view>
</uni-popup>
</template>
<script type='text/ecmascript-6'>
export default {
name: '',
data () {
return {
tool: ['使用反馈', '功能建议', '心得分享', '吐槽拍砖'],
qr: require('@/assets/images/common/qr.webp')
}
},
mounted () {
},
methods: {
open () {
this.$refs.popup.open("center");
},
close () {
this.$refs.popup.close()
}
}
}
</script>
<style scoped lang='scss'>
.kf-box {
position: relative;
width: 864rpx;
height: 478rpx;
background: #ffffff;
border-radius: 32rpx;
padding: 0 48rpx;
box-sizing: border-box;
.close {
position: absolute;
width: 120rpx;
height: 120rpx;
top: 0;
right: 0;
justify-content: center;
}
.title {
font-weight: 500;
font-size: 32rpx;
padding: 46rpx 0;
.sprite-icon {
margin-right: 16rpx;
}
}
.info {
.name {
position: relative;
width: 480rpx;
font-weight: 600;
font-size: 48rpx;
align-items: baseline;
padding-bottom: 24rpx;
border-bottom: 2rpx solid #e6e6e6;
.duty {
font-weight: 400;
font-size: 28rpx;
margin-left: 16rpx;
}
&::after {
position: absolute;
left: 0;
bottom: -2rpx;
width: 280rpx;
height: 4rpx;
background: #2c66f7;
content: "";
}
}
.content {
padding: 28rpx 0;
font-weight: 500;
font-size: 28rpx;
}
.tool {
display: flex;
flex-wrap: wrap;
&-item {
flex: 50%;
font-size: 28rpx;
color: #666666;
margin-bottom: 20rpx;
.sprite-icon {
margin-right: 8rpx;
}
}
}
}
.qr-box {
margin-left: 48rpx;
flex-shrink: 0;
flex-direction: column;
font-weight: 500;
font-size: 28rpx;
.qr {
width: 240rpx;
height: 240rpx;
margin-bottom: 8rpx;
}
}
}
</style>
\ No newline at end of file
<template>
<uni-popup
ref="popup"
border-radius="20px"
>
<view class="setting-box">
<view
class="close flex"
@click="close"
>
<uni-icons
type="closeempty"
:size="18"
color="#1A1A1A"
></uni-icons>
</view>
<view class="app-info flex">
<view class="sprite-icon icon-logo"></view>
展业助手
<view class="version">
版本号:V{{version}}
</view>
</view>
<view class="btn-box">
<view
v-if="accountLength > 1"
class="btn flex"
@click="changeAccount"
>
切换账号
</view>
<view
class="btn flex logout"
@click="logout"
>退出</view>
</view>
<view
class="a"
@click="jump('agreement')"
>《用户隐私协议》</view>
<view
class="icp flex"
@click="jump('icp')"
>
ICP备案号:苏ICP备18023686号-2A
<view class="sprite-icon icon-arrow-right"></view>
</view>
</view>
</uni-popup>
</template>
<script type='text/ecmascript-6'>
import myClick from "@/mixin/click";
export default {
mixins: [myClick],
name: 'SettingBox',
data () {
return {
accountLength: uni.$storage.get('accountLength'),
version: '',
}
},
mounted () {
this.version = plus?.runtime?.version || '1.0.0'
},
methods: {
open () {
this.$refs.popup.open("center");
},
close () {
this.$refs.popup.close()
},
changeAccount () {
uni.redirectTo({
url: '/pages/common/accountItems'
})
},
// 退出
logout () {
let _this = this
uni.showModal({
title: '温馨提示',
content: '是否退出当前账号?',
confirmColor: '#347BFF',
async success (res) {
if (res.confirm) {
_this.stopAudio();
try {
uni.showLoading()
const { code, message } = await uni.$api.userApi.logout()
console.log(code)
if (code == 0) {
uni.$storage.rm("userInfo");
uni.$storage.rm("sessionId");
uni.$storage.rm("noSignInUuid");
setTimeout(() => {
uni.hideLoading()
uni.reLaunch({
url: "/pages/common/login",
});
}, 500)
} else throw message
} catch (error) {
console.log(error)
uni.hideLoading()
uni.showToast({
title: error,
icon: "none",
});
}
}
}
})
},
jump (type) {
let url = type == 'icp' ? 'https://beian.miit.gov.cn/' : 'https://img01.glsx.com.cn/weapp/resource/saas/app/privacy.html'
uni.navigateTo({
url: `/pages/common/webview?url=${url}`
})
}
}
}
</script>
<style scoped lang='scss'>
.setting-box {
position: relative;
width: 720rpx;
height: 880rpx;
background: #ffffff;
border-radius: 40rpx;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
.close {
position: absolute;
width: 120rpx;
height: 120rpx;
top: 0;
right: 0;
justify-content: center;
}
.app-info {
flex-direction: column;
font-size: 32rpx;
color: #333333;
.sprite-icon {
margin-bottom: 12rpx;
box-shadow:0 0 24rpx 0 #3682ef33;
border-radius: 40rpx;
}
.version {
margin-top: 8rpx;
font-size: 24rpx;
color: #999999;
}
}
.btn-box {
margin-top: 120rpx;
.btn {
width: 384rpx;
height: 64rpx;
background: #3b73ff1a;
border: 2rpx solid transparent;
border-radius: 32rpx;
justify-content: center;
font-size: 28rpx;
color: #3b73ff;
margin-bottom: 16rpx;
}
.logout {
background: #ffffff;
color: #333333;
border: 2rpx solid #e8e8e8;
}
}
.a {
font-size: 24rpx;
color: #2c66f7;
margin: 48rpx 0 16rpx;
}
.icp {
font-size: 24rpx;
color: #999999;
}
}
</style>
\ No newline at end of file
......@@ -169,11 +169,11 @@
<script>
import myClick from "@/mixin/click";
import detail from "../detail/detail";
import KfBox from "./components/KfBox";
import KfBox from "@/components/HomeFrame/components/KfBox";
import { mapMutations } from "vuex";
import NoviceGuide from "@/components/NoviceGuide.vue";
import RecordList from "./components/RecordList.vue";
import SettingBox from "./components/SettingBox";
import SettingBox from "@/components/HomeFrame/components/SettingBox";
export default {
mixins: [myClick],
components: { detail, KfBox, NoviceGuide, RecordList, SettingBox },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!