老登陆,经营分析,被挤掉提示
This commit is contained in:
@@ -6,43 +6,36 @@
|
||||
</cu-custom>
|
||||
<view class="bg-img margin flex padding-lg radius align-center text-center" :style="'background-image: url('+mainURL+'login-bg.png)'">
|
||||
<view class="padding-lg margin text-center text-lg text-white w100">
|
||||
<text class="">
|
||||
油站工作人员绑定油站
|
||||
</text>
|
||||
<text class>油站工作人员绑定油站</text>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="pannel">
|
||||
<view class="bg-white margin padding radius shadow-warp">
|
||||
<view class="bg-white margin padding radius shadow-warp">
|
||||
<view class="cu-form-group">
|
||||
<view class="title text-black">手机号</view>
|
||||
<input type="number" v-model="auth.phone" placeholder="请输入手机号" name="input"></input>
|
||||
<input type="number" v-model="auth.phone" placeholder="请输入手机号" name="input" />
|
||||
</view>
|
||||
<view class="cu-form-group padding-top-sm" v-if="showRandom">
|
||||
<view class="title text-black">验证码</view>
|
||||
<input type="number" :maxlength="6" v-model="auth.captcha" placeholder="六位数字验证码" name="input"></input>
|
||||
<button class='cu-btn bg-main-oil shadow' @tap="sendMsg">验证码</button>
|
||||
<input type="number" :maxlength="6" v-model="auth.captcha" placeholder="六位数字验证码" name="input" />
|
||||
<text :class="frozen?'text-gray':'oil-main-color'" @tap="sendMsg">{{tips}}</text>
|
||||
</view>
|
||||
<view class="cu-form-group padding-top-sm" v-else>
|
||||
<view class="title text-black">密码</view>
|
||||
<input inpitype="password" v-model="auth.password" placeholder="请输入登入密码" name="input"></input>
|
||||
<input inpitype="password" v-model="auth.password" placeholder="请输入登入密码" name="input" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="margin-left padding-left-lg" @tap="showRandom=true" v-if="!showRandom">
|
||||
<text class="text-sm">短信验证码登录</text>
|
||||
<view class="margin-right padding-right-lg text-right" @tap="showRandom=true" v-if="!showRandom">
|
||||
<text class="text-sm text-red padding-right">短信验证码登录</text>
|
||||
</view>
|
||||
<view class="margin-left padding-left-lg" @tap="showRandom=false" v-else>
|
||||
<text class="text-sm">密码登录</text>
|
||||
<view class="margin-right padding-right-lg text-right" @tap="showRandom=false" v-else>
|
||||
<text class="text-sm text-red padding-right">密码登录</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="margin-lg padding-lg bottom-bg">
|
||||
<button class="bg-main-oil round" v-if="showRandom" @tap="loginRandom">
|
||||
登录
|
||||
</button>
|
||||
<button class="bg-main-oil round" v-else @tap="loginPwd">
|
||||
登录
|
||||
</button>
|
||||
<view class="margin-lg padding-lg bottom-bg">
|
||||
<button class="bg-main-oil round" v-if="showRandom" @tap="loginRandom">登录</button>
|
||||
<button class="bg-main-oil round" v-else @tap="loginPwd">登录</button>
|
||||
</view>
|
||||
<view class="bottom-part">
|
||||
<service-hotline />
|
||||
@@ -53,6 +46,8 @@
|
||||
<script>
|
||||
import cloudSiteApi from '@/api/cloud-site.js'
|
||||
import loginApi from '@/api/login.js'
|
||||
import md5 from 'js-md5'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -61,7 +56,10 @@
|
||||
forcedLogin: true,
|
||||
oilSiteNo: '',
|
||||
showRandom: true,
|
||||
auth: {}
|
||||
auth: {},
|
||||
tips: '发送验证码',
|
||||
frozen: false // 二维码冷却时间
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@@ -70,19 +68,65 @@
|
||||
},
|
||||
methods: {
|
||||
loginPwd() {
|
||||
const data3 = {
|
||||
username: this.auth.phone,
|
||||
password: this.auth.password,
|
||||
IMEI: 'IMEI',
|
||||
androidMsgId: 'androidMsgId'
|
||||
}
|
||||
loginApi.loginApp(data3).then(res => {
|
||||
console.log('res', res)
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
})
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: loginRes => {
|
||||
const code = loginRes.code
|
||||
console.log(code)
|
||||
console.log('加密', this.auth.password)
|
||||
const data3 = {
|
||||
username: this.auth.phone,
|
||||
password: md5(this.auth.password),
|
||||
code: code
|
||||
}
|
||||
loginApi.loginWeiXinByPassword(data3).then(res => {
|
||||
console.log('res', res)
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
|
||||
console.log('oilSiteCode', this.oilSiteNo)
|
||||
if (res.code === 20000) {
|
||||
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index',
|
||||
fail: (err) => {
|
||||
console.log(err)
|
||||
}
|
||||
})
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'success',
|
||||
duration: 3000
|
||||
})
|
||||
uni.setStorage({
|
||||
key: 'Authorization',
|
||||
data: res.data.accessToken,
|
||||
success: () => {
|
||||
console.log('Authorization成功', res.data.accessToken)
|
||||
}
|
||||
})
|
||||
uni.setStorage({
|
||||
key: 'device',
|
||||
data: res.data.openid,
|
||||
success: () => {
|
||||
console.log('deviceopenid', res.data.openid)
|
||||
}
|
||||
})
|
||||
uni.setStorageSync('userMenu', res.data.loginUser.procedureAuthList)
|
||||
uni.setStorageSync('loginUser', {
|
||||
id: res.data.loginUser.id,
|
||||
name: res.data.loginUser.name
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
fail: err => {
|
||||
console.log(err)
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
loginWeixin() {
|
||||
uni.login({
|
||||
@@ -135,16 +179,43 @@
|
||||
});
|
||||
},
|
||||
sendMsg() {
|
||||
const data2 = {
|
||||
phone: this.auth.phone
|
||||
if (!this.frozen) {
|
||||
if (this.auth.phone) {
|
||||
const data2 = {
|
||||
phone: this.auth.phone
|
||||
}
|
||||
loginApi.loginAppSendSms(data2).then(res => {
|
||||
console.log('res', res)
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
if (res.code === 20000) {
|
||||
this.frozen = true
|
||||
setTimeout(() => {
|
||||
this.frozen = true
|
||||
clearInterval(timer)
|
||||
}, 1000 * 60);
|
||||
let second = 60
|
||||
const timer = setInterval(() => {
|
||||
if (second) {
|
||||
this.tips = `${second}秒后重发`
|
||||
} else {
|
||||
this.tips = `发送验证码`
|
||||
this.disabled = false
|
||||
this.btnColor = '#FE0505'
|
||||
}
|
||||
second--
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '请输入您的账号',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
loginApi.loginAppSendSms(data2).then(res => {
|
||||
console.log('res', res)
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
})
|
||||
},
|
||||
loginRandom() {
|
||||
uni.login({
|
||||
@@ -154,9 +225,9 @@
|
||||
console.log(code)
|
||||
const data2 = {
|
||||
phone: this.auth.phone,
|
||||
username: "mock", //类型:String 必有字段 备注:手机号
|
||||
verifyCode: "mock", //类型:String 必有字段 备注:验证码
|
||||
code: "mock" //类型:String 必有字段 备注:微信code
|
||||
username: this.auth.phone, //类型:String 必有字段 备注:手机号
|
||||
verifyCode: this.auth.captcha, //类型:String 必有字段 备注:验证码
|
||||
code: code //类型:String 必有字段 备注:微信code
|
||||
}
|
||||
loginApi.loginWeiXinSMS(data2).then(res => {
|
||||
console.log('res', res)
|
||||
@@ -164,31 +235,38 @@
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
|
||||
|
||||
console.log('oilSiteCode', this.oilSiteNo)
|
||||
if (res.code === 20000) {
|
||||
// address: "安徽省合肥市庐阳区大杨镇"
|
||||
// fuelLogo: null
|
||||
// linkMan: "符红敏"
|
||||
// oilSiteCode: "1591260293"
|
||||
// oilSiteName: "杭州首鸿金融信息服务有限公司"
|
||||
// phone: "15617055136"
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index',
|
||||
fail: (err) => {
|
||||
console.log(err)
|
||||
}
|
||||
})
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'success',
|
||||
duration: 3000
|
||||
})
|
||||
uni.setStorage({
|
||||
key: 'oilSiteCode',
|
||||
data: this.oilSiteNo,
|
||||
key: 'Authorization',
|
||||
data: res.data.accessToken,
|
||||
success: () => {
|
||||
console.log('缓存成功')
|
||||
console.log('Authorization成功', res.data.accessToken)
|
||||
}
|
||||
})
|
||||
uni.setStorage({
|
||||
key: 'oilSite',
|
||||
data: res.data,
|
||||
key: 'device',
|
||||
data: res.data.openid,
|
||||
success: () => {
|
||||
console.log('缓存成功')
|
||||
console.log('deviceopenid', res.data.openid)
|
||||
}
|
||||
})
|
||||
uni.navigateTo({
|
||||
url: '/pages/Auth/Auth'
|
||||
uni.setStorageSync('userMenu', res.data.loginUser.procedureAuthList)
|
||||
uni.setStorageSync('loginUser', {
|
||||
id: res.data.loginUser.id,
|
||||
name: res.data.loginUser.name
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -197,17 +275,6 @@
|
||||
console.log(err)
|
||||
}
|
||||
});
|
||||
|
||||
// uni.setStorage({
|
||||
// key: 'oilSiteCode',
|
||||
// data: this.oilSiteNo,
|
||||
// success: () => {
|
||||
// console.log('缓存成功')
|
||||
// }
|
||||
// })
|
||||
// uni.navigateTo({
|
||||
// url: '/pages/Auth/Auth'
|
||||
// })
|
||||
|
||||
},
|
||||
getMsg() {
|
||||
|
||||
Reference in New Issue
Block a user