238 lines
5.3 KiB
Vue
238 lines
5.3 KiB
Vue
|
|
<template>
|
|||
|
|
<view class="page-content my-bg">
|
|||
|
|
<cu-custom class="main-topbar bg-main-oil" bgColor="bg-main-oil">
|
|||
|
|
<block slot="content">星油云站</block>
|
|||
|
|
</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>
|
|||
|
|
</view>
|
|||
|
|
|
|||
|
|
</view>
|
|||
|
|
<view class="pannel">
|
|||
|
|
<view class="bg-white margin padding radius ">
|
|||
|
|
<view class="cu-form-group radius " @tap="routerTo('/pages/login/posLogin/posLogin')">
|
|||
|
|
<view class="title text-black">已有账号登录</view>
|
|||
|
|
<view class="cuIcon-right">
|
|||
|
|
|
|||
|
|
</view>
|
|||
|
|
</view>
|
|||
|
|
<view class="cu-form-group padding-top" @tap="routerTo('/pages/login/login')">
|
|||
|
|
<view class="title text-black">首次认证登录</view>
|
|||
|
|
<view class="cuIcon-right">
|
|||
|
|
|
|||
|
|
</view>
|
|||
|
|
</view>
|
|||
|
|
</view>
|
|||
|
|
|
|||
|
|
<view class="margin-left padding-left-lg">
|
|||
|
|
<text class="text-sm">短信验证码登录</text>
|
|||
|
|
</view>
|
|||
|
|
</view>
|
|||
|
|
<view class="bottom-part">
|
|||
|
|
<service-hotline />
|
|||
|
|
</view>
|
|||
|
|
</view>
|
|||
|
|
</template>
|
|||
|
|
|
|||
|
|
<script>
|
|||
|
|
import cloudSiteApi from '@/api/cloud-site.js'
|
|||
|
|
import loginApi from '@/api/login.js'
|
|||
|
|
export default {
|
|||
|
|
data() {
|
|||
|
|
return {
|
|||
|
|
baseURL: this.global.baseURL,
|
|||
|
|
mainURL: this.global.mainURL,
|
|||
|
|
forcedLogin: true,
|
|||
|
|
oilSiteNo: ''
|
|||
|
|
};
|
|||
|
|
},
|
|||
|
|
created() {
|
|||
|
|
uni.showShareMenu()
|
|||
|
|
// this.loginWeixin()
|
|||
|
|
},
|
|||
|
|
methods: {
|
|||
|
|
routerTo(url) {
|
|||
|
|
uni.navigateTo({
|
|||
|
|
url: url
|
|||
|
|
})
|
|||
|
|
},
|
|||
|
|
loginWeixin() {
|
|||
|
|
uni.login({
|
|||
|
|
provider: 'weixin',
|
|||
|
|
success: loginRes => {
|
|||
|
|
const code = loginRes.code
|
|||
|
|
console.log(code)
|
|||
|
|
loginApi.loginWeixin(code).then(res => {
|
|||
|
|
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
|
|||
|
|
})
|
|||
|
|
} else {
|
|||
|
|
console.log('res', res.code)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
})
|
|||
|
|
},
|
|||
|
|
fail: err => {
|
|||
|
|
console.log(err)
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
nextStep() {
|
|||
|
|
if (this.oilSiteNo) {
|
|||
|
|
cloudSiteApi.verifyOilSite({
|
|||
|
|
oilSiteCode: this.oilSiteNo
|
|||
|
|
}).then(res => {
|
|||
|
|
console.log('oilSiteCode', this.oilSiteNo)
|
|||
|
|
if (res.code === 20000) {
|
|||
|
|
// address: "安徽省合肥市庐阳区大杨镇"
|
|||
|
|
// fuelLogo: null
|
|||
|
|
// linkMan: "符红敏"
|
|||
|
|
// oilSiteCode: "1591260293"
|
|||
|
|
// oilSiteName: "杭州首鸿金融信息服务有限公司"
|
|||
|
|
// phone: "15617055136"
|
|||
|
|
uni.setStorage({
|
|||
|
|
key: 'oilSiteCode',
|
|||
|
|
data: this.oilSiteNo,
|
|||
|
|
success: () => {
|
|||
|
|
console.log('缓存成功')
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
uni.setStorage({
|
|||
|
|
key: 'oilSite',
|
|||
|
|
data: res.data,
|
|||
|
|
success: () => {
|
|||
|
|
console.log('缓存成功')
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
uni.navigateTo({
|
|||
|
|
url: '/pages/Auth/Auth'
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
// uni.setStorage({
|
|||
|
|
// key: 'oilSiteCode',
|
|||
|
|
// data: this.oilSiteNo,
|
|||
|
|
// success: () => {
|
|||
|
|
// console.log('缓存成功')
|
|||
|
|
// }
|
|||
|
|
// })
|
|||
|
|
// uni.navigateTo({
|
|||
|
|
// url: '/pages/Auth/Auth'
|
|||
|
|
// })
|
|||
|
|
} else {
|
|||
|
|
uni.showToast({
|
|||
|
|
title: '请输入云站号',
|
|||
|
|
duration: 3000,
|
|||
|
|
icon: 'none'
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
getMsg() {
|
|||
|
|
uni.requestSubscribeMessage({
|
|||
|
|
tmplIds: ['W5XD3NQVa6knC5jXHeWT8GS7q5CHrDUMY_sF79kLkKk'],
|
|||
|
|
success: (res) => {
|
|||
|
|
console.log(res)
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
},
|
|||
|
|
getUserInfo({
|
|||
|
|
detail
|
|||
|
|
}) {
|
|||
|
|
console.log('三方登录只演示登录api能力,暂未关联云端数据');
|
|||
|
|
console.log('detail', detail)
|
|||
|
|
if (detail.userInfo) {
|
|||
|
|
this.loginLocal(detail.userInfo.nickName);
|
|||
|
|
} else {
|
|||
|
|
uni.showToast({
|
|||
|
|
icon: 'none',
|
|||
|
|
title: '登陆失败'
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
loginLocal(nickName) {
|
|||
|
|
uni.setStorageSync('login_type', 'local')
|
|||
|
|
uni.setStorageSync('username', nickName)
|
|||
|
|
this.toMain(nickName);
|
|||
|
|
},
|
|||
|
|
toMain(userName) {
|
|||
|
|
// this.login(userName)
|
|||
|
|
console.log(userName)
|
|||
|
|
/**
|
|||
|
|
* 强制登录时使用reLaunch方式跳转过来
|
|||
|
|
* 返回首页也使用reLaunch方式
|
|||
|
|
*/
|
|||
|
|
if (this.forcedLogin) {
|
|||
|
|
uni.reLaunch({
|
|||
|
|
url: '/pages/index/index',
|
|||
|
|
success: () => {
|
|||
|
|
console.log('success')
|
|||
|
|
},
|
|||
|
|
fail: err => {
|
|||
|
|
console.log(err)
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
uni.navigateBack();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
</script>
|
|||
|
|
|
|||
|
|
<style scoped>
|
|||
|
|
.page-content {
|
|||
|
|
position: relative;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.logo {
|
|||
|
|
min-width: 100%;
|
|||
|
|
text-align: center;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.logo img {
|
|||
|
|
width: 200upx;
|
|||
|
|
height: 200rpx;
|
|||
|
|
background-size: contain;
|
|||
|
|
margin: auto;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.bottom-bg {
|
|||
|
|
position: sticky;
|
|||
|
|
bottom: 50upx;
|
|||
|
|
}
|
|||
|
|
</style>
|