2020-08-13 08:12:57 +00:00
|
|
|
|
import request from "@/utils/request.js";
|
|
|
|
|
import wechat from "@/libs/wechat.js";
|
2021-03-19 10:26:43 +00:00
|
|
|
|
import {
|
|
|
|
|
toLogin,
|
|
|
|
|
checkLogin
|
|
|
|
|
} from '../libs/login';
|
2020-08-13 08:12:57 +00:00
|
|
|
|
/**
|
|
|
|
|
* 获取微信公众号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
|
|
|
|
/**
|
|
|
|
|
* 获取微信sdk配置
|
|
|
|
|
* @returns {*}
|
|
|
|
|
*/
|
2021-06-11 09:41:16 +00:00
|
|
|
|
export function wechatAuth(code, spread) {
|
|
|
|
|
var reg=/^[0-9]+.?[0-9]*$/; //判断字符串是否为数字 ,判断正整数用/^[1-9]+[0-9]*]*$/
|
|
|
|
|
spread = reg.test(spread) ? spread : 0;
|
2020-08-13 08:12:57 +00:00
|
|
|
|
return request.get(
|
2021-06-11 09:41:16 +00:00
|
|
|
|
"wechat/authorize/login?code=" + code + "&spread_spid=" + spread, {},
|
2020-08-13 08:12:57 +00:00
|
|
|
|
{ noAuth: true }
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取登录授权login
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
export function getLogo()
|
|
|
|
|
{
|
|
|
|
|
// wechat/get_logo
|
|
|
|
|
return request.get('wechat/getLogo', {}, { noAuth : true});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 小程序用户登录
|
2020-09-15 08:13:25 +00:00
|
|
|
|
* @param data object 小程序用户登录信息
|
2020-08-13 08:12:57 +00:00
|
|
|
|
*/
|
|
|
|
|
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 });
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-19 02:16:45 +00:00
|
|
|
|
/**
|
|
|
|
|
* 首页 获取客服地址
|
|
|
|
|
* @returns {*}
|
|
|
|
|
*/
|
|
|
|
|
export function kefuConfig() {
|
|
|
|
|
return request.get("config", {}, { noAuth: true });
|
2021-03-19 10:26:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 微信(公众号,小程序)绑定手机号
|
|
|
|
|
* @param {Object} data
|
|
|
|
|
*/
|
|
|
|
|
export function getUserPhone(data){
|
|
|
|
|
return request.post('wechat/register/binding/phone',data,{noAuth : true});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-06-11 09:41:16 +00:00
|
|
|
|
* APP微信登录
|
|
|
|
|
* @param {Object} data
|
|
|
|
|
*/
|
|
|
|
|
export function appAuth(data) {
|
|
|
|
|
return request.post("wechat/authorize/app/login", data, { noAuth : true });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 苹果登录
|
|
|
|
|
* @param {Object} data
|
|
|
|
|
*/
|
|
|
|
|
export function appleLogin(data) {
|
|
|
|
|
return request.post("ios/login", data, { noAuth : true });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 苹果绑定手机号
|
2021-03-19 10:26:43 +00:00
|
|
|
|
* @param {Object} data
|
|
|
|
|
*/
|
2021-06-11 09:41:16 +00:00
|
|
|
|
export function iosBinding(data) {
|
|
|
|
|
return request.post("ios/binding/phone", data, { noAuth : true });
|
2021-01-19 02:16:45 +00:00
|
|
|
|
}
|