123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <template>
- <view>
- <view class="w-750 position-relative" style="height: 100vh;">
- <image src="/pages/subpack/static/images/bg-login.jpg" style="width: 100%;height: 100%;" mode="aspectFill">
- </image>
- </view>
- <view class="w-750 position-absolute top-0 left-0" style="height: 100vh;">
- <u-navbar title="特困户看护平台" bg-color="transparent" :left-icon="null"
- :title-style="{fontWeight:'bold'}"></u-navbar>
- <view class="w-750 flex-column align-center" style="margin-top: 1100rpx;">
- <view class="flex-row align-center justify-center"
- style="width: 606rpx;height: 96rpx;background: linear-gradient( 90deg, #2086FF 0%, #305BFF 100%);box-shadow: 0rpx 8rpx 16rpx 0rpx rgba(48,91,255,0.32);border-radius: 50rpx;border: 2rpx solid #FFFFFF;"
- @click="handleLogin">
- <text class="text-white font-md font-weight-500">一键快捷登录</text>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {}
- },
- methods: {
- // 利用code登录
- loginByCode() {
- // 暂时登录成功
- // 跳转去手机号码填写页面
- uni.navigateTo({
- url: '/pages/subpack/pages/bindInfo/bindInfo'
- })
- },
- // 微信登录
- loginByWechat() {
- uni.login({
- provider: 'weixin',
- timeout: 10000,
- success: (res) => {
- console.log('login', res);
- if (res.code) {
- // 利用code登录
- this.loginByCode(res.code);
- } else {
- uni.$u.toast('获取临时票据失败,请稍后再试')
- }
- },
- fail: (err) => {
- console.log('login-Err', err);
- uni.$u.toast('微信登录失败,请退出后再试')
- }
- })
- },
- // 处理登录
- handleLogin() {
- // 获取provider
- uni.getProvider({
- service: 'oauth',
- success: (res) => {
- console.log('getProvider', res);
- if (res.provider.includes('weixin')) {
- // 微信登录
- this.loginByWechat();
- } else {
- uni.$u.toast('请前往微信小程序登录')
- }
- },
- fail: (err) => {
- console.log('getProvider-Err', err);
- uni.$u.toast('登录异常,请检查运行环境')
- }
- })
- }
- // goToPwdLogin(flag) {
- // uni.$u.route('/pages/subpack/common/login-pwd/login-pwd', {
- // flag
- // });
- // }
- }
- }
- </script>
- <style>
- </style>
|