h5-utils.js
1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import $ from '@/static/js/jquery-3.3.1.min.js'
export function go_android_login() {
window.open('ydncp://www.ydniu.com?type=7')
}
export function remove_uni_page_head() {
$("uni-page-head").remove()
}
export function head_tv(url) {
$("body").css({
"margin-top": "25px",
"overflow": "hidden",
"background-color": "#F8F8F8"
})
$("uni-app").css({
"overflow-y": "auto",
"overflow-x": "hidden"
})
$(".uni-page-head").eq(0).append(
`<div onclick="Android.access2Tv('${url}')" style='font-size:12px;padding:0 5px;margin-right: 8px;height:24px;line-height:24px;margin-top: 3px;background-color: #007AFF;color:#FFFFFF;border-radius:5px;'>TV 投屏</div>`
)
$(".uni-page-head-hd").click(function() {
Android.webGoBack("")
});
}
export function savePicture(Url) {
var blob=new Blob([''], {type:'application/octet-stream'});
var url = URL.createObjectURL(blob);
var a = document.createElement('a');
a.href = Url;
a.download = Url.replace(/(.*\/)*([^.]+.*)/ig,"$2").split("?")[0];
var e = document.createEvent('MouseEvents');
e.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
a.dispatchEvent(e);
URL.revokeObjectURL(url);
}
export function downLoadImg1(url) {
let alink = document.createElement('a');
alink.href = url;
alink.download = '排1111.png';
alink.click();
}
export function downLoadImg(link, filename){
let a = document.createElement('a')
a.href = link
a.download = filename || 'default.png'
a.dispatchEvent(new MouseEvent('click'))
}