This commit is contained in:
caolc
2022-08-08 09:22:43 +08:00
commit fa1b5f31bd
1535 changed files with 285130 additions and 0 deletions

View File

@@ -0,0 +1,111 @@
<template>
<view>
<view class="form_body" style="">
<view class="form_body_title">
登录账户<br/>
<text class="form_body_title_text">
正在使用账号
</text>
<text style="font-weight: 600;" class="form_body_title_text">{{phone}}</text>
</view>
<view style="margin-top: 49rpx !important;" class="form_body_input">
<view style="color: #999999; flex-shrink: 1;">
<uni-icons type="locked" size="24"></uni-icons>
</view>
<uni-easyinput style="flex-grow: 1 !important;" type="password" v-model="password" placeholder="请输入密码"></uni-easyinput>
</view>
<view @tap="switchFn" class="switch">验证码登录</view>
<view style="margin-top: 32rpx !important;" class="form_body_footer">
<button @tap="sumit" class="form_body_butten">一键登录</button>
</view>
</view>
</view>
</template>
<script>
/*
* @property {String} phone:输入的手机号 通过 onLoad中uni.$on('state')自定义事件 更新值
* @property {String} password: 输入的密码
* @property {Function} switchFn: 切换验证码登录组件
* @property {Function} sumit: 一键登录
*/
import oilIdentityApi from '@/api/oil-identity'
import md5 from 'js-md5'
export default {
props:{
phone:{
type:String,
default:' '
}
},
data() {
return {
password:'',
}
},
onLoad() {
console.log(this.phone)
},
methods: {
switchFn(e){
let that = this
uni.$emit('state',{
state:2,
phone:that.phone
})
},
sumit(){
console.log(this.phone,this.password)
if(this.password==''){
uni.showToast({
title:"密码不能为空",
icon:"none"
})
return
}
let data = {
unionId: uni.getStorageSync('unionid') ,
loginSystem:'OIL_OMS_WEB_MINI ',
username:this.phone,
password: md5(this.password)
}
oilIdentityApi.weChatLoginOilOmsWebMini(data).then(res=>{
if(res.code==20000){
console.log(res)
uni.setStorageSync('Authorization',res.data.authTokenDTO.accessToken)
uni.setStorageSync('accountStatus', res.data.isCompanyAccount)
uni.setStorageSync('user', res.data.authTokenDTO.loginUser)
uni.showToast({
title: res.msg,
icon: 'none',
complete: (err) => {
setTimeout(() => {
uni.redirectTo({
url:'../index/newindex'
})
}, 1000);
}
})
}
})
}
}
}
</script>
<style>
.switch{
font-size: 28rpx;
font-weight: 500;
color: #000000;
margin-top: 21rpx;
margin-left:29rpx;
}
.is-input-border{
border: 0px !important;
}
.form_body_title_text{
font-size: 28rpx;
color: #333333;
}
</style>

View File

