Commit 3a74269c authored by caimeng's avatar caimeng

修复多典花贷超首页白屏的问题

parent 0ac8afa9
<script>
import { switchShowTabbar, loadDevice, initSettings, loadLocation, loadNetwork, loadUuid } from '@/utils/index.js'
import { switchShowTabbar, loadDevice, initSettings, ininIndex, initApp, loadLocation, loadNetwork, loadUuid } from '@/utils/index.js'
import config from '@/config/api'
export default {
globalData: {
......@@ -7,7 +7,8 @@ export default {
H5: null,
APP: null
},
onLaunch: function () {
onLaunch: async function () {
// 手机型号
uni.getSystemInfo({
success: function (res) {
......@@ -15,7 +16,7 @@ export default {
uni.setStorageSync('version', res.appVersion)
}
})
// 强制竖屏
plus.screen.lockOrientation("portrait-primary")
......@@ -24,7 +25,7 @@ export default {
// 同意了协议
// if (isAgreePrivacy) {
const common = uni.getStorageSync("m-headers")
if (!common && plus.os.name == 'iOS') {
if (!common && plus.os.name == 'iOS') {
loadNetwork()
loadDevice()
loadLocation()
......@@ -33,10 +34,8 @@ export default {
// }
// 当前版本号
plus.runtime.getProperty(plus.runtime.appid, function (wgtinfo) {
let versionNumber
if (wgtinfo.version) {
versionNumber = wgtinfo.version;
} else {
......@@ -49,16 +48,15 @@ export default {
/*** tabbar*/
switchShowTabbar()
},
async onShow() {
// await initSettings()
async onShow() {
await ininIndex()
await initSettings()
await initApp()
},
/** 切换到后台 */
onHide() {
uni.setStorageSync('canRefreshWeb', 'YES')
},
methods: {
}
}
</script>
......
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
name:"loading"
}
},
onReady() {
uni.showLoading({
title: '加载中...'
});
},
methods: {
}
}
</script>
<style>
</style>
\ No newline at end of file
......@@ -38,7 +38,7 @@ let env = process.env.VUE_APP_BASE_NODE_ENV
*/
// #ifdef APP-PLUS
env = "development";
env = "stest";
// #endif
const api = {
......
......@@ -2,8 +2,8 @@
"name" : "多典花",
"appid" : "__UNI__DE04B13",
"description" : "",
"versionName" : "1.0.4",
"versionCode" : 104,
"versionName" : "1.0.5",
"versionCode" : 105,
"transformPx" : false,
/* 5+App特有相关 */
"app-plus" : {
......
{
"pages": [
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/starPage/index",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": ""
}
},
{
{
"path": "pages/init/index",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "",
"app-plus": {
"animationType": "none"
}
}
},
{
"path": "pages/starPage/index",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": ""
}
},
{
"path": "pages/index/index",
"style": {
"enablePullDownRefresh": false,
......@@ -24,7 +37,7 @@
"navigationBarTitleText": "款式"
}
},
{
"path": "pages/my/index",
"style": {
......@@ -136,13 +149,13 @@
"enablePullDownRefresh": false
}
},
{
"path": "pages/web/face",
"style": {
"navigationBarTitleText": "人脸识别",
"enablePullDownRefresh": false
}
},
{
"path": "pages/web/face",
"style": {
"navigationBarTitleText": "人脸识别",
"enablePullDownRefresh": false
}
},
{
"path": "pages/webview/webview",
"style": {
......@@ -152,26 +165,43 @@
},
{
"path": "pages/websrc/websrc",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/web/web",
"style": {
"navigationStyle": "custom",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"navigationBarTitleText": ""
"navigationBarTitleText": "",
"app-plus": {
"subNVues": [
{
"id": "loadingSubnvue", // 唯一标识
"path": "components/loading", // 页面路径
"type": "popup",
"style": {
"position": "absolute",
"dock": "bottom",
"width": "100rpx",
"height": "150rpx",
"background": "transparent",
"mask": "rgba(0,0,0,0)"
}
}
]
}
}
},
{
"path": "pages/web/websrc",
"style": {
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
},
{
"path": "pages/web/websrc",
"style": {
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
},
{
"path": "pages/bill/indexs",
"style": {
......@@ -219,15 +249,15 @@
}
}
},
{
"path": "uni_modules/uni-frv-external/pages/common/webview/webview",
"style": {
{
"path": "uni_modules/uni-frv-external/pages/common/webview/webview",
"style": {
"enablePullDownRefresh": false,
"navigationBarTitleText": ""
}
}
}
],
],
"tabBar": {
"borderStyle": "white",
"color": "#BBBBBB",
......@@ -239,7 +269,7 @@
"selectedIconPath": "/static/tab/indexf.png",
"text": "首页"
},
{
{
"pagePath": "pages/web/web",
"iconPath": "/static/tab/index-h.png",
"selectedIconPath": "/static/tab/index.png",
......
......@@ -32,7 +32,7 @@
</template>
<script>
import { ininIndex,initApp,initSettings } from '@/utils/index'
import { ininIndex, initApp, initSettings } from '@/utils/index'
export default {
name: "Agreement",
data() {
......@@ -51,7 +51,7 @@ export default {
async onLoad() {
await ininIndex()
await initApp()
await initSettings()
await initSettings()``
await this.init()
},
methods: {
......@@ -72,12 +72,9 @@ export default {
success: function () {
console.log('m-agreement缓存成功')
uni.setStorageSync('appStart', true)
uni.switchTab({
url:"/pages/index/index"
uni.navigateBack({
delta: 1
})
// uni.navigateBack({
// delta: 1
// })
}
})
......
......@@ -3,12 +3,12 @@
<view class='i-header' v-show='isFixed != true'>
<text>多典花</text>
</view>
<view class='i-boxs'>
<view v-if='index !== null' class='i-boxs'>
<!-- Banner 位 -->
<view class='i-banner'>
<swiper :autoplay="true" :interval="3000" :duration="1000" style="height: 359rpx;">
<swiper-item class='swiper-item-i' v-for="(item, index) in bannerList" :key="item.id"
@click='jump(item, index, "banner")'>
<swiper-item class='swiper-item-i' v-for="(item, index) in JSON.parse(index['bannerList'])"
:key="item.id" @click='jump(item, index, "banner")'>
<image :src='item.url' class='banner-item'></image>
</swiper-item>
</swiper>
......@@ -16,7 +16,7 @@
<!-- 金刚位 -->
<view class="i-list">
<view class='mian-item' v-for="(item, index) in list" :key="item.id"
<view class='mian-item' v-for="(item, index) in JSON.parse(index['shortcutList'])" :key="item.id"
@click="jump(item, index, 'diamond')">
<image class='item-img' :src='item.url'></image>
<view class='item-text'>{{ item.name }}</view>
......@@ -88,11 +88,16 @@
</template>
<script>
import { switchShowTabbar, isLogin,initSettings,ininIndex } from '@/utils/index'
import { isLogin, ininIndex } from '@/utils/index'
const cacheIndexData = uni.getStorageSync('dataIndex') ? JSON.parse(uni.getStorageSync('dataIndex')) : null;
export default {
data() {
return {
list: [],
index: cacheIndexData,
hotList: [
{ title: '浏览量', id: 0 },
{ title: '价格', id: 1 },
......@@ -103,7 +108,8 @@ export default {
headerHeight: 0,
scrollTop: 0,
IndexList: [],
bannerList: [],
pageNum: 1,
pageSize: 50,
total: 0,
......@@ -126,40 +132,21 @@ export default {
this.isFixed = false;
}
},
onReady() {
// const systemInfo = uni.getSystemInfoSync();
// if (systemInfo.platform === 'ios') {
// const isAgree = uni.getStorageSync('m-agreement')
// if (!isAgree) {
// this.Go('uni:/pages/agreement/index')
// }
// }
this.isFirstShow = uni.getStorageSync('isFirstShow')
},
async onLoad() {
await this.initAjax();
await this.getAppVersion()
this.isFirstShow = uni.getStorageSync('isFirstShow')
},
async onShow() {
ininIndex()
// 显示隐藏tabBar
switchShowTabbar()
// switchShowTabbar()
// initSettings()
// 首页流量埋点
this.buryingPoint('app:index_page_view')
await this.initAjax();
console.log(this.generateRandomString(),'97666')
// await this.getAppVersion()
},
methods: {
generateRandomString(length = 32) {
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
let result = '';
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * characters.length));
}
return result;
},
// 初始化网络请求
async initAjax() {
await uni.$util.getNetworkException([
......@@ -235,43 +222,22 @@ export default {
// 暂停
pauseClick(data) {
console.log(data, 'ssss')
this.appUpgeadeObj.downloadUrl = ''
},
init() {
const self = this
const {shortcutList,bannerList}=uni.getStorageSync('dataIndex')
// self.$request('/pawn/index', 'GET').then(res => {
// const { shortcutList, bannerList } = res.result
const showIndex = uni.getStorageSync('showIndex')
const token = uni.getStorageSync('token')
if (shortcutList && typeof (shortcutList) == 'string') {
let newArr = []
if (showIndex == true && token) {
self.list = JSON.parse(shortcutList)
} else {
newArr = JSON.parse(shortcutList)
newArr.forEach((item, index) => {
if (item.tager == 'uni:/pages/indexfinance/index,tab') {
newArr.splice(index, 1)
}
})
self.list = newArr
}
}
if (bannerList && typeof (bannerList) == 'string') {
self.bannerList = JSON.parse(bannerList)
}
// }).catch(err => {
// console.log(err, '请求出错')
// })
// 初始Banner位和金刚位
async init() {
try {
const res = await this.$request('/pawn/index', 'GET');
if (res.success) uni.setStorageSync('dataIndex', JSON.stringify(res.result))
this.index = res.result
} catch (err) {
console.log(err, '请求出错')
}
},
goDetail(item) {
// 首页流量埋点
this.buryingPoint('app:index_product_click')
uni.navigateTo({
url: '/pages/productDetails/productDetails?mydata=' + encodeURIComponent(JSON.stringify({ goodId: item.id }))
})
......@@ -369,6 +335,7 @@ export default {
this.pageNum = this.pageNum + 1
this.searchGood();
},
//wgt更新
updateWgt(downloadUrl, newVersion) {
uni.showModal({
......
.stat-page{
width: 100%;
height: 100vh;
background: url('../../static/img/star-page.png') 0 0 no-repeat;
background-size: 100% 100vh;
.start-btn{
position: fixed;
bottom:290rpx;
margin:0 94rpx;
width: 561rpx;
height: 93rpx;
background: #2263E6;
box-shadow: 0rpx 4rpx 15rpx 0rpx rgba(116,178,251,0.5);
border-radius: 47rpx;
font-family: PingFangSC, PingFang SC;
font-weight: 500;
font-size: 32rpx;
color: #FFFFFF;
line-height: 93rpx;
letter-spacing: 5rpx;
text-align: center;
font-style: normal;
}
}
\ No newline at end of file
<template></template>
<script>
export default {
async onLoad() {
const appStart = uni.getStorageSync('appStart')
console.log(appStart,'ri ')
if (appStart) {
uni.switchTab({
url: "/pages/index/index"
})
} else {
uni.redirectTo({
url: "/pages/starPage/index"
})
}
},
}
</script>
<style src="./index.less" lang="less" scoped></style>
\ No newline at end of file
<template>
<view class='stat-page'>
<view class='start-btn' @click='goStart'>立即启动</view>
<view class='start-btn' @click='start'>立即启动</view>
</view>
</template>
<script>
import { ininIndex,initSettings,initApp } from '@/utils/index'
import config from '@/config/api'
import API from '@/server/common'
export default {
data() {
return {
import { ininIndex, initSettings, initApp } from '@/utils/index'
export default {
async onLoad() {
await ininIndex()
await initSettings()
await initApp()
// 有网络了再弹窗
uni.getNetworkType({
success: async function (res) {
if (res.networkType !== 'none') {
this.init()
}
}
},
onReady() {
const appStart = uni.getStorageSync('appStart')
console.log(appStart,'appStart')
if(appStart==true){
uni.switchTab({
url:"/pages/index/index"
})
});
// 监听网络变化,如果
uni.onNetworkStatusChange(async (res) => {
if (res.isConnected) {
await ininIndex()
await initSettings()
await initApp()
this.init()
}
},
async onLoad() {
await ininIndex()
await initSettings()
await initApp()
},
methods: {
goStart(){
const systemInfo = uni.getSystemInfoSync();
if (systemInfo.platform === 'ios') {
const isAgree = uni.getStorageSync('m-agreement')
if (!isAgree) {
this.Go('uni:/pages/agreement/index')
}
}else{
uni.setStorageSync('appStart', true)
uni.switchTab({
url:"/pages/index/index"
})
})
},
methods: {
init() {
const systemInfo = uni.getSystemInfoSync();
if (systemInfo.platform === 'ios') {
const isAgree = uni.getStorageSync('m-agreement')
if (!isAgree) {
this.Go('uni:/pages/agreement/index')
}
}
},
async onShow() {
await ininIndex()
await initSettings()
await initApp()
// 点击跳转到首页
start() {
uni.getNetworkType({
success: async function (res) {
if (res.networkType !== 'none') {
uni.setStorageSync('appStart', true)
uni.switchTab({
url: "/pages/index/index"
})
} else {
uni.showModal({
title: "系统提示",
content: "当前设备无网络或网络弱,请检查网络状态",
success: function (res) {
if (res.confirm) {
plus.runtime.restart();
} else if (res.cancel) {
if (uni.getSystemInfoSync().platform === 'ios') {
plus.ios.import('UIApplication').sharedApplication().performSelector('exit');
} else {
plus.runtime.quit();
}
}
}
})
}
},
})
}
}
}
</script>
<style src="./index.less" lang="less" scoped></style>
\ No newline at end of file
......@@ -6,18 +6,22 @@
<script>
import { loadLocation } from './tools'
import { CheckContactPermission, SelectContact,CheckUniFace } from './authPermission'
import { CheckContactPermission, SelectContact, CheckUniFace } from './authPermission'
import { UploadFile } from './utils/uploads'
import Permission from '@/js_sdk/wa-permission/permission' //权限工具类
import config from '@/config/api'
const LF = uni.requireNativePlugin('AThree-LFv2')
let reloadTimeOut = null
let token = uni.getStorageSync('token')
const H5 = JSON.parse(uni.getStorageSync('H5-SETTING'));
console.log(config['h5'], 'H5地址')
export default {
name: "WEB",
data() {
return {
src: '',
src: config['h5'],
wv: null,
isLogin: token,
canBack: false,
......@@ -65,6 +69,7 @@ export default {
this.wv && this.wv.evalJS(`callback({ 'action': 'OnShow' })`)
},
async onLoad(option) {
this.subnvue_open();
// const mianH5Url = uni.getStorageSync('mianH5Url')
const that = this
console.log(H5.h5Url, '参数666')
......@@ -478,19 +483,19 @@ export default {
},
// 活体认证
async uniFace(config) {
console.log(config,'config')
uni.setStorageSync('userFData',config)
console.log(config, 'config')
uni.setStorageSync('userFData', config)
// 检查相机权限
// if (!this.CheckCamera()) return;
const that = this;
try{
CheckUniFace((data)=>{
try {
CheckUniFace((data) => {
that.GetWebView().evalJS(`receiveUniFace('${JSON.stringify(data)}')`)
})
}catch(err){
} catch (err) {
console.log(err, '获取人脸失败')
}
},
// 获取设备信息
async GetDeviceInfo() {
......@@ -508,7 +513,7 @@ export default {
const that = this;
try {
CheckContactPermission((data) => {
that.GetWebView().evalJS(`receiveContactsBack('${JSON.stringify(data)}')`)
})
} catch (err) {
......
......@@ -56,11 +56,10 @@ export const switchShowTabbar = async () => {
})
} else {
try {
const res= await API.initTabBar()
const { data }=res.result
uni.setStorageSync('showIndex',data)
if (data==true) {
const res = await API.initTabBar()
const { data } = res.result
uni.setStorageSync('showIndex', data)
if (data == true) {
uni.setTabBarItem({
index: 1,
text: '贷款',
......@@ -77,57 +76,50 @@ export const switchShowTabbar = async () => {
}
}
}
//获取h5url地址信息
export const initSettings=async()=>{
// try{
// const res=await API.initSettings()
// const {h5Url}=res.result
// uni.setStorageSync('mianH5Url',h5Url)
// }catch(err){
// console.log(err,'初始化')
// }
const globalData={
WebUrl: config['h5'],
H5: null,
APP: null
}
try {
const { success, result } = await API.initSettings()
if (success) {
globalData.H5 = result
uni.setStorageSync('H5-SETTING', JSON.stringify(result))
}
} catch (err) {
console.log(err, '初始化贷超配置报错')
}
export const initSettings = async () => {
const globalData = {
WebUrl: config['h5'],
H5: null,
APP: null
}
try {
const { success, result } = await API.initSettings()
if (success) {
globalData.H5 = result
uni.setStorageSync('H5-SETTING', JSON.stringify(result))
}
} catch (err) {
console.log(err, '初始化贷超配置报错')
}
}
//获取客服电话贷超
export const initApp=async()=>{
const globalData={
WebUrl: config['h5'],
H5: null,
APP: null
}
try {
const { success, result } = await API.initApp()
if (success) {
console.log(result,'dddd')
globalData.APP = result
uni.setStorageSync('APP-SETTING', JSON.stringify(result))
}
} catch (err) {
console.log(err, '初始化APP配置报错')
}
export const initApp = async () => {
const globalData = {
WebUrl: config['h5'],
H5: null,
APP: null
}
try {
const { success, result } = await API.initApp()
if (success) {
globalData.APP = result
uni.setStorageSync('APP-SETTING', JSON.stringify(result))
}
} catch (err) {
console.log(err, '初始化APP配置报错')
}
}
//首页数据
export const ininIndex=async()=>{
try{
const res=await API.initIndex()
console.log(res,'res')
uni.setStorageSync('dataIndex',res.result)
}catch(err){
console.log(err,'初始化')
}
export const ininIndex = async () => {
try {
const res = await API.initIndex()
if (res.success) uni.setStorageSync('dataIndex', JSON.stringify(res.result))
} catch (err) {
console.log(err, '初始化')
}
}
// 设备信息
export const loadDevice = async () => {
......@@ -168,7 +160,7 @@ export const loadNetwork = () => {
const networkInfo = {
networkStatus: result.networkType
};
// 网络信息存储
uni.setStorage({
key: 'm-network-info',
......
......@@ -44,7 +44,7 @@ const request = async (url, type, data) => {
},
success: (res) => {
// #ifdef APP
// console.log(res, 'response')
console.log(res, 'response')
// #endif
const { data, statusCode } = res;
if (statusCode === 200) {
......
......@@ -26,8 +26,7 @@ export const Jump = function (url, type='navigate') {
default:
console.log("跳转到其它APP 或者 小程序 或者其它的内容")
break;
}
console.log(targetPath,'targetPath')
}
switch (type) {
case 'redirect':
uni.redirectTo({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment