|
@@ -24,6 +24,7 @@
|
|
|
// import { Toast } from '@nutui/nutui';
|
|
|
import { getAllByTypeId, feedbackAdd, getDefaultAddress } from '/@/api/feedback';
|
|
|
// import { setLang } from '/@/i18n';
|
|
|
+ import jsonp from 'jsonp';
|
|
|
import { useI18n } from 'vue-i18n';
|
|
|
const emit = defineEmits(['setActive']);
|
|
|
const submitPc = ref(null);
|
|
@@ -45,6 +46,77 @@
|
|
|
softwareOptionId: [],
|
|
|
hardwareOptionId: [],
|
|
|
});
|
|
|
+ function isWeChat() {
|
|
|
+ //window.navigator.userAgent属性包含了浏览器类型、版本、操作系统类型、浏览器引擎类型等信息,这个属性可以用来判断浏览器类型
|
|
|
+ var ua = window.navigator.userAgent.toLowerCase();
|
|
|
+ //通过正则表达式匹配ua中是否含有MicroMessenger字符串
|
|
|
+ if (ua.match(/MicroMessenger/i) == 'micromessenger') {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ function wxShare() {
|
|
|
+ let url = window.location.href.split('#')[0];
|
|
|
+ if (window.location.ancestorOrigins) {
|
|
|
+ url = window.location.ancestorOrigins[0];
|
|
|
+ }
|
|
|
+ jsonp(
|
|
|
+ 'https://www.4dage.com/wechat/jssdk/share/?uri=' + window.escape(url) + '&name=厦门四维时代微信公众号',
|
|
|
+ 'success_jsonp',
|
|
|
+ function (err, data) {
|
|
|
+ if (err) {
|
|
|
+ console.err(err);
|
|
|
+ } else {
|
|
|
+ console.log(wx);
|
|
|
+ wx.config({
|
|
|
+ debug: false, // 开启调试模式
|
|
|
+ appId: data.appId,
|
|
|
+ timestamp: data.timestamp,
|
|
|
+ nonceStr: data.nonceStr,
|
|
|
+ signature: data.signature,
|
|
|
+ jsApiList: [
|
|
|
+ 'checkJsApi',
|
|
|
+ 'onMenuShareTimeline',
|
|
|
+ 'onMenuShareAppMessage',
|
|
|
+ 'onMenuShareQQ',
|
|
|
+ 'onMenuShareWeibo',
|
|
|
+ 'hideMenuItems',
|
|
|
+ 'showMenuItems',
|
|
|
+ 'hideAllNonBaseMenuItem',
|
|
|
+ 'showAllNonBaseMenuItem',
|
|
|
+ 'translateVoice',
|
|
|
+ 'startRecord',
|
|
|
+ 'stopRecord',
|
|
|
+ 'onRecordEnd',
|
|
|
+ 'playVoice',
|
|
|
+ 'pauseVoice',
|
|
|
+ 'stopVoice',
|
|
|
+ 'uploadVoice',
|
|
|
+ 'downloadVoice',
|
|
|
+ ],
|
|
|
+ });
|
|
|
+ }
|
|
|
+ wx.error(function (err) {
|
|
|
+ console.log(err);
|
|
|
+ });
|
|
|
+ wx.ready(function () {
|
|
|
+ var shareData = {
|
|
|
+ title: '四维时代用户反馈', // 标题
|
|
|
+ desc: '诚挚的邀您填写,期待您的宝贵意见。(旁边用四维时代logo)', // 描述
|
|
|
+ link: window.location.href, // 分享的URL,必须和当前打开的网页的URL是一样的
|
|
|
+ imgUrl: 'https://4dkk.4dage.com/FDKKIMG/icon/kankan_icon180.png', // 缩略图地址
|
|
|
+ success: function () {},
|
|
|
+ cancel: function () {},
|
|
|
+ };
|
|
|
+ wx.onMenuShareAppMessage(shareData);
|
|
|
+ wx.onMenuShareTimeline(shareData);
|
|
|
+ wx.onMenuShareQQ(shareData);
|
|
|
+ wx.onMenuShareQZone(shareData);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ );
|
|
|
+ }
|
|
|
async function onSubmit(formData, setObjId = {}) {
|
|
|
console.log('feedbackAdd', formData);
|
|
|
// return new Promise((resolve) => {
|
|
@@ -80,6 +152,10 @@
|
|
|
setObjId.industryOptionId = '';
|
|
|
}
|
|
|
onMounted(async () => {
|
|
|
+ let isWeixin = isWeChat();
|
|
|
+ if (isWeixin) {
|
|
|
+ wxShare();
|
|
|
+ }
|
|
|
let { data } = await getDefaultAddress();
|
|
|
addres.value = {
|
|
|
country: locale.value == 'en-us' ? data.countryEn : data.country,
|