Commit 3a74269c authored by caimeng's avatar caimeng

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

parent 0ac8afa9
<script> <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' import config from '@/config/api'
export default { export default {
globalData: { globalData: {
...@@ -7,7 +7,8 @@ export default { ...@@ -7,7 +7,8 @@ export default {
H5: null, H5: null,
APP: null APP: null
}, },
onLaunch: function () { onLaunch: async function () {
// 手机型号 // 手机型号
uni.getSystemInfo({ uni.getSystemInfo({
success: function (res) { success: function (res) {
...@@ -33,10 +34,8 @@ export default { ...@@ -33,10 +34,8 @@ export default {
// } // }
// 当前版本号 // 当前版本号
plus.runtime.getProperty(plus.runtime.appid, function (wgtinfo) { plus.runtime.getProperty(plus.runtime.appid, function (wgtinfo) {
let versionNumber let versionNumber
if (wgtinfo.version) { if (wgtinfo.version) {
versionNumber = wgtinfo.version; versionNumber = wgtinfo.version;
} else { } else {
...@@ -49,16 +48,15 @@ export default { ...@@ -49,16 +48,15 @@ export default {
/*** tabbar*/ /*** tabbar*/
switchShowTabbar() switchShowTabbar()
}, },
async onShow() {
// await initSettings()
async onShow() {
await ininIndex()
await initSettings()
await initApp()
}, },
/** 切换到后台 */ /** 切换到后台 */
onHide() { onHide() {
uni.setStorageSync('canRefreshWeb', 'YES') uni.setStorageSync('canRefreshWeb', 'YES')
},
methods: {
} }
} }
</script> </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 ...@@ -38,7 +38,7 @@ let env = process.env.VUE_APP_BASE_NODE_ENV
*/ */
// #ifdef APP-PLUS // #ifdef APP-PLUS
env = "development"; env = "stest";
// #endif // #endif
const api = { const api = {
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
"name" : "多典花", "name" : "多典花",
"appid" : "__UNI__DE04B13", "appid" : "__UNI__DE04B13",
"description" : "", "description" : "",
"versionName" : "1.0.4", "versionName" : "1.0.5",
"versionCode" : 104, "versionCode" : 105,
"transformPx" : false, "transformPx" : false,
/* 5+App特有相关 */ /* 5+App特有相关 */
"app-plus" : { "app-plus" : {
......
{ {
"pages": [ "pages": [
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/init/index",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "",
"app-plus": {
"animationType": "none"
}
}
},
{ {
"path": "pages/starPage/index", "path": "pages/starPage/index",
"style": { "style": {
...@@ -8,6 +20,7 @@ ...@@ -8,6 +20,7 @@
"navigationBarTitleText": "" "navigationBarTitleText": ""
} }
}, },
{ {
"path": "pages/index/index", "path": "pages/index/index",
"style": { "style": {
...@@ -162,7 +175,24 @@ ...@@ -162,7 +175,24 @@
"style": { "style": {
"navigationStyle": "custom", "navigationStyle": "custom",
"enablePullDownRefresh": false, "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)"
}
}
]
}
} }
}, },
{ {
...@@ -226,8 +256,8 @@ ...@@ -226,8 +256,8 @@
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"navigationBarTitleText": "" "navigationBarTitleText": ""
} }
} }
], ],
"tabBar": { "tabBar": {
"borderStyle": "white", "borderStyle": "white",
"color": "#BBBBBB", "color": "#BBBBBB",
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</template> </template>
<script> <script>
import { ininIndex,initApp,initSettings } from '@/utils/index' import { ininIndex, initApp, initSettings } from '@/utils/index'
export default { export default {
name: "Agreement", name: "Agreement",
data() { data() {
...@@ -51,7 +51,7 @@ export default { ...@@ -51,7 +51,7 @@ export default {
async onLoad() { async onLoad() {
await ininIndex() await ininIndex()
await initApp() await initApp()
await initSettings() await initSettings()``
await this.init() await this.init()
}, },
methods: { methods: {
...@@ -72,12 +72,9 @@ export default { ...@@ -72,12 +72,9 @@ export default {
success: function () { success: function () {
console.log('m-agreement缓存成功') console.log('m-agreement缓存成功')
uni.setStorageSync('appStart', true) uni.setStorageSync('appStart', true)
uni.switchTab({ uni.navigateBack({
url:"/pages/index/index" delta: 1
}) })
// uni.navigateBack({
// delta: 1
// })
} }
}) })
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
<view class='i-header' v-show='isFixed != true'> <view class='i-header' v-show='isFixed != true'>
<text>多典花</text> <text>多典花</text>
</view> </view>
<view class='i-boxs'> <view v-if='index !== null' class='i-boxs'>
<!-- Banner 位 --> <!-- Banner 位 -->
<view class='i-banner'> <view class='i-banner'>
<swiper :autoplay="true" :interval="3000" :duration="1000" style="height: 359rpx;"> <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" <swiper-item class='swiper-item-i' v-for="(item, index) in JSON.parse(index['bannerList'])"
@click='jump(item, index, "banner")'> :key="item.id" @click='jump(item, index, "banner")'>
<image :src='item.url' class='banner-item'></image> <image :src='item.url' class='banner-item'></image>
</swiper-item> </swiper-item>
</swiper> </swiper>
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<!-- 金刚位 --> <!-- 金刚位 -->
<view class="i-list"> <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')"> @click="jump(item, index, 'diamond')">
<image class='item-img' :src='item.url'></image> <image class='item-img' :src='item.url'></image>
<view class='item-text'>{{ item.name }}</view> <view class='item-text'>{{ item.name }}</view>
...@@ -88,11 +88,16 @@ ...@@ -88,11 +88,16 @@
</template> </template>
<script> <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 { export default {
data() { data() {
return { return {
list: [], index: cacheIndexData,
hotList: [ hotList: [
{ title: '浏览量', id: 0 }, { title: '浏览量', id: 0 },
{ title: '价格', id: 1 }, { title: '价格', id: 1 },
...@@ -103,7 +108,8 @@ export default { ...@@ -103,7 +108,8 @@ export default {
headerHeight: 0, headerHeight: 0,
scrollTop: 0, scrollTop: 0,
IndexList: [], IndexList: [],
bannerList: [],
pageNum: 1, pageNum: 1,
pageSize: 50, pageSize: 50,
total: 0, total: 0,
...@@ -126,40 +132,21 @@ export default { ...@@ -126,40 +132,21 @@ export default {
this.isFixed = false; 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() { async onLoad() {
await this.initAjax(); this.isFirstShow = uni.getStorageSync('isFirstShow')
await this.getAppVersion()
}, },
async onShow() { async onShow() {
ininIndex() ininIndex()
// 显示隐藏tabBar // 显示隐藏tabBar
switchShowTabbar() // switchShowTabbar()
// initSettings() // initSettings()
// 首页流量埋点 // 首页流量埋点
this.buryingPoint('app:index_page_view') this.buryingPoint('app:index_page_view')
await this.initAjax(); await this.initAjax();
console.log(this.generateRandomString(),'97666') // await this.getAppVersion()
}, },
methods: { 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() { async initAjax() {
await uni.$util.getNetworkException([ await uni.$util.getNetworkException([
...@@ -235,43 +222,22 @@ export default { ...@@ -235,43 +222,22 @@ export default {
// 暂停 // 暂停
pauseClick(data) { pauseClick(data) {
console.log(data, 'ssss')
this.appUpgeadeObj.downloadUrl = '' this.appUpgeadeObj.downloadUrl = ''
}, },
init() { // 初始Banner位和金刚位
const self = this async init() {
const {shortcutList,bannerList}=uni.getStorageSync('dataIndex') try {
const res = await this.$request('/pawn/index', 'GET');
// self.$request('/pawn/index', 'GET').then(res => { if (res.success) uni.setStorageSync('dataIndex', JSON.stringify(res.result))
// const { shortcutList, bannerList } = res.result this.index = res.result
const showIndex = uni.getStorageSync('showIndex') } catch (err) {
const token = uni.getStorageSync('token') console.log(err, '请求出错')
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, '请求出错')
// })
}, },
goDetail(item) { goDetail(item) {
// 首页流量埋点 // 首页流量埋点
this.buryingPoint('app:index_product_click') this.buryingPoint('app:index_product_click')
uni.navigateTo({ uni.navigateTo({
url: '/pages/productDetails/productDetails?mydata=' + encodeURIComponent(JSON.stringify({ goodId: item.id })) url: '/pages/productDetails/productDetails?mydata=' + encodeURIComponent(JSON.stringify({ goodId: item.id }))
}) })
...@@ -369,6 +335,7 @@ export default { ...@@ -369,6 +335,7 @@ export default {
this.pageNum = this.pageNum + 1 this.pageNum = this.pageNum + 1
this.searchGood(); this.searchGood();
}, },
//wgt更新 //wgt更新
updateWgt(downloadUrl, newVersion) { updateWgt(downloadUrl, newVersion) {
uni.showModal({ 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> <template>
<view class='stat-page'> <view class='stat-page'>
<view class='start-btn' @click='goStart'>立即启动</view> <view class='start-btn' @click='start'>立即启动</view>
</view> </view>
</template> </template>
<script> <script>
import { ininIndex,initSettings,initApp } from '@/utils/index' import { ininIndex, initSettings, initApp } from '@/utils/index'
import config from '@/config/api' export default {
import API from '@/server/common' async onLoad() {
export default {
data() {
return {
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"
})
} }
}, });
async onLoad() {
// 监听网络变化,如果
uni.onNetworkStatusChange(async (res) => {
if (res.isConnected) {
await ininIndex() await ininIndex()
await initSettings() await initSettings()
await initApp() await initApp()
this.init()
}
})
}, },
methods: { methods: {
goStart(){ init() {
const systemInfo = uni.getSystemInfoSync(); const systemInfo = uni.getSystemInfoSync();
if (systemInfo.platform === 'ios') { if (systemInfo.platform === 'ios') {
const isAgree = uni.getStorageSync('m-agreement') const isAgree = uni.getStorageSync('m-agreement')
if (!isAgree) { if (!isAgree) {
this.Go('uni:/pages/agreement/index') this.Go('uni:/pages/agreement/index')
} }
}else{ }
},
// 点击跳转到首页
start() {
uni.getNetworkType({
success: async function (res) {
if (res.networkType !== 'none') {
uni.setStorageSync('appStart', true) uni.setStorageSync('appStart', true)
uni.switchTab({ uni.switchTab({
url:"/pages/index/index" 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();
}
} }
}
})
} }
}, },
async onShow() {
await ininIndex() })
await initSettings()
await initApp()
} }
} }
}
</script> </script>
<style src="./index.less" lang="less" scoped></style> <style src="./index.less" lang="less" scoped></style>
\ No newline at end of file
...@@ -6,18 +6,22 @@ ...@@ -6,18 +6,22 @@
<script> <script>
import { loadLocation } from './tools' import { loadLocation } from './tools'
import { CheckContactPermission, SelectContact,CheckUniFace } from './authPermission' import { CheckContactPermission, SelectContact, CheckUniFace } from './authPermission'
import { UploadFile } from './utils/uploads' import { UploadFile } from './utils/uploads'
import Permission from '@/js_sdk/wa-permission/permission' //权限工具类 import Permission from '@/js_sdk/wa-permission/permission' //权限工具类
import config from '@/config/api'
const LF = uni.requireNativePlugin('AThree-LFv2') const LF = uni.requireNativePlugin('AThree-LFv2')
let reloadTimeOut = null let reloadTimeOut = null
let token = uni.getStorageSync('token') let token = uni.getStorageSync('token')
const H5 = JSON.parse(uni.getStorageSync('H5-SETTING')); const H5 = JSON.parse(uni.getStorageSync('H5-SETTING'));
console.log(config['h5'], 'H5地址')
export default { export default {
name: "WEB", name: "WEB",
data() { data() {
return { return {
src: '', src: config['h5'],
wv: null, wv: null,
isLogin: token, isLogin: token,
canBack: false, canBack: false,
...@@ -65,6 +69,7 @@ export default { ...@@ -65,6 +69,7 @@ export default {
this.wv && this.wv.evalJS(`callback({ 'action': 'OnShow' })`) this.wv && this.wv.evalJS(`callback({ 'action': 'OnShow' })`)
}, },
async onLoad(option) { async onLoad(option) {
this.subnvue_open();
// const mianH5Url = uni.getStorageSync('mianH5Url') // const mianH5Url = uni.getStorageSync('mianH5Url')
const that = this const that = this
console.log(H5.h5Url, '参数666') console.log(H5.h5Url, '参数666')
...@@ -478,16 +483,16 @@ export default { ...@@ -478,16 +483,16 @@ export default {
}, },
// 活体认证 // 活体认证
async uniFace(config) { async uniFace(config) {
console.log(config,'config') console.log(config, 'config')
uni.setStorageSync('userFData',config) uni.setStorageSync('userFData', config)
// 检查相机权限 // 检查相机权限
// if (!this.CheckCamera()) return; // if (!this.CheckCamera()) return;
const that = this; const that = this;
try{ try {
CheckUniFace((data)=>{ CheckUniFace((data) => {
that.GetWebView().evalJS(`receiveUniFace('${JSON.stringify(data)}')`) that.GetWebView().evalJS(`receiveUniFace('${JSON.stringify(data)}')`)
}) })
}catch(err){ } catch (err) {
console.log(err, '获取人脸失败') console.log(err, '获取人脸失败')
} }
......
...@@ -56,11 +56,10 @@ export const switchShowTabbar = async () => { ...@@ -56,11 +56,10 @@ export const switchShowTabbar = async () => {
}) })
} else { } else {
try { try {
const res= await API.initTabBar() const res = await API.initTabBar()
const { data }=res.result const { data } = res.result
uni.setStorageSync('showIndex',data) uni.setStorageSync('showIndex', data)
if (data==true) { if (data == true) {
uni.setTabBarItem({ uni.setTabBarItem({
index: 1, index: 1,
text: '贷款', text: '贷款',
...@@ -77,16 +76,10 @@ export const switchShowTabbar = async () => { ...@@ -77,16 +76,10 @@ export const switchShowTabbar = async () => {
} }
} }
} }
//获取h5url地址信息 //获取h5url地址信息
export const initSettings=async()=>{ export const initSettings = async () => {
// try{ const globalData = {
// const res=await API.initSettings()
// const {h5Url}=res.result
// uni.setStorageSync('mianH5Url',h5Url)
// }catch(err){
// console.log(err,'初始化')
// }
const globalData={
WebUrl: config['h5'], WebUrl: config['h5'],
H5: null, H5: null,
APP: null APP: null
...@@ -101,9 +94,10 @@ export const initSettings=async()=>{ ...@@ -101,9 +94,10 @@ export const initSettings=async()=>{
console.log(err, '初始化贷超配置报错') console.log(err, '初始化贷超配置报错')
} }
} }
//获取客服电话贷超 //获取客服电话贷超
export const initApp=async()=>{ export const initApp = async () => {
const globalData={ const globalData = {
WebUrl: config['h5'], WebUrl: config['h5'],
H5: null, H5: null,
APP: null APP: null
...@@ -111,7 +105,6 @@ export const initApp=async()=>{ ...@@ -111,7 +105,6 @@ export const initApp=async()=>{
try { try {
const { success, result } = await API.initApp() const { success, result } = await API.initApp()
if (success) { if (success) {
console.log(result,'dddd')
globalData.APP = result globalData.APP = result
uni.setStorageSync('APP-SETTING', JSON.stringify(result)) uni.setStorageSync('APP-SETTING', JSON.stringify(result))
} }
...@@ -120,13 +113,12 @@ export const initApp=async()=>{ ...@@ -120,13 +113,12 @@ export const initApp=async()=>{
} }
} }
//首页数据 //首页数据
export const ininIndex=async()=>{ export const ininIndex = async () => {
try{ try {
const res=await API.initIndex() const res = await API.initIndex()
console.log(res,'res') if (res.success) uni.setStorageSync('dataIndex', JSON.stringify(res.result))
uni.setStorageSync('dataIndex',res.result) } catch (err) {
}catch(err){ console.log(err, '初始化')
console.log(err,'初始化')
} }
} }
// 设备信息 // 设备信息
......
...@@ -44,7 +44,7 @@ const request = async (url, type, data) => { ...@@ -44,7 +44,7 @@ const request = async (url, type, data) => {
}, },
success: (res) => { success: (res) => {
// #ifdef APP // #ifdef APP
// console.log(res, 'response') console.log(res, 'response')
// #endif // #endif
const { data, statusCode } = res; const { data, statusCode } = res;
if (statusCode === 200) { if (statusCode === 200) {
......
...@@ -27,7 +27,6 @@ export const Jump = function (url, type='navigate') { ...@@ -27,7 +27,6 @@ export const Jump = function (url, type='navigate') {
console.log("跳转到其它APP 或者 小程序 或者其它的内容") console.log("跳转到其它APP 或者 小程序 或者其它的内容")
break; break;
} }
console.log(targetPath,'targetPath')
switch (type) { switch (type) {
case 'redirect': case 'redirect':
uni.redirectTo({ 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