公共url打开支持地图、电话、外部小程序协议方式

master
gongfuxiang 2023-03-17 19:33:57 +08:00
parent 68b9b97553
commit a1f378b7e5
1 changed files with 35 additions and 6 deletions

41
App.vue
View File

@ -57,7 +57,7 @@
"/pages/user/user"
],
//
request_url: 'https://d1.shopxo.vip/',
request_url: 'http://shopxo.com/',
// publicpublichttps://d1.shopxo.vip/public/
static_url: 'https://d1.shopxo.vip/',
// default
@ -1164,12 +1164,41 @@
// url
url_open(value, is_redirect = false) {
if (value != null) {
var temp = value.substr(0, 6);
if (temp == 'http:/' || temp == 'https:') {
this.open_web_view(value);
if ((value || null) != null) {
// web
var http_arr = ['http:/', 'https:'];
if (http_arr.indexOf(value.substr(0, 6)) != -1) {
this.open_web_view(value);
//
} else if(value.substr(0, 8) == 'appid://') {
uni.navigateToMiniProgram({
appId: value.substr(8)
});
//
} else if(value.substr(0, 6) == 'map://') {
var values = value.substr(6).split('|');
if (values.length != 4) {
this.showToast('事件值格式有误');
return false;
}
this.open_location(values[2], values[3], values[0], values[1]);
//
} else if(value.substr(0, 6) == 'tel://') {
this.call_tel(value.substr(6));
//
} else {
if (this.is_tabbar_pages(value)) {
if (this.is_tabbar_pages(value)) {
var temp = value.split('?');
if(temp.length > 1 && (temp[1] || null) != null)
{
value = temp[0];
var query = this.url_params_to_json(temp[1]);
uni.setStorageSync(this.data.cache_page_tabbar_switch_params, query);
}
uni.switchTab({
url: value
});