|
|
@@ -1,42 +1,44 @@
|
|
|
<template>
|
|
|
<view style="position: relative;">
|
|
|
- <view class="bg"></view>
|
|
|
- <view class="bg1"></view>
|
|
|
- <view class="content">
|
|
|
- <view class="top">
|
|
|
- <view class="logo">
|
|
|
- <image src="@/static/icon/logo.png" mode=""></image>
|
|
|
+ <block >
|
|
|
+ <view class="bg"></view>
|
|
|
+ <view class="bg1"></view>
|
|
|
+ <view class="content">
|
|
|
+ <view class="top">
|
|
|
+ <view class="logo">
|
|
|
+ <image src="@/static/icon/logo2.png" mode=""></image>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
- </view>
|
|
|
-
|
|
|
- <view style="width: 76%;margin-top: 30rpx;">
|
|
|
- <u-form :model="form" :error-type="['message']" ref="uForm">
|
|
|
- <u-form-item label-position="top" label="账号" prop="phone" label-width="150">
|
|
|
- <u-input :border="false" placeholder="请输入账号" v-model="form.phone" type="number"></u-input>
|
|
|
- </u-form-item>
|
|
|
- <u-form-item label-position="top" label="密码" prop="password" label-width="150">
|
|
|
- <u-input :border="false" placeholder="请输入登录密码" type="password" v-model="form.password">
|
|
|
- </u-input>
|
|
|
- </u-form-item>
|
|
|
- </u-form>
|
|
|
- <view class="text-right margin-top-10 text-sm">
|
|
|
- <text @click="$jump('/pages/login/login')"
|
|
|
- style="margin-left: 20rpx;text-decoration: underline;">手机号快捷登录</text>
|
|
|
+ <view style="width: 76%;margin-top: 30rpx;">
|
|
|
+ <u-form :model="form" :error-type="['message']" ref="uForm">
|
|
|
+ <u-form-item label-position="top" label="账号" prop="phone" label-width="150">
|
|
|
+ <u-input :border="false" placeholder="请输入账号" v-model="form.phone" type="number"></u-input>
|
|
|
+ </u-form-item>
|
|
|
+ <u-form-item label-position="top" label="密码" prop="password" label-width="150">
|
|
|
+ <u-input :border="false" placeholder="请输入登录密码" type="password" v-model="form.password">
|
|
|
+ </u-input>
|
|
|
+ </u-form-item>
|
|
|
+ </u-form>
|
|
|
+ <view class="text-right margin-top-10 text-sm">
|
|
|
+ <text @click="$jump('/pages/login/login')"
|
|
|
+ style="margin-left: 20rpx;">手机号快捷登录</text>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
- </view>
|
|
|
-
|
|
|
- <view style="width: 86%;margin-top: 120rpx;">
|
|
|
- <view @click="login" class="btn cu-btn round" style="width:100%;height: 90rpx;font-size: 36rpx;">
|
|
|
- 立即登录
|
|
|
+
|
|
|
+ <view style="width: 86%;margin-top: 120rpx;">
|
|
|
+ <view @click="login" class="btn cu-btn round" style="width:100%;height: 90rpx;font-size: 36rpx;">
|
|
|
+ 立即登录
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view class="flex justify-between text-sm" style="margin: 30rpx 30rpx 0;">
|
|
|
+ <text @click="$jump('/pages/login/forget')">忘记密码</text>
|
|
|
+ <text @click="$jump('/pages/login/register')">注册账号</text>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
-
|
|
|
- <view class="flex justify-between text-sm" style="margin: 30rpx 30rpx 0;">
|
|
|
- <text @click="$jump('/pages/login/forget')">忘记密码</text>
|
|
|
- <text @click="$jump('/pages/login/register')">注册账号</text>
|
|
|
- </view>
|
|
|
-
|
|
|
</view>
|
|
|
- </view>
|
|
|
+ </block>
|
|
|
+ <toast ref="toast" ></toast>
|
|
|
+ <loading ref="loading" type="3" />
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
@@ -45,6 +47,8 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ loading:true,
|
|
|
+
|
|
|
customStyle: {
|
|
|
'backgroundColor': '#d18c42',
|
|
|
'color': '#ffffff'
|
|
|
@@ -77,18 +81,23 @@
|
|
|
onReady() {
|
|
|
this.$refs.uForm.setRules(this.rules);
|
|
|
},
|
|
|
- async onLoad() {
|
|
|
+ async onLoad(options) {
|
|
|
+ this.form.phone=options.phone || ''
|
|
|
if (this.$cache.get('phone')) {
|
|
|
+ this.$refs.loading.show("登录中..")
|
|
|
uni.reLaunch({
|
|
|
- url: "/pages/index/index"
|
|
|
+ url: "/pages/index/index",
|
|
|
+ success: () => {
|
|
|
+ this.$refs.loading.hide()
|
|
|
+ }
|
|
|
})
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
login() {
|
|
|
this.$refs.uForm.validate(valid => {
|
|
|
if (valid) {
|
|
|
- this.$dialog.showLoading('登录中..')
|
|
|
this.loginIn()
|
|
|
}
|
|
|
});
|
|
|
@@ -102,17 +111,23 @@
|
|
|
let res = await this.$api.accout.login(p)
|
|
|
this.cacheToken(res.data)
|
|
|
let shopList = res.data.list
|
|
|
- uni.hideLoading()
|
|
|
if (!res.success) {
|
|
|
//登录失败
|
|
|
- this.$u.toast(res.msg)
|
|
|
+ this.$refs.loading.hide()
|
|
|
+ this.$refs.toast.info(res.msg)
|
|
|
return
|
|
|
}
|
|
|
+ this.$refs.loading.showLoading('登录中..')
|
|
|
+ this.loading=true
|
|
|
uni.setStorageSync("phone", this.form.phone)
|
|
|
uni.navigateTo({
|
|
|
url: '/pages/index/index'
|
|
|
})
|
|
|
- this.$u.toast('登录成功')
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.loading=false
|
|
|
+ this.$refs.loading.hide()
|
|
|
+ this.$refs.toast.info('登录成功')
|
|
|
+ },1200)
|
|
|
},
|
|
|
cacheToken(data){
|
|
|
let tokenInfo={
|
|
|
@@ -138,8 +153,6 @@
|
|
|
</style>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
- $color:#d18c42;
|
|
|
-
|
|
|
page {
|
|
|
background-color: #FFFFFF;
|
|
|
}
|
|
|
@@ -157,9 +170,9 @@
|
|
|
position: absolute;
|
|
|
right: -240rpx;
|
|
|
top: -240rpx;
|
|
|
- background-color: #d18c42;
|
|
|
+ background-color: $color;
|
|
|
border-radius: 50%;
|
|
|
- box-shadow: 0rpx 0rpx 50rpx #c5803b;
|
|
|
+ box-shadow: 0rpx 0rpx 50rpx #e28e3f;
|
|
|
}
|
|
|
|
|
|
.bg1 {
|
|
|
@@ -169,7 +182,7 @@
|
|
|
position: absolute;
|
|
|
right: -240rpx;
|
|
|
top: -240rpx;
|
|
|
- background-color: #d18c42;
|
|
|
+ background-color: $color;
|
|
|
border-radius: 50%;
|
|
|
box-shadow: #c6813b;
|
|
|
}
|
|
|
@@ -185,17 +198,9 @@
|
|
|
display: flex;
|
|
|
|
|
|
.logo {
|
|
|
- background-color: $color;
|
|
|
- width: 160rpx;
|
|
|
- height: 160rpx;
|
|
|
- border-radius: 40rpx;
|
|
|
- display: flex;
|
|
|
- justify-content: center;
|
|
|
- align-items: center;
|
|
|
-
|
|
|
image {
|
|
|
- width: 100rpx;
|
|
|
- height: 100rpx;
|
|
|
+ width: 150rpx;
|
|
|
+ height: 150rpx;
|
|
|
}
|
|
|
}
|
|
|
|