|
@ -59,3 +59,109 @@ Vue.prototype.IsMail = code => { |
|
|
var pattern = /^\w+@[a-z0-9]+\.[a-z]+$/i; |
|
|
var pattern = /^\w+@[a-z0-9]+\.[a-z]+$/i; |
|
|
return pattern.test(code); |
|
|
return pattern.test(code); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 图片显示判断
|
|
|
|
|
|
Vue.prototype.showImg = img => { |
|
|
|
|
|
if(!img) return; |
|
|
|
|
|
if (img.indexOf('https://') != -1 || img.indexOf('http://') != -1) { |
|
|
|
|
|
return img; |
|
|
|
|
|
} else { |
|
|
|
|
|
return 'https://tlgz.sz-trip.com' + img; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 获取经纬度
|
|
|
|
|
|
Vue.prototype.getLocation = () => { |
|
|
|
|
|
uni.startLocationUpdate({ |
|
|
|
|
|
success: res => { |
|
|
|
|
|
uni.onLocationChange(data => { |
|
|
|
|
|
uni.setStorageSync('location', { |
|
|
|
|
|
lat: data.latitude, |
|
|
|
|
|
lon: data.longitude |
|
|
|
|
|
}); |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 金刚区头图
|
|
|
|
|
|
Vue.prototype.getHeadImg = type => { |
|
|
|
|
|
return Vue.prototype.Post( |
|
|
|
|
|
{ |
|
|
|
|
|
type, |
|
|
|
|
|
}, |
|
|
|
|
|
'/api/public_service/getKumgangHeadImgList' |
|
|
|
|
|
).then(res => { |
|
|
|
|
|
return res.data[0].image |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 路由页面跳转
|
|
|
|
|
|
Vue.prototype.gotoPath = path => { |
|
|
|
|
|
uni.navigateTo({ |
|
|
|
|
|
url: path |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 返回上一页
|
|
|
|
|
|
Vue.prototype.goBack = () => { |
|
|
|
|
|
console.log(getCurrentPages()) |
|
|
|
|
|
var pages = getCurrentPages(); |
|
|
|
|
|
var page = pages[pages.length - 1]; |
|
|
|
|
|
if(page.route == 'subPackages/techan/techanList') { |
|
|
|
|
|
uni.switchTab({ |
|
|
|
|
|
url: '/pages/index/index' |
|
|
|
|
|
}) |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
getCurrentPages().length > 1 ? uni.navigateBack({}) : uni.switchTab({ |
|
|
|
|
|
url: '/pages/index/index' |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 打开地图
|
|
|
|
|
|
Vue.prototype.openLocation = (lat,lon) => { |
|
|
|
|
|
uni.openLocation({ |
|
|
|
|
|
latitude: Number(lat), |
|
|
|
|
|
longitude: Number(lon), |
|
|
|
|
|
success: function () { |
|
|
|
|
|
console.log('success'); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 拨打电话
|
|
|
|
|
|
Vue.prototype.clickPhone = (phone) => { |
|
|
|
|
|
uni.makePhoneCall({ |
|
|
|
|
|
phoneNumber:phone |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 周几
|
|
|
|
|
|
Vue.prototype.ShowDateDay = day => { |
|
|
|
|
|
let stateTxt = ""; |
|
|
|
|
|
switch (day) { |
|
|
|
|
|
case 0: |
|
|
|
|
|
stateTxt = '周日' |
|
|
|
|
|
break; |
|
|
|
|
|
case 1: |
|
|
|
|
|
stateTxt = '周一' |
|
|
|
|
|
break; |
|
|
|
|
|
case 2: |
|
|
|
|
|
stateTxt = '周二' |
|
|
|
|
|
break; |
|
|
|
|
|
case 3: |
|
|
|
|
|
stateTxt = '周三' |
|
|
|
|
|
break; |
|
|
|
|
|
case 4: |
|
|
|
|
|
stateTxt = '周四' |
|
|
|
|
|
break; |
|
|
|
|
|
case 5: |
|
|
|
|
|
stateTxt = '周五' |
|
|
|
|
|
break; |
|
|
|
|
|
case 6: |
|
|
|
|
|
stateTxt = '周六' |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
return stateTxt |
|
|
|
|
|
} |