初始访问登录页面优化

master
gongfuxiang 2023-03-18 23:47:36 +08:00
parent a1f378b7e5
commit b1902de33b
4 changed files with 76 additions and 74 deletions

58
App.vue
View File

@ -59,9 +59,9 @@
//
request_url: 'http://shopxo.com/',
// publicpublichttps://d1.shopxo.vip/public/
static_url: 'https://d1.shopxo.vip/',
static_url: 'http://shopxo.com/',
// default
system_type: 'default',
system_type: 'default-2',
//
application_title: 'ShopXO',
application_describe: '企业级B2C开源电商系统',
@ -385,26 +385,22 @@
if (res.data.code == 0) {
var data = res.data.data;
var client_type = this.application_client_type();
if ((data.is_user_exist || 0) == 1 || client_type == 'weixin') {
uni.setStorage({
key: self.data.cache_user_info_key,
data: data,
success: res => {
if (typeof object === 'object' && (method || null) != null) {
object[method]();
}
},
fail: () => {
self.showToast('用户信息缓存失败');
}
});
if ((data.is_user_exist || 0) == 1 || client_type == 'weixin') {
uni.setStorageSync(self.data.cache_user_info_key, data);
if (typeof object === 'object' && (method || null) != null) {
object[method]();
}
} else {
uni.setStorage({
key: self.data.cache_user_login_key,
data: data
});
if(is_to_auth) {
self.login_to_auth();
uni.setStorageSync(self.data.cache_user_login_key, data);
if(is_to_auth) {
var pages = getCurrentPages();
if(pages[pages.length-1]['route'] == 'pages/login/login') {
if (typeof object === 'object' && (method || null) != null) {
object[method]();
}
} else {
self.login_to_auth();
}
}
}
} else {
@ -477,19 +473,11 @@
dataType: 'json',
success: res => {
uni.hideLoading();
if (res.data.code == 0) {
uni.setStorage({
key: self.data.cache_user_info_key,
data: res.data.data,
success: res => {
if (typeof object === 'object' && (method || null) != null) {
object[method]();
}
},
fail: () => {
self.showToast('用户信息缓存失败');
}
});
if (res.data.code == 0) {
uni.setStorageSync(self.data.cache_user_info_key, res.data.data);
if (typeof object === 'object' && (method || null) != null) {
object[method]();
}
} else {
self.showToast(res.data.msg);
}
@ -1639,7 +1627,7 @@
* 小程序初始化
*/
onLaunch(params) {},
/**
* 小程序页面显示
*/

View File

@ -82,7 +82,7 @@
},
"mp-toutiao" : {
"usingComponents" : true,
"appid" : "",
"appid" : "ttfb628ddf6458b04f",
"setting" : {
"urlCheck" : false
}

View File

@ -8,10 +8,7 @@
/* #ifdef H5 */
min-height: calc(var(--status-bar-height) + 160rpx);
/* #endif */
padding-top: calc(var(--status-bar-height) + 8px);
/* #ifdef MP-TOUTIAO */
padding-top: 0 !important;
/* #endif */
padding-top: calc(var(--status-bar-height) + 8px);
}
.home-top-nav-logo {
text-align: left;
@ -59,7 +56,10 @@
*
*/
.search-fixed-seat {
padding-top: 70rpx;
padding-top: 70rpx;
/* #ifdef MP-TOUTIAO */
padding-top: 60rpx;
/* #endif */
}
.search-content-fixed {
position: fixed !important;
@ -70,7 +70,7 @@
background-repeat: no-repeat;
background-size: 100% auto;
padding-top: 25px;
/* #ifdef H5 || MP-TOUTIAO || APP */
/* #ifdef H5 || APP */
padding-top: 15rpx !important;
padding-bottom: 15rpx !important;
/* #endif */

View File

@ -1,7 +1,7 @@
<template>
<view>
<view class="content">
<block v-if="(home_site_logo_square || null) != null">
<block v-if="(is_exist_base_data || 0) == 1">
<!-- 表单验证码 -->
<view v-if="current_opt_form == 'bind_verify'" class="form-content">
<form @submit="formBind">
@ -103,7 +103,7 @@
<button :class="'verify-submit pa round br text-size-sm cr-base ' + (verify_disabled ? 'sub-disabled' : '')" type="default" hover-class="none" size="mini" :loading="verify_loading" :disabled="verify_disabled" @tap="verify_send_event">{{verify_submit_text}}</button>
</view>
</block>
<!-- 协议 -->
<!-- 协议 -->
<view class="margin-top-xxxl cr-gray">
<view class="dis-inline-block va-m" @tap="agreement_change">
<radio-group class="dis-inline-block va-m" style="transform:scale(0.6)">
@ -147,6 +147,7 @@
<text v-if="home_user_login_type.indexOf('sms') != -1" class="cr-blue" data-value="login_sms" @tap="opt_type_event"></text>
<text v-if="home_user_login_type.indexOf('email') != -1" class="cr-blue" data-value="login_email" @tap="opt_type_event"></text>
</view>
<view v-else class="tc cr-gray padding-vertical-main">暂时关闭了登录</view>
</view>
</form>
</view>
@ -213,6 +214,7 @@
<text v-if="home_user_reg_type.indexOf('sms') != -1" class="cr-blue" data-value="reg_sms" @tap="opt_type_event"></text>
<text v-if="home_user_reg_type.indexOf('email') != -1" class="cr-blue" data-value="reg_email" @tap="opt_type_event"></text>
</view>
<view v-else class="tc cr-gray padding-vertical-main">暂时关闭了注册</view>
</view>
</form>
</view>
@ -311,9 +313,9 @@
</component-popup>
</block>
<view v-else class="margin-top-xxxl padding-top-xxxl tc">
<text class="cr-red">基础数据有误请点击刷新</text>
<text class="cr-red">基础数据有误如未自动加载则请手动点击加载</text>
<view class="margin-top-xl">
<button type="default" size="mini" class="br-main cr-white bg-main dis-inline-block padding-left-xxxl padding-right-xxxl padding-top-sm padding-bottom-sm round" @tap="cache_refresh_event"></button>
<button type="default" size="mini" class="br-main cr-white bg-main dis-inline-block padding-left-xxxl padding-right-xxxl padding-top-sm padding-bottom-sm round" @tap="cache_refresh_event"></button>
</view>
</view>
</view>
@ -344,6 +346,8 @@
verify_image_url: null,
popup_image_verify_status: false,
//
is_refreshed_base_data: 0,
is_exist_base_data: 0,
common_user_onekey_bind_mobile_list: [],
home_site_logo_square: null,
home_user_login_type: [],
@ -418,7 +422,7 @@
},
//
onShow() {
onShow() {
//
this.init_config();
@ -438,19 +442,22 @@
//
var type = (user == null) ? 'auth' : 'bind';
var form = type;
var is_base = (this.home_site_logo_square || null) != null ? 1 : 0;
// #ifdef H5 || APP
if(user == null) {
//
if((this.home_user_login_type || null) != null && this.home_user_login_type.length > 0) {
//
form = 'login';
type = 'login_'+this.home_user_login_type[0];
form = 'login';
//
type = 'login_'+this.home_user_login_type[0];
//
if(this.home_user_login_img_verify_state == 1 || this.common_img_verify_state == 1) {
this.image_verify_event('user_login');
}
}
//
if(this.home_user_login_img_verify_state == 1 || this.common_img_verify_state == 1) {
this.image_verify_event('user_login');
}
} else {
is_base = 0;
}
} else {
//
if (type == 'bind' && !app.globalData.user_is_need_login(user)) {
@ -472,11 +479,18 @@
{
form = this.params.opt_form;
}
//
if(is_base == 0 && this.is_refreshed_base_data == 0) {
this.cache_refresh_event();
}
this.setData({
user: user,
current_opt_type: type,
current_opt_form: form
current_opt_form: form,
is_exist_base_data: is_base,
is_refreshed_base_data: 1,
});
//
@ -495,8 +509,8 @@
init_config(status) {
if ((status || false) == true) {
this.setData({
home_site_logo_square: app.globalData.get_config('config.home_site_logo_square'),
common_user_onekey_bind_mobile_list: app.globalData.get_config('config.common_user_onekey_bind_mobile_list', []),
home_site_logo_square: app.globalData.get_config('config.home_site_logo_square'),
home_user_login_type: app.globalData.get_config('config.home_user_login_type'),
home_user_reg_type: app.globalData.get_config('config.home_user_reg_type'),
home_user_login_img_verify_state: app.globalData.get_config('config.home_user_login_img_verify_state'),
@ -611,7 +625,7 @@
form_input_email_value: e.detail.value
});
},
//
form_input_accounts_event(e) {
this.setData({
@ -625,14 +639,14 @@
form_input_image_verify_value: e.detail.value
});
},
//
popup_image_verify_close_event(e) {
this.setData({
popup_image_verify_status: false
});
},
//
popup_image_verify_submit_event(e) {
this.verify_send_handle();
@ -1230,20 +1244,20 @@
//
if(value == 'login' && this.home_user_login_type.length > 0) {
data['current_opt_type'] = 'login_'+this.home_user_login_type[0];
//
if(this.home_user_login_img_verify_state == 1 || this.common_img_verify_state == 1) {
this.image_verify_event('user_login');
}
data['current_opt_type'] = 'login_'+this.home_user_login_type[0];
//
if(this.home_user_login_img_verify_state == 1 || this.common_img_verify_state == 1) {
this.image_verify_event('user_login');
}
}
//
if(value == 'reg' && this.home_user_reg_type.length > 0) {
data['current_opt_type'] = 'reg_'+this.home_user_reg_type[0];
//
if(this.home_user_register_img_verify_state == 1 || this.common_img_verify_state == 1) {
this.image_verify_event('user_reg');
}
data['current_opt_type'] = 'reg_'+this.home_user_reg_type[0];
//
if(this.home_user_register_img_verify_state == 1 || this.common_img_verify_state == 1) {
this.image_verify_event('user_reg');
}
}
this.setData(data);
@ -1283,7 +1297,7 @@
});
}
},
//
image_verify_event(e) {
var type = (typeof e == 'string') ? e : e.currentTarget.dataset.type || null;
@ -1295,20 +1309,20 @@
});
}
},
//
cache_refresh_event(e) {
app.globalData.init_config();
var self = this;
uni.showLoading({
title: '刷新中...'
title: '加载中...'
});
setTimeout(function() {
self.init();
uni.hideLoading();
}, 3000);
},
//
plugins_thirdpartylogin_event(e) {
//