Commit a9812b84 by 柳士祥

微信客服发送卡片信息

parent 35a014cd
......@@ -4,7 +4,9 @@
<img src="https://mayi-newshop.oss-cn-shanghai.aliyuncs.com/product/HCe2iRXHsP.png" alt="" />
</div>
<div class="btn-wrap" v-if="defaultContact == true">
<button open-type="contact" show-message-card :session-from="sessionFrom">
<button open-type="contact" show-message-card :send-message-title="wxConcatGoods.title" :send-message-img="wxConcatGoods.img"
:send-message-path="wxConcatGoods.pathLink"
:session-from="sessionFrom">
<div class="btn-main">
<div class="main-img">
<img src="../../../static/images/wx.png" alt="" />
......@@ -31,6 +33,7 @@
<script>
import { getUserLocation } from "../../utils/wxIndex.js";
import { getWxContact } from "@/api/wxContact.js";
import pathToNavigation from '@/utils/pathToNavigation'
const app = getApp();
const { log } = app;
......@@ -39,10 +42,17 @@ export default {
return {
sessionFrom: "",
defaultContact: null,
result: null
result: null,
wxConcatGoods:{}
};
},
onLoad(options) {
if(options.wxConcatGoods){
let wxConcatGoods = JSON.parse(options.wxConcatGoods)
wxConcatGoods['pathLink'] = pathToNavigation.toPageUrl(pathToNavigation.getUrlofLink(wxConcatGoods), pathToNavigation.getUrlofQuery(wxConcatGoods));
console.log(wxConcatGoods,'wxConcatGoods');
this.wxConcatGoods = wxConcatGoods
}
getUserLocation().then((res) => {
options.longitude = res.longitude;
options.latitude = res.latitude;
......
function toPageUrl(backPath, backParams = "") {
return `../index/main?from=themeLink&backpath=${encodeURIComponent(
backPath
)}&params=${encodeURIComponent(backParams)}`;
}
function getUrlofLink(data) {
return data.pathLink.split("?")[0];
}
function getUrlofQuery(data) {
let arr = data.pathLink.split("?")
let params = [];
arr.forEach((res, index) => {
if (index >= 1) {
params.push(res)
}
})
return params.join("?") || "";
}
export default {
toPageUrl,
getUrlofLink,
getUrlofQuery
}
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