Commit a9812b84 by 柳士祥

微信客服发送卡片信息

parent 35a014cd
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
<img src="https://mayi-newshop.oss-cn-shanghai.aliyuncs.com/product/HCe2iRXHsP.png" alt="" /> <img src="https://mayi-newshop.oss-cn-shanghai.aliyuncs.com/product/HCe2iRXHsP.png" alt="" />
</div> </div>
<div class="btn-wrap" v-if="defaultContact == true"> <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="btn-main">
<div class="main-img"> <div class="main-img">
<img src="../../../static/images/wx.png" alt="" /> <img src="../../../static/images/wx.png" alt="" />
...@@ -31,6 +33,7 @@ ...@@ -31,6 +33,7 @@
<script> <script>
import { getUserLocation } from "../../utils/wxIndex.js"; import { getUserLocation } from "../../utils/wxIndex.js";
import { getWxContact } from "@/api/wxContact.js"; import { getWxContact } from "@/api/wxContact.js";
import pathToNavigation from '@/utils/pathToNavigation'
const app = getApp(); const app = getApp();
const { log } = app; const { log } = app;
...@@ -39,10 +42,17 @@ export default { ...@@ -39,10 +42,17 @@ export default {
return { return {
sessionFrom: "", sessionFrom: "",
defaultContact: null, defaultContact: null,
result: null result: null,
wxConcatGoods:{}
}; };
}, },
onLoad(options) { 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) => { getUserLocation().then((res) => {
options.longitude = res.longitude; options.longitude = res.longitude;
options.latitude = res.latitude; 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