Commit 7b69a037 authored by caimeng's avatar caimeng

修改webview的onload 方法支持接收参数跳转到指定的页面

parent 2a453831
...@@ -20,13 +20,13 @@ import api from '@/config/api' ...@@ -20,13 +20,13 @@ import api from '@/config/api'
let reloadTimeOut = null let reloadTimeOut = null
let token = uni.getStorageSync('token') let token = uni.getStorageSync('token')
console.log(token,'是否登录') console.log(token, '是否登录')
export default { export default {
name: "WEB", name: "WEB",
data() { data() {
return { return {
src:'', src: '',
wv: null, wv: null,
isLogin: token, isLogin: token,
canBack: false, canBack: false,
...@@ -36,7 +36,7 @@ export default { ...@@ -36,7 +36,7 @@ export default {
} }
}, },
deviceStatus: '', deviceStatus: '',
typePage:false, typePage: false,
}; };
}, },
onBackPress(e) { onBackPress(e) {
...@@ -67,23 +67,23 @@ export default { ...@@ -67,23 +67,23 @@ export default {
// #endif // #endif
}, },
onTabItemTap(e) { onTabItemTap(e) {
console.log(e, 'tabItemTap') console.log(e, 'tabItemTap')
this.wv && this.wv.evalJS(`callback({ 'action': 'OnShow' })`) this.wv && this.wv.evalJS(`callback({ 'action': 'OnShow' })`)
}, },
async onLoad(option) { async onLoad(option) {
const mianH5Url = uni.getStorageSync('mianH5Url')
const mianH5Url=uni.getStorageSync('mianH5Url') console.log('web onload',option)
const that = this const that = this
if(mianH5Url){ if (option.src) {
console.log(mianH5Url,'参数666') console.log(option.src, '参数555')
that.src = option.src
} else if (mianH5Url) {
console.log(mianH5Url, '参数666')
that.src = mianH5Url that.src = mianH5Url
} }
// if (option.src) {
// console.log(option.src,'参数555')
// that.src = option.src
// }
uni.getStorage({ uni.getStorage({
key: 'm-device-info', key: 'm-device-info',
success: function (res) { success: function (res) {
...@@ -91,6 +91,7 @@ export default { ...@@ -91,6 +91,7 @@ export default {
that.deviceStatus = device that.deviceStatus = device
} }
}) })
}, },
onHide() { onHide() {
// uni.removeStorageSync('hasRefresh') // uni.removeStorageSync('hasRefresh')
...@@ -114,7 +115,7 @@ export default { ...@@ -114,7 +115,7 @@ export default {
} }
let pagearr = getCurrentPages();//获取应用页面栈 let pagearr = getCurrentPages();//获取应用页面栈
let currentPage = pagearr[pagearr.length - 1];//获取当前页面信息 let currentPage = pagearr[pagearr.length - 1];//获取当前页面信息
console.log('option:' , currentPage.options)//获取页面传递的信息 console.log('option:', currentPage.options)//获取页面传递的信息
}, },
onUnload() { onUnload() {
uni.$off('loadingSubnvue'); //移除监听配置的原生子窗体 uni.$off('loadingSubnvue'); //移除监听配置的原生子窗体
...@@ -196,16 +197,16 @@ export default { ...@@ -196,16 +197,16 @@ export default {
}, },
// 获取用户手机号 // 获取用户手机号
GetUserMobile() { GetUserMobile() {
const self=this const self = this
try { try {
uni.getStorage({ uni.getStorage({
key: 'l-mobile', key: 'l-mobile',
success: function(res) { success: function (res) {
console.log(res, '结果') console.log(res, '结果')
const mobile = res.data; const mobile = res.data;
self.GetWebView().evalJS("receiveUserMobile('" + mobile + "')") self.GetWebView().evalJS("receiveUserMobile('" + mobile + "')")
}, },
fail: function(err) { fail: function (err) {
console.log(err, '报错了') console.log(err, '报错了')
} }
}) })
...@@ -235,22 +236,22 @@ export default { ...@@ -235,22 +236,22 @@ export default {
}) })
}, },
//返回方法 //返回方法
GoBack(num){ GoBack(num) {
console.log('wori') console.log('wori')
try{ try {
const self=this const self = this
uni.navigateBack({ uni.navigateBack({
delta:num, delta: num,
success(res) { success(res) {
console.log(res,'9877') console.log(res, '9877')
self.typePage=true self.typePage = true
console.log(self.typePage,'resss') console.log(self.typePage, 'resss')
} }
}) })
}catch(err){ } catch (err) {
this.toast('返回失败') this.toast('返回失败')
console.log(err,'err') console.log(err, 'err')
} }
}, },
......
var isReady=false;var onReadyCallbacks=[]; var isReady=false;var onReadyCallbacks=[];
var isServiceReady=false;var onServiceReadyCallbacks=[]; var isServiceReady=false;var onServiceReadyCallbacks=[];
var __uniConfig = {"pages":["pages/index/index","pages/sort/index","pages/my/index","pages/recruit/index","pages/recruitResult/index","pages/category/category","pages/application/application","pages/myneed/myneed","pages/Ineed/Ineed","pages/productDetails/productDetails","pages/detailResult/detailResult","pages/useFeed/useFeed","pages/lookGoods/lookGoods","pages/login/login","pages/prolist/prolist","pages/setting/setting","pages/contact/contact","pages/web/contact","pages/webview/webview","pages/websrc/websrc","pages/web/web","pages/web/websrc","pages/bill/indexs","pages/finance/index","pages/app-update/index","pages/agreement/index"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"uni-app","navigationBarBackgroundColor":"#FFFFFF","backgroundColor":"#F8F8F8","bounce":"none"},"tabBar":{"borderStyle":"white","color":"#BBBBBB","selectedColor":"#2263E6","list":[{"pagePath":"pages/index/index","iconPath":"/static/tab/indexfh.png","selectedIconPath":"/static/tab/indexf.png","text":"首页"},{"pagePath":"pages/web/web","iconPath":"/static/tab/index-h.png","selectedIconPath":"/static/tab/index.png","text":"贷款"},{"pagePath":"pages/sort/index","iconPath":"/static/tab/sort-h.png","selectedIconPath":"/static/tab/sort.png","text":"分类"},{"pagePath":"pages/my/index","iconPath":"/static/tab/my-h.png","selectedIconPath":"/static/tab/my.png","text":"我的"}]},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"多典花","compilerVersion":"4.24","entryPagePath":"pages/index/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}}; var __uniConfig = {"pages":["pages/index/index","pages/sort/index","pages/my/index","pages/recruit/index","pages/recruitResult/index","pages/category/category","pages/application/application","pages/myneed/myneed","pages/Ineed/Ineed","pages/productDetails/productDetails","pages/detailResult/detailResult","pages/useFeed/useFeed","pages/lookGoods/lookGoods","pages/login/login","pages/prolist/prolist","pages/setting/setting","pages/contact/contact","pages/web/contact","pages/webview/webview","pages/websrc/websrc","pages/web/web","pages/web/websrc","pages/bill/indexs","pages/finance/index","pages/app-update/index","pages/agreement/index"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"uni-app","navigationBarBackgroundColor":"#FFFFFF","backgroundColor":"#F8F8F8","bounce":"none"},"tabBar":{"borderStyle":"white","color":"#BBBBBB","selectedColor":"#2263E6","list":[{"pagePath":"pages/index/index","iconPath":"/static/tab/indexfh.png","selectedIconPath":"/static/tab/indexf.png","text":"首页"},{"pagePath":"pages/web/web","iconPath":"/static/tab/index-h.png","selectedIconPath":"/static/tab/index.png","text":"贷款"},{"pagePath":"pages/sort/index","iconPath":"/static/tab/sort-h.png","selectedIconPath":"/static/tab/sort.png","text":"分类"},{"pagePath":"pages/my/index","iconPath":"/static/tab/my-h.png","selectedIconPath":"/static/tab/my.png","text":"我的"}]},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"多典花","compilerVersion":"4.29","entryPagePath":"pages/index/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
var __uniRoutes = [{"path":"/pages/index/index","meta":{"isQuit":true,"isTabBar":true},"window":{"enablePullDownRefresh":false,"navigationStyle":"custom","bounce":"none"}},{"path":"/pages/sort/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"款式"}},{"path":"/pages/my/index","meta":{"isQuit":true,"isTabBar":true},"window":{"enablePullDownRefresh":true,"navigationStyle":"custom"}},{"path":"/pages/recruit/index","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":"鉴定师招聘"}},{"path":"/pages/recruitResult/index","meta":{},"window":{"enablePullDownRefresh":false,"navigationStyle":"custom"}},{"path":"/pages/category/category","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":"选择鉴定品类"}},{"path":"/pages/application/application","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":"我的鉴定申请"}},{"path":"/pages/myneed/myneed","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":"我需要的"}},{"path":"/pages/Ineed/Ineed","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":"我需要"}},{"path":"/pages/productDetails/productDetails","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":"商品详情"}},{"path":"/pages/detailResult/detailResult","meta":{},"window":{"enablePullDownRefresh":false,"navigationStyle":"custom"}},{"path":"/pages/useFeed/useFeed","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":"用户反馈"}},{"path":"/pages/lookGoods/lookGoods","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":""}},{"path":"/pages/login/login","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":"登录"}},{"path":"/pages/prolist/prolist","meta":{},"window":{"navigationBarTitleText":"相关协议"}},{"path":"/pages/setting/setting","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":"设置"}},{"path":"/pages/contact/contact","meta":{},"window":{"navigationBarTitleText":"通讯录","enablePullDownRefresh":false}},{"path":"/pages/web/contact","meta":{},"window":{"navigationBarTitleText":"通讯录","enablePullDownRefresh":false}},{"path":"/pages/webview/webview","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":""}},{"path":"/pages/websrc/websrc","meta":{},"window":{"navigationBarTitleText":"","enablePullDownRefresh":false}},{"path":"/pages/web/web","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationStyle":"custom","enablePullDownRefresh":false,"navigationBarTitleText":""}},{"path":"/pages/web/websrc","meta":{},"window":{"navigationStyle":"custom","enablePullDownRefresh":false}},{"path":"/pages/bill/indexs","meta":{},"window":{"navigationBarTitleText":"账单"}},{"path":"/pages/finance/index","meta":{},"window":{"enablePullDownRefresh":true,"navigationStyle":"custom"}},{"path":"/pages/app-update/index","meta":{},"window":{"navigationStyle":"custom","navigationBarTitleText":"","enablePullDownRefresh":false,"bounce":"none","animationType":"fade-in","background":"transparent","backgroundColor":"rgba(0,0,0,0)","webviewBGTransparent":true,"mask":"none"}},{"path":"/pages/agreement/index","meta":{},"window":{"navigationStyle":"custom","navigationBarTitleText":"","enablePullDownRefresh":false,"bounce":"none","animationType":"fade-in","background":"transparent","backgroundColor":"rgba(0,0,0,0)","webviewBGTransparent":true,"mask":"none"}}]; var __uniRoutes = [{"path":"/pages/index/index","meta":{"isQuit":true,"isTabBar":true},"window":{"enablePullDownRefresh":false,"navigationStyle":"custom","bounce":"none"}},{"path":"/pages/sort/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"款式"}},{"path":"/pages/my/index","meta":{"isQuit":true,"isTabBar":true},"window":{"enablePullDownRefresh":true,"navigationStyle":"custom"}},{"path":"/pages/recruit/index","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":"鉴定师招聘"}},{"path":"/pages/recruitResult/index","meta":{},"window":{"enablePullDownRefresh":false,"navigationStyle":"custom"}},{"path":"/pages/category/category","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":"选择鉴定品类"}},{"path":"/pages/application/application","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":"我的鉴定申请"}},{"path":"/pages/myneed/myneed","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":"我需要的"}},{"path":"/pages/Ineed/Ineed","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":"我需要"}},{"path":"/pages/productDetails/productDetails","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":"商品详情"}},{"path":"/pages/detailResult/detailResult","meta":{},"window":{"enablePullDownRefresh":false,"navigationStyle":"custom"}},{"path":"/pages/useFeed/useFeed","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":"用户反馈"}},{"path":"/pages/lookGoods/lookGoods","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":""}},{"path":"/pages/login/login","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":"登录"}},{"path":"/pages/prolist/prolist","meta":{},"window":{"navigationBarTitleText":"相关协议"}},{"path":"/pages/setting/setting","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":"设置"}},{"path":"/pages/contact/contact","meta":{},"window":{"navigationBarTitleText":"通讯录","enablePullDownRefresh":false}},{"path":"/pages/web/contact","meta":{},"window":{"navigationBarTitleText":"通讯录","enablePullDownRefresh":false}},{"path":"/pages/webview/webview","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":""}},{"path":"/pages/websrc/websrc","meta":{},"window":{"navigationBarTitleText":"","enablePullDownRefresh":false}},{"path":"/pages/web/web","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationStyle":"custom","enablePullDownRefresh":false,"navigationBarTitleText":""}},{"path":"/pages/web/websrc","meta":{},"window":{"navigationStyle":"custom","enablePullDownRefresh":false}},{"path":"/pages/bill/indexs","meta":{},"window":{"navigationBarTitleText":"账单"}},{"path":"/pages/finance/index","meta":{},"window":{"enablePullDownRefresh":true,"navigationStyle":"custom"}},{"path":"/pages/app-update/index","meta":{},"window":{"navigationStyle":"custom","navigationBarTitleText":"","enablePullDownRefresh":false,"bounce":"none","animationType":"fade-in","background":"transparent","backgroundColor":"rgba(0,0,0,0)","webviewBGTransparent":true,"mask":"none"}},{"path":"/pages/agreement/index","meta":{},"window":{"navigationStyle":"custom","navigationBarTitleText":"","enablePullDownRefresh":false,"bounce":"none","animationType":"fade-in","background":"transparent","backgroundColor":"rgba(0,0,0,0)","webviewBGTransparent":true,"mask":"none"}}];
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); __uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); __uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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