a8d19002 by simon

默认提交

1 parent 2a145a18
......@@ -8,6 +8,9 @@
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<!-- <script src="<%= BASE_URL %>static/js/weixin/jweixin-1.6.0.js"></script>
<script src="<%= BASE_URL %>static/js/kd/kd-sdk.1.0.0.js"></script>
<script src="<%= BASE_URL %>static/js/kd/kd.js"></script> -->
<title>vue-cli3-framework</title>
</head>
......
(function () {
let BASE_HOST = "https://api.kdao.xin";
let BIZ_BASE_HOST = "https://bizapi.kdao.xin";
// 打开微信调试的开关
let DEBUG_SWITCH = "false";
let KD = {};
window.KD = KD;
let _app_id = "", _app_secret = "", _module_code = "";
KD.init = function (appId, appKey, moduleCode) {
_app_id = appId;
_app_secret = appKey;
_module_code = moduleCode;
}
let _request_url = {
wx_signature: BASE_HOST + "/wx/signature",
// 授权后的用户信息
wx_sns_user_info: BASE_HOST + "/wx_user_info",
// 含unionid 的用户信息
wx_user_info: BASE_HOST + "/cgi_bin/user_info",
// 统计
stat: BIZ_BASE_HOST + "/kd_platform_api/stat/s"
}
KD._tools = {};
(function () {
KD._tools._post_json = function (url, data, header, callback) {
var xhr;
//创建ajax引擎
if (window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
} else if (window.AtiveXObject) {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
let data = { code: xhr.status, response: xhr.responseText };
(typeof callback == "function") && callback(data);
}
};
//创建请求
xhr.open("post", url, true);
xhr.setRequestHeader('Content-type', 'application/json');
if (header) {
for (let key in header) {
xhr.setRequestHeader(key, header[key]);
}
}
//发送请求
xhr.send(JSON.stringify(data));
}
KD._tools._post_form = function (url, data, header, callback) {
var xhr;
//创建ajax引擎
if (window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
} else if (window.AtiveXObject) {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
let data = { code: xhr.status, response: xhr.responseText };
(typeof callback == "function") && callback(data);
}
};
//创建请求
xhr.open("post", url, true);
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
if (header) {
for (let key in header) {
xhr.setRequestHeader(key, header[key]);
}
}
//发送请求
let postStr = "";
for (let key in data) {
postStr += key + "=" + data[key] + "&";
}
if (postStr) {
postStr = postStr.substring(0, postStr.length - 1);
}
xhr.send(postStr);
}
KD._tools._get = function (url, data, header, callback) {
var xhr;
//创建ajax引擎
if (window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
} else if (window.AtiveXObject) {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
let data = { code: xhr.status, response: xhr.responseText };
(typeof callback == "function") && callback(data);
}
};
//发送请求
let postStr = "";
for (let key in data) {
postStr += key + "=" + data[key] + "&";
}
if (postStr) {
postStr = "?" + postStr.substring(0, postStr.length - 1);
}
xhr.open("GET", url + postStr, true);
//创建请求
if (header) {
for (let key in header) {
xhr.setRequestHeader(key, header[key]);
}
}
xhr.send(null);
}
KD._tools._get_token = function () {
let key = "pl_token_" + _app_id;
return KD._tools._get_cookie(key);
}
KD._tools._get_wx_app_id = function () {
let key = "pl_wx_" + _app_id;
let res = KD._tools._get_cookie(key);
let wxAppId = res ? res.split(":")[0] : "";
return wxAppId;
}
KD._tools._get_cookie = function (name) {
var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
if (arr = document.cookie.match(reg)) {
return decodeURIComponent(arr[2])
} else {
return null
}
};
/**
* 处理响应结果
*/
KD._tools._handle_response = function (response) {
if (response.code == 200) {
let res = JSON.parse(response.response);
if (res.code == 200) {
return res;
} else {
if (DEBUG_SWITCH) {
alert("_handle_response failure : " + response.content)
}
}
} else {
if (DEBUG_SWITCH) {
alert("_handle_response : " + JSON.stringify(response))
}
}
}
/**
* 加解密CDN方式引入。
*
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/core.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/enc-base64.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/md5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/evpkdf.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/cipher-core.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/aes.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/pad-pkcs7.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/mode-ecb.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/enc-utf8.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/enc-hex.min.js"></script>
*/
KD._tools._init_aes = function () {
if (typeof KD._tools._aes_decrypt == "function") {
return true;
}
if (typeof CryptoJS == "undefined") {
console.error("install CryptoJS first");
return false;
}
if (CryptoJS && _app_secret) {
const key = CryptoJS.enc.Utf8.parse(_app_secret);
const iv = CryptoJS.enc.Utf8.parse(_app_secret.substring(0, 16));
// 解密方法
KD._tools._aes_decrypt = function (srcs) {
// let encryptedHexStr = CryptoJS.enc.Hex.parse(word);
// console.log("1,", encryptedHexStr)
// let srcs = CryptoJS.enc.Base64.stringify(encryptedHexStr);
let decrypt = CryptoJS.AES.decrypt(srcs, key, {
iv: iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
});
let decryptedStr = decrypt.toString(CryptoJS.enc.Utf8);
return decryptedStr.toString();
}
// 加密方法
KD._tools._aes_encrypt = function (word) {
var srcs = CryptoJS.enc.Utf8.parse(word);
var encrypted = CryptoJS.AES.encrypt(srcs, key, {
iv: iv,
mode: CryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7
});
return encrypted.toString();
}
return true;
}
return false;
}
KD._tools._init_headers = function () {
return {
"-kd-platform-id": _app_id,
"-kd-platform-module": _module_code
}
}
})();
// 微信SDK地址
KD.weixin = function () {
let weixin = {};
let tools = KD._tools;
/**
* 权限列表:
* updateAppMessageShareData,updateTimelineShareData,onMenuShareWeibo,onMenuShareQZone,
* startRecord,stopRecord,onVoiceRecordEnd,playVoice,pauseVoice,stopVoice,onVoicePlayEnd,uploadVoice,downloadVoice,
* chooseImage,previewImage,uploadImage,downloadImage,
* translateVoice,
* getNetworkType,openLocation,getLocation,
* hideOptionMenu,showOptionMenu,hideMenuItems,showMenuItems,hideAllNonBaseMenuItem,showAllNonBaseMenuItem,
* closeWindow,scanQRCode,chooseWXPay,openProductSpecificView,addCard,chooseCard,openCard,
*/
weixin.initConfig = function (jsApiList) {
let url = window.location.href;
// jsApiList = jsApiList && jsApiList.length > 0 ? jsApiList : ["updateAppMessageShareData", "updateTimelineShareData", "onMenuShareWeibo", "onMenuShareQZone"];
jsApiList = jsApiList && jsApiList.length > 0 ? jsApiList : ["onMenuShareTimeline", "onMenuShareAppMessage", "hideMenuItems"];
tools._post_json(_request_url.wx_signature, { appId: _app_id, url: url }, null, function (response) {
let res = KD._tools._handle_response(response);
wx.config({
debug: DEBUG_SWITCH, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: res.content.appId, // 必填,公众号的唯一标识
timestamp: res.content.timestamp, // 必填,生成签名的时间戳
nonceStr: res.content.nonceStr, // 必填,生成签名的随机串
signature: res.content.signature,// 必填,签名
jsApiList: jsApiList // 必填,需要使用的JS接口列表
});
wx.ready(function () {
wx.hideMenuItems({
menuList: ["menuItem:copyUrl"] // 要隐藏的菜单项,只能隐藏“传播类”和“保护类”按钮,所有menu项见附录3
});
})
});
}
/**
* 单独设置分享朋友圈
*/
weixin.updateAppMessageShareData = function (title, desc, link, imageUrl, succ) {
wx.ready(function () { //需在用户可能点击分享按钮前就先调用
wx.onMenuShareAppMessage({
title: title, // 分享标题
desc: desc, // 分享描述
link: link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl: imageUrl, // 分享图标
success: function () {
(typeof succ == "function") && succ();
}
})
});
}
weixin.updateTimelineShareData = function (title, link, imageUrl, succ) {
wx.ready(function () { //需在用户可能点击分享按钮前就先调用
wx.onMenuShareTimeline({
title: title, // 分享标题
link: link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl: imageUrl, // 分享图标
success: function () {
(typeof succ == "function") && succ();
}
})
});
}
/**
* 微信设置分享
*/
weixin.setShare = function (title, desc, link, imageUrl, succ) {
weixin.updateAppMessageShareData(title, desc, link, imageUrl, function () {
(typeof succ == "function") && succ("appMessage");
});
weixin.updateTimelineShareData(desc, link, imageUrl, function () {
(typeof succ == "function") && succ("timeline");
});
}
/**
* 获取用户的openid
*/
weixin.getOpenId = function () {
let openId = tools._get_token();
return openId;
}
/**
* 读取用户基本信息
*/
weixin.getUserInfo = function (callback) {
if (typeof callback != "function") {
return;
}
if (typeof CryptoJS != "undefined") {
let info = _get_user_info_from_cookie();
if (info) {
callback(info);
} else {
_get_user_info_by_openid(callback);
}
} else {
_get_user_info_by_openid(callback);
}
}
/**
* 这个是用户授权后,从微信端读取用户基本信息。这个接口需要用户显示授权
*/
weixin.getCgiUserInfo = function (callback) {
if (typeof callback != "function") {
return;
}
let openId = tools._get_token();
let wxAppId = tools._get_wx_app_id();
tools._get(_request_url.wx_user_info, { wxAppId: wxAppId, openId: openId }, null, function (response) {
let res = tools._handle_response(response);
callback(res.content);
})
}
/**
* 通过openid读取用户基本信息
*
* @param {function} callback
*/
function _get_user_info_by_openid(callback) {
let openId = tools._get_token();
let wxAppId = tools._get_wx_app_id();
tools._get(_request_url.wx_sns_user_info, { wxAppId: wxAppId, openId: openId }, null, function (response) {
let res = tools._handle_response(response);
if (typeof callback == "function") {
callback(res.content);
}
})
}
/**
* 从cookie中读取信息
*/
function _get_user_info_from_cookie() {
let data = tools._get_cookie("pl_info_" + _app_id);
if (tools._init_aes()) {
let infoStr = tools._aes_decrypt(data);
return infoStr ? JSON.parse(infoStr) : null
}
return null;
}
return weixin;
}
KD.biz = function () {
let biz = {};
let tools = KD._tools;
/**
* 统计接口
*
* @param {String} channelCode 渠道编号
* @param {String} statClassify 统计类型,可见统计表定义
* @param {String} statKey 统计标识,可见统计表定义
* @param {String} primaryKey 唯一标识,如用户标识、按钮标识
*/
biz.stat = function (channelCode, statClassify, statKey, primaryKey) {
let form = {
aid: _app_id,
cc: !channelCode || channelCode == undefined ? "" : channelCode,//渠道
sc: !statClassify || statClassify == undefined ? "" : statClassify,//统计类型
sk: !statKey || statKey == undefined ? "" : statKey,//统计key
pc: !primaryKey || primaryKey == undefined ? "" : primaryKey //用户标识
}
let headers = tools._init_headers();
tools._get(_request_url.stat, form, headers, function (response) { })
}
return biz;
}
})();
\ No newline at end of file
(function () {
let BASE_HOST = "https://api.kdao.xin";
let BIZ_BASE_HOST = "https://bizapi.kdao.xin";
// 打开微信调试的开关
let DEBUG_SWITCH = false;
let KD = {};
window.KD = KD;
let _app_id = "",
_app_secret = "",
_module_code = "";
KD.init = function (appId, appKey, moduleCode) {
_app_id = appId;
_app_secret = appKey;
_module_code = moduleCode;
}
let _request_url = {
wx_signature: BASE_HOST + "/wx/signature",
// 授权后的用户信息
wx_sns_user_info: BASE_HOST + "/wx_user_info",
// 含unionid 的用户信息
wx_user_info: BASE_HOST + "/cgi_bin/user_info",
// 统计
stat: BIZ_BASE_HOST + "/kd_platform_api/stat/s"
}
KD._tools = {};
(function () {
KD._tools._post_json = function (url, data, header, callback) {
var xhr;
//创建ajax引擎
if (window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
} else if (window.AtiveXObject) {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
let data = {
code: xhr.status,
response: xhr.responseText
};
(typeof callback == "function") && callback(data);
}
};
//创建请求
xhr.open("post", url, true);
xhr.setRequestHeader('Content-type', 'application/json');
if (header) {
for (let key in header) {
xhr.setRequestHeader(key, header[key]);
}
}
//发送请求
xhr.send(JSON.stringify(data));
}
KD._tools._post_form = function (url, data, header, callback) {
var xhr;
//创建ajax引擎
if (window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
} else if (window.AtiveXObject) {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
let data = {
code: xhr.status,
response: xhr.responseText
};
(typeof callback == "function") && callback(data);
}
};
//创建请求
xhr.open("post", url, true);
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
if (header) {
for (let key in header) {
xhr.setRequestHeader(key, header[key]);
}
}
//发送请求
let postStr = "";
for (let key in data) {
postStr += key + "=" + data[key] + "&";
}
if (postStr) {
postStr = postStr.substring(0, postStr.length - 1);
}
xhr.send(postStr);
}
KD._tools._get = function (url, data, header, callback) {
var xhr;
//创建ajax引擎
if (window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
} else if (window.AtiveXObject) {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
let data = {
code: xhr.status,
response: xhr.responseText
};
(typeof callback == "function") && callback(data);
}
};
//发送请求
let postStr = "";
for (let key in data) {
postStr += key + "=" + data[key] + "&";
}
if (postStr) {
postStr = "?" + postStr.substring(0, postStr.length - 1);
}
xhr.open("GET", url + postStr, true);
//创建请求
if (header) {
for (let key in header) {
xhr.setRequestHeader(key, header[key]);
}
}
xhr.send(null);
}
KD._tools._get_token = function () {
let key = "pl_token_" + _app_id;
return KD._tools._get_cookie(key);
}
KD._tools._get_wx_app_id = function () {
let key = "pl_wx_" + _app_id;
let res = KD._tools._get_cookie(key);
let wxAppId = res ? res.split(":")[0] : "";
return wxAppId;
}
KD._tools._get_cookie = function (name) {
var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
if (arr = document.cookie.match(reg)) {
return decodeURIComponent(arr[2])
} else {
return null
}
};
/**
* 处理响应结果
*/
KD._tools._handle_response = function (response) {
if (response.code == 200) {
let res = JSON.parse(response.response);
if (res.code == 200) {
return res;
} else {
if (DEBUG_SWITCH) {
alert("_handle_response failure : " + response.content)
}
}
} else {
if (DEBUG_SWITCH) {
alert("_handle_response : " + JSON.stringify(response))
}
}
}
/**
* 加解密CDN方式引入。
*
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/core.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/enc-base64.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/md5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/evpkdf.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/cipher-core.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/aes.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/pad-pkcs7.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/mode-ecb.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/enc-utf8.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/enc-hex.min.js"></script>
*/
KD._tools._init_aes = function () {
if (typeof KD._tools._aes_decrypt == "function") {
return true;
}
if (typeof CryptoJS == "undefined") {
console.error("install CryptoJS first");
return false;
}
if (CryptoJS && _app_secret) {
const key = CryptoJS.enc.Utf8.parse(_app_secret);
const iv = CryptoJS.enc.Utf8.parse(_app_secret.substring(0, 16));
// 解密方法
KD._tools._aes_decrypt = function (srcs) {
// let encryptedHexStr = CryptoJS.enc.Hex.parse(word);
// console.log("1,", encryptedHexStr)
// let srcs = CryptoJS.enc.Base64.stringify(encryptedHexStr);
console.log("2,", srcs)
let decrypt = CryptoJS.AES.decrypt(srcs, key, {
iv: iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
});
let decryptedStr = decrypt.toString(CryptoJS.enc.Utf8);
console.log("3,", decryptedStr)
return decryptedStr.toString();
}
// 加密方法
KD._tools._aes_encrypt = function (word) {
var srcs = CryptoJS.enc.Utf8.parse(word);
var encrypted = CryptoJS.AES.encrypt(srcs, key, {
iv: iv,
mode: CryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7
});
return encrypted.toString();
}
return true;
}
return false;
}
KD._tools._init_headers = function () {
return {
"-kd-platform-id": _app_id,
"-kd-platform-module": _module_code
}
}
})();
// 微信SDK地址
KD.weixin = function () {
let weixin = {};
let tools = KD._tools;
/**
* 权限列表:
* updateAppMessageShareData,updateTimelineShareData,onMenuShareWeibo,onMenuShareQZone,
* startRecord,stopRecord,onVoiceRecordEnd,playVoice,pauseVoice,stopVoice,onVoicePlayEnd,uploadVoice,downloadVoice,
* chooseImage,previewImage,uploadImage,downloadImage,
* translateVoice,
* getNetworkType,openLocation,getLocation,
* hideOptionMenu,showOptionMenu,hideMenuItems,showMenuItems,hideAllNonBaseMenuItem,showAllNonBaseMenuItem,
* closeWindow,scanQRCode,chooseWXPay,openProductSpecificView,addCard,chooseCard,openCard,
*/
weixin.initConfig = function (jsApiList) {
let url = window.location.href;
jsApiList = jsApiList && jsApiList.length > 0 ? jsApiList : ["updateAppMessageShareData", "updateTimelineShareData", "onMenuShareWeibo", "onMenuShareQZone", "hideMenuItems", "getLocation"];
tools._post_json(_request_url.wx_signature, {
appId: _app_id,
url: url
}, null, function (response) {
let res = KD._tools._handle_response(response);
if (res) {
wx.config({
debug: DEBUG_SWITCH, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: res.content.appId, // 必填,公众号的唯一标识
timestamp: res.content.timestamp, // 必填,生成签名的时间戳
nonceStr: res.content.nonceStr, // 必填,生成签名的随机串
signature: res.content.signature, // 必填,签名
jsApiList: jsApiList // 必填,需要使用的JS接口列表
});
wx.ready(function () {
wx.hideMenuItems({
menuList: ["menuItem:copyUrl"] // 要隐藏的菜单项,只能隐藏“传播类”和“保护类”按钮,所有menu项见附录3
});
})
}
});
}
/**
* 单独设置分享朋友圈
*/
weixin.updateAppMessageShareData = function (title, desc, link, imageUrl, succ) {
wx.ready(function () { //需在用户可能点击分享按钮前就先调用
wx.updateAppMessageShareData({
title: title, // 分享标题
desc: desc, // 分享描述
link: link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl: imageUrl, // 分享图标
success: function () {
(typeof succ == "function") && succ();
}
})
});
}
weixin.updateTimelineShareData = function (title, link, imageUrl, succ) {
wx.ready(function () { //需在用户可能点击分享按钮前就先调用
wx.updateTimelineShareData({
title: title, // 分享标题
link: link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl: imageUrl, // 分享图标
success: function () {
(typeof succ == "function") && succ();
}
})
});
}
/**
* 微信设置分享
*/
weixin.setShare = function (title, desc, link, imageUrl, succ) {
weixin.updateAppMessageShareData(title, desc, link, imageUrl, function () {
(typeof succ == "function") && succ("appMessage");
});
weixin.updateTimelineShareData(desc, link, imageUrl, function () {
(typeof succ == "function") && succ("timeline");
});
}
/**
* 获取用户的openid
*/
weixin.getOpenId = function () {
let openId = tools._get_token();
return openId;
}
/**
* 读取用户基本信息
*/
weixin.localUserInfo = function (callback) {
if (typeof callback != "function") {
return;
}
if (typeof CryptoJS != "undefined") {
let info = _get_user_info_from_cookie();
if (info) {
callback(info);
} else {
_get_user_info_by_openid(callback);
}
} else {
_get_user_info_by_openid(callback);
}
}
/**
* 读取用户基本信息
*/
weixin.getUserInfo = function (callback) {
if (typeof callback != "function") {
return;
}
_get_user_info_by_openid(callback);
}
/**
* 这个是用户授权后,从微信端读取用户基本信息。这个接口需要用户关注公众号
*/
weixin.getCgiUserInfo = function (callback) {
if (typeof callback != "function") {
return;
}
let openId = tools._get_token();
let wxAppId = tools._get_wx_app_id();
tools._get(_request_url.wx_user_info, {
wxAppId: wxAppId,
openId: openId
}, null, function (response) {
let res = tools._handle_response(response);
callback(res && res.content || null);
})
}
/**
* 获取位置
* @param {*} title
* @param {*} link
* @param {*} imageUrl
* @param {*} succ
*/
weixin.getLocation = function (callback) {
wx.ready(function () {
wx.getLocation({
type: 'wgs84', // 默认为wgs84的 gps 坐标,如果要返回直接给 openLocation 用的火星坐标,可传入'gcj02'
success: function (res) {
var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
var speed = res.speed; // 速度,以米/每秒计
var accuracy = res.accuracy; // 位置精度
(typeof callback == "function") && callback(res);
},
fail: function (err) {
console.log("err:", err);
}
});
});
}
/**
* 通过openid读取用户基本信息
*
* @param {function} callback
*/
function _get_user_info_by_openid(callback) {
let openId = tools._get_token();
let wxAppId = tools._get_wx_app_id();
tools._get(_request_url.wx_sns_user_info, {
wxAppId: wxAppId,
openId: openId
}, null, function (response) {
let res = tools._handle_response(response);
if (typeof callback == "function") {
callback(res.content);
}
})
}
/**
* 从cookie中读取信息
*/
function _get_user_info_from_cookie() {
let data = tools._get_cookie("pl_info_" + _app_id);
if (tools._init_aes()) {
let infoStr = tools._aes_decrypt(data);
return infoStr ? JSON.parse(infoStr) : null
}
return null;
}
return weixin;
}
KD.biz = function () {
let biz = {};
let tools = KD._tools;
/**
* 统计接口
*
* @param {String} channelCode 渠道编号
* @param {String} statClassify 统计类型,可见统计表定义
* @param {String} statKey 统计标识,可见统计表定义
* @param {String} primaryKey 唯一标识,如用户标识、按钮标识
*/
biz.stat = function (channelCode, statClassify, statKey, primaryKey) {
let form = {
aid: _app_id,
cc: !channelCode || channelCode == undefined ? "" : channelCode, //渠道
sc: !statClassify || statClassify == undefined ? "" : statClassify, //统计类型
sk: !statKey || statKey == undefined ? "" : statKey, //统计key
pc: !primaryKey || primaryKey == undefined ? "" : primaryKey //用户标识
}
let headers = tools._init_headers();
tools._get(_request_url.stat, form, headers, function (response) {})
}
return biz;
}
})();
\ No newline at end of file
let appId = 'e13baf8d4a0d468eae005935332c5429';
let appKey = '1c60d1543db640e5970ffa4a794eb5c6';
KD.init(appId, appKey);
let weixin = new KD.weixin();
weixin.initConfig();
// window.weixin = weixin;
let openId = weixin.getOpenId();
window.openId = openId;
window.openid = openId;
window.wxUserInfo = null;
let urlShortCode = 's2n7/';
let href = location.href;
if (href.indexOf("192.168.") != -1 || href.indexOf("172.20.") != -1) {
urlShortCode = "";
}
let domain = `${location.protocol}//${document.domain}/${urlShortCode}`;
let shareTitle = "";
let shareDesc = "";
let shareLink = `${domain}index.html`;
let shareImgUrl = `${domain}share.png`;
window.shareCodeLink = shareLink;
var KdIns = window.KdIns || ({});
// 设置分享
KdIns.setShare = function (title, desc, link, imgUrl) {
if (!title) title = shareTitle;
if (!desc) desc = shareDesc;
if (!link) link = shareLink;
if (!imgUrl) imgUrl = shareImgUrl;
weixin.setShare(title, desc, link, imgUrl, (pos) => {})
}
console.log("domain:", domain);
KdIns.setShare(``, ``, ``, ``);
// KdIns.setShareShareCode = function (shareCode) {
// let shareCodeLink = `${shareLink}#/coop?shareCode=${shareCode}`;
// window.shareCodeLink = shareCodeLink;
// KdIns.setShare(``, ``, shareCodeLink, ``);
// }
// KdIns.getShareLink = function (shareCode) {
// let shareCodeLink = `${shareLink}#/coop?shareCode=${shareCode}`;
// return shareCodeLink;
// }
//
KdIns.setShareShareCode = function (shareCode) {
let shareCodeLink = `${shareLink}?f=coop&shareCode=${shareCode}`;
window.shareCodeLink = shareCodeLink;
KdIns.setShare(``, ``, shareCodeLink, ``);
}
KdIns.getShareLink = function (shareCode) {
let shareCodeLink = `${shareLink}?f=coop&shareCode=${shareCode}`;
return shareCodeLink;
}
// 读取微信身份
KdIns.getUserInfo = function () {
return new Promise((resolve, reject) => {
weixin.getUserInfo((res) => {
window.wxUserInfo = res;
window.wxUserInfo.avatar = window.wxUserInfo.headimgurl;
resolve(res);
});
});
}
// 读取微信身份CGI模式,需要用户显示授权后才能获得数据。获取信息中包含了用户的关注信息与unionid
KdIns.getCgiUserInfo = function () {
return new Promise((resolve, reject) => {
weixin.getCgiUserInfo((res) => {
resolve(res);
});
});
}
\ No newline at end of file
!function(e,n){"function"==typeof define&&(define.amd||define.cmd)?define(function(){return n(e)}):n(e,!0)}(this,function(e,n){function i(n,i,t){e.WeixinJSBridge?WeixinJSBridge.invoke(n,o(i),function(e){c(n,e,t)}):u(n,t)}function t(n,i,t){e.WeixinJSBridge?WeixinJSBridge.on(n,function(e){t&&t.trigger&&t.trigger(e),c(n,e,i)}):t?u(n,t):u(n,i)}function o(e){return e=e||{},e.appId=P.appId,e.verifyAppId=P.appId,e.verifySignType="sha1",e.verifyTimestamp=P.timestamp+"",e.verifyNonceStr=P.nonceStr,e.verifySignature=P.signature,e}function r(e){return{timeStamp:e.timestamp+"",nonceStr:e.nonceStr,package:e.package,paySign:e.paySign,signType:e.signType||"SHA1"}}function a(e){return e.postalCode=e.addressPostalCode,delete e.addressPostalCode,e.provinceName=e.proviceFirstStageName,delete e.proviceFirstStageName,e.cityName=e.addressCitySecondStageName,delete e.addressCitySecondStageName,e.countryName=e.addressCountiesThirdStageName,delete e.addressCountiesThirdStageName,e.detailInfo=e.addressDetailInfo,delete e.addressDetailInfo,e}function c(e,n,i){"openEnterpriseChat"==e&&(n.errCode=n.err_code),delete n.err_code,delete n.err_desc,delete n.err_detail;var t=n.errMsg;t||(t=n.err_msg,delete n.err_msg,t=s(e,t),n.errMsg=t),(i=i||{})._complete&&(i._complete(n),delete i._complete),t=n.errMsg||"",P.debug&&!i.isInnerInvoke&&alert(JSON.stringify(n));var o=t.indexOf(":");switch(t.substring(o+1)){case"ok":i.success&&i.success(n);break;case"cancel":i.cancel&&i.cancel(n);break;default:i.fail&&i.fail(n)}i.complete&&i.complete(n)}function s(e,n){var i=e,t=h[i];t&&(i=t);var o="ok";if(n){var r=n.indexOf(":");"confirm"==(o=n.substring(r+1))&&(o="ok"),"failed"==o&&(o="fail"),-1!=o.indexOf("failed_")&&(o=o.substring(7)),-1!=o.indexOf("fail_")&&(o=o.substring(5)),"access denied"!=(o=(o=o.replace(/_/g," ")).toLowerCase())&&"no permission to execute"!=o||(o="permission denied"),"config"==i&&"function not exist"==o&&(o="ok"),""==o&&(o="fail")}return n=i+":"+o}function d(e){if(e){for(var n=0,i=e.length;n<i;++n){var t=e[n],o=g[t];o&&(e[n]=o)}return e}}function u(e,n){if(!(!P.debug||n&&n.isInnerInvoke)){var i=h[e];i&&(e=i),n&&n._complete&&delete n._complete,console.log('"'+e+'",',n||"")}}function l(e){if(!(I||T||P.debug||C<"6.0.2"||x.systemType<0)){var n=new Image;x.appId=P.appId,x.initTime=V.initEndTime-V.initStartTime,x.preVerifyTime=V.preVerifyEndTime-V.preVerifyStartTime,b.getNetworkType({isInnerInvoke:!0,success:function(e){x.networkType=e.networkType;var i="https://open.weixin.qq.com/sdk/report?v="+x.version+"&o="+x.isPreVerifyOk+"&s="+x.systemType+"&c="+x.clientVersion+"&a="+x.appId+"&n="+x.networkType+"&i="+x.initTime+"&p="+x.preVerifyTime+"&u="+x.url;n.src=i}})}}function p(){return(new Date).getTime()}function f(n){w&&(e.WeixinJSBridge?n():S.addEventListener&&S.addEventListener("WeixinJSBridgeReady",n,!1))}function m(){b.invoke||(b.invoke=function(n,i,t){e.WeixinJSBridge&&WeixinJSBridge.invoke(n,o(i),t)},b.on=function(n,i){e.WeixinJSBridge&&WeixinJSBridge.on(n,i)})}if(!e.jWeixin){var g={config:"preVerifyJSAPI",onMenuShareTimeline:"menu:share:timeline",onMenuShareAppMessage:"menu:share:appmessage",onMenuShareQQ:"menu:share:qq",onMenuShareWeibo:"menu:share:weiboApp",onMenuShareQZone:"menu:share:QZone",previewImage:"imagePreview",getLocation:"geoLocation",openProductSpecificView:"openProductViewWithPid",addCard:"batchAddCard",openCard:"batchViewCard",chooseWXPay:"getBrandWCPayRequest",openEnterpriseRedPacket:"getRecevieBizHongBaoRequest",startSearchBeacons:"startMonitoringBeacons",stopSearchBeacons:"stopMonitoringBeacons",onSearchBeacons:"onBeaconsInRange",consumeAndShareCard:"consumedShareCard",openAddress:"editAddress"},h=function(){var e={};for(var n in g)e[g[n]]=n;return e}(),S=e.document,y=S.title,v=navigator.userAgent.toLowerCase(),_=navigator.platform.toLowerCase(),I=!(!_.match("mac")&&!_.match("win")),T=-1!=v.indexOf("wxdebugger"),w=-1!=v.indexOf("micromessenger"),k=-1!=v.indexOf("android"),M=-1!=v.indexOf("iphone")||-1!=v.indexOf("ipad"),C=function(){var e=v.match(/micromessenger\/(\d+\.\d+\.\d+)/)||v.match(/micromessenger\/(\d+\.\d+)/);return e?e[1]:""}(),V={initStartTime:p(),initEndTime:0,preVerifyStartTime:0,preVerifyEndTime:0},x={version:1,appId:"",initTime:0,preVerifyTime:0,networkType:"",isPreVerifyOk:1,systemType:M?1:k?2:-1,clientVersion:C,url:encodeURIComponent(location.href)},P={},A={_completes:[]},B={state:0,data:{}};f(function(){V.initEndTime=p()});var b={config:function(e){P=e,u("config",e);var n=!1!==P.check;f(function(){if(n)i(g.config,{verifyJsApiList:d(P.jsApiList)},function(){A._complete=function(e){V.preVerifyEndTime=p(),B.state=1,B.data=e},A.success=function(e){x.isPreVerifyOk=0},A.fail=function(e){A._fail?A._fail(e):B.state=-1};var e=A._completes;return e.push(function(){l()}),A.complete=function(n){for(var i=0,t=e.length;i<t;++i)e[i]();A._completes=[]},A}()),V.preVerifyStartTime=p();else{B.state=1;for(var e=A._completes,t=0,o=e.length;t<o;++t)e[t]();A._completes=[]}}),P.beta&&m()},ready:function(e){0!=B.state?e():(A._completes.push(e),!w&&P.debug&&e())},error:function(e){C<"6.0.2"||(-1==B.state?e(B.data):A._fail=e)},checkJsApi:function(e){var n=function(e){var n=e.checkResult;for(var i in n){var t=h[i];t&&(n[t]=n[i],delete n[i])}return e};i("checkJsApi",{jsApiList:d(e.jsApiList)},(e._complete=function(e){if(k){var i=e.checkResult;i&&(e.checkResult=JSON.parse(i))}e=n(e)},e))},onMenuShareTimeline:function(e){t(g.onMenuShareTimeline,{complete:function(){i("shareTimeline",{title:e.title||y,desc:e.title||y,img_url:e.imgUrl||"",link:e.link||location.href,type:e.type||"link",data_url:e.dataUrl||""},e)}},e)},onMenuShareAppMessage:function(e){t(g.onMenuShareAppMessage,{complete:function(n){"favorite"===n.scene?i("sendAppMessage",{title:e.title||y,desc:e.desc||"",link:e.link||location.href,img_url:e.imgUrl||"",type:e.type||"link",data_url:e.dataUrl||""}):i("sendAppMessage",{title:e.title||y,desc:e.desc||"",link:e.link||location.href,img_url:e.imgUrl||"",type:e.type||"link",data_url:e.dataUrl||""},e)}},e)},onMenuShareQQ:function(e){t(g.onMenuShareQQ,{complete:function(){i("shareQQ",{title:e.title||y,desc:e.desc||"",img_url:e.imgUrl||"",link:e.link||location.href},e)}},e)},onMenuShareWeibo:function(e){t(g.onMenuShareWeibo,{complete:function(){i("shareWeiboApp",{title:e.title||y,desc:e.desc||"",img_url:e.imgUrl||"",link:e.link||location.href},e)}},e)},onMenuShareQZone:function(e){t(g.onMenuShareQZone,{complete:function(){i("shareQZone",{title:e.title||y,desc:e.desc||"",img_url:e.imgUrl||"",link:e.link||location.href},e)}},e)},startRecord:function(e){i("startRecord",{},e)},stopRecord:function(e){i("stopRecord",{},e)},onVoiceRecordEnd:function(e){t("onVoiceRecordEnd",e)},playVoice:function(e){i("playVoice",{localId:e.localId},e)},pauseVoice:function(e){i("pauseVoice",{localId:e.localId},e)},stopVoice:function(e){i("stopVoice",{localId:e.localId},e)},onVoicePlayEnd:function(e){t("onVoicePlayEnd",e)},uploadVoice:function(e){i("uploadVoice",{localId:e.localId,isShowProgressTips:0==e.isShowProgressTips?0:1},e)},downloadVoice:function(e){i("downloadVoice",{serverId:e.serverId,isShowProgressTips:0==e.isShowProgressTips?0:1},e)},translateVoice:function(e){i("translateVoice",{localId:e.localId,isShowProgressTips:0==e.isShowProgressTips?0:1},e)},chooseImage:function(e){i("chooseImage",{scene:"1|2",count:e.count||9,sizeType:e.sizeType||["original","compressed"],sourceType:e.sourceType||["album","camera"]},(e._complete=function(e){if(k){var n=e.localIds;try{n&&(e.localIds=JSON.parse(n))}catch(e){}}},e))},previewImage:function(e){i(g.previewImage,{current:e.current,urls:e.urls},e)},uploadImage:function(e){i("uploadImage",{localId:e.localId,isShowProgressTips:0==e.isShowProgressTips?0:1},e)},downloadImage:function(e){i("downloadImage",{serverId:e.serverId,isShowProgressTips:0==e.isShowProgressTips?0:1},e)},getNetworkType:function(e){var n=function(e){var n=e.errMsg;e.errMsg="getNetworkType:ok";var i=e.subtype;if(delete e.subtype,i)e.networkType=i;else{var t=n.indexOf(":"),o=n.substring(t+1);switch(o){case"wifi":case"edge":case"wwan":e.networkType=o;break;default:e.errMsg="getNetworkType:fail"}}return e};i("getNetworkType",{},(e._complete=function(e){e=n(e)},e))},openLocation:function(e){i("openLocation",{latitude:e.latitude,longitude:e.longitude,name:e.name||"",address:e.address||"",scale:e.scale||28,infoUrl:e.infoUrl||""},e)},getLocation:function(e){e=e||{},i(g.getLocation,{type:e.type||"wgs84"},(e._complete=function(e){delete e.type},e))},hideOptionMenu:function(e){i("hideOptionMenu",{},e)},showOptionMenu:function(e){i("showOptionMenu",{},e)},closeWindow:function(e){i("closeWindow",{},e=e||{})},hideMenuItems:function(e){i("hideMenuItems",{menuList:e.menuList},e)},showMenuItems:function(e){i("showMenuItems",{menuList:e.menuList},e)},hideAllNonBaseMenuItem:function(e){i("hideAllNonBaseMenuItem",{},e)},showAllNonBaseMenuItem:function(e){i("showAllNonBaseMenuItem",{},e)},scanQRCode:function(e){i("scanQRCode",{needResult:(e=e||{}).needResult||0,scanType:e.scanType||["qrCode","barCode"]},(e._complete=function(e){if(M){var n=e.resultStr;if(n){var i=JSON.parse(n);e.resultStr=i&&i.scan_code&&i.scan_code.scan_result}}},e))},openAddress:function(e){i(g.openAddress,{},(e._complete=function(e){e=a(e)},e))},openProductSpecificView:function(e){i(g.openProductSpecificView,{pid:e.productId,view_type:e.viewType||0,ext_info:e.extInfo},e)},addCard:function(e){for(var n=e.cardList,t=[],o=0,r=n.length;o<r;++o){var a=n[o],c={card_id:a.cardId,card_ext:a.cardExt};t.push(c)}i(g.addCard,{card_list:t},(e._complete=function(e){var n=e.card_list;if(n){for(var i=0,t=(n=JSON.parse(n)).length;i<t;++i){var o=n[i];o.cardId=o.card_id,o.cardExt=o.card_ext,o.isSuccess=!!o.is_succ,delete o.card_id,delete o.card_ext,delete o.is_succ}e.cardList=n,delete e.card_list}},e))},chooseCard:function(e){i("chooseCard",{app_id:P.appId,location_id:e.shopId||"",sign_type:e.signType||"SHA1",card_id:e.cardId||"",card_type:e.cardType||"",card_sign:e.cardSign,time_stamp:e.timestamp+"",nonce_str:e.nonceStr},(e._complete=function(e){e.cardList=e.choose_card_info,delete e.choose_card_info},e))},openCard:function(e){for(var n=e.cardList,t=[],o=0,r=n.length;o<r;++o){var a=n[o],c={card_id:a.cardId,code:a.code};t.push(c)}i(g.openCard,{card_list:t},e)},consumeAndShareCard:function(e){i(g.consumeAndShareCard,{consumedCardId:e.cardId,consumedCode:e.code},e)},chooseWXPay:function(e){i(g.chooseWXPay,r(e),e)},openEnterpriseRedPacket:function(e){i(g.openEnterpriseRedPacket,r(e),e)},startSearchBeacons:function(e){i(g.startSearchBeacons,{ticket:e.ticket},e)},stopSearchBeacons:function(e){i(g.stopSearchBeacons,{},e)},onSearchBeacons:function(e){t(g.onSearchBeacons,e)},openEnterpriseChat:function(e){i("openEnterpriseChat",{useridlist:e.userIds,chatname:e.groupName},e)}};return n&&(e.wx=e.jWeixin=b),b}});
\ No newline at end of file
!function(e,n){"function"==typeof define&&(define.amd||define.cmd)?define(function(){return n(e)}):n(e,!0)}(this,function(o,e){if(!o.jWeixin){var n,c={config:"preVerifyJSAPI",onMenuShareTimeline:"menu:share:timeline",onMenuShareAppMessage:"menu:share:appmessage",onMenuShareQQ:"menu:share:qq",onMenuShareWeibo:"menu:share:weiboApp",onMenuShareQZone:"menu:share:QZone",previewImage:"imagePreview",getLocation:"geoLocation",openProductSpecificView:"openProductViewWithPid",addCard:"batchAddCard",openCard:"batchViewCard",chooseWXPay:"getBrandWCPayRequest",openEnterpriseRedPacket:"getRecevieBizHongBaoRequest",startSearchBeacons:"startMonitoringBeacons",stopSearchBeacons:"stopMonitoringBeacons",onSearchBeacons:"onBeaconsInRange",consumeAndShareCard:"consumedShareCard",openAddress:"editAddress"},a=function(){var e={};for(var n in c)e[c[n]]=n;return e}(),i=o.document,t=i.title,r=navigator.userAgent.toLowerCase(),s=navigator.platform.toLowerCase(),d=!(!s.match("mac")&&!s.match("win")),u=-1!=r.indexOf("wxdebugger"),l=-1!=r.indexOf("micromessenger"),p=-1!=r.indexOf("android"),f=-1!=r.indexOf("iphone")||-1!=r.indexOf("ipad"),m=(n=r.match(/micromessenger\/(\d+\.\d+\.\d+)/)||r.match(/micromessenger\/(\d+\.\d+)/))?n[1]:"",g={initStartTime:L(),initEndTime:0,preVerifyStartTime:0,preVerifyEndTime:0},h={version:1,appId:"",initTime:0,preVerifyTime:0,networkType:"",isPreVerifyOk:1,systemType:f?1:p?2:-1,clientVersion:m,url:encodeURIComponent(location.href)},v={},S={_completes:[]},y={state:0,data:{}};O(function(){g.initEndTime=L()});var I=!1,_=[],w={config:function(e){B("config",v=e);var t=!1!==v.check;O(function(){if(t)M(c.config,{verifyJsApiList:C(v.jsApiList),verifyOpenTagList:C(v.openTagList)},function(){S._complete=function(e){g.preVerifyEndTime=L(),y.state=1,y.data=e},S.success=function(e){h.isPreVerifyOk=0},S.fail=function(e){S._fail?S._fail(e):y.state=-1};var t=S._completes;return t.push(function(){!function(){if(!(d||u||v.debug||m<"6.0.2"||h.systemType<0)){var i=new Image;h.appId=v.appId,h.initTime=g.initEndTime-g.initStartTime,h.preVerifyTime=g.preVerifyEndTime-g.preVerifyStartTime,w.getNetworkType({isInnerInvoke:!0,success:function(e){h.networkType=e.networkType;var n="https://open.weixin.qq.com/sdk/report?v="+h.version+"&o="+h.isPreVerifyOk+"&s="+h.systemType+"&c="+h.clientVersion+"&a="+h.appId+"&n="+h.networkType+"&i="+h.initTime+"&p="+h.preVerifyTime+"&u="+h.url;i.src=n}})}}()}),S.complete=function(e){for(var n=0,i=t.length;n<i;++n)t[n]();S._completes=[]},S}()),g.preVerifyStartTime=L();else{y.state=1;for(var e=S._completes,n=0,i=e.length;n<i;++n)e[n]();S._completes=[]}}),w.invoke||(w.invoke=function(e,n,i){o.WeixinJSBridge&&WeixinJSBridge.invoke(e,x(n),i)},w.on=function(e,n){o.WeixinJSBridge&&WeixinJSBridge.on(e,n)})},ready:function(e){0!=y.state?e():(S._completes.push(e),!l&&v.debug&&e())},error:function(e){m<"6.0.2"||(-1==y.state?e(y.data):S._fail=e)},checkJsApi:function(e){M("checkJsApi",{jsApiList:C(e.jsApiList)},(e._complete=function(e){if(p){var n=e.checkResult;n&&(e.checkResult=JSON.parse(n))}e=function(e){var n=e.checkResult;for(var i in n){var t=a[i];t&&(n[t]=n[i],delete n[i])}return e}(e)},e))},onMenuShareTimeline:function(e){P(c.onMenuShareTimeline,{complete:function(){M("shareTimeline",{title:e.title||t,desc:e.title||t,img_url:e.imgUrl||"",link:e.link||location.href,type:e.type||"link",data_url:e.dataUrl||""},e)}},e)},onMenuShareAppMessage:function(n){P(c.onMenuShareAppMessage,{complete:function(e){"favorite"===e.scene?M("sendAppMessage",{title:n.title||t,desc:n.desc||"",link:n.link||location.href,img_url:n.imgUrl||"",type:n.type||"link",data_url:n.dataUrl||""}):M("sendAppMessage",{title:n.title||t,desc:n.desc||"",link:n.link||location.href,img_url:n.imgUrl||"",type:n.type||"link",data_url:n.dataUrl||""},n)}},n)},onMenuShareQQ:function(e){P(c.onMenuShareQQ,{complete:function(){M("shareQQ",{title:e.title||t,desc:e.desc||"",img_url:e.imgUrl||"",link:e.link||location.href},e)}},e)},onMenuShareWeibo:function(e){P(c.onMenuShareWeibo,{complete:function(){M("shareWeiboApp",{title:e.title||t,desc:e.desc||"",img_url:e.imgUrl||"",link:e.link||location.href},e)}},e)},onMenuShareQZone:function(e){P(c.onMenuShareQZone,{complete:function(){M("shareQZone",{title:e.title||t,desc:e.desc||"",img_url:e.imgUrl||"",link:e.link||location.href},e)}},e)},updateTimelineShareData:function(e){M("updateTimelineShareData",{title:e.title,link:e.link,imgUrl:e.imgUrl},e)},updateAppMessageShareData:function(e){M("updateAppMessageShareData",{title:e.title,desc:e.desc,link:e.link,imgUrl:e.imgUrl},e)},startRecord:function(e){M("startRecord",{},e)},stopRecord:function(e){M("stopRecord",{},e)},onVoiceRecordEnd:function(e){P("onVoiceRecordEnd",e)},playVoice:function(e){M("playVoice",{localId:e.localId},e)},pauseVoice:function(e){M("pauseVoice",{localId:e.localId},e)},stopVoice:function(e){M("stopVoice",{localId:e.localId},e)},onVoicePlayEnd:function(e){P("onVoicePlayEnd",e)},uploadVoice:function(e){M("uploadVoice",{localId:e.localId,isShowProgressTips:0==e.isShowProgressTips?0:1},e)},downloadVoice:function(e){M("downloadVoice",{serverId:e.serverId,isShowProgressTips:0==e.isShowProgressTips?0:1},e)},translateVoice:function(e){M("translateVoice",{localId:e.localId,isShowProgressTips:0==e.isShowProgressTips?0:1},e)},chooseImage:function(e){M("chooseImage",{scene:"1|2",count:e.count||9,sizeType:e.sizeType||["original","compressed"],sourceType:e.sourceType||["album","camera"]},(e._complete=function(e){if(p){var n=e.localIds;try{n&&(e.localIds=JSON.parse(n))}catch(e){}}},e))},getLocation:function(e){},previewImage:function(e){M(c.previewImage,{current:e.current,urls:e.urls},e)},uploadImage:function(e){M("uploadImage",{localId:e.localId,isShowProgressTips:0==e.isShowProgressTips?0:1},e)},downloadImage:function(e){M("downloadImage",{serverId:e.serverId,isShowProgressTips:0==e.isShowProgressTips?0:1},e)},getLocalImgData:function(e){!1===I?(I=!0,M("getLocalImgData",{localId:e.localId},(e._complete=function(e){if(I=!1,0<_.length){var n=_.shift();wx.getLocalImgData(n)}},e))):_.push(e)},getNetworkType:function(e){M("getNetworkType",{},(e._complete=function(e){e=function(e){var n=e.errMsg;e.errMsg="getNetworkType:ok";var i=e.subtype;if(delete e.subtype,i)e.networkType=i;else{var t=n.indexOf(":"),o=n.substring(t+1);switch(o){case"wifi":case"edge":case"wwan":e.networkType=o;break;default:e.errMsg="getNetworkType:fail"}}return e}(e)},e))},openLocation:function(e){M("openLocation",{latitude:e.latitude,longitude:e.longitude,name:e.name||"",address:e.address||"",scale:e.scale||28,infoUrl:e.infoUrl||""},e)},getLocation:function(e){M(c.getLocation,{type:(e=e||{}).type||"wgs84"},(e._complete=function(e){delete e.type},e))},hideOptionMenu:function(e){M("hideOptionMenu",{},e)},showOptionMenu:function(e){M("showOptionMenu",{},e)},closeWindow:function(e){M("closeWindow",{},e=e||{})},hideMenuItems:function(e){M("hideMenuItems",{menuList:e.menuList},e)},showMenuItems:function(e){M("showMenuItems",{menuList:e.menuList},e)},hideAllNonBaseMenuItem:function(e){M("hideAllNonBaseMenuItem",{},e)},showAllNonBaseMenuItem:function(e){M("showAllNonBaseMenuItem",{},e)},scanQRCode:function(e){M("scanQRCode",{needResult:(e=e||{}).needResult||0,scanType:e.scanType||["qrCode","barCode"]},(e._complete=function(e){if(f){var n=e.resultStr;if(n){var i=JSON.parse(n);e.resultStr=i&&i.scan_code&&i.scan_code.scan_result}}},e))},openAddress:function(e){M(c.openAddress,{},(e._complete=function(e){e=function(e){return e.postalCode=e.addressPostalCode,delete e.addressPostalCode,e.provinceName=e.proviceFirstStageName,delete e.proviceFirstStageName,e.cityName=e.addressCitySecondStageName,delete e.addressCitySecondStageName,e.countryName=e.addressCountiesThirdStageName,delete e.addressCountiesThirdStageName,e.detailInfo=e.addressDetailInfo,delete e.addressDetailInfo,e}(e)},e))},openProductSpecificView:function(e){M(c.openProductSpecificView,{pid:e.productId,view_type:e.viewType||0,ext_info:e.extInfo},e)},addCard:function(e){for(var n=e.cardList,i=[],t=0,o=n.length;t<o;++t){var r=n[t],a={card_id:r.cardId,card_ext:r.cardExt};i.push(a)}M(c.addCard,{card_list:i},(e._complete=function(e){var n=e.card_list;if(n){for(var i=0,t=(n=JSON.parse(n)).length;i<t;++i){var o=n[i];o.cardId=o.card_id,o.cardExt=o.card_ext,o.isSuccess=!!o.is_succ,delete o.card_id,delete o.card_ext,delete o.is_succ}e.cardList=n,delete e.card_list}},e))},chooseCard:function(e){M("chooseCard",{app_id:v.appId,location_id:e.shopId||"",sign_type:e.signType||"SHA1",card_id:e.cardId||"",card_type:e.cardType||"",card_sign:e.cardSign,time_stamp:e.timestamp+"",nonce_str:e.nonceStr},(e._complete=function(e){e.cardList=e.choose_card_info,delete e.choose_card_info},e))},openCard:function(e){for(var n=e.cardList,i=[],t=0,o=n.length;t<o;++t){var r=n[t],a={card_id:r.cardId,code:r.code};i.push(a)}M(c.openCard,{card_list:i},e)},consumeAndShareCard:function(e){M(c.consumeAndShareCard,{consumedCardId:e.cardId,consumedCode:e.code},e)},chooseWXPay:function(e){M(c.chooseWXPay,V(e),e)},openEnterpriseRedPacket:function(e){M(c.openEnterpriseRedPacket,V(e),e)},startSearchBeacons:function(e){M(c.startSearchBeacons,{ticket:e.ticket},e)},stopSearchBeacons:function(e){M(c.stopSearchBeacons,{},e)},onSearchBeacons:function(e){P(c.onSearchBeacons,e)},openEnterpriseChat:function(e){M("openEnterpriseChat",{useridlist:e.userIds,chatname:e.groupName},e)},launchMiniProgram:function(e){M("launchMiniProgram",{targetAppId:e.targetAppId,path:function(e){if("string"==typeof e&&0<e.length){var n=e.split("?")[0],i=e.split("?")[1];return n+=".html",void 0!==i?n+"?"+i:n}}(e.path),envVersion:e.envVersion},e)},openBusinessView:function(e){M("openBusinessView",{businessType:e.businessType,queryString:e.queryString||"",envVersion:e.envVersion},(e._complete=function(n){if(p){var e=n.extraData;if(e)try{n.extraData=JSON.parse(e)}catch(e){n.extraData={}}}},e))},miniProgram:{navigateBack:function(e){e=e||{},O(function(){M("invokeMiniProgramAPI",{name:"navigateBack",arg:{delta:e.delta||1}},e)})},navigateTo:function(e){O(function(){M("invokeMiniProgramAPI",{name:"navigateTo",arg:{url:e.url}},e)})},redirectTo:function(e){O(function(){M("invokeMiniProgramAPI",{name:"redirectTo",arg:{url:e.url}},e)})},switchTab:function(e){O(function(){M("invokeMiniProgramAPI",{name:"switchTab",arg:{url:e.url}},e)})},reLaunch:function(e){O(function(){M("invokeMiniProgramAPI",{name:"reLaunch",arg:{url:e.url}},e)})},postMessage:function(e){O(function(){M("invokeMiniProgramAPI",{name:"postMessage",arg:e.data||{}},e)})},getEnv:function(e){O(function(){e({miniprogram:"miniprogram"===o.__wxjs_environment})})}}},T=1,k={};return i.addEventListener("error",function(e){if(!p){var n=e.target,i=n.tagName,t=n.src;if("IMG"==i||"VIDEO"==i||"AUDIO"==i||"SOURCE"==i)if(-1!=t.indexOf("wxlocalresource://")){e.preventDefault(),e.stopPropagation();var o=n["wx-id"];if(o||(o=T++,n["wx-id"]=o),k[o])return;k[o]=!0,wx.ready(function(){wx.getLocalImgData({localId:t,success:function(e){n.src=e.localData}})})}}},!0),i.addEventListener("load",function(e){if(!p){var n=e.target,i=n.tagName;n.src;if("IMG"==i||"VIDEO"==i||"AUDIO"==i||"SOURCE"==i){var t=n["wx-id"];t&&(k[t]=!1)}}},!0),e&&(o.wx=o.jWeixin=w),w}function M(n,e,i){o.WeixinJSBridge?WeixinJSBridge.invoke(n,x(e),function(e){A(n,e,i)}):B(n,i)}function P(n,i,t){o.WeixinJSBridge?WeixinJSBridge.on(n,function(e){t&&t.trigger&&t.trigger(e),A(n,e,i)}):B(n,t||i)}function x(e){return(e=e||{}).appId=v.appId,e.verifyAppId=v.appId,e.verifySignType="sha1",e.verifyTimestamp=v.timestamp+"",e.verifyNonceStr=v.nonceStr,e.verifySignature=v.signature,e}function V(e){return{timeStamp:e.timestamp+"",nonceStr:e.nonceStr,package:e.package,paySign:e.paySign,signType:e.signType||"SHA1"}}function A(e,n,i){"openEnterpriseChat"!=e&&"openBusinessView"!==e||(n.errCode=n.err_code),delete n.err_code,delete n.err_desc,delete n.err_detail;var t=n.errMsg;t||(t=n.err_msg,delete n.err_msg,t=function(e,n){var i=e,t=a[i];t&&(i=t);var o="ok";if(n){var r=n.indexOf(":");"confirm"==(o=n.substring(r+1))&&(o="ok"),"failed"==o&&(o="fail"),-1!=o.indexOf("failed_")&&(o=o.substring(7)),-1!=o.indexOf("fail_")&&(o=o.substring(5)),"access denied"!=(o=(o=o.replace(/_/g," ")).toLowerCase())&&"no permission to execute"!=o||(o="permission denied"),"config"==i&&"function not exist"==o&&(o="ok"),""==o&&(o="fail")}return n=i+":"+o}(e,t),n.errMsg=t),(i=i||{})._complete&&(i._complete(n),delete i._complete),t=n.errMsg||"",v.debug&&!i.isInnerInvoke&&alert(JSON.stringify(n));var o=t.indexOf(":");switch(t.substring(o+1)){case"ok":i.success&&i.success(n);break;case"cancel":i.cancel&&i.cancel(n);break;default:i.fail&&i.fail(n)}i.complete&&i.complete(n)}function C(e){if(e){for(var n=0,i=e.length;n<i;++n){var t=e[n],o=c[t];o&&(e[n]=o)}return e}}function B(e,n){if(!(!v.debug||n&&n.isInnerInvoke)){var i=a[e];i&&(e=i),n&&n._complete&&delete n._complete,console.log('"'+e+'",',n||"")}}function L(){return(new Date).getTime()}function O(e){l&&(o.WeixinJSBridge?e():i.addEventListener&&i.addEventListener("WeixinJSBridgeReady",e,!1))}});
\ No newline at end of file
......@@ -35,8 +35,7 @@ export default {
},
},
mounted() {
console.log("111");
this.initWaterMark();
// this.initWaterMark();
},
};
</script>
......@@ -69,21 +68,6 @@ div {
margin: 20px;
}
.app__title {
font-size: $fontSize;
line-height: $fontSize + 4px;
font-weight: bold;
padding-bottom: 10px;
margin-bottom: 20px;
border-bottom: 0.5px solid #eeeeee;
}
.app__desc {
font-size: $fontSizeSmaller;
line-height: $fontSizeSmaller + 2px;
margin-bottom: 20px;
color: $colorGray;
}
.app__bgc {
position: fixed;
......
module.exports = {
testListGet: '/xxx/xxx/list',
login: '/front/userApi/login', // 登录
profile: '/front/userApi/profile', // 个人信息
uploadProfile: '/front/userApi/uploadProfile', // 更新头像昵称
upload: '/common/upload', // 上传文件 [x]
list: "xxx",
// areaQuery: 'https://api.k.wxpai.cn/bizproxy/kdapi/area', // post 区域查询
areaQuery: 'https://api.k.wxpai.cn/bizproxy/kdapi/area', // post 区域查询
}
\ No newline at end of file
......
......@@ -102,7 +102,7 @@ axios.interceptors.response.use(
/**
* 分解参数&拦截请求
*/
function analysisParams(params) {
function analysisParams(params) {
let {
url,
data,
......@@ -196,6 +196,22 @@ export const httpPost = params => {
data.append('path', '/pro/mzczcradmin/')
data.append('file', file.file)
*/
// export const formdata = params => {
// let {
// url,
// data,
// } = params;
// let formData = new FormData(); //使用formData对象
// for (let key in data) {
// formData.append(key, data[key]);
// }
// return axios.post(`${base}${url}`, formData, {
// headers: {
// "Content-Type": "multipart/form-data"
// }
// }).then(res => res.data.content);
// }
export const formdata = params => {
let {
url,
......@@ -208,13 +224,16 @@ export const formdata = params => {
}
return axios.post(`${base}${url}`, formData, {
headers: {
"Content-Type": "multipart/form-data"
"Content-Type": "multipart/form-data",
"-kd-platform-module": MODULE_CODE,
"-kd-platform-env": ENV
}
}).then(res => res.data.content);
}
/**
* 打点
* @param {*} params
......
This diff could not be displayed because it is too large.
......@@ -6,13 +6,15 @@ import store from './store'
import api from '@/api/api'
import {
httpGet,
httpPost
httpPost,
formdata
} from '@/api/fetch-api.js'
// import Mock from './mock'
// Mock.bootstrap();
import 'amfe-flexible/index.js'
import vant from '@/utils/vant-util'
// import '@/styles/index.scss' // global css
import '@/styles/fonticon.scss' // 图标字体
......@@ -22,30 +24,70 @@ import '@/assets/fonts/font.scss' // 字体引入
Vue.config.productionTip = false
import {
Swipe,
SwipeItem,
Lazyload,
Tab,
Tabs,
Sticky,
Popup,
Tabbar,
TabbarItem,
Icon,
Toast,
Button
} from 'vant';
Vue.use(Swipe).use(SwipeItem)
.use(Lazyload)
.use(Tab).use(Tabs)
.use(Sticky)
.use(Popup)
.use(Tabbar).use(TabbarItem)
.use(Icon)
.use(Button)
.use(Toast);
// 原app节点请通过 document.getElementById('app') 获取
// routes里的component组件需要以import方式引入,否则页面创建的时候,app还没挂载。
// function initVue() {
// let codeSn = getQuery("c");
// if (process.env.NODE_ENV == "development") {
// openid = "oDPvDjjha8EVFhJaceqxs3Bta-1k";
// }
// console.log("openid:", openid);
// app.post({
// url: app.api.login,
// data: {
// openid: openid
// }
// }).then((result) => {
// console.log("result:", result);
// setToken(result.sessionId);
// // console.log("KdIns:", KdIns);
// // 显示授权,或者头像昵称
// // if (process.env.NODE_ENV == "development") {
// // let wxUserInfo = {}
// // wxUserInfo.avatar = 'https://thirdwx.qlogo.cn/mmopen/vi_32/g5XHJelCh5ca3HbruKTM38uaOk0lqzMK4vDb7bLsUNiacRfEc7wp8wLP6GDlFicFFXZ1xAuTnSl8GfSoibPUgY1eg/132';
// // wxUserInfo.nickname = "SimonFungC";;
// // app.post({
// // url: app.api.uploadProfile,
// // data: wxUserInfo
// // }).then((result) => {})
// // } else {
// // KdIns.getUserInfo().then((res) => {
// // let wxUserInfo = res;
// // wxUserInfo.avatar = wxUserInfo.headimgurl;
// // app.post({
// // url: app.api.uploadProfile,
// // data: wxUserInfo
// // }).then((result) => {})
// // })
// // }
// window.vue = new Vue({
// router,
// store,
// data: {
// isInit: false,
// // wxUserInfo: wxUserInfo,
// codeSn: codeSn,
// },
// render: h => h(VueApp)
// }).$mount('#app');
// // console.log('window.vue:',window.vue);
// }).catch((err) => {
// });
// }
// initVue();
let app = new Vue({
router,
......@@ -56,12 +98,11 @@ let app = new Vue({
render: h => h(VueApp)
}).$mount('#app')
// 挂载全局app
app.api = api;
app.get = httpGet;
app.post = httpPost;
app.uploadFile = formdata;
app.router = router;
window.app = app;
\ No newline at end of file
// 原app节点请通过 document.getElementById('app') 获取
// routes里的component组件需要以import方式引入,否则页面创建的时候,app还没挂载。
\ No newline at end of file
......
import areaList from '@common/area.js'
import {
Toast
} from 'vant';
export default {
data() {
return {
key: 'value',
fileList: [],
areaVisible: false,
areaList: [],
// 姓名、手机号、省市区、详细地址
editable: false,
formData: { // 奖品信息。抽奖后显示
"winCode": "",
"name": "",
"mobile": "",
"province": "",
"city": "",
"district": "",
"address": "",
"extData": "",
"prize": { // 奖品信息
"prizeName": "",
"prizePic": "",
"prizeThumb": "",
"prizeType": "", // 如果不中奖,奖品标识为lose
"outParams": "",
"extParams": "",
"outParamsVo": { // outParams参数格式化}
}
}
},
page: 1,
size: 10,
loading: false,
finished: false,
list: [],
}
},
components: {},
computed: {
areaStr() {
let result = "";
let {
province,
city,
district
} = this.formData;
if (province && city && district) {
result = `${province}-${city}-${district}`
}
return result;
}
},
methods: {
resetPage() {
this.loading = false;
this.page = 1;
this.total = 0;
this.list = [];
this.finished = false;
},
onLoad() {
if (this.finished) {
this.loading = false;
} else {
this.page++;
this.queryList();
}
},
queryList() {
app.get({
url: app.api.list,
data: {
page: this.page,
size: this.size
}
}).then((result) => {
this.list = this.list.concat(result.list);
this.finished = this.list.length >= result.total;
this.loading = false;
}).catch((err) => {
this.loading = false;
this.finished = true;
});
},
// 显示地区
onShowAreaSelect() {
if (!this.editable) return;
this.areaVisible = true;
},
// 确认省市区
onAreaConfirm(val) {
this.areaVisible = false;
if (val && val.length >= 3) {
this.formData.province = val[0].name || "";
this.formData.city = val[1].name || "";
this.formData.district = val[2].name || "";
this.formData.provinceCode = val[0].code || "";
this.formData.cityCode = val[1].code || "";
this.formData.districtCode = val[2].code || "";
}
},
beforeAvatarUpload(file) {
const size = 10 * 1024 * 1024;
if (file.size > size) {
Toast('上传图片大小不能超过10M');
return false;
}
return true;
},
afterRead(file) {
console.log("file:", file);
if (file.length == undefined) {
this.uploadFile(file);
} else {
for (let index = 0; index < file.length; index++) {
this.uploadFile(file[index]);
}
}
},
uploadFile(file) {
file.status = 'uploading';
file.message = '上传中...';
this.loading = true;
app.uploadFile({
url: app.api.upload,
// data: formData
data: {
file: file.file,
subPath: this.subPath
}
})
.then(res => {
file.status = 'done';
file.message = '';
file.url = res;
console.log("file:", file);
console.log("fileList:", this.fileList);
this.loading = false;
})
.catch(e => {
file.status = 'failed';
file.message = '上传失败';
this.loading = false;
this.refreshFileList();
Toast("上传失败,请上传体积小于10的文件")
});
},
refreshFileList() {
let fileList = this.fileList.filter(item => {
return item.url
});
this.fileList = fileList
},
initData() {
this.editable = true;
}
},
mounted() {
this.areaList = areaList;
this.initData();
},
created() {}
}
\ No newline at end of file
.top-space {
height: 60px;
}
.form {
margin: 0 auto 0;
padding: 0 30px;
@extend .bb;
&-item {
margin: 0 auto 60px;
&-tit {}
.cont {}
}
}
.btn-wrap {
margin: 60px auto 0;
padding: 0 30px;
@extend .bb;
.btn {
@include bc();
}
}
\ No newline at end of file
<template>
<div class="page">
<div class="app__bgc bgc"></div>
<div class="app__bg bg"></div>
<div class="app__content main">
<div class="top-space"></div>
<div class="content">
<div class="form">
<div class="form-item">
<div class="form-tit">列表</div>
<div class="cont">
<div class="list">
<van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad"
:immediate-check="false">
<div v-for="(item,index) in list" :key="item.id">
{{ index }}
</div>
</van-list>
</div>
</div>
</div>
<div class="form-item">
<div class="form-tit">地区</div>
<div class="cont">
<div @click="onShowAreaSelect" class="val">
<input readonly="true" v-model="areaStr" class="ipt" type="text">
</div>
</div>
</div>
<div class="form-item">
<div class="form-tit">图片上传</div>
<div class="cont">
<van-uploader v-model="fileList" :after-read="afterRead" accept="image/png, image/jpeg, video/mp4"
preview-size='26vw' :max-count="9">
</van-uploader>
</div>
</div>
</div>
<div class="btn-wrap">
<div class="btn">提 交</div>
</div>
</div>
</div>
<van-popup v-model="areaVisible" position="bottom" get-container="body">
<van-area title="省市区选择" :area-list="areaList" @confirm="onAreaConfirm" @cancel="areaVisible=false" />
</van-popup>
</div>
</template>
<script src="./exp.js"></script>
<style lang="scss" scoped>
@import "./exp.scss";
</style>
\ No newline at end of file
.content {
color: $colorBlue;
@extend .underline;
}
......
......@@ -20,6 +20,14 @@ const routes = [{
}
},
{
path: '/exp',
name: 'exp',
component: () => import('./pages/exp/exp.vue'),
meta: {
title: ''
}
},
{
path: '/demo',
name: 'demo',
component: () => import('./pages/demo/demo.vue'),
......
......@@ -17,6 +17,7 @@
-ms-text-overflow: ellipsis;
}
@mixin ellipsis1() {
display: -webkit-box;
word-break: break-all;
......@@ -51,6 +52,7 @@
// 清除浮动
@mixin clearfix() {
&:before,
&:after {
content: " "; // 1
......@@ -101,81 +103,40 @@
border: 0;
}
// 橙色底实心 自定义圆角按钮
@mixin btc($hei: 22px, $borderRadius: 4px, $padding: 12px, $fontSize: 14px) {
@extend .fcc;
padding: 0 $padding;
height: $hei;
line-height: normal;
text-align: center;
border-radius: $borderRadius;
background-color: $cOrange;
font-size: $fontSize;
color: #ffffff;
letter-spacing: 1.4px;
cursor: pointer;
user-select: none;
}
// 白底空心 自定义圆角按钮
@mixin btc-o($hei: 22px, $borderRadius: 4px, $padding: 12px, $fontSize: 14px) {
@extend .fcc;
@extend .bb;
padding: 0 $padding;
height: $hei;
line-height: normal;
text-align: center;
border-radius: $borderRadius;
font-size: $fontSize;
color: $cOrange;
letter-spacing: 1.4px;
background-color: #ffffff;
cursor: pointer;
border: solid 1px $cOrange;
user-select: none;
}
// 定宽 橙色底实心圆角按钮
@mixin btc2($wid: 118px, $hei: 22px, $fontSize: 14px) {
width: $wid;
height: $hei;
line-height: $hei + 2px;
// 居中按钮样式
@mixin btc($width, $height) {
width: $width;
height: $height;
line-height: $height;
text-align: center;
border-radius: $hei * 0.5;
background-color: $cOrange;
font-size: $fontSize;
color: #ffffff;
letter-spacing: 1.4px;
cursor: pointer;
user-select: none;
}
// 橙框橙字
@mixin btc3($hei: 22px, $fontSize: 14px) {
height: $hei;
line-height: $hei;
padding: 0 12px;
// 通用按钮
@mixin bc($width:100%, $height:88px, $fontSize:30px) {
color: #FFFFFF;
position: relative;
width: $width;
height: $height;
line-height: $height;
text-align: center;
border-radius: 2px;
font-size: $fontSize;
letter-spacing: 1.4px;
cursor: pointer;
user-select: none;
color: $cOrange;
border: solid 1px $cOrange;
}
// 定宽 黑色底实心圆角按钮
@mixin btc4($wid: 118px, $hei: 22px, $fontSize: 14px) {
width: $wid;
height: $hei;
line-height: $hei + 2px;
border-radius: 8px;
background-color: $colorMain;
}
// 通用按钮
@mixin bc-o($width:100%, $height:88px, $fontSize:30px) {
position: relative;
width: $width;
height: $height;
line-height: $height;
text-align: center;
border-radius: $hei * 0.5;
background-color: $cLightDard;
font-size: $fontSize;
color: #ffffff;
letter-spacing: 1.4px;
cursor: pointer;
user-select: none;
border-radius: 8px;
color: $colorMain;
border: solid 1PX $colorMain;
background-color: transparent;
}
\ No newline at end of file
......
......@@ -64,3 +64,17 @@
.pointer {
cursor: pointer;
}
.untouch {
pointer-events: none;
}
.ell {
@include ellipsis(1);
}
.ell2 {
@include ellipsis(2);
}
\ No newline at end of file
......
/**
* ------------------------------------------------------------------
* Sass 变量
*
* ------------------------------------------------------------------
*
*/
// Margin
$marginTopSmaller: 20px;
$marginTopSmall: 30px;
$marginTopMedium: 40px;
$marginTopLarge: 60px;
$marginTopLarger: 80px;
// Padding
$paddingTopSmaller: 20px;
$paddingTopSmall: 30px;
$paddingTopMedium: 40px;
$paddingTopLarge: 60px;
$paddingTopLarger: 80px;
// Color
$colorBlue: #20A0FF;
$colorGreen: #13CE66;
$colorGray: #475669;
$colorBlack: #000;
$colorRed: #FF4949;
$colorYellow: #F7BA2A;
$color: #787878;
$colorLink: #1D8CE0;
$backGroundColor: #fff;
// Font
$fontSize: 32px;
// Font 文字
// 大标题 Medium 26pt 34H 500
$fontSizeTitleLarger: 52px;
// 标准标题 Medium 20pt 28H 500
$fontSizeTitleLarge: 40px;
// 标准标题 Medium 18pt 24H 500
$fontSizeTitle: 36rpx;
// 正文5 大部分正文文字+导航栏的文字 Regular 17pt 23H 400
$fontSizeNavLarge: 34px;
// 正文5 大部分正文文字+导航栏的文字 Regular 16pt 22H 400
$fontSizeNav: 32px;
// 正文4 信息较多且需要多呈现时的正文使用 Regular 15pt 21H 400
$fontSize: 30px;
// 正文3 信息较多且需要多呈现时的正文使用 Regular 14pt 21H 400
$fontSizeSmall: 28px;
$fontSizeSmaller: 24px;
$fontSizeLarge: 36px;
$fontSizeLarger: 44px;
// 正文2 对主题进行释意的文字+协议条款文字等 Regular 13pt 19H 400
$fontSizeRemark: 26px;
// 正文1 对主题进行释意的文字+协议条款文字等 Regular 12pt 16H 400
$fontSizeRemarkSmall: 24px;
// 标签栏辅助文字 Medium 10pt 14H 500
$fontSizeTag: 20px;
// 表单中数据文字 Regular 8pt 10H 400
$fontSizeData: 16px;
// Color 颜色 以下来自 有赞建议
$color: #323233; // 文字色,指主文字1
$colorText: #646566; // 文字色,指主文字2
$colorLight: #969799; // 文字色,指辅助、说明文字
$colorTips: #969799; // 文字色,指 disable、提示文字等
$colorBorder: #DCDEE0; // 边框、线色
$colorBorderLight: #EBEDF0; // 边框、线色
$colorBg: #F2F3F5; // 深色背景
$colorBgLight: #F7F8FA; // 浅色背景
$colorBlack: #000000; // 黑色
$colorWhite: #ffffff; // 白色
// 功能色
$colorLink:#576B95; // 文字链颜色
$colorSuccess: #07C160; // 成功色
$colorDanger: #EE0A24; // 报错色
$colorWarning: #ED6A0C; // 通知消息中的文本颜色
$colorWarning: #FFFBE8; // 通知消息中的背景颜色
$colorInfo: #FAAB0C; // 文字辅助颜色
// 业务色 以下颜色为自定义
$colorMain:#409EFF; // 主题颜色 根据业务定义 // #EE0A24有赞默认
$colorPrice: #ee0a24; // 价格颜色
// $fontGray:#9F9E9E; // 提示文字颜色
// BorderRadius 角边
$borderRaidus: 16px; // 默认卡片编辑 角边
$borderRaidusPopup: 40px; // 模态面板编辑 角边
$borderRaidusDialog: 32px; // 对话框 角边
// Space 间距 有赞建议为8的倍数(8点网格系统)
$marginLarge:32px; // 外边距 多用于主内容离屏幕边缘
$margin:24px; // 外边距 多用于主内容离屏幕边缘
$marginSmall: 16px; // 小外边距 多用于内容间上下距离
$marginSmaller: 8px; // 小外边距 多用列表item间上下左右距离
$paddinglarge:32px; // 内边距
$padding: 24px;
$paddingSmall: 16px;
$paddingSmaller: 8px;
// 页面样式
$pageBottom: 160px; // 页面底部
$contentWid: 690px; //内容宽度 (由间距为8的倍数所得)
$contentWidth: 710px; //内容宽度 (由间距为8的倍数所得)
$screenWidth: 750px; // 屏幕宽度
......
import Vue from 'vue'
import {
Swipe,
SwipeItem,
Lazyload,
Tab,
Tabs,
Sticky,
Popup,
Tabbar,
TabbarItem,
Icon,
Uploader,
Area,
List,
Toast,
Button
} from 'vant';
Vue.use(Swipe).use(SwipeItem)
.use(Lazyload)
.use(Tab).use(Tabs)
.use(Sticky)
.use(Popup)
.use(Tabbar).use(TabbarItem)
.use(Icon)
.use(Uploader)
.use(Area)
.use(List)
.use(Button)
.use(Toast);