Commit 6a2b298b authored by caimeng's avatar caimeng

问题已修复,准备合并代码

parent bed17652
<script>
import { switchShowTabbar, loadDevice, loadLocation, loadNetwork, loadUuid } from '@/utils/index.js'
import { switchShowTabbar, loadDevice, initSettings, loadLocation, loadNetwork, loadUuid } from '@/utils/index.js'
import config from '@/config/api'
export default {
globalData: {
WebUrl: config['h5']
WebUrl: config['h5'],
H5: null,
APP: null
},
onLaunch: function () {
// 手机型号
......@@ -47,18 +49,59 @@ export default {
/*** tabbar*/
switchShowTabbar()
},
onBackPress(e) {
console.log(e,'全局返回监听');
async onShow() {
await this.initLoanSetting();
await this.initSetting()
await initSettings()
},
onShow() { },
/** 切换到后台 */
onHide() {
uni.setStorageSync('canRefreshWeb', 'YES')
console.log('APP 组件 的onHide方法')
},
ontabitemtap(e) {
console.log(e, 'tab点击监听')
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>
......
......@@ -12,4 +12,11 @@
package id:io.dcloud.ddh
查看证书信息的命令:`keytool -v -list -keystore (keystore/jks的文件绝对路径)`
\ No newline at end of file
查看证书信息的命令:`keytool -v -list -keystore (keystore/jks的文件绝对路径)`
### 其他
参考:
- [uniapp 全局数据(globalData)的设置,获取,更改](https://blog.csdn.net/qq_37128634/article/details/106059230)
\ No newline at end of file
......@@ -88,7 +88,7 @@
</template>
<script>
import { switchShowTabbar, isLogin,initSettings } from '@/utils/index'
import { switchShowTabbar, isLogin } from '@/utils/index'
export default {
data() {
return {
......@@ -137,21 +137,18 @@ export default {
this.isFirstShow = uni.getStorageSync('isFirstShow')
},
async onLoad() {
// console.log(storage.getUserInfo().mobile,'uuuuuu')
await this.initAjax();
await this.getAppVersion()
},
async onShow() {
// 显示隐藏tabBar
switchShowTabbar()
// 首页流量埋点
this.buryingPoint('app:index_page_view')
this.buryingPoint('app:index_pageView')
await this.initAjax();
initSettings()
// 显示隐藏tabBar
switchShowTabbar()
},
methods: {
......@@ -178,15 +175,15 @@ export default {
if (!isLogin()) {
this.JumpToLogin()
}else {
if(item.tager=='uni:/pages/indexfinance/index,tab'){
console.log(item.tager,'987')
this.Go('uni:/pages/web/web','tab')
}else{
} else {
if (item.tager == 'uni:/pages/indexfinance/index,tab') {
console.log(item.tager, '987')
this.Go('uni:/pages/web/web', 'tab')
} else {
this.Go(item.tager)
}
}
},
......@@ -195,14 +192,13 @@ export default {
const self = this
uni.getSystemInfo({
success: (res) => {
console.log(res.appVersion, 'dddd')
const appVersion = res.appVersion
let platform = res.platform;
// 获取本机版本号
let type;
platform === "android" ? (type = "ANDROID") : (type = "IOS");
self.$request(`/pawn/setting/other/appVersion/${type}`, 'GET').then(res => {
if (res.success == true) {
const response = res.result.data;
if (appVersion < response.versionName) {
......@@ -237,27 +233,24 @@ export default {
init() {
const self = this
self.$request('/pawn/index', 'GET').then(res => {
const { shortcutList, bannerList } = res.result
const showIndex = uni.getStorageSync('showIndex')
const { shortcutList, bannerList } = res.result
const showIndex = uni.getStorageSync('showIndex')
const token = uni.getStorageSync('token')
if (shortcutList && typeof(shortcutList)=='string') {
let newArr=[]
let arrOne=[]
if(showIndex==true && 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)
} else {
newArr = JSON.parse(shortcutList)
newArr.forEach((item, index) => {
if (item.tager == 'uni:/pages/indexfinance/index,tab') {
newArr.splice(index, 1)
}
})
self.list =newArr
console.log(newArr,'newArr')
self.list = newArr
}
}
if (bannerList && typeof(bannerList)=='string' ) {
if (bannerList && typeof (bannerList) == 'string') {
self.bannerList = JSON.parse(bannerList)
}
}).catch(err => {
......@@ -331,10 +324,9 @@ export default {
}
try {
self.$request('/pawn/category/getGoodsPage', 'POST', params).then(res => {
const { current, total, size, records } = res.result
const { total, records } = res.result
const hasNextPage = total - self.pageSize * self.pageNum > 0 ? true : false //是否有下一页
if (self.loadFlag) {
self.IndexList = self.IndexList.concat(records)
} else {
self.IndexList = records
......
......@@ -54,26 +54,18 @@ export default {
},
methods: {
init() {
const self = this
self.$request('/pawn/setting', 'GET').then(res => {
console.log(res, 'settings');
const { protocol, phone } = res.result
if (protocol) {
const protocolList = JSON.parse(protocol)
console.log(protocolList, 'item966')
protocolList.map((item) => {
if (item.protocolName == '隐私协议') {
self.protocols = item
} else if (item.protocolName == '用户服务协议') {
self.protocolf = item
}
})
}
}).catch(err => {
console.log(err, '请求出错')
})
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() {
this.clickStatus = !this.clickStatus
......@@ -205,7 +197,7 @@ export default {
}
self.$request('/app/v1/loginNoCheck', 'POST', params).then(res => {
const { deviceId, token } = res.result
const cacheData = Object.assign({}, res.result, { mobile: self.mobile })
console.log(cacheData, '返回的结果')
uni.setStorageSync('user_info_obj', JSON.stringify(cacheData));
......@@ -218,7 +210,7 @@ export default {
uni.navigateBack({
delta: 1
})
}).catch(err => {
console.log(err, '请求出错')
})
......
.my-page{
width:100%;
.my-page {
width: 100%;
height: 100vh;
max-height: 100vh;
background: #F7FAFF;
// padding-bottom:10rpx;
.my-top{
padding-top:8rpx;
.my-top {
padding-top: 8rpx;
width: 100%;
height: 505rpx;
background: url('https://ddh.yyhock.com/ddhMall/my-bg.png') 0 0 no-repeat;
background-size: 100% 505rpx;
.my-header{
display: flex;
.header-img{
margin-top:128rpx;
margin-left: 28rpx;
width: 122rpx;
height: 122rpx;
background-size: 100% ;
}
.header-des{
padding-left: 15rpx;
margin-top:128rpx;
font-family: PingFangSC, PingFang SC;
text-align: left;
font-style: normal;
.des-name{
padding:17rpx 0 10rpx;
height: 50rpx;
font-weight: 500;
font-size: 36rpx;
color: #333333;
line-height: 50rpx;
}
.des-text{
height: 28rpx;
font-weight: 400;
font-size: 24rpx;
color: #999999;
line-height: 28rpx;
}
}
.my-header {
display: flex;
.header-img {
margin-top: 128rpx;
margin-left: 28rpx;
width: 122rpx;
height: 122rpx;
background-size: 100%;
}
.header-des {
padding-left: 15rpx;
margin-top: 128rpx;
font-family: PingFangSC, PingFang SC;
text-align: left;
font-style: normal;
.des-name {
padding: 17rpx 0 10rpx;
height: 50rpx;
font-weight: 500;
font-size: 36rpx;
color: #333333;
line-height: 50rpx;
}
.des-text {
height: 28rpx;
font-weight: 400;
font-size: 24rpx;
color: #999999;
line-height: 28rpx;
}
}
}
.my-line{
margin:66rpx 30rpx 0;
.my-line {
margin: 66rpx 30rpx 0;
display: flex;
align-items: center;
height: 144rpx;
background: linear-gradient( 180deg, #FFFFFF 0%, #FFFFFF 100%);
background: linear-gradient(180deg, #FFFFFF 0%, #FFFFFF 100%);
border-radius: 10rpx;
.line-left{
.line-left {
display: flex;
align-items: center;
// margin-left: 46rpx;
padding-left: 46rpx;
flex:1;
height:104rpx;
.left-img{
flex: 1;
height: 104rpx;
.left-img {
width: 46rpx;
height: 46rpx;
background-size: 100%;
}
.l-text{
padding:0 45rpx 0 25rpx;
.l-text {
padding: 0 45rpx 0 25rpx;
height: 40rpx;
font-family: PingFangSC, PingFang SC;
font-weight: 400;
......@@ -75,7 +85,8 @@
text-align: center;
font-style: normal;
}
.l-go{
.l-go {
display: inline-block;
width: 24rpx;
height: 24rpx;
......@@ -83,31 +94,37 @@
background-size: 100%;
}
}
.line-left:nth-child(2n){
.line-left:nth-child(2n) {
padding-left: 46rpx;
border-left:2rpx solid #E9E9E9;
border-left: 2rpx solid #E9E9E9;
}
}
.my-box-s{
.my-box-s {
margin: 19rpx 30rpx 30rpx;
width: 690rpx;
height: 169rpx;
background: #FFFFFF;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(232,232,232,0.49);
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(232, 232, 232, 0.49);
border-radius: 10rpx;
.s-con{
.s-con {
padding: 27rpx 14rpx;
display: flex;
flex-wrap: wrap;
.con-item{
.con-item {
margin-right: 50rpx;
.item-img{
margin:0 39rpx;
.item-img {
margin: 0 39rpx;
width: 50rpx;
height: 50rpx;
background-size: 100%;
}
.item-text{
.item-text {
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 28rpx;
......@@ -117,42 +134,51 @@
font-style: normal;
}
}
.con-item:last-child{
.con-item:last-child {
margin-right: 0;
}
}
}
.my-contain{
margin:0rpx 30rpx 34rpx;
.con-top{
.my-contain {
margin: 0rpx 30rpx 34rpx;
.con-top {
display: inline-block;
width:136rpx;
width: 136rpx;
height: 48rpx;
background: url('https://ddh.yyhock.com/ddhMall/my-text.png') 0 0 no-repeat;
background-size: 136rpx 48rpx;
}
.con-box{
.con-box {
margin-top: 24rpx;
background: #FFFFFF;
.box-line{
margin:0 13rpx 0 27rpx;
.box-line {
margin: 0 13rpx 0 27rpx;
height: 110rpx;
background: #FFFFFF;
border-bottom: 2rpx solid #E9E9E9;
.line-item{
.line-item {
display: flex;
align-items: center;
justify-content: space-between;
.item-l{
.item-l {
// margin-left:27rpx;
display: flex;
align-items: center;
.l-img{
.l-img {
width: 40rpx;
height: 40rpx;
background-size: 100%;
}
.l-text{
.l-text {
margin-left: 30rpx;
font-family: PingFangSC, PingFang SC;
font-weight: 400;
......@@ -163,7 +189,8 @@
font-style: normal;
}
}
.item-r{
.item-r {
// margin-right:13rpx;
width: 30rpx;
height: 30rpx;
......@@ -171,26 +198,30 @@
background-size: 100%;
}
}
}
.box-line:last-child{
border-bottom:none;
.box-line:last-child {
border-bottom: none;
}
}
}
.my-footer{
margin-top:104rpx;
.my-footer {
margin-top: 104rpx;
background: #F7FAFF;
padding-bottom:10rpx;
.footer-btn{
margin-left:38%;
padding-bottom: 10rpx;
.footer-btn {
margin-left: 38%;
display: flex;
width: 180rpx;
height: 63rpx;
border-radius: 32rpx;
border: 1rpx solid #999999;
.btn-tel{
margin:16rpx 12rpx 0 24rpx;
.btn-tel {
margin: 16rpx 12rpx 0 24rpx;
display: inline-block;
width: 30rpx;
height: 30rpx;
......@@ -198,7 +229,8 @@
background-size: 100%;
vertical-align: middle;
}
.btn-text{
.btn-text {
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 24rpx;
......@@ -209,8 +241,9 @@
vertical-align: middle;
}
}
.footer-des{
margin:24rpx 0 14rpx;
.footer-des {
margin: 24rpx 0 14rpx;
height: 33rpx;
font-family: PingFangSC, PingFang SC;
font-weight: 400;
......@@ -220,7 +253,8 @@
text-align: center;
font-style: normal;
}
.footer-time{
.footer-time {
height: 28rpx;
font-family: PingFangSC, PingFang SC;
font-weight: 400;
......@@ -230,8 +264,9 @@
text-align: center;
font-style: normal;
}
.footer-tips{
padding-top:30rpx;
.footer-tips {
padding-top: 30rpx;
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 24rpx;
......@@ -242,5 +277,5 @@
}
}
}
}
}
\ No newline at end of file
......@@ -9,24 +9,36 @@
<view class='des-text'>多典花承诺保护您的信息安全</view>
</view>
</view>
<view class='my-line' v-show="menuBar && menuBar.length > 0">
<view class='line-left' v-for="item in menuBar" :key="item.id" @click="goBar(item)">
<image class='left-img' :src='item.iconUrl'></image>
<view class='l-text'>{{ item.title }}</view>
<i class='l-go'></i>
<!-- 我的还款&申请记录 -->
<template v-if="menuBar && menuBar.length > 0">
<view class='my-line'>
<view class='line-left' v-for="item in menuBar" :key="item.id" @click="goBar(item)">
<image class='left-img' :src='item.iconUrl'></image>
<view class='l-text'>{{ item.title }}</view>
<i class='l-go'></i>
</view>
</view>
</view>
<view class='my-box-s'>
<view class='s-con'>
<view class='con-item' @click="goPage(item)" v-for="item in extMenuBarList" :key="item.id">
<image class="item-img" :src="item.iconUrl"></image>
<view class='item-text'>{{ item.title }}</view>
</template>
<!-- 金刚栏位 -->
<template v-if="extMenuBarList && extMenuBarList.length">
<view class='my-box-s'>
<view class='s-con'>
<view class='con-item' @click="goPage(item)" v-for="item in extMenuBarList" :key="item.id">
<image class="item-img" :src="item.iconUrl"></image>
<view class='item-text'>{{ item.title }}</view>
</view>
</view>
</view>
</view>
<view class="my-contain">
</template>
<!-- 更多服务 -->
<view v-if="menuList && menuList.length" class="my-contain">
<i class='con-top'></i>
<view class='con-box' v-show='menuList && menuList.length > 0'>
<view class='con-box' v-if='menuList && menuList.length > 0'>
<view class="box-line" v-for="item in menuList" @click='goItem(item)' :key="item.id">
<view class='line-item'>
<view class='item-l'>
......@@ -36,11 +48,11 @@
<view class='item-r'></view>
</view>
</view>
</view>
</view>
<!-- 联系我们 -->
<view class='my-footer'>
<view class='footer-btn' @click="goTel">
<i class='btn-tel'></i>
......@@ -50,12 +62,16 @@
<view class='footer-time'>(12:00-13:00休息)</view>
<view class='footer-tips'>理性借贷 合理消费</view>
</view>
</view>
</view>
</template>
<script>
import { switchShowTabbar, isLogin,initSettings } from '@/utils/index'
import { switchShowTabbar } from '@/utils/index'
const APP = JSON.parse(uni.getStorageSync('APP-SETTING'));
const H5 = JSON.parse(uni.getStorageSync('H5-SETTING'));
export default {
data() {
return {
......@@ -63,35 +79,34 @@ export default {
menuList: [],
mobileNum: '',
menuBar: [],
serviceCall: '',
extMenuBarList: [],
HUrl:''
serviceCall: APP.serviceCall,
extMenuBarList: []
}
},
onLoad() {
this.init();
this.initPawn()
},
onShow() {
this.buryingPoint('app:my_pageView')
// 显示隐藏tabBar
switchShowTabbar()
this.init();
this.initPawn()
// 埋点
this.buryingPoint('app:my_pageView')
},
// 页面下拉刷新
async onPullDownRefresh() {
// 初始化设备
await this.init()
await switchShowTabbar();
await this.init()
setTimeout(() => {
uni.stopPullDownRefresh();
}, 1000);
},
methods: {
toJSON(){},
toJSON() { },
// 初始化
init() {
const token = uni.getStorageSync('token')
......@@ -100,78 +115,19 @@ export default {
return this.Go('uni:/pages/login/login')
} else {
this.initMy()
this.initTels()
}
},
// 显示隐藏tabBar
switchShowTabbar() {
const token = uni.getStorageSync('token')
if (!token) {
console.log(token, 'tokentab')
uni.setTabBarItem({
index: 1,
visible: false
})
} else {
const self = this
self.$request('/pawn/setting/other/switch/loan', 'GET').then(res => {
const { data } = res.result
if (res.code == 200 && data == true) {
try {
console.log(data, '显示')
uni.setTabBarItem({
index: 1,
text: '贷款',
visible: true,
})
} catch (error) {
console.log(error);
}
} else {
console.log(data, '隐藏')
uni.setTabBarItem({
index: 1,
visible: false
})
}
})
}
},
initPawn(){
const self=this
self.$request('/pawn/setting','GET').then(res => {
const { protocol,phone,h5Url }=res.result
if(h5Url){
self.HUrl=h5Url
console.log(self.HUrl,'setting')
}
}).catch(err=>{
console.log(err,'请求出错')
})
},
// 初始化APP配置页面
initTels() {
const self = this
self.$request('/app/v1/settings', 'GET').then(res => {
const { serviceCall,h5Url } = res.result
self.serviceCall = serviceCall
}).catch(err => {
console.log(err, '请求出错')
})
},
// 初始化个人中心页面
initMy() {
const self = this
self.$request('/app/v1/userIndex', 'GET').then(res => {
const { menuBar, user, baseMenuBar, extMenuBarList } = res.result
const showIndex = uni.getStorageSync('showIndex')
console.log(showIndex,'myindex')
if(showIndex==true){
console.log(showIndex, 'myindex')
if (showIndex == true) {
self.menuBar = menuBar
}else{
self.menuBar =[]
} else {
self.menuBar = []
}
self.menuList = baseMenuBar
self.extMenuBarList = extMenuBarList
......@@ -182,6 +138,8 @@ export default {
console.log(err, '请求出错')
})
},
goPage(item) {
console.log(item.title)
switch (item.title) {
......@@ -200,56 +158,42 @@ export default {
default:
break;
}
this.Go(item.linkUrl)
},
goLogin() {
this.Go('uni:/pages/login/login')
},
goBar(item) {
console.log(item.linkUrl,'item')
let newPath
switch (item.title) {
case "我的还款":
this.buryingPoint('app:my_repayment_click')
// const url='http://192.168.0.82:8080/#/'
newPath=this.HUrl+item.linkUrl
newPath = H5.h5Url + item.linkUrl
uni.navigateTo({
url:`/pages/web/websrc?url=${newPath}`
url: `/pages/web/websrc?url=${newPath}`
})
break;
case "申请记录":
this.buryingPoint('app:my_application_record_click')
// const url='http://192.168.0.82:8080/#/loanRecord'
newPath=this.HUrl+item.linkUrl
newPath = H5.h5Url + item.linkUrl
uni.navigateTo({
url:`/pages/web/websrc?url=${newPath}`
url: `/pages/web/websrc?url=${newPath}`
})
break;
default:
break;
}
// const self = this
// const token = uni.getStorageSync('token')
// if (token != '') {
// let newList = []
// newList = item.linkUrl.split(',')
// self.Go(newList[0], newList[1])
// } else {
// self.Go('uni:/pages/login/login')
// }
},
goTel() {
this.buryingPoint('app:my_contact_us_click')
uni.makePhoneCall({
phoneNumber: this.serviceCall //仅为示例
});
this.handleCall(APP.serviceCall)
},
goItem(item) {
goItem(item) {
switch (item.title) {
case "设置":
this.buryingPoint('app:my_settings_click')
......@@ -261,14 +205,7 @@ export default {
break;
}
if (item.linkUrl != '') {
this.Go(item.linkUrl)
} else {
uni.makePhoneCall({
phoneNumber: this.mobileNum
});
}
if (item.linkUrl) this.Go(item.linkUrl)
}
}
}
......
......@@ -67,7 +67,7 @@ export default {
async onLoad(option) {
const mianH5Url = uni.getStorageSync('mianH5Url')
console.log('')
console.log('333')
const that = this
if (option.src) {
......@@ -107,9 +107,22 @@ export default {
}
}
}
let pagearr = getCurrentPages();//获取应用页面栈
let currentPage = pagearr[pagearr.length - 1];//获取当前页面信息
console.log('option:', currentPage.options)//获取页面传递的信息
// 这里为借款做的刷新
const canRefresh = uni.getStorageSync('canRefresh');
console.log('onShow方法')
console.log(canRefresh, '是否需要刷新')
if (canRefresh) {
uni.removeStorageSync('canRefresh')
if (reloadTimeOut) clearTimeout(reloadTimeOut)
reloadTimeOut = setTimeout(() => {
console.log('到这里了')
this.wv && this.wv.reload()
}, 400)
}
},
onUnload() {
uni.$off('loadingSubnvue'); //移除监听配置的原生子窗体
......@@ -249,6 +262,16 @@ export default {
}
},
// 设置缓存
SetLocalStore(config) {
try {
if (!config) return
const { key, val } = config
uni.setStorageSync(key, val)
} catch (err) {
console.log(err, '设置本地存储报错')
}
},
// Toast 提示框
Toast(config) {
try {
......
......@@ -237,7 +237,6 @@ export default {
} catch (err) {
console.log(err, '设置本地存储报错')
}
},
// Toast 提示框
Toast(config) {
......
......@@ -48,6 +48,7 @@
methods: {
},
onShow(){
console.log("websrc 的webview")
}
}
</script>
......
This diff is collapsed.
This diff is collapsed.
......@@ -78,11 +78,13 @@ export const switchShowTabbar = async () => {
}
//获取h5url地址信息
export const initSettings=async()=>{
const res=await API.initSettings()
const {h5Url}=res.result
console.log(h5Url,'h5Url3333')
uni.setStorageSync('mianH5Url',h5Url)
try{
const res=await API.initSettings()
const {h5Url}=res.result
uni.setStorageSync('mianH5Url',h5Url)
}catch(err){
console.log(err,'初始化')
}
}
// 设备信息
export const loadDevice = async () => {
......
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