Commit f209c7dc by 肖康

阿斯达

parent 2906022a
......@@ -11,7 +11,7 @@ import axios from 'axios'
*/
var urlApi, url, urlPc, zyApi, lyApi;
;
switch (window.location.hostname) {
case "m.ichunt.com":
urlPc = 'https://www.ichunt.com/v3/';
......@@ -51,6 +51,8 @@ export const productionUrl = url;
export const productionUrlApi = urlApi;
export const apis = {
/**wx分享签名接口**/
wxShare: url + 'shareparams',
/**
* 首页
*/
......@@ -648,6 +650,8 @@ export const services = {
getlxuserrank(params) {
return axios.post(apis.getlxuserrank, params)
},
wxShare(params) {
return axios.post(apis.wxShare, params)
},
};
\ No newline at end of file
import Util from "../util";
export default {
bind(el, binding) {
el.addEventListener('click', function () {
var loginpta = Util.isLogin() ? true : false;
if (!loginpta) {
window.location.href = '/v3/login?referer=' + encodeURIComponent(window.location.href);
return;
}
var rootElement = document.body;
var newElement = document.createElement("div");
newElement.setAttribute("class", "share-mask");
......
......@@ -8,7 +8,9 @@ Vue.use(Toast);
const state = {
cartCount: 0,
loginCheck: false,
phpParams: {}
phpParams: {},
wxShareInfo:"",
wxShareState:false
}
const mutations = {
......@@ -87,6 +89,16 @@ const actions = {
}).catch(function (err) {
console.log('网络出现问题,请重试');
});
},
wxShare({commit}, payload) {
var params = Util.getParams();
Services.wxShare(params).then((res) => {
let data = res.data;
state.wxShareInfo=data.data;
state.wxShareState=true;
}).catch(function (err) {
console.log('网络出现问题,请重试');
});
}
}
......
<template>
</template>
<script>
import Vue from 'vue'
import {mapState} from 'vuex'
let wxjs = require('weixin-js-sdk')
export default {
name: 'wxShare',
props: {
url: {
type: String,
default: window.location.href
}
},
data() {
return {
shareObj:{
title: "asdasdas", // 分享标题
desc: 1, // 分享描述
link: 1, // 分享链接
imgUrl: "http://img.ichunt.com/images/cms/201909/09/2b0615811e2a34b98f7ae6db8847106b.jpg", // 分享图标
success: function (resp) {
alert(3)
}
}
}
},
computed:{
...mapState({
wxShareInfo:state => state.common.wxShareInfo,
wxShareState:state => state.common.wxShareState,
}),
},
watch:{
wxShareState(val){
if(val){
this.share();
}
}
},
created() {
this.$store.dispatch({
type: "wxShare"
});
},
methods: {
share(){
var self=this;
// 微信配置
wx.config({
debug: false,
appId: self.wxShareInfo.appId,
timestamp: self.wxShareInfo.timestamp,
nonceStr: self.wxShareInfo.nonceStr,
signature:self.wxShareInfo.signature,
jsApiList: ['onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareWeibo','onMenuShareQZone'] // 功能列表,我们要使用JS-SDK的什么功能
});
// config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在 页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready 函数中。
wx.ready(function(){
wx.checkJsApi({
jsApiList: ['onMenuShareTimeline','onMenuShareAppMessage'], // 需要检测的JS接口列表,所有JS接口列表见附录2,
success: function(res) {
// console.log(res);
// 以键值对的形式返回,可用的api值true,不可用为false
// 如:{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
}
});
// 获取“分享到朋友圈”按钮点击状态及自定义分享内容接口
wx.onMenuShareTimeline(self.shareObj);
// 获取“分享给朋友”按钮点击状态及自定义分享内容接口
wx.onMenuShareAppMessage(self.shareObj);
//获取“分享到QQ”按钮点击状态及自定义分享内容接口
wx.onMenuShareQQ(self.shareObj);
//获取“分享到腾讯微博”按钮点击状态及自定义分享内容接口
wx.onMenuShareWeibo(self.shareObj);
//获取“分享到QQ空间”按钮点击状态及自定义分享内容接口
wx.onMenuShareQZone(self.shareObj);
});
}
},
}
</script>
<template>
<section class="sample" >
<Header :title="title" :meaushow='meaushow' :bgcolor="bgcolor"></Header>
<wxShare :url="shareurl"></wxShare>
<div class="banner"></div>
<div class="zititle">
<span>猎芯自营</span>
......@@ -35,7 +36,7 @@
<div class="get-user-con">
<h3>样品申请成功!我们会尽快为您审核<i class="icon iconfont icon-guanbi" @click="getuserf"></i></h3>
<h2>邀请好友注册可额外获得一次样品申请机会,多邀多得</h2>
<span >点击邀请</span>
<span v-shareMask>点击邀请</span>
</div>
</div>
</section>
......@@ -47,6 +48,7 @@
import Vue from 'vue'
import {mapState} from 'vuex'
import Header from "@/views/common/Header.vue";
import wxShare from "@/views/common/wxShare.vue";
import { Tab, Tabs } from 'vant';
Vue.use(Tab).use(Tabs);
export default {
......@@ -61,6 +63,7 @@
swipeThreshold:4,
active:0,
getPop:false,//获得机会弹窗,没机会时展示
shareurl:"http://www.baidu.com"
}
},
computed: {
......@@ -84,8 +87,8 @@
}
},
components: {
Header
Header,
wxShare
}
}
</script>
......
......@@ -27,7 +27,7 @@
<script src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js" type="text/javascript" charset="utf-8"></script>
<script src="//static.leixin.com/static/js/flexible.min.js" type="text/javascript" charset="utf-8"></script>
<script src="//static.leixin.com/static/js/shence.min.js" type="text/javascript" charset="utf-8"></script>
<link href="//static.leixin.com/0.js" rel="prefetch"><link href="//static.leixin.com/1.js" rel="prefetch"><link href="//static.leixin.com/10.js" rel="prefetch"><link href="//static.leixin.com/11.js" rel="prefetch"><link href="//static.leixin.com/12.js" rel="prefetch"><link href="//static.leixin.com/13.js" rel="prefetch"><link href="//static.leixin.com/14.js" rel="prefetch"><link href="//static.leixin.com/15.js" rel="prefetch"><link href="//static.leixin.com/16.js" rel="prefetch"><link href="//static.leixin.com/17.js" rel="prefetch"><link href="//static.leixin.com/18.js" rel="prefetch"><link href="//static.leixin.com/19.js" rel="prefetch"><link href="//static.leixin.com/2.js" rel="prefetch"><link href="//static.leixin.com/20.js" rel="prefetch"><link href="//static.leixin.com/21.js" rel="prefetch"><link href="//static.leixin.com/22.js" rel="prefetch"><link href="//static.leixin.com/23.js" rel="prefetch"><link href="//static.leixin.com/24.js" rel="prefetch"><link href="//static.leixin.com/25.js" rel="prefetch"><link href="//static.leixin.com/26.js" rel="prefetch"><link href="//static.leixin.com/27.8008a77d0dca03e02ece.hot-update.js" rel="prefetch"><link href="//static.leixin.com/27.js" rel="prefetch"><link href="//static.leixin.com/28.js" rel="prefetch"><link href="//static.leixin.com/29.js" rel="prefetch"><link href="//static.leixin.com/3.js" rel="prefetch"><link href="//static.leixin.com/30.js" rel="prefetch"><link href="//static.leixin.com/31.js" rel="prefetch"><link href="//static.leixin.com/32.js" rel="prefetch"><link href="//static.leixin.com/33.js" rel="prefetch"><link href="//static.leixin.com/34.js" rel="prefetch"><link href="//static.leixin.com/35.js" rel="prefetch"><link href="//static.leixin.com/36.js" rel="prefetch"><link href="//static.leixin.com/37.js" rel="prefetch"><link href="//static.leixin.com/38.js" rel="prefetch"><link href="//static.leixin.com/39.js" rel="prefetch"><link href="//static.leixin.com/4.js" rel="prefetch"><link href="//static.leixin.com/40.js" rel="prefetch"><link href="//static.leixin.com/41.js" rel="prefetch"><link href="//static.leixin.com/42.js" rel="prefetch"><link href="//static.leixin.com/43.js" rel="prefetch"><link href="//static.leixin.com/44.js" rel="prefetch"><link href="//static.leixin.com/45.js" rel="prefetch"><link href="//static.leixin.com/5.js" rel="prefetch"><link href="//static.leixin.com/6.js" rel="prefetch"><link href="//static.leixin.com/7.js" rel="prefetch"><link href="//static.leixin.com/8.js" rel="prefetch"><link href="//static.leixin.com/9.js" rel="prefetch"><link href="//static.leixin.com/app.js" rel="preload" as="script"></head>
<link href="//static.leixin.com/0.js" rel="prefetch"><link href="//static.leixin.com/10.js" rel="prefetch"><link href="//static.leixin.com/11.js" rel="prefetch"><link href="//static.leixin.com/12.js" rel="prefetch"><link href="//static.leixin.com/13.js" rel="prefetch"><link href="//static.leixin.com/14.js" rel="prefetch"><link href="//static.leixin.com/15.js" rel="prefetch"><link href="//static.leixin.com/16.js" rel="prefetch"><link href="//static.leixin.com/17.js" rel="prefetch"><link href="//static.leixin.com/18.js" rel="prefetch"><link href="//static.leixin.com/19.js" rel="prefetch"><link href="//static.leixin.com/2.js" rel="prefetch"><link href="//static.leixin.com/20.js" rel="prefetch"><link href="//static.leixin.com/21.js" rel="prefetch"><link href="//static.leixin.com/22.js" rel="prefetch"><link href="//static.leixin.com/23.js" rel="prefetch"><link href="//static.leixin.com/24.js" rel="prefetch"><link href="//static.leixin.com/25.js" rel="prefetch"><link href="//static.leixin.com/26.js" rel="prefetch"><link href="//static.leixin.com/27.js" rel="prefetch"><link href="//static.leixin.com/28.js" rel="prefetch"><link href="//static.leixin.com/29.js" rel="prefetch"><link href="//static.leixin.com/3.js" rel="prefetch"><link href="//static.leixin.com/30.js" rel="prefetch"><link href="//static.leixin.com/31.js" rel="prefetch"><link href="//static.leixin.com/32.js" rel="prefetch"><link href="//static.leixin.com/33.js" rel="prefetch"><link href="//static.leixin.com/34.js" rel="prefetch"><link href="//static.leixin.com/35.js" rel="prefetch"><link href="//static.leixin.com/36.js" rel="prefetch"><link href="//static.leixin.com/37.js" rel="prefetch"><link href="//static.leixin.com/38.js" rel="prefetch"><link href="//static.leixin.com/39.js" rel="prefetch"><link href="//static.leixin.com/4.js" rel="prefetch"><link href="//static.leixin.com/40.js" rel="prefetch"><link href="//static.leixin.com/41.js" rel="prefetch"><link href="//static.leixin.com/42.js" rel="prefetch"><link href="//static.leixin.com/43.js" rel="prefetch"><link href="//static.leixin.com/44.js" rel="prefetch"><link href="//static.leixin.com/45.js" rel="prefetch"><link href="//static.leixin.com/46.js" rel="prefetch"><link href="//static.leixin.com/47.5a8c79be568a96b363b0.hot-update.js" rel="prefetch"><link href="//static.leixin.com/47.js" rel="prefetch"><link href="//static.leixin.com/48.js" rel="prefetch"><link href="//static.leixin.com/5.js" rel="prefetch"><link href="//static.leixin.com/6.js" rel="prefetch"><link href="//static.leixin.com/7.js" rel="prefetch"><link href="//static.leixin.com/8.js" rel="prefetch"><link href="//static.leixin.com/9.js" rel="prefetch"><link href="//static.leixin.com/app.js" rel="preload" as="script"></head>
<body class="boxsiz">
<noscript>
<strong>网站出现了一点小问题,正在紧急修复中.......</strong>
......
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 sign in to comment