fhrons-mobile-next 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.poc +8 -0
- package/assets/css/colors.js +6 -0
- package/assets/css/customVant.less +60 -0
- package/assets/css/extra.css +32 -0
- package/assets/css/global.css +1 -0
- package/assets/css/global.less +1637 -0
- package/assets/css/index.js +63 -0
- package/assets/css/static.less +607 -0
- package/assets/js/func.js +361 -0
- package/assets/js/globalData.js +18 -0
- package/assets/js/qywxapi.js +484 -0
- package/{packages → assets/js}/storage.js +1 -20
- package/assets/js/upload.js +269 -0
- package/assets/js/validate.js +48 -0
- package/assets/js/vant.js +39 -0
- package/assets/js/wxapi.js +297 -0
- package/assets/vantLang/index.js +172 -0
- package/assets/vantLang/lib/en-US.js +95 -0
- package/assets/vantLang/lib/es-ES.js +95 -0
- package/assets/vantLang/lib/pt-PT.js +96 -0
- package/assets/vantLang/lib/zh-CN.js +96 -0
- package/assets/vantLang/lib/zh-HK.js +96 -0
- package/assets/vantLang/locales/en_US.js +102 -0
- package/assets/vantLang/locales/es_ES.js +102 -0
- package/assets/vantLang/locales/index.js +12 -0
- package/assets/vantLang/locales/pt_PT.js +102 -0
- package/assets/vantLang/locales/zh_CN.js +102 -0
- package/assets/vantLang/locales/zh_T.js +102 -0
- package/babel.config.js +15 -0
- package/index.js +68 -33
- package/inject-env-plugin.js +29 -0
- package/package.json +46 -32
- package/packages/areaMobile/index.js +5 -0
- package/packages/areaMobile/index.vue +260 -0
- package/packages/autoGraph/VueEsign.vue +309 -0
- package/packages/autoGraph/index.js +5 -0
- package/packages/autoGraph/index.vue +472 -0
- package/packages/commonForm/CommonAsyncAreaPicker.vue +223 -0
- package/packages/commonForm/CommonDatePicker.vue +152 -0
- package/packages/commonForm/CommonForm.vue +786 -0
- package/packages/commonForm/CommonFullTimePicker.vue +137 -0
- package/packages/commonForm/CommonSinglePicker.vue +121 -0
- package/packages/commonForm/CommonYearMonthPicker.vue +127 -0
- package/packages/commonForm/index.js +33 -0
- package/packages/dialog/index.js +32 -0
- package/packages/dialog/index.vue +379 -0
- package/packages/index.js +7 -3
- package/packages/introduce/index.js +5 -0
- package/packages/introduce/index.vue +31 -0
- package/packages/loading/Loading.vue +70 -0
- package/packages/loading/index.js +43 -0
- package/packages/mindMap/index.js +5 -0
- package/packages/mindMap/index.vue +437 -0
- package/packages/pdfViewer/index.js +12 -0
- package/packages/pdfViewer/index.vue +131 -0
- package/packages/sharePanel/SheetPanel.vue +316 -0
- package/packages/sharePanel/index.js +5 -0
- package/packages/sharePanel/index.vue +476 -0
- package/packages/sharePanel/props.js +58 -0
- package/packages/sharePanel/utils/QyWxShareMixin.js +93 -0
- package/packages/sharePanel/utils/shareWay.js +81 -0
- package/packages/theme/index copy.js +89 -0
- package/packages/theme/index.js +38 -0
- package/packages/theme/theme.css +910 -0
- package/packages/theme/theme.less +26 -0
- package/packages/uploadFile/VanUploadFile.vue +80 -0
- package/packages/uploadFile/index.js +5 -0
- package/packages/uploadFile/index.vue +725 -0
- package/packages/uploadFile/vanUpload.js +5 -0
- package/packages/verify/Verify/VerifyPoints.vue +247 -0
- package/packages/verify/Verify/VerifySlide.vue +364 -0
- package/packages/verify/index.js +5 -0
- package/packages/verify/index.vue +416 -0
- package/packages/verify/utils/verify.js +53 -0
- package/packages/videoPage/index.js +5 -0
- package/packages/videoPage/index.vue +440 -0
- package/plugins/sensors/fhsensors.js +84 -0
- package/plugins/sensors/sensors.js +175 -0
- package/plugins/sensors/sensorsFun.js +1387 -0
- package/fhrons-mobile-next-2.0.0.tgz +0 -0
- package/packages/fhImage/index.js +0 -5
- package/packages/fhImage/index.vue +0 -57
- package/packages/fhPresetImage/index.js +0 -5
- package/packages/fhPresetImage/index.vue +0 -39
- package/packages/html2canvas/index.js +0 -29
- package/upload copy.js +0 -468
- package/utils/tools.js +0 -22
- /package/{dist → fhcommon/dist}/fhcommon.min.js +0 -0
- /package/{dist → fhcommon/dist}/fhcommon.min.js.LICENSE.txt +0 -0
- /package/{upload.js → fhcommon/upload.js} +0 -0
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id="share">
|
|
3
|
+
<!-- 微信、APP分享 -->
|
|
4
|
+
<template v-if="sourceWx === 'isApp' || sourceWx === 'isWx' || isExample">
|
|
5
|
+
<div v-if="shareMask" class="share-sign" @click="handleCancel">
|
|
6
|
+
<img :src="imgType[language]" alt="" :class="[isMiniprogram ? 'mr60' : '']" />
|
|
7
|
+
<slot />
|
|
8
|
+
</div>
|
|
9
|
+
<SheetPanel :is-show="showSheetPanel" :title="$t('mystore.mystore.177j43')" :showTitle="showTitle" :targetDom="targetDom" :share-text="shareData.text" :options="options" @close="handleCancel" @select="handleSelect">
|
|
10
|
+
<template #post>
|
|
11
|
+
<slot name="post"></slot>
|
|
12
|
+
</template>
|
|
13
|
+
<template #close>
|
|
14
|
+
<slot name="close"></slot>
|
|
15
|
+
</template>
|
|
16
|
+
</SheetPanel>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<!-- 企微分享 -->
|
|
20
|
+
<template v-else-if="sourceWx === 'isQyWx'">
|
|
21
|
+
<div v-if="shareMask" class="share-sign" @click="handleCancel">
|
|
22
|
+
<img :src="imgType[language]" />
|
|
23
|
+
<slot />
|
|
24
|
+
</div>
|
|
25
|
+
<!-- 九宫格图片分享 -->
|
|
26
|
+
<van-image-preview v-model="shareMaskImg" :images="images" :closeable="true" @onClose="shareMaskImg = false">
|
|
27
|
+
<template v-slot:cover>
|
|
28
|
+
<div v-if="showCopy" class="pd12 flex-start img-preview-bottom">
|
|
29
|
+
<i class="iconfont icon-dianxuangouxuan ft16 pr6 c-39cc52" />
|
|
30
|
+
<span class="c-ffffff">{{ $t("componentsfile.qyweixinpanel.860j35") }}{{ text }}</span>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
</van-image-preview>
|
|
34
|
+
</template>
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script>
|
|
39
|
+
import wxApi from "../../assets/js/wxapi";
|
|
40
|
+
import { getStorage } from "../../assets/js/storage";
|
|
41
|
+
import { getSystemName } from "../../assets/js/func";
|
|
42
|
+
import shareWay, { AbroadShareWay, shareGuide } from "./utils/shareWay";
|
|
43
|
+
import props from "./props";
|
|
44
|
+
import QyWxShareMixin from "./utils/QyWxShareMixin";
|
|
45
|
+
|
|
46
|
+
export default {
|
|
47
|
+
name: "SharePanel",
|
|
48
|
+
mixins: [ QyWxShareMixin],
|
|
49
|
+
components: {
|
|
50
|
+
SheetPanel: () => import("./SheetPanel"),
|
|
51
|
+
},
|
|
52
|
+
props: {
|
|
53
|
+
// 微信分享显隐控制
|
|
54
|
+
showShare: {
|
|
55
|
+
type: Boolean, // 要求父组件数据传输类型
|
|
56
|
+
required: true // 必传
|
|
57
|
+
},
|
|
58
|
+
// 是否展示指引遮罩层
|
|
59
|
+
showMask: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: true
|
|
62
|
+
},
|
|
63
|
+
// 遮罩展示时间,为0时不会自动消失,需手动取消
|
|
64
|
+
maskDuration: {
|
|
65
|
+
type: Number,
|
|
66
|
+
default: 5000
|
|
67
|
+
},
|
|
68
|
+
// 微信分享方式 分享方式的索引集合
|
|
69
|
+
shareMethods: {
|
|
70
|
+
type: Array,
|
|
71
|
+
default: () => [0, 1]
|
|
72
|
+
},
|
|
73
|
+
// 引入页面是否隐藏右上角菜单
|
|
74
|
+
isHideOptionMenu: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: true
|
|
77
|
+
},
|
|
78
|
+
// 分享结束回调方法名
|
|
79
|
+
callbackName: {
|
|
80
|
+
type: String,
|
|
81
|
+
default: ''
|
|
82
|
+
},
|
|
83
|
+
// 微信分享api签名等业务接口所需外部参数
|
|
84
|
+
// 微信分享需要 => firUrl, saasId, appId
|
|
85
|
+
// 企微分享需要 => firUrl, saasId || corpId, agentId
|
|
86
|
+
otherParam: {
|
|
87
|
+
type: Object,
|
|
88
|
+
default: () => {
|
|
89
|
+
return {
|
|
90
|
+
lang: '',
|
|
91
|
+
firUrl: '',
|
|
92
|
+
saasId: '',
|
|
93
|
+
appId: '',
|
|
94
|
+
agentId: '',
|
|
95
|
+
corpId: ''
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
targetDom: {
|
|
100
|
+
type: String,
|
|
101
|
+
default:''
|
|
102
|
+
},
|
|
103
|
+
showTitle: {
|
|
104
|
+
type: Boolean,
|
|
105
|
+
default: true
|
|
106
|
+
},
|
|
107
|
+
// 下载图片自定义前置方法,方法接收resolve,并需要在结束时调用
|
|
108
|
+
beforeDownload: Function
|
|
109
|
+
},
|
|
110
|
+
model: {
|
|
111
|
+
prop: "showShare",
|
|
112
|
+
event: "close",
|
|
113
|
+
},
|
|
114
|
+
data() {
|
|
115
|
+
return {
|
|
116
|
+
sourceWx: this.$globalData.isQYWeiXin ? "isQyWx" : this.$globalData.isWeiXin ? "isWx" : this.$globalData.isApp ? "isApp" : "",
|
|
117
|
+
language: this.otherParam.lang || (getStorage({ key: getSystemName() + "language" }) || {}).content || "zh_CN",
|
|
118
|
+
shareMask: false, // 微信指引面板
|
|
119
|
+
showSheetPanel: false, // app分享面板
|
|
120
|
+
options: [], // 展示的分享方式配置数据
|
|
121
|
+
abroadShareType: [], // 海外分享类型
|
|
122
|
+
imgType: shareGuide, // 指引多语言图片静态资源
|
|
123
|
+
shareImgType: ["poster", "img", "code", "image"], // 分享数据类型 - 图片
|
|
124
|
+
shareData: {
|
|
125
|
+
type: "", // 类型(海报,文字,图文,音视频,其他en)
|
|
126
|
+
text: "", // 文案
|
|
127
|
+
desc: "", // 文字内容描述
|
|
128
|
+
title: "", // 标题
|
|
129
|
+
link: "", // (物料内容分享的url)
|
|
130
|
+
imgUrl: "", // (分享的小图标url)
|
|
131
|
+
flag: "", // (0 朋友圈 ,1微信,2 企业微信)
|
|
132
|
+
other: "", // 扩展字段可以为空
|
|
133
|
+
},
|
|
134
|
+
closeTimer: null,
|
|
135
|
+
isExample: false, // 组件文档网页端演示用,仅用于pc端展示分享弹窗
|
|
136
|
+
};
|
|
137
|
+
},
|
|
138
|
+
computed: {
|
|
139
|
+
isShowSheetPanel() {
|
|
140
|
+
return this.showShare;
|
|
141
|
+
},
|
|
142
|
+
isMiniprogram() {
|
|
143
|
+
return wx && wx.miniProgram && window.__wxjs_environment === "miniprogram";
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
watch: {
|
|
147
|
+
// 监听控制显隐源头 prop => showShare
|
|
148
|
+
showShare() {
|
|
149
|
+
if (this.$globalData.isWeiXin || this.$globalData.isQYWeiXin) {
|
|
150
|
+
this.shareMask = this.showShare && this.showMask;
|
|
151
|
+
} else if (this.$globalData.isApp || this.isExample) {
|
|
152
|
+
this.showSheetPanel = this.showShare;
|
|
153
|
+
}
|
|
154
|
+
// if (this.shareData.type === 'img' && this.showShare) {
|
|
155
|
+
// this.shareSudokuImg();
|
|
156
|
+
// } else { ...
|
|
157
|
+
},
|
|
158
|
+
// 监听遮罩显隐
|
|
159
|
+
shareMask(val) {
|
|
160
|
+
if (val) {
|
|
161
|
+
this.copyText(this.shareData.text);
|
|
162
|
+
if (this.maskDuration) {
|
|
163
|
+
this.closeTimer && clearTimeout(this.closeTimer);
|
|
164
|
+
this.closeTimer = setTimeout(() => {
|
|
165
|
+
this.handleCancel();
|
|
166
|
+
}, this.maskDuration);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
shareMethods() {
|
|
171
|
+
this.setOptions();
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
created() {
|
|
175
|
+
console.log("分享环境", this.sourceWx);
|
|
176
|
+
this.createdHandle();
|
|
177
|
+
},
|
|
178
|
+
methods: {
|
|
179
|
+
// 初始化分享
|
|
180
|
+
async createdHandle() {
|
|
181
|
+
this.setOptions();
|
|
182
|
+
if (this.$globalData.isQYWeiXin) {
|
|
183
|
+
await this.createdQYHandle(this.isHideOptionMenu);
|
|
184
|
+
} else if (this.$globalData.isWeiXin) {
|
|
185
|
+
await wxApi.wxShare({ ...this.otherParam, isHideOptionMenu: this.isHideOptionMenu });
|
|
186
|
+
}
|
|
187
|
+
// 事件 - 分享、微信分享等初始化完成后
|
|
188
|
+
this.$emit("afterInit");
|
|
189
|
+
},
|
|
190
|
+
// 设置分享方式
|
|
191
|
+
setOptions() {
|
|
192
|
+
const optionsAll = shareWay();
|
|
193
|
+
this.options = this.shareMethods.reduce((prev, item) => {
|
|
194
|
+
const option = optionsAll.find((o, i) => i === item);
|
|
195
|
+
option && prev.push(option);
|
|
196
|
+
return prev;
|
|
197
|
+
}, []);
|
|
198
|
+
// 获取海外分享类型集合
|
|
199
|
+
this.abroadShareType = AbroadShareWay().map((item) => item.type);
|
|
200
|
+
},
|
|
201
|
+
// 设置微信分享参数
|
|
202
|
+
setShareData(option = {}) {
|
|
203
|
+
// let { type } = this.shareData;
|
|
204
|
+
let { type } = option;
|
|
205
|
+
const typearr = ["activetopic"];
|
|
206
|
+
if (typearr.includes(type)) {
|
|
207
|
+
type = "article";
|
|
208
|
+
}
|
|
209
|
+
this.shareData = {
|
|
210
|
+
text: "", // 文案
|
|
211
|
+
desc: "", // 文字内容描述
|
|
212
|
+
title: "", // 标题
|
|
213
|
+
link: "", // (物料内容分享的url)
|
|
214
|
+
imgUrl: "", // (分享的小图标url)
|
|
215
|
+
flag: "", // (0 朋友圈 ,1微信,2 企业微信)
|
|
216
|
+
other: "", // 扩展字段可以为空
|
|
217
|
+
fileExtension: "",
|
|
218
|
+
// ...this.shareData,
|
|
219
|
+
type,
|
|
220
|
+
...option,
|
|
221
|
+
};
|
|
222
|
+
},
|
|
223
|
+
async handleSelect(option) {
|
|
224
|
+
console.log("handleSelect: this.shareData", this.shareData);
|
|
225
|
+
if (this.abroadShareType.includes(option.type)) {
|
|
226
|
+
// 海外分享
|
|
227
|
+
const shareText = ["text", "article", "video", "formActivity"];
|
|
228
|
+
const fileName = this.shareData.link || "";
|
|
229
|
+
const urlNameArr = (fileName.split("/").pop() || "").split(".");
|
|
230
|
+
const fileFormat = this.shareData.fileExtension || urlNameArr.length > 1 ? urlNameArr.pop() : "";
|
|
231
|
+
const fileType = ["png", "jpg", "jpeg", "gif"];
|
|
232
|
+
if (this.shareImgType.includes(this.shareData.type) || (this.shareData.type === "package" && fileType.includes(fileFormat))) {
|
|
233
|
+
// 图片类型
|
|
234
|
+
const url = fileName;
|
|
235
|
+
if (this.$globalData.isApp && this.$globalData.isIOS) {
|
|
236
|
+
if (window.webkit && window.webkit.messageHandlers.JSToAppImgActivityVC) {
|
|
237
|
+
window.webkit.messageHandlers.JSToAppImgActivityVC.postMessage(JSON.stringify({ url: url }));
|
|
238
|
+
}
|
|
239
|
+
} else if (this.$globalData.isAndroid && window.android) {
|
|
240
|
+
// 获取到图片的名称和后缀数组
|
|
241
|
+
const urlNameArr = (url.split("/").pop() || "").split(".");
|
|
242
|
+
const params = {
|
|
243
|
+
isText: false,
|
|
244
|
+
fileDownloadUrl: url,
|
|
245
|
+
fileName: urlNameArr.shift() || "",
|
|
246
|
+
fileExtension: fileFormat ? "." + fileFormat : ".png", // 没有后缀给一个默认的后缀
|
|
247
|
+
type: option.AppType,
|
|
248
|
+
};
|
|
249
|
+
window.android.jsToAppForShareWhatsApp(JSON.stringify(params));
|
|
250
|
+
}
|
|
251
|
+
} else if (this.shareData.type === "package") {
|
|
252
|
+
const url = this.shareData.link || "";
|
|
253
|
+
if (this.$globalData.isApp && this.$globalData.isIOS) {
|
|
254
|
+
if (window.webkit && window.webkit.messageHandlers.JSToAppRequestActivityVC) {
|
|
255
|
+
window.webkit.messageHandlers.JSToAppRequestActivityVC.postMessage(JSON.stringify({ path: url, name: this.shareData.title || "" }));
|
|
256
|
+
}
|
|
257
|
+
} else if (this.$globalData.isAndroid && window.android) {
|
|
258
|
+
// 获取到图片的名称和后缀数组
|
|
259
|
+
const urlNameArr = (url.split("/").pop() || "").split(".");
|
|
260
|
+
const params = {
|
|
261
|
+
isText: false,
|
|
262
|
+
fileDownloadUrl: url,
|
|
263
|
+
fileName: urlNameArr.shift() || "",
|
|
264
|
+
fileExtension: "." + fileFormat,
|
|
265
|
+
type: option.AppType,
|
|
266
|
+
};
|
|
267
|
+
if (fileFormat) {
|
|
268
|
+
window.android.jsToAppForShareWhatsApp(JSON.stringify(params));
|
|
269
|
+
} else {
|
|
270
|
+
console.error(`取不到后缀,需要传入this.shareData.fileExtension`);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
} else {
|
|
274
|
+
// } else if (shareText.includes(this.shareData.type)) {
|
|
275
|
+
try {
|
|
276
|
+
// 文本类型
|
|
277
|
+
const t = this.shareData.title || ""; // 标题
|
|
278
|
+
const d = this.shareData.desc || ""; // 描述信息
|
|
279
|
+
const i = this.shareData.imgUrl || ""; // 分享图片
|
|
280
|
+
const u = this.shareData.link || ""; // 分享只是分享文案,在whatsapp里的卡片展示是在分享的链接目标页面里面处理<mate>标签写og协议
|
|
281
|
+
const res = await axios.post(`/funapi/cbsmh/mh/mhThirdService/setSheareMate`, {
|
|
282
|
+
title: t, // 写入mate标签的title属性的content值 <meta property="og:title" content="">
|
|
283
|
+
description: d, // 写入mate标签的description属性的content值 <meta property="og:description" content="">
|
|
284
|
+
image: i, // 写入mate标签的image属性的content值 <meta property="og:image" content="">
|
|
285
|
+
url: u, // 重定向的原分享页面
|
|
286
|
+
});
|
|
287
|
+
// 接口存参数,返回id值,通过id值可以取到参数值
|
|
288
|
+
if (res.status === "SUCCESS") {
|
|
289
|
+
const whatsAppId = res.id || ""; // 分享出去的链接,返回一个只含meta标签和一段跳转原分享页面的 页面链接
|
|
290
|
+
const GATEWAY_PREFIX = process.env.VUE_APP_ENV_CONFIG === "scp" ? `/${process.env.VUE_APP_NAME}` : "";
|
|
291
|
+
const shareUrl = `${location.origin + GATEWAY_PREFIX}/funapi/cbsmh/mh/mhThirdService/getSheareMate/${whatsAppId}`; // 接口地址 返回一个只含meta标签和一段跳转原分享页面的脚本内容
|
|
292
|
+
const text = `标题:${t}\n\n描述:${d}\n\n链接:${shareUrl}`;
|
|
293
|
+
if (this.$globalData.isApp && this.$globalData.isIOS) {
|
|
294
|
+
if (window.webkit && window.webkit.messageHandlers.jsToAppShareWSApp) {
|
|
295
|
+
window.webkit.messageHandlers.jsToAppShareWSApp.postMessage(JSON.stringify({ text: text }));
|
|
296
|
+
}
|
|
297
|
+
} else if (this.$globalData.isAndroid && window.android) {
|
|
298
|
+
const params = {
|
|
299
|
+
isText: true,
|
|
300
|
+
content: text,
|
|
301
|
+
type: option.AppType,
|
|
302
|
+
};
|
|
303
|
+
window.android.jsToAppForShareWhatsApp(JSON.stringify(params));
|
|
304
|
+
}
|
|
305
|
+
} else {
|
|
306
|
+
this.$toast(this.$t("mystore.mystore.wmtyv4"));
|
|
307
|
+
}
|
|
308
|
+
} catch (error) {
|
|
309
|
+
this.$toast(this.$t("mystore.mystore.wmtyv4"));
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
} else if (option.type.includes("AppDownload")) {
|
|
313
|
+
// 下载图片前
|
|
314
|
+
const downloadUrl = this.beforeDownload && await new Promise(resolve => {
|
|
315
|
+
this.beforeDownload(resolve);
|
|
316
|
+
})
|
|
317
|
+
// 图片下载
|
|
318
|
+
// poster, img, code
|
|
319
|
+
if (this.shareImgType.includes(this.shareData.type) || downloadUrl || this.shareData.codeLink || this.shareData.imgLink) {
|
|
320
|
+
const url = downloadUrl ? downloadUrl :
|
|
321
|
+
option.type === "AppDownloadCode" && this.shareData.codeLink ? this.shareData.codeLink :
|
|
322
|
+
this.shareData.imgLink ? this.shareData.imgLink : this.shareData.link;
|
|
323
|
+
this.downLoadPicDown(url);
|
|
324
|
+
} else {
|
|
325
|
+
this.$toast(this.$t("componentsfile.sharemediapanel.7l8t53"));
|
|
326
|
+
}
|
|
327
|
+
} else if (option.type === "QyAppMessage") {
|
|
328
|
+
// 企微分享
|
|
329
|
+
if (this.$globalData.isIOS && window.webkit && window.webkit.messageHandlers) {
|
|
330
|
+
const data = {
|
|
331
|
+
title: this.shareData.title || "",
|
|
332
|
+
desc: this.shareData.desc || "",
|
|
333
|
+
imgUrl: this.shareData.imgUrl || "",
|
|
334
|
+
link: this.shareData.link || "",
|
|
335
|
+
text: this.shareData.text || "",
|
|
336
|
+
};
|
|
337
|
+
window.webkit.messageHandlers.WWKShare.postMessage(data);
|
|
338
|
+
} else if (this.$globalData.isAndroid && window.android) {
|
|
339
|
+
const data = {
|
|
340
|
+
title: this.shareData.title,
|
|
341
|
+
description: this.shareData.desc,
|
|
342
|
+
thumbUrl: this.shareData.imgUrl,
|
|
343
|
+
webPageUrl: this.shareData.link,
|
|
344
|
+
shareType: "link", // //标记,用来区分分享的类型,text,image,file,video,link,program
|
|
345
|
+
};
|
|
346
|
+
window.android.jsToAppForShareWeWork(JSON.stringify(data));
|
|
347
|
+
}
|
|
348
|
+
} else if (option.type === "AppMessage" || option.type === "Timeline") {
|
|
349
|
+
// 微信、朋友圈分享
|
|
350
|
+
if (this.$globalData.isIOS && window.webkit && window.webkit.messageHandlers) {
|
|
351
|
+
this.setShareData({ flag: option.flag });
|
|
352
|
+
window.AppToJSShareSuccess = function () {};
|
|
353
|
+
window.AppToJsStopScreenSharing = function () {};
|
|
354
|
+
window.webkit.messageHandlers.share.postMessage(this.shareData);
|
|
355
|
+
} else if (this.$globalData.isAndroid && window.android) {
|
|
356
|
+
if (this.shareImgType.includes(this.shareData.type)) {
|
|
357
|
+
// 分享海报或者分享图片
|
|
358
|
+
const data = {
|
|
359
|
+
flag: option.flag,
|
|
360
|
+
type: "img",
|
|
361
|
+
link: this.shareData.link,
|
|
362
|
+
text: this.shareData.text,
|
|
363
|
+
};
|
|
364
|
+
window.android.share(JSON.stringify(data));
|
|
365
|
+
} else {
|
|
366
|
+
const shareFn = option.type === "AppMessage" ? "goShardWxFriends" : "goShardWxCircle";
|
|
367
|
+
window.android[shareFn](this.shareData.link, this.shareData.desc, this.shareData.title, this.shareData.imgUrl, this.shareData.text);
|
|
368
|
+
}
|
|
369
|
+
} else if (this.isMiniprogram) {
|
|
370
|
+
// 小程序
|
|
371
|
+
this.shareMask = true;
|
|
372
|
+
}
|
|
373
|
+
} else if (option.type === "link") {
|
|
374
|
+
if (!this.shareData.link) {
|
|
375
|
+
return this.$toast(this.$t("componentsfile.sharepanel.2fe9j3"));
|
|
376
|
+
}
|
|
377
|
+
this.$copyText(this.shareData.link)
|
|
378
|
+
.then(() => this.$toast(this.$t("componentsfile.sharepanel.1e92j5")))
|
|
379
|
+
.catch(() => this.$toast(this.$t("componentsfile.sharepanel.3l8g6c")));
|
|
380
|
+
}
|
|
381
|
+
// 关闭分享弹窗
|
|
382
|
+
if (this.callbackName) {
|
|
383
|
+
this.$emit(this.callbackName, option);
|
|
384
|
+
}
|
|
385
|
+
this.handleCancel();
|
|
386
|
+
},
|
|
387
|
+
wxRegister(option = {}) {
|
|
388
|
+
const { isHideOptionMenu = false } = option;
|
|
389
|
+
option = { ...this.shareData, ...option, isHideOptionMenu };
|
|
390
|
+
wxApi.wxRegister(option);
|
|
391
|
+
},
|
|
392
|
+
wxHideMenu() {
|
|
393
|
+
if (this.$globalData.isQYWeiXin) {
|
|
394
|
+
this.qyWxHideMenu();
|
|
395
|
+
} else {
|
|
396
|
+
wxApi.wxHideMenu();
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
copyText(str) {
|
|
400
|
+
if (!str) return;
|
|
401
|
+
// 复制文案
|
|
402
|
+
this.$copyText(str)
|
|
403
|
+
.then(() => this.$toast(this.$t("utils.sharemixins.u31ln7")))
|
|
404
|
+
.catch(() => this.$toast(this.$t("applyprocess.examine.320980")));
|
|
405
|
+
},
|
|
406
|
+
handleCancel() {
|
|
407
|
+
this.closeTimer && clearTimeout(this.closeTimer);
|
|
408
|
+
this.$emit("close", false);
|
|
409
|
+
},
|
|
410
|
+
/**
|
|
411
|
+
* app下载图片的方法
|
|
412
|
+
* @param urlList 图片地址的数组,单图允许传字符串
|
|
413
|
+
* @param completeCallaBack 下载完成的回调
|
|
414
|
+
*/
|
|
415
|
+
downLoadPicDown(urlList, completeCallaBack) {
|
|
416
|
+
if (!Array.isArray(urlList)) {
|
|
417
|
+
urlList = [urlList];
|
|
418
|
+
}
|
|
419
|
+
const url = urlList.join(",");
|
|
420
|
+
if (!this.$globalData.isQyWeiXin && this.$globalData.isApp) {
|
|
421
|
+
// 下载完成的回调
|
|
422
|
+
window.AppToJsPicDownComplete = function () {
|
|
423
|
+
if (completeCallaBack) {
|
|
424
|
+
completeCallaBack();
|
|
425
|
+
} else {
|
|
426
|
+
if (this.$globalData.isIOS) {
|
|
427
|
+
this.$toast(this.$t("insuranceai.questionassistant.xk5841"));
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
if (this.$globalData.isIOS && window.webkit) {
|
|
432
|
+
console.log("ios:===", `^jstoios^JSToPicDown^${url}`);
|
|
433
|
+
window.location = `^jstoios^JSToPicDown^${url}`;
|
|
434
|
+
} else if (this.$globalData.isAndroid && window.android) {
|
|
435
|
+
if (urlList.length > 1) {
|
|
436
|
+
console.log("android:==", JSON.stringify({ images: urlList }));
|
|
437
|
+
const list = urlList.map((item) => ({ imgUrl: item }));
|
|
438
|
+
window.android.jsToAppForDownloadMoreImages(JSON.stringify({ images: list }));
|
|
439
|
+
} else {
|
|
440
|
+
console.log("android:==", JSON.stringify({ url }));
|
|
441
|
+
window.android.downLoadosterP(JSON.stringify({ url }));
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
},
|
|
446
|
+
},
|
|
447
|
+
};
|
|
448
|
+
</script>
|
|
449
|
+
|
|
450
|
+
<style scoped lang="less">
|
|
451
|
+
#share {
|
|
452
|
+
/deep/ .van-image-preview__cover {
|
|
453
|
+
width: 100%;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
.share-sign {
|
|
457
|
+
position: fixed;
|
|
458
|
+
top: 0;
|
|
459
|
+
left: 0;
|
|
460
|
+
z-index: 3101;
|
|
461
|
+
text-align: right;
|
|
462
|
+
top: 0;
|
|
463
|
+
right: 0;
|
|
464
|
+
top: 0;
|
|
465
|
+
bottom: 0;
|
|
466
|
+
background-color: rgba(0, 0, 0, 0.3);
|
|
467
|
+
}
|
|
468
|
+
.share-sign img {
|
|
469
|
+
width: 200px;
|
|
470
|
+
float: right;
|
|
471
|
+
}
|
|
472
|
+
.img-preview-bottom {
|
|
473
|
+
position: absolute;
|
|
474
|
+
top: 50px;
|
|
475
|
+
}
|
|
476
|
+
</style>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
// 微信分享显隐控制
|
|
4
|
+
showShare: {
|
|
5
|
+
type: Boolean, // 要求父组件数据传输类型
|
|
6
|
+
required: true // 必传
|
|
7
|
+
},
|
|
8
|
+
// 是否展示指引遮罩层
|
|
9
|
+
showMask: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: true
|
|
12
|
+
},
|
|
13
|
+
// 遮罩展示时间,为0时不会自动消失,需手动取消
|
|
14
|
+
maskDuration: {
|
|
15
|
+
type: Number,
|
|
16
|
+
default: 5000
|
|
17
|
+
},
|
|
18
|
+
// 微信分享方式 分享方式的索引集合
|
|
19
|
+
shareMethods: {
|
|
20
|
+
type: Array,
|
|
21
|
+
default: () => [0, 1]
|
|
22
|
+
},
|
|
23
|
+
// 引入页面是否隐藏右上角菜单
|
|
24
|
+
isHideOptionMenu: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: true
|
|
27
|
+
},
|
|
28
|
+
// 分享结束回调方法名
|
|
29
|
+
callbackName: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: ''
|
|
32
|
+
},
|
|
33
|
+
// 微信分享api签名等业务接口所需外部参数
|
|
34
|
+
// 微信分享需要 => firUrl, saasId, appId
|
|
35
|
+
// 企微分享需要 => firUrl, saasId || corpId, agentId
|
|
36
|
+
otherParam: {
|
|
37
|
+
type: Object,
|
|
38
|
+
default: () => {
|
|
39
|
+
return {
|
|
40
|
+
lang: '',
|
|
41
|
+
firUrl: '',
|
|
42
|
+
saasId: '',
|
|
43
|
+
appId: '',
|
|
44
|
+
agentId: '',
|
|
45
|
+
corpId: ''
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
targetDom: {
|
|
50
|
+
type: String,
|
|
51
|
+
default:''
|
|
52
|
+
},
|
|
53
|
+
showTitle: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default:true
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import i18n from '../../../assets/vantLang';
|
|
2
|
+
import qyWxApi from '../../../assets/js/qywxapi';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
data() {
|
|
6
|
+
return {
|
|
7
|
+
shareMaskImg: false, // 九宫格面板
|
|
8
|
+
images: [], // 九宫格图片
|
|
9
|
+
showCopy: false,
|
|
10
|
+
text: i18n.t('componentsfile.qyweixinpanel.xlf8eg')
|
|
11
|
+
};
|
|
12
|
+
},
|
|
13
|
+
methods: {
|
|
14
|
+
// 企微分享初始化
|
|
15
|
+
createdQYHandle(isHideOptionMenu = false) {
|
|
16
|
+
const param = { ...this.otherParam, isHideOptionMenu };
|
|
17
|
+
return qyWxApi.getQwSignature(param);
|
|
18
|
+
},
|
|
19
|
+
// 企业微信分享通用方法
|
|
20
|
+
async qyWxShare(option = {}) {
|
|
21
|
+
const qwEntry = await this.getContext();
|
|
22
|
+
if (qwEntry === 'normal') {
|
|
23
|
+
// if (qwEntry === 'normal' || (qwEntry === 'chat_attachment' && this.$globalData.isAndroid)) {
|
|
24
|
+
this.qwShareFromWorkBench(option);
|
|
25
|
+
} else if (qwEntry !== 'normal') {
|
|
26
|
+
this.qwShareFromChatTool(option);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
// 在企业微信工具栏或者附件栏 向当前会话发送消息
|
|
30
|
+
qwShareFromChatTool(option = {}) { // initQyWxConfig
|
|
31
|
+
option = { ...this.shareData, ...option };
|
|
32
|
+
let { type = 'news', enterChat = true, mediaid, success } = option;
|
|
33
|
+
qyWxApi.wxRegister({
|
|
34
|
+
msgtype: type === 'img' || type === 'image' ? 'image' : type === 'text' ? 'text' : 'news',
|
|
35
|
+
enterChat,
|
|
36
|
+
image: { mediaid },
|
|
37
|
+
text: { content: option.text },
|
|
38
|
+
news: {
|
|
39
|
+
link: option.link, //H5消息页面url 必填
|
|
40
|
+
title: option.title, //H5消息标题
|
|
41
|
+
desc: option.desc, //H5消息摘要
|
|
42
|
+
imgUrl: option.imgUrl //H5消息封面图片URL
|
|
43
|
+
},
|
|
44
|
+
success: res => {
|
|
45
|
+
// 成功回调
|
|
46
|
+
success(res);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
// 工作台进入的环境 发起分享
|
|
51
|
+
qwShareFromWorkBench(option = {}) { // initQyToOther
|
|
52
|
+
option = { ...this.shareData, ...option };
|
|
53
|
+
if (option.type === 'img' || option.type === 'image') {
|
|
54
|
+
if (this.$globalData.isApp) {
|
|
55
|
+
// 工作台移动端
|
|
56
|
+
this.text = this.$t(i18n.t('componentsfile.qyweixinpanel.5cpn1w'));
|
|
57
|
+
} else {
|
|
58
|
+
// 工作台PC端
|
|
59
|
+
this.text = this.$t(i18n.t('componentsfile.qyweixinpanel.xlf8eg'));
|
|
60
|
+
}
|
|
61
|
+
// 如果是图片的企微工作台分享就起九宫格历史
|
|
62
|
+
option.text && this.$copyText(option.text).then(() => { this.showCopy = true; }).catch(() => { this.$toast(i18n.t('mystore.mystore.wmtyv4')); });
|
|
63
|
+
let imgUrl = [];
|
|
64
|
+
if (option.imgUrl instanceof Array) {
|
|
65
|
+
imgUrl = option.imgUrl;
|
|
66
|
+
} else {
|
|
67
|
+
imgUrl = [option.imgUrl];
|
|
68
|
+
}
|
|
69
|
+
this.images = imgUrl.reduce((prev, item) => {
|
|
70
|
+
item && prev.push(item);
|
|
71
|
+
return prev;
|
|
72
|
+
}, []);
|
|
73
|
+
this.shareMaskImg = true;
|
|
74
|
+
} else {
|
|
75
|
+
qyWxApi.qwShareToOther(option);
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
// 群发给客户
|
|
79
|
+
qywxGroup(option) {
|
|
80
|
+
option = { ...this.shareData, ...option };
|
|
81
|
+
qyWxApi.qywxGroup(option);
|
|
82
|
+
},
|
|
83
|
+
launchMiniprogram(option) {
|
|
84
|
+
qyWxApi.launchMiniprogram(option);
|
|
85
|
+
},
|
|
86
|
+
getContext() {
|
|
87
|
+
return qyWxApi.getContext();
|
|
88
|
+
},
|
|
89
|
+
qyWxHideMenu() {
|
|
90
|
+
qyWxApi.wxHideMenu();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|