Commit 0ac8afa9 authored by ly's avatar ly

多典花启动页

parent 174d6b2c
No preview for this file type
......@@ -10,6 +10,10 @@
"default" : {
"launchtype" : "local"
},
"h5" : {
"launchtype" : "local"
},
"provider" : "aliyun",
"type" : "uniCloud"
},
{
......
......@@ -7,8 +7,7 @@ export default {
H5: null,
APP: null
},
onLaunch: function () {
console.log('764')
onLaunch: function () {
// 手机型号
uni.getSystemInfo({
success: function (res) {
......@@ -25,10 +24,10 @@ export default {
// 同意了协议
// if (isAgreePrivacy) {
const common = uni.getStorageSync("m-headers")
if (!common && plus.os.name == 'iOS') {
loadDevice();
loadNetwork();
loadLocation();
if (!common && plus.os.name == 'iOS') {
loadNetwork()
loadDevice()
loadLocation()
loadUuid()
}
// }
......@@ -51,9 +50,7 @@ export default {
switchShowTabbar()
},
async onShow() {
await this.initLoanSetting();
await this.initSetting()
await initSettings()
// await initSettings()
},
/** 切换到后台 */
......@@ -61,49 +58,7 @@ export default {
uni.setStorageSync('canRefreshWeb', 'YES')
},
methods: {
// 初始化APP配置
async initSetting() {
try {
/**
* protocolList,
* ossBasePath,
* ossBucket,
* domainConfig,
* appAudited,
* pushType,
* h5Url,
* tabList,
* faceUrl,
* serviceCall,
* ocrChannel,
* privacyPolicyAgreed
*/
const { success, result } = await this.$request('/app/v1/settings', 'GET');
if (success) {
this.globalData.APP = result
uni.setStorageSync('APP-SETTING', JSON.stringify(result))
}
} catch (err) {
console.log(err, '初始化APP配置报错')
}
},
// 初始化贷超H5配置
async initLoanSetting() {
try {
/**
* h5Url,
* protocol,
* phone
* */
const { success, result } = await this.$request('/pawn/setting', 'GET');
if (success) {
this.globalData.H5 = result
uni.setStorageSync('H5-SETTING', JSON.stringify(result))
}
} catch (err) {
console.log(err, '初始化贷超配置报错')
}
}
}
}
</script>
......
......@@ -38,7 +38,7 @@ let env = process.env.VUE_APP_BASE_NODE_ENV
*/
// #ifdef APP-PLUS
env = "prod";
env = "development";
// #endif
const api = {
......
{
"pages": [
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
{
"path": "pages/starPage/index",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": ""
}
},
{
"path": "pages/index/index",
"style": {
"enablePullDownRefresh": false,
......@@ -17,6 +24,7 @@
"navigationBarTitleText": "款式"
}
},
{
"path": "pages/my/index",
"style": {
......@@ -210,8 +218,9 @@
"popGesture": "none"
}
}
}
,{
},
{
"path": "uni_modules/uni-frv-external/pages/common/webview/webview",
"style": {
"enablePullDownRefresh": false,
......
......@@ -32,7 +32,7 @@
</template>
<script>
import { ininIndex,initApp,initSettings } from '@/utils/index'
export default {
name: "Agreement",
data() {
......@@ -45,11 +45,14 @@ export default {
protocolf: {
"protocolName": "用户服务协议",
"protocolUrl": "https://ddh.yyhock.com/appStatic/protocol/dd-user.html"
},
}
}
},
onLoad() {
this.init()
async onLoad() {
await ininIndex()
await initApp()
await initSettings()
await this.init()
},
methods: {
// 拒绝授权
......@@ -68,9 +71,13 @@ export default {
data: 'true',
success: function () {
console.log('m-agreement缓存成功')
uni.navigateBack({
delta: 1
uni.setStorageSync('appStart', true)
uni.switchTab({
url:"/pages/index/index"
})
// uni.navigateBack({
// delta: 1
// })
}
})
......@@ -137,8 +144,11 @@ export default {
})
}
},
onShow() {
this.init()
async onShow() {
await this.init()
await ininIndex()
await initApp()
await initSettings()
}
}
</script>
......
......@@ -88,7 +88,7 @@
</template>
<script>
import { switchShowTabbar, isLogin,initSettings } from '@/utils/index'
import { switchShowTabbar, isLogin,initSettings,ininIndex } from '@/utils/index'
export default {
data() {
return {
......@@ -127,27 +127,25 @@ export default {
}
},
onReady() {
const systemInfo = uni.getSystemInfoSync();
if (systemInfo.platform === 'ios') {
const isAgree = uni.getStorageSync('m-agreement')
if (!isAgree) {
this.Go('uni:/pages/agreement/index')
}
}
// 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() {
// console.log(storage.getUserInfo().mobile,'uuuuuu')
await this.initAjax();
await this.getAppVersion()
await initSettings()
},
async onShow() {
ininIndex()
// 显示隐藏tabBar
switchShowTabbar()
// initSettings()
// 首页流量埋点
this.buryingPoint('app:index_page_view')
await this.initAjax();
console.log(this.generateRandomString(),'97666')
......@@ -242,8 +240,10 @@ export default {
},
init() {
const self = this
self.$request('/pawn/index', 'GET').then(res => {
const { shortcutList, bannerList } = res.result
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') {
......@@ -263,9 +263,9 @@ export default {
if (bannerList && typeof (bannerList) == 'string') {
self.bannerList = JSON.parse(bannerList)
}
}).catch(err => {
console.log(err, '请求出错')
})
// }).catch(err => {
// console.log(err, '请求出错')
// })
},
goDetail(item) {
......
......@@ -54,34 +54,16 @@ export default {
},
methods: {
async init() {
// const $App_Setting = uni.getStorageSync("APP-SETTING")
// if ($App_Setting) {
// const { protocolList } = JSON.parse($App_Setting)
// protocolList.map((item) => {
// if (item.protocolName == '隐私协议') {
// this.protocols = item
// } else if (item.protocolName == '用户服务协议') {
// this.protocolf = item
// }
// })
// }
try {
const { success, result } = await this.$request('/app/v1/settings', 'GET');
if (success) {
// this.globalData.APP = result
console.log(result,'result333')
const {protocolList}=result
protocolList.map((item) => {
if (item.protocolName == '隐私协议') {
this.protocols = item
} else if (item.protocolName == '用户服务协议') {
this.protocolf = item
}
})
uni.setStorageSync('APP-SETTING', JSON.stringify(result))
}
} catch (err) {
console.log(err, '初始化APP配置报错')
const $App_Setting = uni.getStorageSync("APP-SETTING")
if ($App_Setting) {
const { protocolList } = JSON.parse($App_Setting)
protocolList.map((item) => {
if (item.protocolName == '隐私协议') {
this.protocols = item
} else if (item.protocolName == '用户服务协议') {
this.protocolf = item
}
})
}
},
btnIcon() {
......
......@@ -69,8 +69,8 @@
<script>
import { switchShowTabbar } from '@/utils/index'
// const APP = JSON.parse(uni.getStorageSync('APP-SETTING'));
// const H5 = JSON.parse(uni.getStorageSync('H5-SETTING'));
const APP = JSON.parse(uni.getStorageSync('APP-SETTING'));
const H5 = JSON.parse(uni.getStorageSync('H5-SETTING'));
export default {
data() {
......@@ -79,24 +79,19 @@ export default {
menuList: [],
mobileNum: '',
menuBar: [],
// serviceCall: APP.serviceCall,
serviceCall:APP.serviceCall,
serviceCall: '',
extMenuBarList: [],
hFUrl:''
}
},
onLoad() {
this.init();
this.initSetting()
this.initLoanSetting()
this.init()
},
onShow() {
// 显示隐藏tabBar
switchShowTabbar()
this.init();
this.initSetting()
this.initLoanSetting()
this.init()
// 埋点
this.buryingPoint('app:my_pageView')
},
......@@ -143,39 +138,6 @@ export default {
console.log(err, '请求出错')
})
},
// 初始化APP配置
async initSetting() {
try {
const { success, result } = await this.$request('/app/v1/settings', 'GET');
if (success) {
// this.globalData.APP = result
console.log(result,'result333')
this.serviceCall=result.serviceCall
uni.setStorageSync('APP-SETTING', JSON.stringify(result))
}
} catch (err) {
console.log(err, '初始化APP配置报错')
}
},
// 初始化贷超H5配置
async initLoanSetting() {
try {
/**
* h5Url,
* protocol,
* phone
* */
const { success, result } = await this.$request('/pawn/setting', 'GET');
if (success) {
// this.globalData.H5 = result
console.log(result,'result4444')
this.hFUrl=result.h5Url
uni.setStorageSync('H5-SETTING', JSON.stringify(result))
}
} catch (err) {
console.log(err, '初始化贷超配置报错')
}
},
goPage(item) {
console.log(item.title)
switch (item.title) {
......@@ -207,8 +169,8 @@ export default {
case "我的还款":
this.buryingPoint('app:my_repayment_click')
// const url='http://192.168.0.82:8080/#/'
// newPath = H5.h5Url + item.linkUrl //app.vue中的全局写法
newPath =this.hFUrl+ item.linkUrl
newPath = H5.h5Url + item.linkUrl //app.vue中的全局写法
// newPath =this.hFUrl+ item.linkUrl
uni.navigateTo({
url: `/pages/web/websrc?url=${newPath}`
})
......@@ -216,8 +178,8 @@ export default {
case "申请记录":
this.buryingPoint('app:my_application_record_click')
// const url='http://192.168.0.82:8080/#/loanRecord'
// newPath = H5.h5Url + item.linkUrl
newPath =this.hFUrl+ item.linkUrl
newPath = H5.h5Url + item.linkUrl
// newPath =this.hFUrl+ item.linkUrl
uni.navigateTo({
url: `/pages/web/websrc?url=${newPath}`
})
......@@ -227,7 +189,6 @@ export default {
}
},
goTel() {
// this.handleCall(APP.serviceCall)
const self = this
self.buryingPoint('app:my_contact_us_click')
const telPhone = uni.getStorageSync('telPhone')
......@@ -251,7 +212,7 @@ export default {
goPhone() {
uni.setStorageSync('telPhone', '1')
uni.makePhoneCall({
phoneNumber: this.serviceCall //仅为示例
phoneNumber:APP.serviceCall//仅为示例
});
},
......
......@@ -4,7 +4,7 @@
<!-- 左侧分类 -->
<view class="leftTab">
<scroll-view scroll-y="true" class="tabBox">
<block v-for="(item,index) in tabList" :key="item.id">
<block v-for="item in tabList" :key="item.id">
<view class="tabItem" :class="tabCurrent == item.id ?'tabActive':''" @click="changeTab(item.id)">
{{item.categoryName}}
</view>
......@@ -62,8 +62,7 @@
init(){
const self=this
self.$request('/pawn/category/getCategoryList','POST').then((res)=>{
self.tabList=res.result
console.log(res,'9766')
self.tabList=res.result
})
},
initSearch(){
......@@ -102,7 +101,7 @@
})
},
changeTab(index) {
console.log(index,'indexhyyy')
this.tabCurrent = index
// this.categoryId=index
this.pageNum=1
......@@ -142,7 +141,8 @@
this.buryingPoint('app:sort_pageView')
this.init()
this.initSearch()
initSettings()
switchShowTabbar()
}
}
</script>
......
.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>
<view class='stat-page'>
<view class='start-btn' @click='goStart'>立即启动</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 {
}
},
onReady() {
const appStart = uni.getStorageSync('appStart')
console.log(appStart,'appStart')
if(appStart==true){
uni.switchTab({
url:"/pages/index/index"
})
}
},
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"
})
}
}
},
async onShow() {
await ininIndex()
await initSettings()
await initApp()
}
}
</script>
<style src="./index.less" lang="less" scoped></style>
\ No newline at end of file
......@@ -12,7 +12,7 @@ import Permission from '@/js_sdk/wa-permission/permission' //权限工具类
const LF = uni.requireNativePlugin('AThree-LFv2')
let reloadTimeOut = null
let token = uni.getStorageSync('token')
const H5 = JSON.parse(uni.getStorageSync('H5-SETTING'));
export default {
name: "WEB",
data() {
......@@ -65,17 +65,15 @@ export default {
this.wv && this.wv.evalJS(`callback({ 'action': 'OnShow' })`)
},
async onLoad(option) {
const mianH5Url = uni.getStorageSync('mianH5Url')
console.log('333')
// const mianH5Url = uni.getStorageSync('mianH5Url')
const that = this
console.log(H5.h5Url, '参数666')
if (option.src) {
console.log(option.src, '参数555')
that.src = option.src
} else if (mianH5Url) {
console.log(mianH5Url, '参数666')
that.src = mianH5Url
} else if (H5.h5Url) {
console.log(H5.h5Url, '参数666')
that.src = H5.h5Url
}
uni.getStorage({
......
......@@ -8,5 +8,13 @@ export default {
/* 初始化h5地址 */
async initSettings(data) {
return request('/pawn/setting', 'GET', data);
}
},
/* 初始化settings获取手机号 */
async initApp(data) {
return request('/app/v1/settings', 'GET', data);
},
/* 初始化首页 */
async initIndex(data) {
return request('/pawn/index', 'GET', data);
},
}
No preview for this file type
No preview for this file type
This diff is collapsed.
......@@ -3,6 +3,7 @@ import { convertPromise } from './header.js'
import Permission from '@/js_sdk/wa-permission/permission'
import { SelectLocation } from "./authPerission";
import API from '@/server/common'
import config from '@/config/api'
......@@ -78,10 +79,52 @@ 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 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 ininIndex=async()=>{
try{
const res=await API.initSettings()
const {h5Url}=res.result
uni.setStorageSync('mianH5Url',h5Url)
const res=await API.initIndex()
console.log(res,'res')
uni.setStorageSync('dataIndex',res.result)
}catch(err){
console.log(err,'初始化')
}
......
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