Commit 9745a6ad by 梁建民

js

parent a3d74831
......@@ -51,7 +51,7 @@ const actions = {
setTimeout(function () {
toast.clear();
if (payload.from == 'risk') {
window.location.href = "/h5/view/#/risksuccess";
window.location.href = "/h5/view/#/risksuccess?account="+payload.account;
} else {
window.location.href = "/";
}
......
<template>
</template>
<script>
import Vue from 'vue'
import {mapState} from 'vuex'
import util from "../../util/index"
let wxjs = require('weixin-js-sdk');
export default {
name: 'wxShare',
props: {
url: {
type: String,
default: window.location.href
}
import Vue from 'vue'
import {mapState} from 'vuex'
import util from "../../util/index"
let wxjs = require('weixin-js-sdk');
},
data() {
return {
shareObj:{
title: "好物分享给你,帮我助力,我们一起免费拿样品", // 分享标题
desc: "在吗?拜托帮我点一下,你也能免费申请元器件样品~帮我助力 你拿样品", // 分享描述
link: window.location.origin+"/v3/samplereg?uid="+util.getCookie("Yo4teW_uid"), // 分享链接
imgUrl: "http://img.ichunt.com/images/ichunt/self_sample/apply.png", // 分享图标
success: function (resp) {
},
error:function(){
export default {
name: 'wxShare',
props: {
url: {
type: String,
default: window.location.href
},
title: {
type: String,
default: '好物分享给你,帮我助力,我们一起免费拿样品'
},
desc: {
type: String,
default: '在吗?拜托帮我点一下,你也能免费申请元器件样品~帮我助力 你拿样品'
},
link: {
type: String,
default: window.location.origin + "/v3/samplereg?uid=" + util.getCookie("Yo4teW_uid")
},
imgUrl: {
type: String,
default: 'http://img.ichunt.com/images/ichunt/self_sample/apply.png'
}
},
data() {
return {
shareObj: {
title: this.title, // 分享标题
desc: this.desc, // 分享描述
link: this.link, // 分享链接
imgUrl: this.imgUrl, // 分享图标
success: function (resp) {
}
}
}
},
computed:{
...mapState({
wxShareInfo:state => state.common.wxShareInfo,
wxShareState:state => state.common.wxShareState,
}),
},
watch:{
wxShareState(val){
if(val&&util.getCookie("Yo4teW_uid")){
this.share();
}
}
},
created() {
if(util.getCookie("Yo4teW_uid")){
this.$store.dispatch({
type: "wxShare",
current_url:window.location.href
});
}
},
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','onMenuShareQQ','onMenuShareWeibo','onMenuShareQZone'], // 需要检测的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);
});
},
error: function () {
}
}
}
},
computed: {
...mapState({
wxShareInfo: state => state.common.wxShareInfo,
wxShareState: state => state.common.wxShareState,
})
},
watch: {
wxShareState(val) {
if (val && util.getCookie("Yo4teW_uid")) {
this.share();
}
}
},
created() {
if (util.getCookie("Yo4teW_uid")) {
this.$store.dispatch({
type: "wxShare",
current_url: window.location.href
});
}
},
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']
});
wx.ready(function () {
wx.checkJsApi({
jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo', 'onMenuShareQZone'], //需要检测的JS接口列表,所有JS接口列表见附录2,
success: function (res) {
console.log(res);
}
},
}
});
// 获取“分享到朋友圈”按钮点击状态及自定义分享内容接口
wx.onMenuShareTimeline(self.shareObj);
// 获取“分享给朋友”按钮点击状态及自定义分享内容接口
wx.onMenuShareAppMessage(self.shareObj);
//获取“分享到QQ”按钮点击状态及自定义分享内容接口
wx.onMenuShareQQ(self.shareObj);
//获取“分享到腾讯微博”按钮点击状态及自定义分享内容接口
wx.onMenuShareWeibo(self.shareObj);
//获取“分享到QQ空间”按钮点击状态及自定义分享内容接口
wx.onMenuShareQZone(self.shareObj);
});
}
},
}
</script>
......@@ -18,7 +18,7 @@
<div class="shade" v-if="shade" @click="shade=false">
<b class="im"></b>
</div>
<wxShare :url="shareUrl"></wxShare>
<wxShare :link="link" :title="title" :desc="desc" :imgUrl="imgUrl"></wxShare>
</section>
</template>
......@@ -35,18 +35,23 @@
level: '',
quota: '',
text: [],
shareUrl:''
link: '',
title: '邀你偷偷看看你的公司评分',
desc: '',
imgUrl: '',
account: ''
}
},
created() {
var num = Math.floor(Math.random() * 4);
this.account = this.$route.query.account;
this.getData(num);
},
methods: {
getData: function (num) {
var level = ['SSS', 'SS', 'S', 'A+'];
var quota = ['500', '300', '100', '20'];
var desc = ['的公司综合评级SSS,“老板说赚多少亿无所谓,做人重要是开心!', '的公司综合评级SS,“问:‘你的超能力是什么?答:‘Rich’”', '的公司综合评级S,“先定一个能达到的小目标,比如我先赚他一个亿”', '的公司综合评级A+,“别的我不敢说,就算骗自己我也不会骗我的客(父)户(母)!']
var text = [
[
{
......@@ -141,6 +146,7 @@
this.text = text[num];
this.level = level[num];
this.quota = quota[num];
this.desc = this.account + desc[num];
},
share: function () {
this.shade = true;
......
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[4],{
/***/ "./node_modules/_core-js@2.6.10@core-js/modules/_string-html.js":
/*!**********************************************************************!*\
!*** ./node_modules/_core-js@2.6.10@core-js/modules/_string-html.js ***!
\**********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("var $export = __webpack_require__(/*! ./_export */ \"./node_modules/_core-js@2.6.10@core-js/modules/_export.js\");\nvar fails = __webpack_require__(/*! ./_fails */ \"./node_modules/_core-js@2.6.10@core-js/modules/_fails.js\");\nvar defined = __webpack_require__(/*! ./_defined */ \"./node_modules/_core-js@2.6.10@core-js/modules/_defined.js\");\nvar quot = /\"/g;\n// B.2.3.2.1 CreateHTML(string, tag, attribute, value)\nvar createHTML = function (string, tag, attribute, value) {\n var S = String(defined(string));\n var p1 = '<' + tag;\n if (attribute !== '') p1 += ' ' + attribute + '=\"' + String(value).replace(quot, '&quot;') + '\"';\n return p1 + '>' + S + '</' + tag + '>';\n};\nmodule.exports = function (NAME, exec) {\n var O = {};\n O[NAME] = exec(createHTML);\n $export($export.P + $export.F * fails(function () {\n var test = ''[NAME]('\"');\n return test !== test.toLowerCase() || test.split('\"').length > 3;\n }), 'String', O);\n};\n\n\n//# sourceURL=webpack:///./node_modules/_core-js@2.6.10@core-js/modules/_string-html.js?");
/***/ }),
/***/ "./node_modules/_core-js@2.6.10@core-js/modules/es6.string.link.js":
/*!*************************************************************************!*\
!*** ./node_modules/_core-js@2.6.10@core-js/modules/es6.string.link.js ***!
\*************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n// B.2.3.10 String.prototype.link(url)\n__webpack_require__(/*! ./_string-html */ \"./node_modules/_core-js@2.6.10@core-js/modules/_string-html.js\")('link', function (createHTML) {\n return function link(url) {\n return createHTML(this, 'a', 'href', url);\n };\n});\n\n\n//# sourceURL=webpack:///./node_modules/_core-js@2.6.10@core-js/modules/es6.string.link.js?");
/***/ }),
/***/ "./node_modules/_weixin-js-sdk@1.4.0-test@weixin-js-sdk/index.js":
/*!***********************************************************************!*\
!*** ./node_modules/_weixin-js-sdk@1.4.0-test@weixin-js-sdk/index.js ***!
......
......@@ -4326,7 +4326,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vue_
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"./node_modules/_vue@2.6.10@vue/dist/vue.runtime.esm.js\");\n/* harmony import */ var vant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vant */ \"./node_modules/_vant@2.2.7@vant/es/index.js\");\n/* harmony import */ var _api_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../api/index */ \"./src/api/index.js\");\n\n\n\n\nvar qs = __webpack_require__(/*! qs */ \"./node_modules/_qs@6.9.0@qs/lib/index.js\");\n\nvue__WEBPACK_IMPORTED_MODULE_0__[\"default\"].use(vant__WEBPACK_IMPORTED_MODULE_1__[\"Toast\"]);\nvar state = {\n formImgShow: false,\n countDown: false\n};\nvar mutations = {\n getfileuploadbanner: function getfileuploadbanner(state, payload) {\n state.getfileuploadbanner = payload.data;\n },\n articleShowData: function articleShowData(state, payload) {\n state.articleShowData = payload.data;\n }\n};\nvar actions = {\n actionLogins: function actionLogins(_ref, payload) {\n var commit = _ref.commit;\n var toast = vant__WEBPACK_IMPORTED_MODULE_1__[\"Toast\"].loading({\n forbidClick: true\n }); //IC信用贷\n\n if (payload.from == 'risk') {\n var params = {\n com_name: payload.com_name,\n user_name: payload.user_name,\n account: payload.account,\n sms_verify: payload.sms_verify,\n \"ptag\": 'edcp'\n };\n } else {\n var params = {\n account: payload.account,\n sms_verify: payload.sms_verify\n };\n }\n\n _api_index__WEBPACK_IMPORTED_MODULE_2__[\"services\"].actionLogins(qs.stringify(params)).then(function (res) {\n var data = res.data;\n\n if (data.err_code == 0) {\n setTimeout(function () {\n toast.clear();\n\n if (payload.from == 'risk') {\n window.location.href = \"/h5/view/#/risksuccess\";\n } else {\n window.location.href = \"/\";\n }\n }, 1000);\n } else {\n toast.clear();\n Object(vant__WEBPACK_IMPORTED_MODULE_1__[\"Toast\"])({\n message: data.err_msg,\n duration: 3000\n });\n }\n }).catch(function (err) {\n state.loading = false;\n });\n },\n smsVerifys: function smsVerifys(_ref2, payload) {\n var commit = _ref2.commit;\n var params = {\n mobile: payload.mobile,\n verify: payload.verify,\n channel: 1\n };\n _api_index__WEBPACK_IMPORTED_MODULE_2__[\"services\"].smsVerifys(qs.stringify(params)).then(function (res) {\n var data = res.data;\n\n if (data.err_code == 0) {\n state.formImgShow = false;\n state.countDown = true;\n } else if (data.err_code == 10001 || data.err_code == 10002) {\n state.formImgShow = true;\n Object(vant__WEBPACK_IMPORTED_MODULE_1__[\"Toast\"])({\n message: data.err_msg,\n duration: 2000\n });\n } else {\n Object(vant__WEBPACK_IMPORTED_MODULE_1__[\"Toast\"])({\n message: data.err_msg,\n duration: 3000\n });\n }\n }).catch(function (err) {});\n }\n};\nvar getters = {};\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n state: state,\n mutations: mutations,\n actions: actions,\n getters: getters\n});\n\n//# sourceURL=webpack:///./src/store/modules/special/index.js?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"./node_modules/_vue@2.6.10@vue/dist/vue.runtime.esm.js\");\n/* harmony import */ var vant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vant */ \"./node_modules/_vant@2.2.7@vant/es/index.js\");\n/* harmony import */ var _api_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../api/index */ \"./src/api/index.js\");\n\n\n\n\nvar qs = __webpack_require__(/*! qs */ \"./node_modules/_qs@6.9.0@qs/lib/index.js\");\n\nvue__WEBPACK_IMPORTED_MODULE_0__[\"default\"].use(vant__WEBPACK_IMPORTED_MODULE_1__[\"Toast\"]);\nvar state = {\n formImgShow: false,\n countDown: false\n};\nvar mutations = {\n getfileuploadbanner: function getfileuploadbanner(state, payload) {\n state.getfileuploadbanner = payload.data;\n },\n articleShowData: function articleShowData(state, payload) {\n state.articleShowData = payload.data;\n }\n};\nvar actions = {\n actionLogins: function actionLogins(_ref, payload) {\n var commit = _ref.commit;\n var toast = vant__WEBPACK_IMPORTED_MODULE_1__[\"Toast\"].loading({\n forbidClick: true\n }); //IC信用贷\n\n if (payload.from == 'risk') {\n var params = {\n com_name: payload.com_name,\n user_name: payload.user_name,\n account: payload.account,\n sms_verify: payload.sms_verify,\n \"ptag\": 'edcp'\n };\n } else {\n var params = {\n account: payload.account,\n sms_verify: payload.sms_verify\n };\n }\n\n _api_index__WEBPACK_IMPORTED_MODULE_2__[\"services\"].actionLogins(qs.stringify(params)).then(function (res) {\n var data = res.data;\n\n if (data.err_code == 0) {\n setTimeout(function () {\n toast.clear();\n\n if (payload.from == 'risk') {\n window.location.href = \"/h5/view/#/risksuccess?account=\" + payload.account;\n } else {\n window.location.href = \"/\";\n }\n }, 1000);\n } else {\n toast.clear();\n Object(vant__WEBPACK_IMPORTED_MODULE_1__[\"Toast\"])({\n message: data.err_msg,\n duration: 3000\n });\n }\n }).catch(function (err) {\n state.loading = false;\n });\n },\n smsVerifys: function smsVerifys(_ref2, payload) {\n var commit = _ref2.commit;\n var params = {\n mobile: payload.mobile,\n verify: payload.verify,\n channel: 1\n };\n _api_index__WEBPACK_IMPORTED_MODULE_2__[\"services\"].smsVerifys(qs.stringify(params)).then(function (res) {\n var data = res.data;\n\n if (data.err_code == 0) {\n state.formImgShow = false;\n state.countDown = true;\n } else if (data.err_code == 10001 || data.err_code == 10002) {\n state.formImgShow = true;\n Object(vant__WEBPACK_IMPORTED_MODULE_1__[\"Toast\"])({\n message: data.err_msg,\n duration: 2000\n });\n } else {\n Object(vant__WEBPACK_IMPORTED_MODULE_1__[\"Toast\"])({\n message: data.err_msg,\n duration: 3000\n });\n }\n }).catch(function (err) {});\n }\n};\nvar getters = {};\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n state: state,\n mutations: mutations,\n actions: actions,\n getters: getters\n});\n\n//# sourceURL=webpack:///./src/store/modules/special/index.js?");
/***/ }),
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