mall-uniapp/api/public.js

81 lines
1.6 KiB
JavaScript
Raw Normal View History

2020-08-13 08:12:57 +00:00
import request from "@/utils/request.js";
import wechat from "@/libs/wechat.js";
/**
* 获取微信公众号js配置
* @returns {*}
*/
2020-08-17 07:28:28 +00:00
export function getWechatConfig() {
return request.get("wechat/config",{ url: encodeURIComponent(wechat.signLink()) },{ noAuth: true });
}
2020-08-13 08:12:57 +00:00
// export function getWechatConfig() {
// return request.get(
2020-08-17 07:28:28 +00:00
// "wechat/config",
// { url: encodeURIComponent(location.href.split('#')[0]) },
2020-08-13 08:12:57 +00:00
// { noAuth: true }
// );
// }
/**
* 获取微信sdk配置
* @returns {*}
*/
export function wechatAuth(code, spread, login_type) {
return request.get(
"wechat/authorize/login",
{ code, spread, login_type },
{ noAuth: true }
);
}
/**
* 获取登录授权login
*
*/
export function getLogo()
{
// wechat/get_logo
return request.get('wechat/getLogo', {}, { noAuth : true});
}
/**
* 小程序用户登录
* @param data object 小程序用户登陆信息
*/
export function login(code,data) {
return request.post("wechat/authorize/program/login?code="+code, data, { noAuth : true });
}
/**
* 分享
* @returns {*}
*/
export function getShare() {
return request.get("share", {}, { noAuth: true });
}
/**
* 获取关注海报
* @returns {*}
*/
export function follow() {
return request.get("wechat/follow", {}, { noAuth: true });
}
/**
* 获取图片base64
* @retins {*}
* */
export function imageBase64(image) {
2020-08-17 07:28:28 +00:00
return request.post("qrcode/base64",image,{ noAuth: true },1);
2020-08-13 08:12:57 +00:00
}
/**
* 自动复制口令功能
* @returns {*}
*/
export function copyWords() {
return request.get("copy_words", {}, { noAuth: true });
}