share.html
7.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
<title></title>
<script src="../../assets/js/fontsize.js"></script>
<!--<link rel="stylesheet" href="../../assets/css/api.css"/>-->
<!--<link rel="stylesheet" href="http://at.alicdn.com/t/font_641470_jg64l6ijsg4lsor.css">-->
<link rel="stylesheet" href="../../assets/icon/iconfont.css">
<style>
body, html {
background-color: transparent !important;
height: 100%;
}
.meal {
display: flex;
flex-direction: column;
justify-content: flex-end;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.meal_item {
display: flex;
align-items: center;
justify-content: space-around;
padding: 0.25rem 0;
background-color: #fff;
}
.share_top {
font-size: 18px;
color: #555;
text-align: center;
padding: 0.2rem 0;
border-bottom: 1px solid #E4E4E4;
background-color: #fff;
}
.share_item {
display: flex;
align-items: center;
flex-direction: column;
font-size: 16px;
color: #555;
}
.share_item .icon {
font-size: 25px;
width: 30px;
height: 30px;
margin-bottom: 0.1rem;
}
.cancel {
text-align: center;
font-size: 16px;
color: #fff;
background-color: #dbb25f;
padding: 0.15rem 0;
}
</style>
</head>
<body>
<div id="app">
<div @click="close" class="meal">
<div class="share_top">分享到</div>
<div class="meal_item" @click.stop>
<div class="share_item" @click="share_f('session')">
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-weixin"></use>
</svg>
<span class="">微信</span>
</div>
<div class="share_item" @click="share_f('timeline')">
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-pengyouquan"></use>
</svg>
<span class="">微信朋友圈</span>
</div>
<div class="share_item">
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-QQgai" @click="share_qq"></use>
</svg>
<span class="">腾讯QQ</span>
</div>
<div class="share_item" @click="clipBoard">
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-fuzhilianjie1"></use>
</svg>
<span class="">复制链接</span>
</div>
</div>
<div class="cancel" @click="api.closeFrame()">取消</div>
</div>
</div>
</body>
</html>
<script type="text/javascript" src="../../assets/js/api.js"></script>
<script type="text/javascript" src="../../assets/js/public.js"></script>
<script type="text/javascript" src="../../assets/js/fastclick.js"></script>
<script>
new FastClick(document.body);
</script>
<script type="text/javascript" src="../../assets/js/vue.min.js"></script>
<script type="text/javascript" src="../../assets/js/swiper-3.4.2.min.js"></script>
<!--<script type="text/javascript" src="http://at.alicdn.com/t/font_641470_jg64l6ijsg4lsor.js"></script>-->
<script type="text/javascript" src="../../assets/icon/iconfont.js"></script>
<script type="text/javascript" src="../../assets/js/axios.min.js"></script>
<script>
var app = new Vue({
el: '#app',
data: {
url: '',
title: '',
des: '',
img: '',
default_img: '../../asset/image/logo200.png',
id: '',
invite_type: ''
},
created: function () {
apiready = function () {
app.url = api.pageParam.share_url;
app.title = api.pageParam.share_title;
app.desc = api.pageParam.share_desc;
app.img = api.pageParam.share_img;
app.id = api.pageParam.share_id;
app.invite_type = api.pageParam.invite_type;
// alert(JSON.stringify(app.img))
}
},
methods: {
close: function () {
api.closeFrame();
},
share_f: function (type) {
var wx = api.require('wx');
wx.isInstalled(function (ret, err) {
if (ret.installed) {
wx.shareWebpage({
apiKey: '',
scene: type,
title: app.title,
description: app.desc,
thumb: 'widget://assets/image/logo200.png',
contentUrl:app.url?app.url: goodUrl + 'download.html'
}, function (ret, err) {
if (ret.status) {
toastMsg('分享成功');
} else {
toastMsg('取消分享');
}
api.closeFrame();
});
} else {
toastMsg('当前设备未安装微信客户端');
}
});
},
share_qq: function () {
var qq = api.require('qq');
qq.installed(function (ret, err) {
if (ret.status) {
qq.shareNews({
url: app.url?app.url: goodUrl + 'download.html',
type: 'QFriend',
title: app.title,
description: app.desc,
imgUrl: 'widget://assets/image/logo200.png'
}, function (ret, err) {
// alert(JSON.stringify(ret))
if (ret.status) {
toastMsg("分享成功!");
} else {
toastMsg(err.code)
}
api.closeFrame()
});
} else {
toastMsg('请安装腾讯QQ')
}
});
},
clipBoard: function () {
var clipBoard = api.require('clipBoard');
clipBoard.set({
value:app.url?app.url: goodUrl + 'download.html'
}, function (ret, err) {
if (ret) {
clipBoard.get(function (ret, err) {
if (ret) {
toastMsg('复制成功')
} else {
toastMsg('复制失败,请重试')
}
api.closeFrame();
});
} else {
}
});
}
}
})
</script>