@@ -0,0 +1,97 @@
<template>
<view>
<view class="form_body" style="">
<view class="form_body_title">欢迎登录星云台</view>
<view class="form_body_input">
<view style="color: #999999;">+86</view>
<input type="number" v-model="phone" placeholder="请输入手机号" class="form_input" />
</view>
<view class="form_body_footer">
<view class="form_body_footer_text">
<view>
<uni-data-checkbox multiple v-model="value" :localdata="range" @change="change">
</uni-data-checkbox>
</view>
阅读并同意 <text style="color: #2A67FE;">用户隐私政策</text> <text
style="color: #2A67FE;">星油能源注册服务协议</text>
</view>
<button @tap="sumit" style="margin-top:26rpx; " class="form_body_butten">一键登录</button>
</view>
</view>
<uni-popup ref="popup" type="center">
<view class="popup">
<view class="popup_title">为了更好地使用服务<br /><text style="margin-top: 15rpx;">登录前请先阅读并同意下方协议</text></view>
<view class="popup_text">用户隐私政策星油能源注册服务协议</view>
<view class="popup_footer">
<view @tap="ishowFn(0)" class="popup_footer_butteno">不同意</view>
<view @tap="ishowFn(1)" class="popup_footer_buttent">同意并继续</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
import tool from '@/utils/tool'
export default {
data() {
return {
phone:'',
value: [],
range: [{
"value": 0,
"text": ""
}]
}
},
methods: {
ishowFn(e){
if(e){
this.value.push(0)
this.$refs.popup.close()
}else{
this.$refs.popup.close()
}
},
sumit() {
if (this.value.length == 0) {
this.$refs.popup.open('center')
return
}
if(this.phone==''){
uni.showToast({
title:'手机号不能为空',
icon:'none'
})
return
}
let checkPage = {
phone:{
custom:/^[1][3,4,5,7,8,9][0-9]{9}$/,
WrongText:'请输入正确手机号码'
}
}
let check = tool.checkFn({phone:this.phone},[],checkPage)
if(!check.result){
uni.showToast({
title:check.WrongText,
icon:'error'
})
return
}
let that = this
uni.$emit('state',{
state:1,
phone:that.phone
})
},
change(e) {
console.log(this.value)
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,97 @@
<template>
<view>
<view class="form_body" style="">
<view class="form_body_title">
登陆账户<br/>
<text class="form_body_title_text">
验证码已发送至
</text>
<text style="font-weight: 600;" class="form_body_title_text">{{phone}}</text>
</view>
<view style=" background-color: #f0f2ff; border-radius: 0;" class="form_body_input">
<xt-verify-code style="width: 100%;" v-model="verifyCode" @confirm="confirm"></xt-verify-code>
</view>
<view class="switch">
<view @tap="switchFn">密码登录</view>
<view style="font-size: 26rpx;color: #2866FF;" @tap="senFn">{{timer.time==0? timer.timeText:timer.time+'s'}}</view>
</view>
</view>
</view>
</template>
<script>
export default {
props:{
phone:{
type:String,
default:''
}
},
data() {
return {
value: '',
timer:{
time:60,
timeText:'重新发送'
},
verifyCode:'',
range: [{
"value": 0,
"text": ""
}]
}
},
created() {
this.timerFn()
},
methods: {
senFn(){
if(this.timer.time!==0) return;
this.timer.time = 60
this.timerFn()
},
timerFn(){
let that = this
let time = setInterval(() => {
console.log('定时器启动')
that.timer.time--;
if(that.timer.time == 0){
clearInterval(time)
}
}, 1000);
},
switchFn(){
let that = this
uni.$emit('state',{
state:1,
phone:that.phone
})
},
confirm(e){
if(e){
console.log(e)
}
console.log(this.verifyCode,'验证码')
},
sumit(){
console.log(1)
}
}
}
</script>
<style>
.switch{
font-size: 28rpx;
font-weight: 500;
color: #000000;
margin-top: 21rpx;
margin-left:29rpx;
display: flex;
justify-content: space-between;
}
.form_body_title_text{
font-size: 28rpx;
color: #333333;
}
</style>

346
pages/login/login.vue Normal file
View File

@@ -0,0 +1,346 @@
<template>
<view>
<image style=" position:absolute;top: 0;width: 100%; z-index: -1;" mode="widthFix"
src="../../static/loginbg.png"></image>
<starlogin v-show="ishow.state==0" />
<password :phone="phone" v-show="ishow.state==1" />
<verificationCode :phone="phone" v-if="ishow.state==2" />
<view class="other">
<view @click="ishow.state=0" class="ghphone" v-show="ishow.state==2||ishow.state==1">更换手机号登录</view>
<view class="other_title">
<view class="xian" style="flex: 1;"></view>
<view class="xian_text" style="">其他方式登录</view>
<view class="xian" style="flex: 1;"></view>
</view>
<view style="text-align: center;margin-top: 32rpx;">
<button class="wxlogin" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber">
<image class="wx" style="" src="@/static/wxlogo.png"></image>
</button>
</view>
</view>
</view>
</template>
<script>
/*
* @property {String} phone:输入的手机号 通过 onLoad中uni.$on('state')自定义事件 更新值
* @property {Object} ishow:组件展示状态、 state: 0:手机号输入组件 1:密码登录组件 2:验证码登陆组件
* @property {Object} e:微信各种加密数据 包括加密之后的手机号
* @property {String} sessionKey:微信登陆返回的参数
* @property {String} unionId:请求头参数
* @property {String} openId:请求头参数
* @property {String} Authorization:请求头参数
* @property {String} accountStatus:请求头参数
* @property {String} oginSystem: OIL_OMS_WEB_MINI (运营管理) OIL_CMS_WEB_MINI客户运营
* @property {Function} loginFn: 调用微信接口获取code 通过code调用服务端接口换取请求头数据
* @property {Function} autoLogin: 静默登陆方法 判断是否在数据库中绑定过手机号
* @property {Function} decryptPhoneNumber: 微信获取用户手机号回调函数
* @property {Function} bindLoginByPhone: 微信获取用户手机号回调成功后请求手机号登录接口
* @property {Function} loginSuccess: 登陆成功后执行 存储到本地token等数据
*/
import starlogin from './coments/starlogin.vue'
import password from './coments/passwordLogin.vue'
import verificationCode from './coments/verificationCode.vue'
import oilIdentityApi from '@/api/oil-identity'
export default {
components: {
starlogin,
password,
verificationCode
},
data() {
return {
type:0,
sessionKey: '',
ishow: {
state: 0
},
sessionKey: '',
phone: '',
password: ''
}
},
onLoad(e) {
let that = this
uni.$on('state', function(e) {
that.ishow.state = e.state
that.phone = e.phone
})
if(e.type){
this.type = JSON.parse(e.type)
console.log(this.type,e.type,'*-*-')
}
this.loginFn()
},
methods: {
decryptPhoneNumber(e) {
if (e.detail.errMsg === 'getPhoneNumber:ok') {
const data1 = {
...e.detail,
sessionKey: this.sessionKey,
unionId: uni.getStorageSync('unionid'),
openId: uni.getStorageSync('openid'),
loginSystem: 'OIL_OMS_WEB_MINI'
}
this.bindLoginByPhone(data1)
} else {
uni.showModal({
title: '用户拒绝手机号的授权',
content: `请输入手机号码登录,如有疑问,请联系客服处理`
})
}
},
bindLoginByPhone(data) {
oilIdentityApi.bindLoginByPhone(data).then(res => {
if (res.code == 20000) {
this.loginSuccess(res)
}
})
},
loginSuccess(res) {
let resData = res.data
if (resData.authTokenDTO.loginFlag) {
uni.setStorageSync('Authorization', resData.authTokenDTO.accessToken)
uni.setStorageSync('accountStatus', resData.isCompanyAccount)
let user = resData.authTokenDTO.loginUser
uni.setStorageSync('user', user)
uni.showToast({
title: res.msg,
icon: 'none',
complete: (err) => {
setTimeout(() => {
uni.redirectTo({
url:'../index/newindex'
})
}, 1000);
// console.log(err)
}
})
}
},
loginFn() {
uni.clearStorageSync()
if(this.type==1){
uni.setStorageSync('logintype',this.type)
}
uni.login({
provider: 'weixin',
success: (loginRes) => {
const code = loginRes.code
// this.onceCode = code
oilIdentityApi.sendCode({
code: code
}).then(res => {
if (res.code === 20000) {
console.log(res.data,'--------------')
uni.setStorageSync('openid', res.data.openId)
uni.setStorageSync('unionid', res.data.unionId)
this.sessionKey = res.data.sessionKey
uni.setStorageSync('sessionKey', res.data.sessionKey)
this.autoLogin(loginRes)
} else if (res.code == 1002) {
uni.showModal({
title: '微信登录失败提醒',
content: `${res.msg}如有疑问,请联系客服处理`
})
} else {
console.log('res', res.code)
}
}).catch(err => {
})
},
fail: err => {},
})
},
autoLogin(loginRes) {
oilIdentityApi.autoLogin({
code: loginRes.code,
unionId: uni.getStorageSync('unionid'),
loginSystem: 'OIL_OMS_WEB_MINI'
}).then(res => {
if (res.code == 20000) {
this.loginSuccess(res)
}
})
},
sumit() {
if (this.value.length == 0) {
this.$refs.popup.open('center')
}
console.log(this.value)
},
change(e) {
console.log('e:', e);
}
}
}
</script>
<style>
.wxlogin {
background-color: white;
width: 70rpx;
height: 70rpx;
border-radius: 50px;
border: 0px !important;
padding: 0 !important;
}
.ghphone {
text-align: center;
font-size: 28rpx;
margin-bottom: 24rpx;
color: #2866FF;
}
.uni-easyinput__content-input {
height: 100rpx;
}
.popup_footer_buttent {
width: 250rpx;
height: 88rpx;
background: #2866FF;
border-radius: 10rpx;
color: #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
}
.popup_footer_butteno {
width: 250rpx;
height: 88rpx;
border-radius: 10rpx;
color: #333333;
border: 1px solid #BBBBBB;
display: flex;
align-items: center;
justify-content: center;
}
.popup_footer {
display: flex;
justify-content: space-around;
font-size: 32rpx !important;
margin-top: 50rpx;
}
.popup_text {
margin-top: 77rpx;
font-size: 26rpx;
color: #BBBBBB;
line-height: 30rpx;
text-align: center;
}
.popup_title {
font-size: 36rpx;
color: #000000;
padding-top: 69rpx;
text-align: center;
font-weight: 800;
}
.popup {
width: 630rpx;
height: 450rpx;
background: #FFFFFF;
border-radius: 30rpx;
}
.wx {
width: 70rpx;
height: 70rpx;
}
.xian_text {
flex-shrink: 1;
font-size: 20rpx;
color: #999999;
margin: 0 15rpx;
}
.xian {
height: 1px;
background-color: #E3E5E7;
}
.other_title {
display: flex;
align-items: center;
}
.other {
/* margin-top: 257rpx; */
width: 750rpx;
position: absolute;
bottom: 98rpx;
}
.checkbox__inner {
border-radius: 50px !important;
}
.checklist-box {
margin-right: 0px !important;
}
.form_body_footer_text {
font-size: 22rpx;
color: #B6B6B6;
display: flex;
align-items: center;
}
.form_body_footer {
margin-top: 92rpx;
}
.form_body_butten {
width: 650rpx;
height: 100rpx;
background: #2866FF;
border-radius: 10rpx;
color: white;
font-size: 36rpx;
/* margin-top: 24rpx; */
}
.form_body_input {
display: flex;
background-color: #F5F5F5;
margin-top: 50rpx;
border-radius: 50rpx;
padding-left: 28rpx;
align-items: center;
}
.form_input {
padding-left: 20rpx;
height: 100rpx;
}
.is-input-border.data-v-abe12412 {
border: 0px !important;
}
.form_body_title {
font-size: 48rpx;
color: #333333;
font-weight: 600;
margin-left: 31rpx;
}
.form_body {
width: 650rpx;
margin: 0 auto;
margin-top: 421rpx;
}
</style>

156
pages/login/privacy.vue Normal file
View File

@@ -0,0 +1,156 @@
<template>
<view class="privacy_body">
<image style=" position:absolute;top: 0;width: 100%; z-index: -1;" mode="widthFix"
src="../../static/privacy.png"></image>
<view class="logo_body">
<image style="width: 255rpx;height:96rpx;" src="../../static/logo.png"></image>
</view>
<view :style="{opacity:isShow.opacity}" v-show="isShow.step==0" class="tipcontainer">
<view class="tip">
<view class="tip_title" style="">用户协议与隐私政策</view>
<view class="tip_text">
欢迎使用星云台智慧能源结算平台请您
认真阅读并了解最终用户许可协议和隐私
政策已了解我们的服务内容和我们在手
机和使用你个人信息的处理和使用规则
我们将严格按照
<text style="color: #2A67FE;">用户许可协议</text>
<text style="color: #2A67FE;">隐私政策协议</text>
为您提供安全的服务为您
的个人信息安全提供保障
</view>
</view>
<view class="tip_footer">
<button @tap="agree" class="tip_footer_butten">同意</button>
<view class="tip_footer_buttentext">不同意并退出</view>
</view>
</view>
<view :style="{opacity:isShow.opacity}" v-show="isShow.step==1" class="tipcontainer">
<view class="tip">
<view class="tip_title" style="">授权提示</view>
<view style="text-align: initial;color: #000000;font-size: 26rpx; margin-top: 56rpx;">星云台需要获取您以下权限:</view>
<view style="text-align: initial; margin-top:30rpx ;">
<view style="color: #333333;font-weight: 600;">
存储权限
</view>
<view style="color: #666666;">
以支持获取您在扫 码加油时扫描您本地
图片
</view>
</view>
<view style="text-align: initial; margin-top:30rpx ;">
<view style="font-weight: 600;color: #333333;">
位置信息
</view>
<view style="color: #666666;">
以为您提供您附近的加油站信息
</view>
</view>
</view>
<view class="tip_footer">
<button @tap="jump" class="tip_footer_butten">明白了</button>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
imgurl: this.networkResource.baseUrl,
isShow: {
step: 0,
opacity:1
}
}
},
methods: {
jump(){
uni.redirectTo({
url:"./login"
})
},
agree() {
this.isShow.opacity = 0
setTimeout(()=>{
if(this.isShow.step==1){
this.isShow.step = 0
return
}
setTimeout(()=>{
this.isShow.opacity = 1
},500)
this.isShow.step += 1
},1000)
}
}
}
</script>
<style>
.tip_text {
margin: 0 auto;
line-height: 48rpx;
text-align: justify;
width: 494rpx;
margin-top: 56rpx;
}
.tip_title {
margin-top: 59rpx;
font-size: 36rpx;
font-weight: 600;
}
.tip_footer_buttentext {
color: #666666;
margin-top: 44rpx;
}
.tip_footer_butten {
background-color: #2A67FE;
width: 490rpx;
border-radius: 12rpx;
color: white;
}
.tip_footer {
margin-top: 92rpx;
font-size: 30rpx;
}
.tip {
width: 570rpx;
height: 550rpx;
background: #FFFFFF;
box-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.34);
margin: 0 auto;
font-size: 26rpx;
color: #333333;
padding: 59rpx 38rpx 87rpx 38rpx;
box-sizing: content-box;
}
.tipcontainer {
margin-top: 27rpx;
text-align: center;
transition: all 1s;
}
.logo_body {
width: 100vw;
z-index: 1;
padding-top: 245rpx;
}
.privacy_body {
width: 100vw;
height: 100vh;
position: relative;
margin: 0 !important;
padding: 0 !important;
}
</style>