Commit 5c4fd3bc authored by 郭志伟's avatar 郭志伟

fix: 分享测试

parent eaf6f86a
...@@ -8,24 +8,15 @@ ...@@ -8,24 +8,15 @@
<body> <body>
<div>跳转中...</div> <div>跳转中...</div>
<script> <script>
var _path = getQueryVariable("path"); var _path = window.location.hash ? window.location.hash.split("#")[0];
if (_path) { if (_path) {
_path = decodeURIComponent(_path); _path = decodeURIComponent(_path);
} else { } else {
_path = "/home"; _path = "home";
} }
var nextPage = document.createElement("a"); var nextPage = document.createElement("a");
nextPage.setAttribute("href", window.location.origin + "/" + decodeURIComponent(_path)); nextPage.setAttribute("href", window.location.origin + "+" + decodeURIComponent(_path));
nextPage.click(); nextPage.click();
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
}
return(false);
}
</script> </script>
</body> </body>
</html> </html>
\ No newline at end of file
import { setShare } from "@/service/wxJsSdk"; import { setShare } from "@/service/wxJsSdk";
const currentOrigin = window.location.origin + "/share.html#"; const currentOrigin = window.location.origin;
const logo = currentOrigin + "/shareImg/index.png"; const logo = currentOrigin + "/shareImg/index.png";
const shareList = { const shareList = {
home: { home: {
title: "【芒果保险】好保险,省钱买", title: "【芒果保险】好保险,省钱买",
desc: desc:
" 「芒果保险」是专注于健康保障的互联网保险严选平台,为用户挑选性价比高、更适合自己的保险产品,让每个家庭都有备无患。", " 「芒果保险」是专注于健康保障的互联网保险严选平台,为用户挑选性价比高、更适合自己的保险产品,让每个家庭都有备无患。",
url: currentOrigin + "home", url: "home",
imgUrl: logo imgUrl: logo
}, },
smartmeasure: { smartmeasure: {
title: "【芒果保险】智能风险评测", title: "【芒果保险】智能风险评测",
desc: "「芒果保险」不知道怎么买保险?AI小果为您提供30S快速评测,推荐最适合你的保险。", desc: "「芒果保险」不知道怎么买保险?AI小果为您提供30S快速评测,推荐最适合你的保险。",
url: currentOrigin + "home%2Fsmart-measure", url: "home%2Fsmart-measure",
imgUrl: currentOrigin + "/shareImg/ai.png" imgUrl: currentOrigin + "/shareImg/ai.png"
}, },
activity: { activity: {
title: "最高18888元红包 抽!抽!抽!", title: "最高18888元红包 抽!抽!抽!",
desc: "100%中奖!「芒果保险」老用户专享,参与投票即可抽取最高18888元红包", desc: "100%中奖!「芒果保险」老用户专享,参与投票即可抽取最高18888元红包",
url: currentOrigin + "home%2Factivity", url: "home%2Factivity",
imgUrl: currentOrigin + "/shareImg/activity.jpg" imgUrl: currentOrigin + "/shareImg/activity.jpg"
}, },
goods: { goods: {
title: "【芒果保险】好保险,省钱买", title: "【芒果保险】好保险,省钱买",
desc: desc:
"「芒果保险」是专注于健康保障的互联网保险严选平台,为用户挑选性价比高、更适合自己的保险产品,让每个家庭都有备无患。", "「芒果保险」是专注于健康保障的互联网保险严选平台,为用户挑选性价比高、更适合自己的保险产品,让每个家庭都有备无患。",
url: currentOrigin + "goods", url: "goods",
imgUrl: logo imgUrl: logo
}, },
consultant: { consultant: {
title: "【芒果保险】限时优惠!0.99元聘请芒果保险顾问,1对1量身定制", title: "【芒果保险】限时优惠!0.99元聘请芒果保险顾问,1对1量身定制",
desc: desc:
"「芒果保险」1对1保险顾问,帮您最高节省50%保费,为你量身选保险!顾问团队是由资深保险精算师组成,将秉承中立客观的服务态度,进行条款解读。", "「芒果保险」1对1保险顾问,帮您最高节省50%保费,为你量身选保险!顾问团队是由资深保险精算师组成,将秉承中立客观的服务态度,进行条款解读。",
url: currentOrigin + "consultant", url: "consultant",
imgUrl: currentOrigin + "/shareImg/advisor.png" imgUrl: currentOrigin + "/shareImg/advisor.png"
}, },
user: { user: {
title: "【芒果保险】好保险,省钱买", title: "【芒果保险】好保险,省钱买",
desc: desc:
"「芒果保险」是专注于健康保障的互联网保险严选平台,为用户挑选性价比高、更适合自己的保险产品,让每个家庭都有备无患。", "「芒果保险」是专注于健康保障的互联网保险严选平台,为用户挑选性价比高、更适合自己的保险产品,让每个家庭都有备无患。",
url: currentOrigin + "user", url: "user",
imgUrl: logo imgUrl: logo
}, },
tkylx001detail: { tkylx001detail: {
title: "【芒果保险】万家保·百万医疗险", title: "【芒果保险】万家保·百万医疗险",
desc: desc:
"「报销型医疗险」最高600万全面医疗保障,120种重大疾病医疗0免赔,30天~65周岁均可保,70种抗癌特药定期上新,免费提供住院费用垫付服务等一站式就医服务。", "「报销型医疗险」最高600万全面医疗保障,120种重大疾病医疗0免赔,30天~65周岁均可保,70种抗癌特药定期上新,免费提供住院费用垫付服务等一站式就医服务。",
url: currentOrigin + "goods%2Fdetail%3Fid%3DTKYLX001", url: "goods%2Fdetail%3Fid%3DTKYLX001",
imgUrl: currentOrigin + "/shareImg/goods-01.png" imgUrl: currentOrigin + "/shareImg/goods-01.png"
}, },
htdqzjx001detail: { htdqzjx001detail: {
title: "【芒果保险】万家保·重疾轻症险", title: "【芒果保险】万家保·重疾轻症险",
desc: desc:
"「给付型重疾险」100种重症+40种轻症确诊即赔,轻症赔付后,重疾保障继续有效。30天~60周岁均可保。", "「给付型重疾险」100种重症+40种轻症确诊即赔,轻症赔付后,重疾保障继续有效。30天~60周岁均可保。",
url: currentOrigin + "goods%2Fdetail%3Fid%3DHTDQZJX001", url: "goods%2Fdetail%3Fid%3DHTDQZJX001",
imgUrl: currentOrigin + "/shareImg/goods-02.png" imgUrl: currentOrigin + "/shareImg/goods-02.png"
}, },
zaywx001detail: { zaywx001detail: {
...@@ -66,14 +66,14 @@ const shareList = { ...@@ -66,14 +66,14 @@ const shareList = {
title: "【芒果保险】华贵大麦2020定期寿险", title: "【芒果保险】华贵大麦2020定期寿险",
desc: desc:
"「定期寿险」家庭主要收入贡献者的必备保险,最高可赔350万。免体检,责任免除仅3条,1~6类职业均可保,健康告知仅3条。", "「定期寿险」家庭主要收入贡献者的必备保险,最高可赔350万。免体检,责任免除仅3条,1~6类职业均可保,健康告知仅3条。",
url: currentOrigin + "goods%2Fdetail%3Fid%3DHGSX001", url: "goods%2Fdetail%3Fid%3DHGSX001",
imgUrl: currentOrigin + "/shareImg/goods-04.png" imgUrl: currentOrigin + "/shareImg/goods-04.png"
}, },
policydetail: { policydetail: {
title: "【芒果保险】好保险,省钱买", title: "【芒果保险】好保险,省钱买",
desc: desc:
"「芒果保险」是专注于健康保障的互联网保险严选平台,为用户挑选性价比高、更适合自己的保险产品,让每个家庭都有备无患。", "「芒果保险」是专注于健康保障的互联网保险严选平台,为用户挑选性价比高、更适合自己的保险产品,让每个家庭都有备无患。",
url: currentOrigin + "user", url: "user",
imgUrl: logo imgUrl: logo
} }
}; };
......
...@@ -3,6 +3,7 @@ let protocol = window.location.protocol; ...@@ -3,6 +3,7 @@ let protocol = window.location.protocol;
export default { export default {
// basicHost: "http://yapi.quantgroups.com/mock/329/", // basicHost: "http://yapi.quantgroups.com/mock/329/",
basicHost: "https://hathaway-mg.liangkebang.net/", basicHost: "https://hathaway-mg.liangkebang.net/",
sharePath: "https://mangguo-mg.liangkebang.net/share.html#",
// basicHost: "http://192.168.29.211:8964/", // basicHost: "http://192.168.29.211:8964/",
wxAppId: "wx514de17b23d53a20", wxAppId: "wx514de17b23d53a20",
shenceUrl: `${protocol}//bn.xyqb.com/sa?project=default`, // 神策数据请求地址 shenceUrl: `${protocol}//bn.xyqb.com/sa?project=default`, // 神策数据请求地址
......
...@@ -4,6 +4,7 @@ export default { ...@@ -4,6 +4,7 @@ export default {
// basicHost: "http://192.168.29.211:8964/", // basicHost: "http://192.168.29.211:8964/",
// basicHost: "http://127.0.0.1:8964/", // basicHost: "http://127.0.0.1:8964/",
basicHost: "https://mangguo.qthbx.com/api/", basicHost: "https://mangguo.qthbx.com/api/",
sharePath: "https://mangguo.qthbx.com/share.html#",
wxAppId: "wx514de17b23d53a20", wxAppId: "wx514de17b23d53a20",
shenceUrl: `${protocol}//bn.xyqb.com/sa?project=default`, // 神策数据请求地址 shenceUrl: `${protocol}//bn.xyqb.com/sa?project=default`, // 神策数据请求地址
test: false test: false
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Description: weixin-js-sdk * @Description: weixin-js-sdk
* @LastEditors: gzw * @LastEditors: gzw
* @Date: 20120-08-30 18:40:11 * @Date: 20120-08-30 18:40:11
* @LastEditTime: 2020-09-01 18:00:52 * @LastEditTime: 2020-09-01 18:12:00
*/ */
import cfg from "@/config/index"; import cfg from "@/config/index";
import { getwxAuth } from "@/api/user"; import { getwxAuth } from "@/api/user";
...@@ -36,7 +36,7 @@ export async function setShare({ ...@@ -36,7 +36,7 @@ export async function setShare({
//分享到朋友圈 //分享到朋友圈
wx.updateTimelineShareData({ wx.updateTimelineShareData({
title, // 分享时的标题 title, // 分享时的标题
link, // 分享时的链接 link: cfg.sharePath + link, // 分享时的链接
imgUrl, // 分享时的图标 imgUrl, // 分享时的图标
success: function() { success: function() {
console.log("分享成功"); console.log("分享成功");
...@@ -49,7 +49,7 @@ export async function setShare({ ...@@ -49,7 +49,7 @@ export async function setShare({
wx.updateAppMessageShareData({ wx.updateAppMessageShareData({
title, title,
desc, desc,
link, link: cfg.sharePath + link, // 分享时的链接
imgUrl, imgUrl,
type: "link", type: "link",
dataUrl: "", dataUrl: "",
...@@ -70,12 +70,16 @@ export function checkOpenId() { ...@@ -70,12 +70,16 @@ export function checkOpenId() {
const openId = localStorage.get("openId"); const openId = localStorage.get("openId");
const local = window.location.href; const local = window.location.href;
if (!openId && isWeixinBrower) { if (!openId && isWeixinBrower) {
window.location.href = var nextPage = document.createElement("a");
nextPage.setAttribute(
"href",
"https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" +
cfg.wxAppId + cfg.wxAppId +
"&redirect_uri=" + "&redirect_uri=" +
encodeURIComponent(local) + encodeURIComponent(local) +
"&response_type=code&scope=snsapi_base&state=1#wechat_redirect"; "&response_type=code&scope=snsapi_base&state=1#wechat_redirect"
);
nextPage.click();
return false; return false;
} else { } else {
return true; return true;
......
...@@ -707,8 +707,9 @@ export default { ...@@ -707,8 +707,9 @@ export default {
...mapState("user", ["userInfo"]), ...mapState("user", ["userInfo"]),
age() { age() {
const currentIdNo = this.getRealIdNo(); const currentIdNo = this.getRealIdNo();
if (!currentIdNo) return; if (!currentIdNo) return 18;
const birthday = getBirthDate(currentIdNo); const birthday = getBirthDate(currentIdNo);
if (!birthday) return 18;
const userAge = birthday ? getRealAge(birthday) : ""; const userAge = birthday ? getRealAge(birthday) : "";
return isNaN(userAge) ? 18 : userAge; return isNaN(userAge) ? 18 : userAge;
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment