初始化仓库
This commit is contained in:
commit
dc9b1ce7e4
|
@ -0,0 +1,27 @@
|
|||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
.hbuilderx
|
||||
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
build.sh
|
||||
.idea
|
||||
unpackage
|
||||
*.bak
|
|
@ -0,0 +1,128 @@
|
|||
<script>
|
||||
// #ifdef APP-PLUS
|
||||
import { initEvent } from "@/utils/uniMPevent.js"
|
||||
import { plus } from "./uni_modules/uview-ui/libs/function/digit";
|
||||
// #endif
|
||||
export default {
|
||||
onLaunch: function() {
|
||||
console.log('App Launch')
|
||||
// #ifdef APP-PLUS
|
||||
initEvent();
|
||||
// #endif
|
||||
if(this.$store.state.app.token){
|
||||
plus.navigator.closeSplashscreen();
|
||||
}else {
|
||||
uni.reLaunch({
|
||||
url:'/pages/login/login',
|
||||
success() {
|
||||
plus.navigator.closeSplashscreen();
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
onShow: function() {
|
||||
console.log('App Show')
|
||||
},
|
||||
onHide: function() {
|
||||
console.log('App Hide')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
/* #ifndef APP-PLUS-NVUE || APP-NVUE */
|
||||
@import "@/plugin/animate/animate.min.css";
|
||||
@import 'static/css/base.css';
|
||||
@import 'static/iconfont/iconfont.css';
|
||||
@import 'static/iconfont/iconlihai.css';
|
||||
@import 'static/iconfont/icontan.css';
|
||||
@import 'static/iconfont/demo.css';
|
||||
@import 'static/css/style.scss';
|
||||
|
||||
|
||||
view {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.custom_style {
|
||||
color: #fff;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 24rpx;
|
||||
|
||||
&_icon {
|
||||
background-image: url('static/tabbar_icon/d.png');
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
font-size: 80rpx;
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-top: -50rpx;
|
||||
// box-shadow: 0px 5px 10px 1px rgba(32, 161, 98, 0.3);
|
||||
}
|
||||
|
||||
.custom_style-txt {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin-top: 5rpx;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.bg-color-red {
|
||||
background-color: #e93323 !important;
|
||||
}
|
||||
|
||||
.syspadding {
|
||||
padding-top: var(--status-bar-height);
|
||||
}
|
||||
|
||||
.flex {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.uni-scroll-view::-webkit-scrollbar {
|
||||
/* 隐藏滚动条,但依旧具备可以滚动的功能 */
|
||||
display: none
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 0;
|
||||
height: 0;
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
::-moz-scrollbar {
|
||||
width: 0;
|
||||
height: 0;
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.empty-txt {
|
||||
line-height: 100rpx;
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.product-con .conter img {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.open-location {
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
uni-tabbar {
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
/*#endif*/
|
||||
</style>
|
|
@ -0,0 +1,312 @@
|
|||
import request from "@/utils/request.js";
|
||||
|
||||
/**
|
||||
* 获取云仓分类
|
||||
*
|
||||
*/
|
||||
export function cloudWarehouse(data) {
|
||||
return request.get("store/product/cloudWarehouse", data, { noAuth: true });
|
||||
}
|
||||
/**
|
||||
* 获取云仓分类
|
||||
*
|
||||
*/
|
||||
export function getCityCloundShop(data) {
|
||||
return request.get("city/get_cloud_shop", data);
|
||||
}
|
||||
/**
|
||||
* 商品扫码枪查询商品是否存在
|
||||
*
|
||||
*/
|
||||
export function seachBarCodeAPI(data) {
|
||||
return request.get("micro/seach_bar_code", data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取里海云仓商品
|
||||
*
|
||||
*/
|
||||
export function getProductSpuAPI(id, param) {
|
||||
return request.get(`product/spu/cloud_merchant/${id}`, param, { noAuth: true });
|
||||
}
|
||||
//获取云仓库店铺id
|
||||
export function get_cloud_shop(street_code) {
|
||||
return request.get(`city/get_cloud_shop?street_code=${street_code}`, {}, { noAuth: true });
|
||||
}
|
||||
export function post_product_import(id) {
|
||||
return request.post(`micro/product_import`, { id: id }, { noAuth: true });
|
||||
}
|
||||
/**
|
||||
* 公共接口 ,优惠券接口 , 行业此讯 , 手机号码注册
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 获取主页数据 无需授权
|
||||
*
|
||||
*/
|
||||
export function getIndexData() {
|
||||
return request.get("common/home", {}, { noAuth: true });
|
||||
}
|
||||
/**
|
||||
* 获取app版本
|
||||
*/
|
||||
export function getAppVersion() {
|
||||
return request.get('appVersion', {}, { noAuth: true });
|
||||
}
|
||||
/**
|
||||
* 获取登录授权login
|
||||
*
|
||||
*/
|
||||
export function getLogo() {
|
||||
return request.get('wechat/get_logo', {}, { noAuth: true });
|
||||
}
|
||||
/**
|
||||
* 保存form_id
|
||||
* @param string formId
|
||||
*/
|
||||
export function setFormId(formId) {
|
||||
return request.post("wechat/set_form_id", { formId: formId });
|
||||
}
|
||||
/**
|
||||
* 领取优惠卷
|
||||
* @param int couponId
|
||||
*
|
||||
*/
|
||||
export function setCouponReceive(couponId) {
|
||||
return request.post('coupon/receive/' + couponId);
|
||||
}
|
||||
/**
|
||||
* 商铺优惠券列表
|
||||
* @param object data
|
||||
*/
|
||||
export function getShopCoupons(id) {
|
||||
return request.get('coupon/store/' + id, {}, { noAuth: true })
|
||||
}
|
||||
/**
|
||||
* 商品优惠券列表
|
||||
* @param object data
|
||||
*/
|
||||
export function getCoupons(data) {
|
||||
return request.get('coupon/product', data, { noAuth: true })
|
||||
}
|
||||
/**
|
||||
* 我的优惠券
|
||||
* @param int types 0全部 1未使用 2已使用
|
||||
*/
|
||||
export function getUserCoupons(data) {
|
||||
return request.get('coupon/list', data)
|
||||
}
|
||||
/**
|
||||
* 文章分类列表
|
||||
*
|
||||
*/
|
||||
export function getArticleCategoryList() {
|
||||
return request.get('article/category/lst', {}, { noAuth: true })
|
||||
}
|
||||
|
||||
export function getArticleCategoryLists() {
|
||||
return request.get('article/category/lst?is_home='+1, {}, { noAuth: true })
|
||||
}
|
||||
/**
|
||||
* 文章列表
|
||||
* @param int cid
|
||||
*
|
||||
*/
|
||||
export function getArticleList(cid, data) {
|
||||
return request.get('article/lst/' + cid, data, { noAuth: true })
|
||||
}
|
||||
/**
|
||||
* 文章 热门列表
|
||||
*
|
||||
*/
|
||||
export function getArticleHotList() {
|
||||
return request.get('article/hot/list', {}, { noAuth: true });
|
||||
}
|
||||
/**
|
||||
* 文章 轮播列表
|
||||
*
|
||||
*/
|
||||
export function getArticleBannerList() {
|
||||
return request.get('article/banner/list', {}, { noAuth: true })
|
||||
}
|
||||
/**
|
||||
* 文章详情
|
||||
* @param int id
|
||||
*
|
||||
*/
|
||||
export function getArticleDetails(id) {
|
||||
return request.get('article/detail/' + id, {}, { noAuth: true });
|
||||
}
|
||||
/**
|
||||
* 手机号+验证码登录接口
|
||||
* @param object data
|
||||
*/
|
||||
export function loginMobile(data) {
|
||||
return request.post('login/mobile', data, { noAuth: true })
|
||||
}
|
||||
/**
|
||||
* 获取短信KEY
|
||||
* @param object phone
|
||||
*/
|
||||
export function verifyCode() {
|
||||
return request.get('verify_code', {}, { noAuth: true })
|
||||
}
|
||||
/**
|
||||
* 验证码发送
|
||||
* @param object phone
|
||||
*/
|
||||
export function registerVerify(phone, reset, key, code) {
|
||||
return request.post('register/verify', {
|
||||
phone: phone,
|
||||
type: reset === undefined ? 'reset' : reset,
|
||||
key: key,
|
||||
code: code
|
||||
}, { noAuth: true })
|
||||
}
|
||||
/**
|
||||
* 手机号注册
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function phoneRegister(data) {
|
||||
return request.post('register', data, { noAuth: true });
|
||||
}
|
||||
/**
|
||||
* 手机号修改密码
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function phoneRegisterReset(data) {
|
||||
return request.post('register/reset', data, { noAuth: true })
|
||||
}
|
||||
/**
|
||||
* 手机号+密码登录
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function phoneLogin(data) {
|
||||
return request.post('login', data, { noAuth: true })
|
||||
}
|
||||
/* h5切换公众号登陆 */
|
||||
export function switchH5Login(data) {
|
||||
return request.post("user/switch", data);
|
||||
}
|
||||
/** 绑定手机号 */
|
||||
export function bindingPhone(data) {
|
||||
return request.post('user/binding', data);
|
||||
}
|
||||
/** 修改手机号 */
|
||||
export function modifyPhone(data) {
|
||||
return request.post('user/change/phone', data);
|
||||
}
|
||||
/** 修改密码 */
|
||||
export function modifyPassword(data) {
|
||||
return request.post('user/change/password', data);
|
||||
}
|
||||
/** 退出登錄 */
|
||||
export function logout() {
|
||||
return request.get('logout');
|
||||
}
|
||||
/** 获取订阅消息id */
|
||||
export function getTemlIds() {
|
||||
return request.get('wechat/teml_ids', {}, { noAuth: true });
|
||||
}
|
||||
/** 首页拼团数据 */
|
||||
export function pink() {
|
||||
return request.get('pink', {}, { noAuth: true });
|
||||
}
|
||||
/** 获取城市信息 */
|
||||
export function getCity() {
|
||||
return request.get('system/city/lst', {}, { noAuth: true });
|
||||
}
|
||||
export function getCityV2(pid) {
|
||||
return request.get('v2/system/city/lst/' + pid, {}, { noAuth: true });
|
||||
}
|
||||
export function getCityList(address) {
|
||||
return request.get('v2/system/city', { address }, { noAuth: true });
|
||||
}
|
||||
/** 获取小程序直播列表 */
|
||||
export function getLiveList(page, limit) {
|
||||
return request.get('wechat/live', { page, limit }, { noAuth: true });
|
||||
}
|
||||
/* APP登录 */
|
||||
export function wechatAppAuth(data) {
|
||||
return request.post("auth/app", data, { noAuth: true });
|
||||
}
|
||||
/* APPLE登录 */
|
||||
export function appleAppAuth(data) {
|
||||
return request.post("auth/apple", data, { noAuth: true });
|
||||
}
|
||||
/* 小程序获取手机号解密 */
|
||||
export function appletsDecrypt(data) {
|
||||
return request.post("user/mp/binding", data);
|
||||
}
|
||||
/**
|
||||
* 获取首页DIY;
|
||||
*/
|
||||
export function getDiy(data) {
|
||||
return request.get('diy', data, { noAuth: true });
|
||||
}
|
||||
/**
|
||||
* 获取首页微页面;
|
||||
*/
|
||||
export function getPageDiy(data) {
|
||||
return request.get(`micro`, data, {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 滑块信息
|
||||
* @param {Object} data
|
||||
*/
|
||||
export function getAjcaptcha(data) {
|
||||
return request.get("ajcaptcha", data, {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 滑块验证
|
||||
* @param {Object} data
|
||||
*/
|
||||
export function ajcaptchaCheck(data) {
|
||||
return request.post("ajcheck", data, {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取所在的地区数据
|
||||
* @param {Object} data
|
||||
*/
|
||||
export function village(data) {
|
||||
return request.get('v2/system/geo/lst', data, { noAuth: true });
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所在的村队数据
|
||||
* @param {Object} data
|
||||
*/
|
||||
export function brigade(data) {
|
||||
return request.get('v2/system/brigade', data, { noAuth: true });
|
||||
}
|
||||
|
||||
/*
|
||||
生产 -- 获取商户保证金信息支付接口
|
||||
*/
|
||||
export function paymerchant() {
|
||||
return request.post(`user/margin`,{});
|
||||
}
|
||||
|
||||
/*
|
||||
生产 -- 获取商户保证金信息接口
|
||||
*/
|
||||
export function merchant(data) {
|
||||
return request.get(`store/merchant/margin`, data);
|
||||
}
|
||||
|
||||
//获取保证金缴纳列表
|
||||
export function marginlist(data) {
|
||||
return request.get(`user/margin/list`,data);
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
import oahttp from "@/utils/oahttp.js";
|
||||
|
||||
/**
|
||||
* 充值
|
||||
*/
|
||||
export const recharge = (data) => oahttp.post('/recharge/recharge', data)
|
||||
/**
|
||||
* 押金充值记录
|
||||
*/
|
||||
export const deposit_recharge = (data) => oahttp.get('/recharge/deposit_lists', data)
|
||||
/**
|
||||
* 支付方式
|
||||
*/
|
||||
export const payWay = (data) => oahttp.get('/pay/payWay', data)
|
||||
|
||||
/**
|
||||
* 预支付
|
||||
*/
|
||||
export const payPrepay = (data) => oahttp.post('/pay/prepay', data)
|
||||
|
||||
/**
|
||||
* 支付配置
|
||||
*/
|
||||
export const wechatJsConfig = (data) => oahttp.get('/wechat/jsConfig', data)
|
||||
|
||||
/**
|
||||
* 支付状态
|
||||
*/
|
||||
export const payStatus = (data) => oahttp.get('/pay/payStatus', data)
|
||||
|
||||
/**
|
||||
* 充值记录
|
||||
*/
|
||||
export const rechargeLists = (data) => oahttp.get('/recharge/lists', data)
|
||||
|
||||
/**
|
||||
* 余额明细
|
||||
*/
|
||||
export const accountLogLists = (data) => oahttp.get('/account_log/lists', data)
|
||||
|
||||
/**
|
||||
* 月份统计
|
||||
*/
|
||||
export const accountLogListsMonth = (data) => oahttp.get('/account_log/year_count', data)
|
||||
|
||||
/**
|
||||
* 余额提现
|
||||
*/
|
||||
export const userWithdraw = (data) => oahttp.get('/user/withdraw', data)
|
||||
|
||||
/**
|
||||
* 提现记录
|
||||
*/
|
||||
export const userWithdrawList = (data) => oahttp.get('/user/withdrawList', data)
|
||||
|
||||
/**
|
||||
* 可提现金额
|
||||
*/
|
||||
export const getCurrCycleWithdraw = (data) => oahttp.get('/user/getCurrCycleWithdraw', data)
|
|
@ -0,0 +1,144 @@
|
|||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
import request from "@/utils/request.js";
|
||||
import wechat from "@/libs/wechat.js";
|
||||
|
||||
/**
|
||||
* 获取微信sdk配置
|
||||
* @returns {*}
|
||||
*/
|
||||
export function getWechatConfig() {
|
||||
return request.get(
|
||||
"wechat/config", {
|
||||
url: wechat.signLink()
|
||||
}, {
|
||||
noAuth: true
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取微信sdk配置
|
||||
* @returns {*}
|
||||
*/
|
||||
export function wechatAuth(code, spread, login_type) {
|
||||
return request.get(
|
||||
"auth/wechat", {
|
||||
code,
|
||||
spread,
|
||||
login_type
|
||||
}, {
|
||||
noAuth: true
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function commonAuth(data) {
|
||||
return request.post(
|
||||
"auth", data, {
|
||||
noAuth: true
|
||||
}
|
||||
);
|
||||
}
|
||||
/**
|
||||
* 获取登录授权login
|
||||
*
|
||||
*/
|
||||
export function getLogo() {
|
||||
return request.get('wechat/get_logo', {}, {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 小程序用户登录
|
||||
* @param data object 小程序用户登陆信息
|
||||
*/
|
||||
export function login(data) {
|
||||
return request.post("auth/mp", data, {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 绑定小程序账号
|
||||
* @param data object 小程序用户登陆信息
|
||||
*/
|
||||
export function bindMp(data) {
|
||||
return request.post("auth/bindMp", data, {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 绑定极光id
|
||||
* @param data object 小程序用户登陆信息
|
||||
*/
|
||||
export function bindJG(data) {
|
||||
return request.post("auth/bindJg", 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, code) {
|
||||
return request.post(
|
||||
"common/base64", {
|
||||
image: image,
|
||||
code: code
|
||||
}, {
|
||||
noAuth: true
|
||||
}
|
||||
);
|
||||
}
|
||||
// 配置
|
||||
export function getconfig(data) {
|
||||
return request.get("config",data,{noAuth: true});
|
||||
}
|
||||
// 浏览记录
|
||||
export function history(data) {
|
||||
return request.post("common/visit",data);
|
||||
}
|
||||
export function getSubscribe(){
|
||||
return request.get("subscribe", {}, {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
||||
export function getVersion() {
|
||||
return request.get("version",{},{noAuth: true});
|
||||
}
|
||||
/**
|
||||
* 获取组件底部菜单
|
||||
* @param data object 获取组件底部菜单
|
||||
*/
|
||||
export function getNavigation(data) {
|
||||
return request.get("navigation", data, {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
import request from "@/utils/request.js";
|
||||
|
||||
/**
|
||||
* 获取供销平台版本信息
|
||||
*/
|
||||
export function getGXconfig(data) {
|
||||
return request.get("global/config", data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取商城小程序信息
|
||||
*/
|
||||
|
||||
export function miniapp(data) {
|
||||
return request.get("miniapp/version?version=1", data);
|
||||
}
|
||||
|
|
@ -0,0 +1,732 @@
|
|||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
import request from "@/utils/request.js";
|
||||
|
||||
import request1 from "@/utils/requestb.js";
|
||||
import Cache from '@/utils/cache'
|
||||
/**
|
||||
* 获取版本信息
|
||||
*/
|
||||
export function Appversion(data) {
|
||||
return request.get(`app/version`, data, {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 提交提现
|
||||
*/
|
||||
export function postCreateApplyAPI(merId, data) {
|
||||
return request.post(`admin/${merId}/create_apply`, data);
|
||||
}
|
||||
/**
|
||||
* 申请提现
|
||||
*/
|
||||
export function getAdminApplyAPI(merId, data) {
|
||||
return request.get(`admin/${merId}/apply`, data);
|
||||
}
|
||||
/**
|
||||
* 提现记录
|
||||
*/
|
||||
export function getAdminApplyListAPI(merId) {
|
||||
return request.get(`admin/${merId}/lis_apply`);
|
||||
}
|
||||
/**
|
||||
* 获取用户信息
|
||||
*
|
||||
*/
|
||||
export function getUserInfo() {
|
||||
return request.get('user');
|
||||
}
|
||||
/**
|
||||
* 头像
|
||||
*
|
||||
*/
|
||||
export function editAvatar(data) {
|
||||
return request.post('user/change/info', data);
|
||||
}
|
||||
|
||||
// 修改昵称
|
||||
export function updateInfo(data) {
|
||||
return request.post('user/change/avatar', data);
|
||||
}
|
||||
/**
|
||||
* h5用户登录
|
||||
* @param data object 用户账号密码
|
||||
*/
|
||||
export function loginH5(data) {
|
||||
return request.post("auth/login", data, {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
||||
/**
|
||||
* h5用户手机号登录
|
||||
* @param data object 用户手机号 也只能
|
||||
*/
|
||||
export function loginMobile(data) {
|
||||
return request.post("auth/smslogin", data, {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
||||
/**
|
||||
* h5用户手机号登录
|
||||
* @param data object 用户手机号 也只能
|
||||
*/
|
||||
export function loginMpPhone(data) {
|
||||
return request.post("auth/mp_phone", data, {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 验证码key
|
||||
*/
|
||||
export function getCodeApi() {
|
||||
return request.get("verify_code", {}, {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* h5用户发送验证码
|
||||
* @param data object 用户手机号
|
||||
*/
|
||||
export function registerVerify(data) {
|
||||
return request.post("auth/verify", data, {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
||||
/**
|
||||
* h5用户手机号注册
|
||||
* @param data object 用户手机号 验证码 密码
|
||||
*/
|
||||
export function register(data) {
|
||||
return request.post("auth/register", data, {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户手机号修改密码
|
||||
* @param data object 用户手机号 验证码 密码
|
||||
*/
|
||||
export function registerReset(data) {
|
||||
return request.post("/register/reset", data, {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 用户手机号忘记密码
|
||||
*/
|
||||
export function registerForget(data) {
|
||||
return request.post("user/change_pwd", data, {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 获取用户中心菜单
|
||||
*
|
||||
*/
|
||||
export function getMenuList() {
|
||||
return request.get("common/menus", {}, { noAuth: true });
|
||||
}
|
||||
/*
|
||||
* 签到用户信息
|
||||
* */
|
||||
export function getSignUser() {
|
||||
return request.get("user/sign/info");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取签到配置
|
||||
*
|
||||
*/
|
||||
export function getSignConfig() {
|
||||
return request.get('sign/config')
|
||||
}
|
||||
/**
|
||||
* 获取签到列表
|
||||
* @param object data
|
||||
*/
|
||||
export function getSignList(data) {
|
||||
return request.get('user/sign/lst', data);
|
||||
}
|
||||
/**
|
||||
* 用户签到
|
||||
*/
|
||||
export function setSignIntegral() {
|
||||
return request.post('user/sign/create')
|
||||
}
|
||||
|
||||
/**
|
||||
* 签到列表(年月)
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function getSignMonthList(data) {
|
||||
return request.get('user/sign/month', data)
|
||||
}
|
||||
/**
|
||||
* 活动状态
|
||||
*
|
||||
*/
|
||||
export function userActivity() {
|
||||
return request.get('user/activity');
|
||||
}
|
||||
/*
|
||||
* 资金明细(types|0=全部,1=消费,2=充值,3=返佣)
|
||||
* */
|
||||
export function getCommissionInfo(q, types) {
|
||||
return request.get("user/bill", q);
|
||||
}
|
||||
/*
|
||||
* 提现列表
|
||||
* */
|
||||
export function extractLst(data) {
|
||||
return request.get("user/extract/lst", data);
|
||||
}
|
||||
/*
|
||||
* 积分记录
|
||||
* */
|
||||
export function getIntegralList(data) {
|
||||
return request.get("user/integral/lst", data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分销海报图片
|
||||
*
|
||||
*/
|
||||
export function spreadBanner() {
|
||||
//#ifdef H5
|
||||
return request.get('user/spread_image', {
|
||||
type: 'wechat'
|
||||
});
|
||||
//#endif
|
||||
//#ifdef MP
|
||||
return request.get('user/spread_image', {
|
||||
type: 'routine'
|
||||
});
|
||||
//#endif
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 获取推广用户一级和二级
|
||||
* @param object data
|
||||
*/
|
||||
export function spreadPeople(data) {
|
||||
return request.get('user/spread_list', data);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 推广佣金/提现总和
|
||||
* @param int type
|
||||
*/
|
||||
export function spreadCount(type) {
|
||||
return request.get('spread/count/' + type);
|
||||
}
|
||||
/*
|
||||
* 推广数据
|
||||
* */
|
||||
export function getSpreadInfo() {
|
||||
return request.get("/commission");
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 推广订单
|
||||
* @param object data
|
||||
*/
|
||||
export function spreadOrder(data) {
|
||||
return request.get('user/spread_order', data);
|
||||
}
|
||||
/*
|
||||
* 获取推广人排行
|
||||
* */
|
||||
export function getRankList(data) {
|
||||
return request.get("user/spread_top", data);
|
||||
}
|
||||
/*
|
||||
* 获取佣金排名
|
||||
* */
|
||||
export function getBrokerageRank(q) {
|
||||
return request.get("user/brokerage_top", q);
|
||||
}
|
||||
/**
|
||||
* 提现申请
|
||||
* @param object data
|
||||
*/
|
||||
export function extractCash(data) {
|
||||
return request.post('user/extract/create', data)
|
||||
}
|
||||
/**
|
||||
* 提现银行/提现最低金额
|
||||
*
|
||||
*/
|
||||
export function extractBank() {
|
||||
return request.get('user/extract/banklst');
|
||||
}
|
||||
/**
|
||||
* 会员等级列表
|
||||
*
|
||||
*/
|
||||
export function userLevelGrade() {
|
||||
return request.get('user/level/grade');
|
||||
}
|
||||
/**
|
||||
* 获取某个等级任务
|
||||
* @param int id 任务id
|
||||
*/
|
||||
export function userLevelTask(id) {
|
||||
return request.get('user/level/task/' + id);
|
||||
}
|
||||
/**
|
||||
* 检查用户是否可以成为会员
|
||||
*
|
||||
*/
|
||||
export function userLevelDetection() {
|
||||
return request.get('user/level/detection');
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 地址列表
|
||||
* @param object data
|
||||
*/
|
||||
export function getAddressList(data) {
|
||||
return request.get('user/address/lst', data);
|
||||
}
|
||||
/**
|
||||
* 设置默认地址
|
||||
* @param int id
|
||||
*/
|
||||
export function setAddressDefault(id) {
|
||||
return request.post('user/address/update/' + id)
|
||||
}
|
||||
/**
|
||||
* 修改 添加地址
|
||||
* @param object data
|
||||
*/
|
||||
export function editAddress(data) {
|
||||
return request.post('user/address/create', data);
|
||||
}
|
||||
/**
|
||||
* 删除地址
|
||||
* @param int id
|
||||
*
|
||||
*/
|
||||
export function delAddress(id) {
|
||||
return request.post('user/address/delete/' + id)
|
||||
}
|
||||
/**
|
||||
* 获取单个地址
|
||||
* @param int id
|
||||
*/
|
||||
export function getAddressDetail(id) {
|
||||
return request.get('user/address/detail/' + id);
|
||||
}
|
||||
/**
|
||||
* 修改用户信息
|
||||
* @param object
|
||||
*/
|
||||
export function userEdit(data) {
|
||||
return request.post('user/edit', data);
|
||||
}
|
||||
/*
|
||||
* 退出登录
|
||||
* */
|
||||
export function getLogout() {
|
||||
return request.post("logout");
|
||||
}
|
||||
/**
|
||||
* 佣金转入
|
||||
*
|
||||
*/
|
||||
export function rechargeBrokerage(data) {
|
||||
return request.post('user/recharge/brokerage', data)
|
||||
}
|
||||
/**
|
||||
* 小程序充值
|
||||
*
|
||||
*/
|
||||
export function rechargeRoutine(data) {
|
||||
return request.post('recharge/routine', data)
|
||||
}
|
||||
/*
|
||||
* 公众号充值
|
||||
* */
|
||||
export function rechargeWechat(data) {
|
||||
return request.post("user/recharge", data);
|
||||
}
|
||||
/**
|
||||
* 获取默认地址
|
||||
*
|
||||
*/
|
||||
export function getAddressDefault() {
|
||||
return request.get('address/default');
|
||||
}
|
||||
/**
|
||||
* 充值金额选择
|
||||
*/
|
||||
export function getRechargeApi() {
|
||||
return request.get("common/recharge_quota");
|
||||
}
|
||||
/**
|
||||
* 登陆记录
|
||||
*/
|
||||
export function setVisit(data) {
|
||||
return request.post('user/set_visit', {
|
||||
...data
|
||||
}, {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 客服列表
|
||||
*/
|
||||
export function serviceList(data) {
|
||||
return request.get("service/list", data);
|
||||
}
|
||||
/**
|
||||
* 客服列表
|
||||
*/
|
||||
export function serviceLogin(key, data) {
|
||||
return request.post("service/scan_login/" + key, data);
|
||||
}
|
||||
/**
|
||||
* 客服获取客户列表
|
||||
*/
|
||||
export function serviceUserList(mer_id, data) {
|
||||
return request.get("service/user_list/" + mer_id, data);
|
||||
}
|
||||
/**
|
||||
* 用户获取聊天记录详情
|
||||
*/
|
||||
export function getChatRecord(to_uid, data) {
|
||||
return request.get("service/history/" + to_uid, data);
|
||||
}
|
||||
/**
|
||||
* 客服获取聊天记录详情
|
||||
*/
|
||||
export function getMerHistory(userid, mer_id, data) {
|
||||
return request.get("service/mer_history/" + mer_id + '/' + userid, data);
|
||||
}
|
||||
/**
|
||||
* 静默绑定推广人
|
||||
* @param {Object} puid
|
||||
*/
|
||||
export function spread(puid) {
|
||||
Cache.set("spread", puid || 0);
|
||||
return request.post("user/spread", {
|
||||
spread_spid: puid
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 反馈类型
|
||||
*/
|
||||
export function feedbackType() {
|
||||
return request.get("common/feedback_type");
|
||||
}
|
||||
/**
|
||||
* 提交反馈
|
||||
*/
|
||||
export function feedback(data) {
|
||||
return request.post("user/feedback", {
|
||||
...data
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 反馈列表
|
||||
*/
|
||||
export function feedbackList(data) {
|
||||
return request.get("user/feedback/list", data);
|
||||
}
|
||||
/**
|
||||
* 反馈列表
|
||||
*/
|
||||
export function feedbackDetail(id) {
|
||||
return request.get("user/feedback/detail/" + id);
|
||||
}
|
||||
/**
|
||||
* 浏览记录
|
||||
*/
|
||||
export function historyList(data) {
|
||||
return request.get("user/history", data);
|
||||
}
|
||||
/**
|
||||
* 删除浏览记录
|
||||
*/
|
||||
export function historyDelete(id) {
|
||||
return request.post("user/history/delete/" + id);
|
||||
}
|
||||
/**
|
||||
* 批量删除浏览记录
|
||||
*/
|
||||
export function historyBatchDelete(data) {
|
||||
return request.post("user/history/batch/delete", data);
|
||||
}
|
||||
/**
|
||||
* 批量收藏浏览记录
|
||||
*/
|
||||
export function historyBatchCollect(data) {
|
||||
return request.post("user/relation/batch/create", data);
|
||||
}
|
||||
/**
|
||||
* 佣金记录
|
||||
*/
|
||||
export function brokerage_list(data) {
|
||||
return request.get("user/brokerage_list", data);
|
||||
}
|
||||
/**
|
||||
* 佣金数据
|
||||
*/
|
||||
export function spreadInfo() {
|
||||
return request.get("user/spread_info");
|
||||
}
|
||||
// 图片验证码
|
||||
export function getCaptcha() {
|
||||
return request.get('captcha', {}, {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
||||
// 用户账户列表
|
||||
export function userAcc() {
|
||||
return request.get('user/account', {}, {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
||||
// 创建发票
|
||||
export function invoiceSave(data) {
|
||||
return request.post('user/receipt/create', data);
|
||||
}
|
||||
// 编辑发票
|
||||
export function invoiceUpdate(id, data) {
|
||||
return request.post('user/receipt/update/' + id, data);
|
||||
}
|
||||
// 获取默认发票
|
||||
export function invoiceDefault(id) {
|
||||
return request.post('user/receipt/is_default/' + id);
|
||||
}
|
||||
// 发票抬头--列表
|
||||
export function invoice(data) {
|
||||
return request.get('user/receipt/lst', data);
|
||||
}
|
||||
// 发票抬头--删除
|
||||
export function invoiceDelete(id) {
|
||||
return request.post('user/receipt/delete/' + id);
|
||||
}
|
||||
// 发票--详情
|
||||
export function invoiceDetail(id) {
|
||||
return request.get('user/receipt/detail/' + id);
|
||||
}
|
||||
/**
|
||||
* 新版分享海报信息获取
|
||||
*
|
||||
*/
|
||||
export function spreadMsg(data) {
|
||||
return request.get('user/v2/spread_image', data);
|
||||
}
|
||||
/**
|
||||
* 图片链接转base64
|
||||
*
|
||||
*/
|
||||
export function imgToBase(data) {
|
||||
return request.post('common/base64', data);
|
||||
}
|
||||
/**
|
||||
* 获取协议
|
||||
*
|
||||
*/
|
||||
export function getAgreementApi(key) {
|
||||
return request.get('agreement/' + key, {}, { noAuth: true });
|
||||
}
|
||||
/**
|
||||
* 获取协议
|
||||
*
|
||||
*/
|
||||
export function getIntegralInfo() {
|
||||
return request.get('user/integral/info');
|
||||
}
|
||||
/**
|
||||
* 获取店铺列表
|
||||
*
|
||||
*/
|
||||
export function getStoreList(data) {
|
||||
return request.get('user/services', data);
|
||||
}
|
||||
/*
|
||||
获取佣金说明
|
||||
*/
|
||||
export function commissionDescription() {
|
||||
return request.get('agreement/sys_extension_agree')
|
||||
}
|
||||
/*
|
||||
获取用户分销等级信息
|
||||
*/
|
||||
export function getBrokerageInfo() {
|
||||
return request.get('user/brokerage/info')
|
||||
}
|
||||
/*
|
||||
获取用户分销等级表格数据
|
||||
*/
|
||||
export function getBrokerageGrade() {
|
||||
return request.get('user/brokerage/all')
|
||||
}
|
||||
/*
|
||||
分销员升级提醒
|
||||
*/
|
||||
export function brokerageNotice(data) {
|
||||
return request.get(`user/brokerage/notice`, data)
|
||||
}
|
||||
/*
|
||||
口令解析
|
||||
*/
|
||||
export function pwdResolution(data) {
|
||||
return request.get(`command/copy?key=${data}`)
|
||||
}
|
||||
/*
|
||||
获取佣金说明
|
||||
*/
|
||||
export function getInstructions(key) {
|
||||
return request.get(`agreement/${key}`)
|
||||
}
|
||||
/*
|
||||
会员信息
|
||||
*/
|
||||
export function memberInfo() {
|
||||
return request.get('user/member/info')
|
||||
}
|
||||
/**
|
||||
* 成长值记录
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function growthValueRecord(data) {
|
||||
return request.get('user/member/log', data)
|
||||
}
|
||||
/**
|
||||
* 协议规则列表
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function cacheLst() {
|
||||
return request.get('agreement_lst', {}, { noAuth: true })
|
||||
}
|
||||
/**
|
||||
* 协议规则列表对应的数据
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function cacheInfo(key) {
|
||||
return request.get(`agreement/${key}`, {}, { noAuth: true })
|
||||
}
|
||||
/**
|
||||
* 注销账户
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function userOut(data) {
|
||||
return request.post(`user/cancel`, data)
|
||||
}
|
||||
/**
|
||||
* 获取聊天用户信息
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function serviceUser(merId, uid) {
|
||||
return request.get(`service/user/${merId}/${uid}`)
|
||||
}
|
||||
/**
|
||||
* 保存聊天用户备注
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function serviceSaveMark(merId, uid, mark) {
|
||||
return request.post(`service/mark/${merId}/${uid}`, { mark })
|
||||
}
|
||||
/**
|
||||
* 获取会员卡类型
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function memberCard() {
|
||||
return request.get(`svip/pay_lst`)
|
||||
}
|
||||
/**
|
||||
* 开通付费会员--支付
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function memberCardCreate(id, data) {
|
||||
return request.post(`svip/pay/${id}`, data)
|
||||
}
|
||||
/**
|
||||
* 付费会员权益
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function memberEquity() {
|
||||
return request.get(`svip/user_info`, {}, { noAuth: true })
|
||||
}
|
||||
/**
|
||||
* 付费会员优惠券
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function memberCouponLst() {
|
||||
return request.get(`svip/coupon_lst`, {}, { noAuth: true })
|
||||
}
|
||||
/**
|
||||
* 付费会员优惠券--领取
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function receiveMemberCoupon(id) {
|
||||
return request.post(`svip/coupon_receive/${id}`)
|
||||
}
|
||||
/**
|
||||
* 付费会员--会员商品
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function groomList(data) {
|
||||
return request.get(`svip/product_lst`, data, { noAuth: true })
|
||||
}
|
||||
/**
|
||||
* 客服聊天--撤回消息
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function chatReverstApi(id) {
|
||||
return request.post(`service/recall/${id}`)
|
||||
}
|
||||
/**
|
||||
* 客服聊天--判断店铺是否有在线客服
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function hasServiceApi(id) {
|
||||
return request.get(`has_service/${id}`)
|
||||
}
|
||||
/**
|
||||
* 银行卡提现--银行卡信息
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function getBankInfo() {
|
||||
return request.get(`user/extract/history_bank`)
|
||||
}
|
||||
// 商户账单管理
|
||||
export function getBillDetil() {
|
||||
return request.get(`mer/financial_record`)
|
||||
}
|
||||
|
||||
|
||||
|
||||
//获取商户入驻所签署公司
|
||||
|
||||
export function merstreet(data) {
|
||||
return request1.get(`company/street_company`, data);
|
||||
}
|
|
@ -0,0 +1,815 @@
|
|||
<!--
|
||||
parser 主模块组件
|
||||
github:https://github.com/jin-yufeng/Parser
|
||||
docs:https://jin-yufeng.github.io/Parser
|
||||
插件市场:https://ext.dcloud.net.cn/plugin?id=805
|
||||
author:JinYufeng
|
||||
update:2020/04/14
|
||||
-->
|
||||
<template>
|
||||
<view>
|
||||
<slot v-if="!nodes.length" />
|
||||
<!--#ifdef APP-PLUS-NVUE-->
|
||||
<web-view id="top" ref="web" :src="src" :style="'margin-top:-2px;height:'+height+'px'" @onPostMessage="_message" />
|
||||
<!--#endif-->
|
||||
<!--#ifndef APP-PLUS-NVUE-->
|
||||
<view id="top" :style="showAm+(selectable?';user-select:text;-webkit-user-select:text':'')" :animation="scaleAm" @tap="_tap"
|
||||
@touchstart="_touchstart" @touchmove="_touchmove">
|
||||
<!--#ifdef H5-->
|
||||
<div :id="'rtf'+uid"></div>
|
||||
<!--#endif-->
|
||||
<!--#ifndef H5-->
|
||||
<trees :nodes="nodes" :lazy-load="lazyLoad" :loadVideo="loadVideo" />
|
||||
<image v-for="(item, index) in imgs" v-bind:key="index" :id="index" :src="item" hidden @load="_load" />
|
||||
<!--#endif-->
|
||||
<image v-for="(item, index) in imgs" v-bind:key="index" :id="index" :src="item" hidden @load="_load" />
|
||||
</view>
|
||||
<!--#endif-->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// #ifndef H5 || APP-PLUS-NVUE
|
||||
import trees from './libs/trees';
|
||||
var cache = {},
|
||||
// #ifdef MP-WEIXIN || MP-TOUTIAO
|
||||
fs = uni.getFileSystemManager ? uni.getFileSystemManager() : null,
|
||||
// #endif
|
||||
Parser = require('./libs/MpHtmlParser.js');
|
||||
var document; // document 补丁包 https://jin-yufeng.github.io/Parser/#/instructions?id=document
|
||||
// 计算 cache 的 key
|
||||
function hash(str) {
|
||||
for (var i = str.length, val = 5381; i--;)
|
||||
val += (val << 5) + str.charCodeAt(i);
|
||||
return val;
|
||||
}
|
||||
// #endif
|
||||
// #ifdef H5 || APP-PLUS-NVUE
|
||||
var rpx = uni.getSystemInfoSync().screenWidth / 750,
|
||||
cfg = require('./libs/config.js');
|
||||
// #endif
|
||||
// #ifdef APP-PLUS-NVUE
|
||||
var dom = weex.requireModule('dom');
|
||||
// #endif
|
||||
export default {
|
||||
name: 'parser',
|
||||
data() {
|
||||
return {
|
||||
// #ifdef APP-PLUS
|
||||
loadVideo: false,
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
uid: this._uid,
|
||||
// #endif
|
||||
// #ifdef APP-PLUS-NVUE
|
||||
src: '',
|
||||
height: 1,
|
||||
// #endif
|
||||
// #ifndef APP-PLUS-NVUE
|
||||
scaleAm: '',
|
||||
showAm: '',
|
||||
imgs: [],
|
||||
// #endif
|
||||
nodes: []
|
||||
}
|
||||
},
|
||||
// #ifndef H5 || APP-PLUS-NVUE
|
||||
components: {
|
||||
trees
|
||||
},
|
||||
// #endif
|
||||
props: {
|
||||
'html': null,
|
||||
// #ifndef MP-ALIPAY
|
||||
'autopause': {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// #endif
|
||||
'autosetTitle': {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// #ifndef H5 || APP-PLUS-NVUE
|
||||
'compress': Number,
|
||||
'useCache': Boolean,
|
||||
'xml': Boolean,
|
||||
// #endif
|
||||
'domain': String,
|
||||
// #ifndef MP-BAIDU || MP-ALIPAY || APP-PLUS
|
||||
'gestureZoom': Boolean,
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN || MP-QQ || H5 || APP-PLUS
|
||||
'lazyLoad': Boolean,
|
||||
// #endif
|
||||
'selectable': Boolean,
|
||||
'tagStyle': Object,
|
||||
'showWithAnimation': Boolean,
|
||||
'useAnchor': Boolean
|
||||
},
|
||||
watch: {
|
||||
html(html) {
|
||||
this.setContent(html);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// 图片数组
|
||||
this.imgList = [];
|
||||
this.imgList.each = function(f) {
|
||||
for (var i = 0, len = this.length; i < len; i++)
|
||||
this.setItem(i, f(this[i], i, this));
|
||||
}
|
||||
this.imgList.setItem = function(i, src) {
|
||||
if (i == void 0 || !src) return;
|
||||
// #ifndef MP-ALIPAY || APP-PLUS
|
||||
// 去重
|
||||
if (src.indexOf('http') == 0 && this.includes(src)) {
|
||||
var newSrc = '';
|
||||
for (var j = 0, c; c = src[j]; j++) {
|
||||
if (c == '/' && src[j - 1] != '/' && src[j + 1] != '/') break;
|
||||
newSrc += Math.random() > 0.5 ? c.toUpperCase() : c;
|
||||
}
|
||||
newSrc += src.substr(j);
|
||||
return this[i] = newSrc;
|
||||
}
|
||||
// #endif
|
||||
this[i] = src;
|
||||
// 暂存 data src
|
||||
if (src.includes('data:image')) {
|
||||
var filePath, info = src.match(/data:image\/(\S+?);(\S+?),(.+)/);
|
||||
if (!info) return;
|
||||
// #ifdef MP-WEIXIN || MP-TOUTIAO
|
||||
filePath = `${wx.env.USER_DATA_PATH}/${Date.now()}.${info[1]}`;
|
||||
fs && fs.writeFile({
|
||||
filePath,
|
||||
data: info[3],
|
||||
encoding: info[2],
|
||||
success: () => this[i] = filePath
|
||||
})
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
filePath = `_doc/parser_tmp/${Date.now()}.${info[1]}`;
|
||||
var bitmap = new plus.nativeObj.Bitmap();
|
||||
bitmap.loadBase64Data(src, () => {
|
||||
bitmap.save(filePath, {}, () => {
|
||||
bitmap.clear()
|
||||
this[i] = filePath;
|
||||
})
|
||||
})
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
if (this.html) this.setContent(this.html);
|
||||
},
|
||||
beforeDestroy() {
|
||||
// #ifdef H5
|
||||
if (this._observer) this._observer.disconnect();
|
||||
// #endif
|
||||
this.imgList.each(src => {
|
||||
// #ifdef APP-PLUS
|
||||
if (src && src.includes('_doc')) {
|
||||
plus.io.resolveLocalFileSystemURL(src, entry => {
|
||||
entry.remove();
|
||||
});
|
||||
}
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN || MP-TOUTIAO
|
||||
if (src && src.includes(uni.env.USER_DATA_PATH))
|
||||
fs && fs.unlink({
|
||||
filePath: src
|
||||
})
|
||||
// #endif
|
||||
})
|
||||
clearInterval(this._timer);
|
||||
},
|
||||
methods: {
|
||||
// #ifdef H5 || APP-PLUS-NVUE
|
||||
_Dom2Str(nodes) {
|
||||
var str = '';
|
||||
for (var node of nodes) {
|
||||
if (node.type == 'text')
|
||||
str += node.text;
|
||||
else {
|
||||
str += ('<' + node.name);
|
||||
for (var attr in node.attrs || {})
|
||||
str += (' ' + attr + '="' + node.attrs[attr] + '"');
|
||||
if (!node.children || !node.children.length) str += '>';
|
||||
else str += ('>' + this._Dom2Str(node.children) + '</' + node.name + '>');
|
||||
}
|
||||
}
|
||||
return str;
|
||||
},
|
||||
_handleHtml(html, append) {
|
||||
if (typeof html != 'string') html = this._Dom2Str(html.nodes || html);
|
||||
// 处理 rpx
|
||||
if (html.includes('rpx'))
|
||||
html = html.replace(/[0-9.]+\s*rpx/g, $ => parseFloat($) * rpx + 'px');
|
||||
if (!append) {
|
||||
// 处理 tag-style 和 userAgentStyles
|
||||
var style = '<style>@keyframes show{0%{opacity:0}100%{opacity:1}}';
|
||||
for (var item in cfg.userAgentStyles)
|
||||
style += `${item}{${cfg.userAgentStyles[item]}}`;
|
||||
for (item in this.tagStyle)
|
||||
style += `${item}{${this.tagStyle[item]}}`;
|
||||
style += '</style>';
|
||||
html = style + html;
|
||||
}
|
||||
return html;
|
||||
},
|
||||
// #endif
|
||||
setContent(html, append) {
|
||||
// #ifdef APP-PLUS-NVUE
|
||||
if (!html) {
|
||||
this.src = '';
|
||||
this.height = 1;
|
||||
return;
|
||||
}
|
||||
if (append) return;
|
||||
plus.io.resolveLocalFileSystemURL('_doc', entry => {
|
||||
entry.getDirectory('parser_tmp', {
|
||||
create: true
|
||||
}, entry => {
|
||||
var fileName = Date.now() + '.html';
|
||||
entry.getFile(fileName, {
|
||||
create: true
|
||||
}, entry => {
|
||||
entry.createWriter(writer => {
|
||||
writer.onwriteend = () => {
|
||||
this.nodes = [1];
|
||||
this.src = '_doc/parser_tmp/' + fileName;
|
||||
this.$nextTick(function() {
|
||||
entry.remove();
|
||||
})
|
||||
}
|
||||
html =
|
||||
'<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1' +
|
||||
(this.selectable ? '' : ',user-scalable=no') +
|
||||
'"><script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"></' +
|
||||
'script><base href="' + this.domain + '">' + this._handleHtml(html) +
|
||||
'<script>"use strict";function post(t){uni.postMessage({data:t})}' +
|
||||
(this.showWithAnimation ? 'document.body.style.animation="show .5s",' : '') +
|
||||
'document.addEventListener("UniAppJSBridgeReady",function(){post({action:"load",text:document.body.innerText});var t=document.getElementsByTagName("title");t.length&&post({action:"getTitle",title:t[0].innerText});for(var e,o=document.getElementsByTagName("img"),n=[],i=0,r=0;e=o[i];i++)e.onerror=function(){post({action:"error",source:"img",target:this})},e.hasAttribute("ignore")||"A"==e.parentElement.nodeName||(e.i=r++,n.push(e.src),e.onclick=function(){post({action:"preview",img:{i:this.i,src:this.src}})});post({action:"getImgList",imgList:n});for(var a,s=document.getElementsByTagName("a"),c=0;a=s[c];c++)a.onclick=function(){var t,e=this.getAttribute("href");if("#"==e[0]){var r=document.getElementById(e.substr(1));r&&(t=r.offsetTop)}return post({action:"linkpress",href:e,offset:t}),!1};;for(var u,m=document.getElementsByTagName("video"),d=0;u=m[d];d++)u.style.maxWidth="100%;",u.onerror=function(){post({action:"error",source:"video",target:this})}' +
|
||||
(this.autopause ? ',u.onplay=function(){for(var t,e=0;t=m[e];e++)t!=this&&t.pause()}' : '') +
|
||||
';for(var g,l=document.getElementsByTagName("audio"),p=0;g=l[p];p++)g.onerror=function(){post({action:"error",source:"audio",target:this})};window.onload=function(){post({action:"ready",height:document.body.scrollHeight})}});</' +
|
||||
'script>';
|
||||
writer.write(html);
|
||||
});
|
||||
})
|
||||
})
|
||||
})
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
if (!html) {
|
||||
if (this.rtf && !append) this.rtf.parentNode.removeChild(this.rtf);
|
||||
return;
|
||||
}
|
||||
var div = document.createElement('div');
|
||||
if (!append) {
|
||||
if (this.rtf) this.rtf.parentNode.removeChild(this.rtf);
|
||||
this.rtf = div;
|
||||
} else {
|
||||
if (!this.rtf) this.rtf = div;
|
||||
else this.rtf.appendChild(div);
|
||||
}
|
||||
div.innerHTML = this._handleHtml(html, append);
|
||||
for (var styles = this.rtf.getElementsByTagName('style'), i = 0, style; style = styles[i++];) {
|
||||
style.innerHTML = style.innerHTML.replace(/body/g, '#rtf' + this._uid);
|
||||
style.setAttribute('scoped', 'true');
|
||||
}
|
||||
// 懒加载
|
||||
if (!this._observer && this.lazyLoad && IntersectionObserver) {
|
||||
this._observer = new IntersectionObserver(changes => {
|
||||
for (let item, i = 0; item = changes[i++];) {
|
||||
if (item.isIntersecting) {
|
||||
item.target.src = item.target.getAttribute('data-src');
|
||||
item.target.removeAttribute('data-src');
|
||||
this._observer.unobserve(item.target);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
rootMargin: '900px 0px 900px 0px'
|
||||
})
|
||||
}
|
||||
var _ts = this;
|
||||
// 获取标题
|
||||
var title = this.rtf.getElementsByTagName('title');
|
||||
if (title.length && this.autosetTitle)
|
||||
uni.setNavigationBarTitle({
|
||||
title: title[0].innerText
|
||||
})
|
||||
// 图片处理
|
||||
this.imgList.length = 0;
|
||||
var imgs = this.rtf.getElementsByTagName('img');
|
||||
for (let i = 0, j = 0, img; img = imgs[i]; i++) {
|
||||
img.style.maxWidth = '100%';
|
||||
var src = img.getAttribute('src');
|
||||
if (this.domain && src) {
|
||||
if (src[0] == '/') {
|
||||
if (src[1] == '/')
|
||||
img.src = (this.domain.includes('://') ? this.domain.split('://')[0] : '') + ':' + src;
|
||||
else img.src = this.domain + src;
|
||||
} else if (!src.includes('://')) img.src = this.domain + '/' + src;
|
||||
}
|
||||
if (!img.hasAttribute('ignore') && img.parentElement.nodeName != 'A') {
|
||||
img.i = j++;
|
||||
_ts.imgList.push(img.src || img.getAttribute('data-src'));
|
||||
img.onclick = function() {
|
||||
var preview = true;
|
||||
this.ignore = () => preview = false;
|
||||
_ts.$emit('imgtap', this);
|
||||
if (preview) {
|
||||
uni.previewImage({
|
||||
current: this.i,
|
||||
urls: _ts.imgList
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
img.onerror = function() {
|
||||
_ts.$emit('error', {
|
||||
source: 'img',
|
||||
target: this
|
||||
});
|
||||
}
|
||||
if (_ts.lazyLoad && this._observer && img.src && img.i != 0) {
|
||||
img.setAttribute('data-src', img.src);
|
||||
img.removeAttribute('src');
|
||||
this._observer.observe(img);
|
||||
}
|
||||
}
|
||||
// 链接处理
|
||||
var links = this.rtf.getElementsByTagName('a');
|
||||
for (var link of links) {
|
||||
link.onclick = function() {
|
||||
var jump = true,
|
||||
href = this.getAttribute('href');
|
||||
_ts.$emit('linkpress', {
|
||||
href,
|
||||
ignore: () => jump = false
|
||||
});
|
||||
if (jump && href) {
|
||||
if (href[0] == '#') {
|
||||
if (_ts.useAnchor) {
|
||||
_ts.navigateTo({
|
||||
id: href.substr(1)
|
||||
})
|
||||
}
|
||||
} else if (href.indexOf('http') == 0 || href.indexOf('//') == 0)
|
||||
return true;
|
||||
else {
|
||||
uni.navigateTo({
|
||||
url: href
|
||||
})
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// 视频处理
|
||||
var videos = this.rtf.getElementsByTagName('video');
|
||||
_ts.videoContexts = videos;
|
||||
for (let video, i = 0; video = videos[i++];) {
|
||||
video.style.maxWidth = '100%';
|
||||
video.onerror = function() {
|
||||
_ts.$emit('error', {
|
||||
source: 'video',
|
||||
target: this
|
||||
});
|
||||
}
|
||||
video.onplay = function() {
|
||||
if (_ts.autopause)
|
||||
for (let item, i = 0; item = _ts.videoContexts[i++];)
|
||||
if (item != this) item.pause();
|
||||
}
|
||||
}
|
||||
// 音频处理
|
||||
var audios = this.rtf.getElementsByTagName('audios');
|
||||
for (var audio of audios)
|
||||
audio.onerror = function() {
|
||||
_ts.$emit('error', {
|
||||
source: 'audio',
|
||||
target: this
|
||||
});
|
||||
}
|
||||
this.document = this.rtf;
|
||||
if (!append) document.getElementById('rtf' + this._uid).appendChild(this.rtf);
|
||||
this.$nextTick(() => {
|
||||
this.nodes = [1];
|
||||
this.$emit('load');
|
||||
})
|
||||
setTimeout(() => this.showAm = '', 500);
|
||||
// #endif
|
||||
// #ifndef H5 || APP-PLUS-NVUE
|
||||
var nodes;
|
||||
if (!html)
|
||||
return this.nodes = [];
|
||||
else if (typeof html == 'string') {
|
||||
let parser = new Parser(html, this);
|
||||
// 缓存读取
|
||||
if (this.useCache) {
|
||||
var hashVal = hash(html);
|
||||
if (cache[hashVal])
|
||||
nodes = cache[hashVal];
|
||||
else {
|
||||
nodes = parser.parse();
|
||||
cache[hashVal] = nodes;
|
||||
}
|
||||
} else nodes = parser.parse();
|
||||
this.$emit('parse', nodes);
|
||||
} else if (Object.prototype.toString.call(html) == '[object Array]') {
|
||||
// 非本插件产生的 array 需要进行一些转换
|
||||
if (html.length && html[0].PoweredBy != 'Parser') {
|
||||
let parser = new Parser(html, this);
|
||||
(function f(ns) {
|
||||
for (var i = 0, n; n = ns[i]; i++) {
|
||||
if (n.type == 'text') continue;
|
||||
n.attrs = n.attrs || {};
|
||||
for (var item in n.attrs)
|
||||
if (typeof n.attrs[item] != 'string') n.attrs[item] = n.attrs[item].toString();
|
||||
parser.matchAttr(n, parser);
|
||||
if (n.children && n.children.length) {
|
||||
parser.STACK.push(n);
|
||||
f(n.children);
|
||||
parser.popNode(parser.STACK.pop());
|
||||
} else n.children = void 0;
|
||||
}
|
||||
})(html);
|
||||
}
|
||||
nodes = html;
|
||||
} else if (typeof html == 'object' && html.nodes) {
|
||||
nodes = html.nodes;
|
||||
console.warn('错误的 html 类型:object 类型已废弃');
|
||||
} else
|
||||
return console.warn('错误的 html 类型:' + typeof html);
|
||||
// #ifdef APP-PLUS
|
||||
this.loadVideo = false;
|
||||
// #endif
|
||||
if (document) this.document = new document(this.nodes, 'nodes', this);
|
||||
if (append) this.nodes = this.nodes.concat(nodes);
|
||||
else this.nodes = nodes;
|
||||
if (nodes.length && nodes[0].title && this.autosetTitle)
|
||||
uni.setNavigationBarTitle({
|
||||
title: nodes[0].title
|
||||
})
|
||||
this.$nextTick(() => {
|
||||
this.imgList.length = 0;
|
||||
this.videoContexts = [];
|
||||
// #ifdef MP-TOUTIAO
|
||||
setTimeout(() => {
|
||||
// #endif
|
||||
var f = (cs) => {
|
||||
for (let i = 0, c; c = cs[i++];) {
|
||||
if (c.$options.name == 'trees') {
|
||||
for (var j = c.nodes.length, item; item = c.nodes[--j];) {
|
||||
if (item.c) continue;
|
||||
if (item.name == 'img') {
|
||||
this.imgList.setItem(item.attrs.i, item.attrs.src);
|
||||
// #ifndef MP-ALIPAY
|
||||
if (!c.observer && !c.imgLoad && item.attrs.i != '0') {
|
||||
if (this.lazyLoad && uni.createIntersectionObserver) {
|
||||
c.observer = uni.createIntersectionObserver(c);
|
||||
c.observer.relativeToViewport({
|
||||
top: 900,
|
||||
bottom: 900
|
||||
}).observe('._img', () => {
|
||||
c.imgLoad = true;
|
||||
c.observer.disconnect();
|
||||
})
|
||||
} else
|
||||
c.imgLoad = true;
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
// #ifndef MP-ALIPAY
|
||||
else if (item.name == 'video') {
|
||||
var ctx = uni.createVideoContext(item.attrs.id, c);
|
||||
ctx.id = item.attrs.id;
|
||||
this.videoContexts.push(ctx);
|
||||
}
|
||||
// #endif
|
||||
// #ifdef MP-BAIDU || MP-ALIPAY || APP-PLUS
|
||||
if (item.attrs && item.attrs.id) {
|
||||
this.anchors = this.anchors || [];
|
||||
this.anchors.push({
|
||||
id: item.attrs.id,
|
||||
node: c
|
||||
})
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
if (c.$children.length)
|
||||
f(c.$children)
|
||||
}
|
||||
}
|
||||
f(this.$children);
|
||||
// #ifdef MP-TOUTIAO
|
||||
}, 200)
|
||||
this.$emit('load');
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
setTimeout(() => {
|
||||
this.loadVideo = true;
|
||||
}, 3000);
|
||||
// #endif
|
||||
})
|
||||
// #endif
|
||||
// #ifndef APP-PLUS-NVUE
|
||||
var height;
|
||||
clearInterval(this._timer);
|
||||
this._timer = setInterval(() => {
|
||||
// #ifdef H5
|
||||
var res = [this.rtf.getBoundingClientRect()];
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
// #ifdef APP-PLUS
|
||||
uni.createSelectorQuery().in(this)
|
||||
// #endif
|
||||
// #ifndef APP-PLUS
|
||||
this.createSelectorQuery()
|
||||
// #endif
|
||||
.select('#top').boundingClientRect().exec(res => {
|
||||
// #endif
|
||||
this.width = res[0].width;
|
||||
if (res[0].height == height) {
|
||||
this.$emit('ready', res[0])
|
||||
clearInterval(this._timer);
|
||||
}
|
||||
height = res[0].height;
|
||||
// #ifndef H5
|
||||
});
|
||||
// #endif
|
||||
}, 350)
|
||||
if (this.showWithAnimation && !append) this.showAm = 'animation:show .5s';
|
||||
// #endif
|
||||
},
|
||||
getText(ns = this.nodes) {
|
||||
// #ifdef APP-PLUS-NVUE
|
||||
return this._text;
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
return this.rtf.innerText;
|
||||
// #endif
|
||||
// #ifndef H5 || APP-PLUS-NVUE
|
||||
var txt = '';
|
||||
for (var i = 0, n; n = ns[i++];) {
|
||||
if (n.type == 'text') txt += n.text.replace(/ /g, '\u00A0').replace(/</g, '<').replace(/>/g, '>')
|
||||
.replace(/&/g, '&');
|
||||
else if (n.type == 'br') txt += '\n';
|
||||
else {
|
||||
// 块级标签前后加换行
|
||||
var block = n.name == 'p' || n.name == 'div' || n.name == 'tr' || n.name == 'li' || (n.name[0] == 'h' && n.name[1] >
|
||||
'0' && n.name[1] < '7');
|
||||
if (block && txt && txt[txt.length - 1] != '\n') txt += '\n';
|
||||
if (n.children) txt += this.getText(n.children);
|
||||
if (block && txt[txt.length - 1] != '\n') txt += '\n';
|
||||
else if (n.name == 'td' || n.name == 'th') txt += '\t';
|
||||
}
|
||||
}
|
||||
return txt;
|
||||
// #endif
|
||||
},
|
||||
navigateTo(obj) {
|
||||
if (!this.useAnchor)
|
||||
return obj.fail && obj.fail({
|
||||
errMsg: 'Anchor is disabled'
|
||||
})
|
||||
// #ifdef APP-PLUS-NVUE
|
||||
if (!obj.id)
|
||||
dom.scrollToElement(this.$refs.web);
|
||||
else
|
||||
this.$refs.web.evalJs('var pos=document.getElementById("' + obj.id +
|
||||
'");if(pos)post({action:"linkpress",href:"#",offset:pos.offsetTop})');
|
||||
return obj.success && obj.success({
|
||||
errMsg: 'pageScrollTo:ok'
|
||||
});
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
if (!obj.id) {
|
||||
window.scrollTo(0, this.rtf.offsetTop);
|
||||
return obj.success && obj.success({
|
||||
errMsg: 'pageScrollTo:ok'
|
||||
});
|
||||
}
|
||||
var target = document.getElementById(obj.id);
|
||||
if (!target) return obj.fail && obj.fail({
|
||||
errMsg: 'Label not found'
|
||||
});
|
||||
obj.scrollTop = this.rtf.offsetTop + target.offsetTop;
|
||||
uni.pageScrollTo(obj);
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
var Scroll = (selector, component) => {
|
||||
uni.createSelectorQuery().in(component ? component : this).select(selector).boundingClientRect().selectViewport()
|
||||
.scrollOffset()
|
||||
.exec(res => {
|
||||
if (!res || !res[0])
|
||||
return obj.fail && obj.fail({
|
||||
errMsg: 'Label not found'
|
||||
});
|
||||
obj.scrollTop = res[1].scrollTop + res[0].top;
|
||||
uni.pageScrollTo(obj);
|
||||
})
|
||||
}
|
||||
if (!obj.id) Scroll('#top');
|
||||
else {
|
||||
// #ifndef MP-BAIDU || MP-ALIPAY || APP-PLUS
|
||||
Scroll('#top >>> #' + obj.id + ', #top >>> .' + obj.id);
|
||||
// #endif
|
||||
// #ifdef MP-BAIDU || MP-ALIPAY || APP-PLUS
|
||||
for (var anchor of this.anchors)
|
||||
if (anchor.id == obj.id)
|
||||
Scroll('#' + obj.id + ', .' + obj.id, anchor.node);
|
||||
// #endif
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
getVideoContext(id) {
|
||||
// #ifndef APP-PLUS-NVUE
|
||||
if (!id) return this.videoContexts;
|
||||
else
|
||||
for (var i = this.videoContexts.length; i--;)
|
||||
if (this.videoContexts[i].id == id) return this.videoContexts[i];
|
||||
// #endif
|
||||
},
|
||||
// 预加载
|
||||
preLoad(html, num) {
|
||||
// #ifdef H5 || APP-PLUS-NVUE
|
||||
if (html.constructor == Array)
|
||||
html = this._Dom2Str(html);
|
||||
var script = "var contain=document.createElement('div');contain.innerHTML='" + html.replace(/'/g, "\\'") +
|
||||
"';for(var imgs=contain.querySelectorAll('img'),i=imgs.length-1;i>=" + num +
|
||||
";i--)imgs[i].removeAttribute('src');";
|
||||
// #endif
|
||||
// #ifdef APP-PLUS-NVUE
|
||||
this.$refs.web.evalJs(script);
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
eval(script);
|
||||
// #endif
|
||||
// #ifndef H5 || APP-PLUS-NVUE
|
||||
if (typeof html == 'string') {
|
||||
var id = hash(html);
|
||||
html = new Parser(html, this).parse();
|
||||
cache[id] = html;
|
||||
}
|
||||
var wait = [];
|
||||
(function f(ns) {
|
||||
for (var i = 0, n; n = ns[i++];) {
|
||||
if (n.name == 'img' && n.attrs.src && !wait.includes(n.attrs.src))
|
||||
wait.push(n.attrs.src);
|
||||
f(n.children || []);
|
||||
}
|
||||
})(html);
|
||||
if (num) wait = wait.slice(0, num);
|
||||
this._wait = (this._wait || []).concat(wait);
|
||||
if (!this.imgs) this.imgs = this._wait.splice(0, 15);
|
||||
else if (this.imgs.length < 15)
|
||||
this.imgs = this.imgs.concat(this._wait.splice(0, 15 - this.imgs.length));
|
||||
// #endif
|
||||
},
|
||||
// #ifdef APP-PLUS-NVUE
|
||||
_message(e) {
|
||||
// 接收 web-view 消息
|
||||
var data = e.detail.data[0];
|
||||
if (data.action == 'load') {
|
||||
this.$emit('load');
|
||||
this._text = data.text;
|
||||
} else if (data.action == 'getTitle') {
|
||||
if (this.autosetTitle)
|
||||
uni.setNavigationBarTitle({
|
||||
title: data.title
|
||||
})
|
||||
} else if (data.action == 'getImgList') {
|
||||
this.imgList.length = 0;
|
||||
for (var i = data.imgList.length; i--;)
|
||||
this.imgList.setItem(i, data.imgList[i]);
|
||||
} else if (data.action == 'preview') {
|
||||
var preview = true;
|
||||
data.img.ignore = () => preview = false;
|
||||
this.$emit('imgtap', data.img);
|
||||
if (preview)
|
||||
uni.previewImage({
|
||||
current: data.img.i,
|
||||
urls: this.imgList
|
||||
})
|
||||
} else if (data.action == 'linkpress') {
|
||||
var jump = true,
|
||||
href = data.href;
|
||||
this.$emit('linkpress', {
|
||||
href,
|
||||
ignore: () => jump = false
|
||||
})
|
||||
if (jump && href) {
|
||||
if (href[0] == '#') {
|
||||
if (this.useAnchor)
|
||||
dom.scrollToElement(this.$refs.web, {
|
||||
offset: data.offset
|
||||
})
|
||||
} else if (href.includes('://'))
|
||||
plus.runtime.openWeb(href);
|
||||
else
|
||||
uni.navigateTo({
|
||||
url: href
|
||||
})
|
||||
}
|
||||
} else if (data.action == 'error')
|
||||
this.$emit('error', {
|
||||
source: data.source,
|
||||
target: data.target
|
||||
})
|
||||
else if (data.action == 'ready') {
|
||||
this.height = data.height;
|
||||
this.$nextTick(() => {
|
||||
uni.createSelectorQuery().in(this).select('#top').boundingClientRect().exec(res => {
|
||||
this.rect = res[0];
|
||||
this.$emit('ready', res[0]);
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
// #endif
|
||||
// #ifndef APP-PLUS-NVUE
|
||||
// #ifndef H5
|
||||
_load(e) {
|
||||
if (this._wait.length)
|
||||
this.$set(this.imgs, e.target.id, this._wait.shift());
|
||||
},
|
||||
// #endif
|
||||
_tap(e) {
|
||||
// #ifndef MP-BAIDU || MP-ALIPAY || APP-PLUS
|
||||
if (this.gestureZoom && e.timeStamp - this._lastT < 300) {
|
||||
var initY = e.touches[0].pageY - e.currentTarget.offsetTop;
|
||||
if (this._zoom) {
|
||||
this._scaleAm.translateX(0).scale(1).step();
|
||||
uni.pageScrollTo({
|
||||
scrollTop: (initY + this._initY) / 2 - e.touches[0].clientY,
|
||||
duration: 400
|
||||
})
|
||||
} else {
|
||||
var initX = e.touches[0].pageX - e.currentTarget.offsetLeft;
|
||||
this._initY = initY;
|
||||
this._scaleAm = uni.createAnimation({
|
||||
transformOrigin: `${initX}px ${this._initY}px 0`,
|
||||
timingFunction: 'ease-in-out'
|
||||
});
|
||||
// #ifdef MP-TOUTIAO
|
||||
this._scaleAm.opacity(1);
|
||||
// #endif
|
||||
this._scaleAm.scale(2).step();
|
||||
this._tMax = initX / 2;
|
||||
this._tMin = (initX - this.width) / 2;
|
||||
this._tX = 0;
|
||||
}
|
||||
this._zoom = !this._zoom;
|
||||
this.scaleAm = this._scaleAm.export();
|
||||
}
|
||||
this._lastT = e.timeStamp;
|
||||
// #endif
|
||||
},
|
||||
_touchstart(e) {
|
||||
// #ifndef MP-BAIDU || MP-ALIPAY || APP-PLUS
|
||||
if (e.touches.length == 1)
|
||||
this._initX = this._lastX = e.touches[0].pageX;
|
||||
// #endif
|
||||
},
|
||||
_touchmove(e) {
|
||||
// #ifndef MP-BAIDU || MP-ALIPAY || APP-PLUS
|
||||
var diff = e.touches[0].pageX - this._lastX;
|
||||
if (this._zoom && e.touches.length == 1 && Math.abs(diff) > 20) {
|
||||
this._lastX = e.touches[0].pageX;
|
||||
if ((this._tX <= this._tMin && diff < 0) || (this._tX >= this._tMax && diff > 0))
|
||||
return;
|
||||
this._tX += (diff * Math.abs(this._lastX - this._initX) * 0.05);
|
||||
if (this._tX < this._tMin) this._tX = this._tMin;
|
||||
if (this._tX > this._tMax) this._tX = this._tMax;
|
||||
this._scaleAm.translateX(this._tX).step();
|
||||
this.scaleAm = this._scaleAm.export();
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@keyframes show {
|
||||
0% {
|
||||
opacity: 0
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* #ifdef MP-WEIXIN */
|
||||
:host {
|
||||
display: block;
|
||||
overflow: scroll;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
</style>
|
|
@ -0,0 +1,111 @@
|
|||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
/*
|
||||
解析和匹配 Css 的选择器
|
||||
github:https://github.com/jin-yufeng/Parser
|
||||
docs:https://jin-yufeng.github.io/Parser
|
||||
author:JinYufeng
|
||||
update:2020/03/15
|
||||
*/
|
||||
var cfg = require('./config.js');
|
||||
class CssHandler {
|
||||
constructor(tagStyle) {
|
||||
var styles = Object.assign({}, cfg.userAgentStyles);
|
||||
for (var item in tagStyle)
|
||||
styles[item] = (styles[item] ? styles[item] + ';' : '') + tagStyle[item];
|
||||
this.styles = styles;
|
||||
}
|
||||
getStyle = data => this.styles = new CssParser(data, this.styles).parse();
|
||||
match(name, attrs) {
|
||||
var tmp, matched = (tmp = this.styles[name]) ? tmp + ';' : '';
|
||||
if (attrs.class) {
|
||||
var items = attrs.class.split(' ');
|
||||
for (var i = 0, item; item = items[i]; i++)
|
||||
if (tmp = this.styles['.' + item])
|
||||
matched += tmp + ';';
|
||||
}
|
||||
if (tmp = this.styles['#' + attrs.id])
|
||||
matched += tmp + ';';
|
||||
return matched;
|
||||
}
|
||||
}
|
||||
module.exports = CssHandler;
|
||||
class CssParser {
|
||||
constructor(data, init) {
|
||||
this.data = data;
|
||||
this.floor = 0;
|
||||
this.i = 0;
|
||||
this.list = [];
|
||||
this.res = init;
|
||||
this.state = this.Space;
|
||||
}
|
||||
parse() {
|
||||
for (var c; c = this.data[this.i]; this.i++)
|
||||
this.state(c);
|
||||
return this.res;
|
||||
}
|
||||
section = () => this.data.substring(this.start, this.i);
|
||||
isLetter = c => (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
|
||||
// 状态机
|
||||
Space(c) {
|
||||
if (c == '.' || c == '#' || this.isLetter(c)) {
|
||||
this.start = this.i;
|
||||
this.state = this.Name;
|
||||
} else if (c == '/' && this.data[this.i + 1] == '*')
|
||||
this.Comment();
|
||||
else if (!cfg.blankChar[c] && c != ';')
|
||||
this.state = this.Ignore;
|
||||
}
|
||||
Comment() {
|
||||
this.i = this.data.indexOf('*/', this.i) + 1;
|
||||
if (!this.i) this.i = this.data.length;
|
||||
this.state = this.Space;
|
||||
}
|
||||
Ignore(c) {
|
||||
if (c == '{') this.floor++;
|
||||
else if (c == '}' && !--this.floor) this.state = this.Space;
|
||||
}
|
||||
Name(c) {
|
||||
if (cfg.blankChar[c]) {
|
||||
this.list.push(this.section());
|
||||
this.state = this.NameSpace;
|
||||
} else if (c == '{') {
|
||||
this.list.push(this.section());
|
||||
this.Content();
|
||||
} else if (c == ',') {
|
||||
this.list.push(this.section());
|
||||
this.Comma();
|
||||
} else if (!this.isLetter(c) && (c < '0' || c > '9') && c != '-' && c != '_')
|
||||
this.state = this.Ignore;
|
||||
}
|
||||
NameSpace(c) {
|
||||
if (c == '{') this.Content();
|
||||
else if (c == ',') this.Comma();
|
||||
else if (!cfg.blankChar[c]) this.state = this.Ignore;
|
||||
}
|
||||
Comma() {
|
||||
while (cfg.blankChar[this.data[++this.i]]);
|
||||
if (this.data[this.i] == '{') this.Content();
|
||||
else {
|
||||
this.start = this.i--;
|
||||
this.state = this.Name;
|
||||
}
|
||||
}
|
||||
Content() {
|
||||
this.start = ++this.i;
|
||||
if ((this.i = this.data.indexOf('}', this.i)) == -1) this.i = this.data.length;
|
||||
var content = this.section();
|
||||
for (var i = 0, item; item = this.list[i++];)
|
||||
if (this.res[item]) this.res[item] += ';' + content;
|
||||
else this.res[item] = content;
|
||||
this.list = [];
|
||||
this.state = this.Space;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,586 @@
|
|||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
/*
|
||||
将 html 解析为适用于小程序 rich-text 的 DOM 结构
|
||||
github:https://github.com/jin-yufeng/Parser
|
||||
docs:https://jin-yufeng.github.io/Parser
|
||||
author:JinYufeng
|
||||
update:2020/04/13
|
||||
*/
|
||||
var cfg = require('./config.js'),
|
||||
blankChar = cfg.blankChar,
|
||||
CssHandler = require('./CssHandler.js'),
|
||||
{
|
||||
screenWidth,
|
||||
system
|
||||
} = wx.getSystemInfoSync();
|
||||
// #ifdef MP-BAIDU || MP-ALIPAY || MP-TOUTIAO
|
||||
var entities = {
|
||||
lt: '<',
|
||||
gt: '>',
|
||||
amp: '&',
|
||||
quot: '"',
|
||||
apos: "'",
|
||||
nbsp: '\xA0',
|
||||
ensp: '\u2002',
|
||||
emsp: '\u2003',
|
||||
ndash: '–',
|
||||
mdash: '—',
|
||||
middot: '·',
|
||||
lsquo: '‘',
|
||||
rsquo: '’',
|
||||
ldquo: '“',
|
||||
rdquo: '”',
|
||||
bull: '•',
|
||||
hellip: '…',
|
||||
permil: '‰',
|
||||
copy: '©',
|
||||
reg: '®',
|
||||
trade: '™',
|
||||
times: '×',
|
||||
divide: '÷',
|
||||
cent: '¢',
|
||||
pound: '£',
|
||||
yen: '¥',
|
||||
euro: '€',
|
||||
sect: '§'
|
||||
};
|
||||
// #endif
|
||||
var emoji; // emoji 补丁包 https://jin-yufeng.github.io/Parser/#/instructions?id=emoji
|
||||
class MpHtmlParser {
|
||||
constructor(data, options = {}) {
|
||||
this.attrs = {};
|
||||
this.compress = options.compress;
|
||||
this.CssHandler = new CssHandler(options.tagStyle, screenWidth);
|
||||
this.data = data;
|
||||
this.domain = options.domain;
|
||||
this.DOM = [];
|
||||
this.i = this.start = this.audioNum = this.imgNum = this.videoNum = 0;
|
||||
this.protocol = this.domain && this.domain.includes('://') ? this.domain.split('://')[0] : '';
|
||||
this.state = this.Text;
|
||||
this.STACK = [];
|
||||
this.useAnchor = options.useAnchor;
|
||||
this.xml = options.xml;
|
||||
}
|
||||
parse() {
|
||||
if (emoji) this.data = emoji.parseEmoji(this.data);
|
||||
for (var c; c = this.data[this.i]; this.i++)
|
||||
this.state(c);
|
||||
if (this.state == this.Text) this.setText();
|
||||
while (this.STACK.length) this.popNode(this.STACK.pop());
|
||||
// #ifdef MP-BAIDU || MP-TOUTIAO
|
||||
// 将顶层标签的一些样式提取出来给 rich-text
|
||||
(function f(ns) {
|
||||
for (var i = ns.length, n; n = ns[--i];) {
|
||||
if (n.type == 'text') continue;
|
||||
if (!n.c) {
|
||||
var style = n.attrs.style;
|
||||
if (style) {
|
||||
var j, k, res;
|
||||
if ((j = style.indexOf('display')) != -1)
|
||||
res = style.substring(j, (k = style.indexOf(';', j)) == -1 ? style.length : k);
|
||||
if ((j = style.indexOf('float')) != -1)
|
||||
res += ';' + style.substring(j, (k = style.indexOf(';', j)) == -1 ? style.length : k);
|
||||
n.attrs.contain = res;
|
||||
}
|
||||
} else f(n.children);
|
||||
}
|
||||
})(this.DOM);
|
||||
// #endif
|
||||
if (this.DOM.length) {
|
||||
this.DOM[0].PoweredBy = 'Parser';
|
||||
if (this.title) this.DOM[0].title = this.title;
|
||||
}
|
||||
return this.DOM;
|
||||
}
|
||||
// 设置属性
|
||||
setAttr() {
|
||||
var name = this.getName(this.attrName);
|
||||
if (cfg.trustAttrs[name]) {
|
||||
if (!this.attrVal) {
|
||||
if (cfg.boolAttrs[name]) this.attrs[name] = 'T';
|
||||
} else if (name == 'src') this.attrs[name] = this.getUrl(this.attrVal.replace(/&/g, '&'));
|
||||
else this.attrs[name] = this.attrVal;
|
||||
}
|
||||
this.attrVal = '';
|
||||
while (blankChar[this.data[this.i]]) this.i++;
|
||||
if (this.isClose()) this.setNode();
|
||||
else {
|
||||
this.start = this.i;
|
||||
this.state = this.AttrName;
|
||||
}
|
||||
}
|
||||
// 设置文本节点
|
||||
setText() {
|
||||
var back, text = this.section();
|
||||
if (!text) return;
|
||||
text = (cfg.onText && cfg.onText(text, () => back = true)) || text;
|
||||
if (back) {
|
||||
this.data = this.data.substr(0, this.start) + text + this.data.substr(this.i);
|
||||
let j = this.start + text.length;
|
||||
for (this.i = this.start; this.i < j; this.i++) this.state(this.data[this.i]);
|
||||
return;
|
||||
}
|
||||
if (!this.pre) {
|
||||
// 合并空白符
|
||||
var tmp = [];
|
||||
for (let i = text.length, c; c = text[--i];)
|
||||
if (!blankChar[c] || (!blankChar[tmp[0]] && (c = ' '))) tmp.unshift(c);
|
||||
text = tmp.join('');
|
||||
if (text == ' ') return;
|
||||
}
|
||||
// 处理实体
|
||||
var siblings = this.siblings(),
|
||||
i = -1,
|
||||
j, en;
|
||||
while (1) {
|
||||
if ((i = text.indexOf('&', i + 1)) == -1) break;
|
||||
if ((j = text.indexOf(';', i + 2)) == -1) break;
|
||||
if (text[i + 1] == '#') {
|
||||
en = parseInt((text[i + 2] == 'x' ? '0' : '') + text.substring(i + 2, j));
|
||||
if (!isNaN(en)) text = text.substr(0, i) + String.fromCharCode(en) + text.substring(j + 1);
|
||||
} else {
|
||||
en = text.substring(i + 1, j);
|
||||
// #ifdef MP-WEIXIN || MP-QQ || APP-PLUS
|
||||
if (en == 'nbsp') text = text.substr(0, i) + '\xA0' + text.substr(j + 1); // 解决 失效
|
||||
else if (en != 'lt' && en != 'gt' && en != 'amp' && en != 'ensp' && en != 'emsp' && en != 'quot' && en != 'apos') {
|
||||
i && siblings.push({
|
||||
type: 'text',
|
||||
text: text.substr(0, i)
|
||||
})
|
||||
siblings.push({
|
||||
type: 'text',
|
||||
text: `&${en};`,
|
||||
en: 1
|
||||
})
|
||||
text = text.substr(j + 1);
|
||||
i = -1;
|
||||
}
|
||||
// #endif
|
||||
// #ifdef MP-BAIDU || MP-ALIPAY || MP-TOUTIAO
|
||||
if (entities[en]) text = text.substr(0, i) + entities[en] + text.substr(j + 1);
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
text && siblings.push({
|
||||
type: 'text',
|
||||
text
|
||||
})
|
||||
}
|
||||
// 设置元素节点
|
||||
setNode() {
|
||||
var node = {
|
||||
name: this.tagName.toLowerCase(),
|
||||
attrs: this.attrs
|
||||
},
|
||||
close = cfg.selfClosingTags[node.name] || (this.xml && this.data[this.i] == '/');
|
||||
this.attrs = {};
|
||||
if (!cfg.ignoreTags[node.name]) {
|
||||
this.matchAttr(node);
|
||||
if (!close) {
|
||||
node.children = [];
|
||||
if (node.name == 'pre' && cfg.highlight) {
|
||||
this.remove(node);
|
||||
this.pre = node.pre = true;
|
||||
}
|
||||
this.siblings().push(node);
|
||||
this.STACK.push(node);
|
||||
} else if (!cfg.filter || cfg.filter(node, this) != false)
|
||||
this.siblings().push(node);
|
||||
} else {
|
||||
if (!close) this.remove(node);
|
||||
else if (node.name == 'source') {
|
||||
var parent = this.STACK[this.STACK.length - 1],
|
||||
attrs = node.attrs;
|
||||
if (parent && attrs.src)
|
||||
if (parent.name == 'video' || parent.name == 'audio')
|
||||
parent.attrs.source.push(attrs.src);
|
||||
else {
|
||||
var i, media = attrs.media;
|
||||
if (parent.name == 'picture' && !parent.attrs.src && !(attrs.src.indexOf('.webp') && system.includes('iOS')) &&
|
||||
(!media || (media.includes('px') &&
|
||||
(((i = media.indexOf('min-width')) != -1 && (i = media.indexOf(':', i + 8)) != -1 && screenWidth > parseInt(
|
||||
media.substr(i + 1))) ||
|
||||
((i = media.indexOf('max-width')) != -1 && (i = media.indexOf(':', i + 8)) != -1 && screenWidth < parseInt(
|
||||
media.substr(i + 1)))))))
|
||||
parent.attrs.src = attrs.src;
|
||||
}
|
||||
} else if (node.name == 'base' && !this.domain) this.domain = node.attrs.href;
|
||||
}
|
||||
if (this.data[this.i] == '/') this.i++;
|
||||
this.start = this.i + 1;
|
||||
this.state = this.Text;
|
||||
}
|
||||
// 移除标签
|
||||
remove(node) {
|
||||
var name = node.name,
|
||||
j = this.i;
|
||||
while (1) {
|
||||
if ((this.i = this.data.indexOf('</', this.i + 1)) == -1) {
|
||||
if (name == 'pre' || name == 'svg') this.i = j;
|
||||
else this.i = this.data.length;
|
||||
return;
|
||||
}
|
||||
this.start = (this.i += 2);
|
||||
while (!blankChar[this.data[this.i]] && !this.isClose()) this.i++;
|
||||
if (this.getName(this.section()) == name) {
|
||||
// 代码块高亮
|
||||
if (name == 'pre') {
|
||||
this.data = this.data.substr(0, j + 1) + cfg.highlight(this.data.substring(j + 1, this.i - 5), node.attrs) +
|
||||
this.data.substr(this.i - 5);
|
||||
return this.i = j;
|
||||
} else if (name == 'style')
|
||||
this.CssHandler.getStyle(this.data.substring(j + 1, this.i - 7));
|
||||
else if (name == 'title')
|
||||
this.title = this.data.substring(j + 1, this.i - 7);
|
||||
if ((this.i = this.data.indexOf('>', this.i)) == -1) this.i = this.data.length;
|
||||
// 处理 svg
|
||||
if (name == 'svg') {
|
||||
var src = this.data.substring(j, this.i + 1);
|
||||
if (!node.attrs.xmlns) src = ' xmlns="http://www.w3.org/2000/svg"' + src;
|
||||
var i = j;
|
||||
while (this.data[j] != '<') j--;
|
||||
src = this.data.substring(j, i) + src;
|
||||
var parent = this.STACK[this.STACK.length - 1];
|
||||
if (node.attrs.width == '100%' && parent && (parent.attrs.style || '').includes('inline'))
|
||||
parent.attrs.style = 'width:300px;max-width:100%;' + parent.attrs.style;
|
||||
this.siblings().push({
|
||||
name: 'img',
|
||||
attrs: {
|
||||
src: 'data:image/svg+xml;utf8,' + src.replace(/#/g, '%23'),
|
||||
ignore: 'T'
|
||||
}
|
||||
})
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 处理属性
|
||||
matchAttr(node) {
|
||||
var attrs = node.attrs,
|
||||
style = this.CssHandler.match(node.name, attrs, node) + (attrs.style || ''),
|
||||
styleObj = {};
|
||||
if (attrs.id) {
|
||||
if (this.compress & 1) attrs.id = void 0;
|
||||
else if (this.useAnchor) this.bubble();
|
||||
}
|
||||
if ((this.compress & 2) && attrs.class) attrs.class = void 0;
|
||||
switch (node.name) {
|
||||
case 'img':
|
||||
if (attrs['data-src']) {
|
||||
attrs.src = attrs.src || attrs['data-src'];
|
||||
attrs['data-src'] = void 0;
|
||||
}
|
||||
if (attrs.src && !attrs.ignore) {
|
||||
if (this.bubble()) attrs.i = (this.imgNum++).toString();
|
||||
else attrs.ignore = 'T';
|
||||
}
|
||||
break;
|
||||
case 'a':
|
||||
case 'ad':
|
||||
// #ifdef APP-PLUS
|
||||
case 'iframe':
|
||||
case 'embed':
|
||||
// #endif
|
||||
this.bubble();
|
||||
break;
|
||||
case 'font':
|
||||
if (attrs.color) {
|
||||
styleObj['color'] = attrs.color;
|
||||
attrs.color = void 0;
|
||||
}
|
||||
if (attrs.face) {
|
||||
styleObj['font-family'] = attrs.face;
|
||||
attrs.face = void 0;
|
||||
}
|
||||
if (attrs.size) {
|
||||
var size = parseInt(attrs.size);
|
||||
if (size < 1) size = 1;
|
||||
else if (size > 7) size = 7;
|
||||
var map = ['xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'];
|
||||
styleObj['font-size'] = map[size - 1];
|
||||
attrs.size = void 0;
|
||||
}
|
||||
break;
|
||||
case 'video':
|
||||
case 'audio':
|
||||
if (!attrs.id) attrs.id = node.name + (++this[`${node.name}Num`]);
|
||||
else this[`${node.name}Num`]++;
|
||||
if (node.name == 'video') {
|
||||
if (attrs.width) {
|
||||
style = `width:${parseFloat(attrs.width) + (attrs.width.includes('%') ? '%' : 'px')};${style}`;
|
||||
attrs.width = void 0;
|
||||
}
|
||||
if (attrs.height) {
|
||||
style = `height:${parseFloat(attrs.height) + (attrs.height.includes('%') ? '%' : 'px')};${style}`;
|
||||
attrs.height = void 0;
|
||||
}
|
||||
if (this.videoNum > 3) node.lazyLoad = true;
|
||||
}
|
||||
attrs.source = [];
|
||||
if (attrs.src) attrs.source.push(attrs.src);
|
||||
if (!attrs.controls && !attrs.autoplay)
|
||||
console.warn(`存在没有 controls 属性的 ${node.name} 标签,可能导致无法播放`, node);
|
||||
this.bubble();
|
||||
break;
|
||||
case 'td':
|
||||
case 'th':
|
||||
if (attrs.colspan || attrs.rowspan)
|
||||
for (var k = this.STACK.length, item; item = this.STACK[--k];)
|
||||
if (item.name == 'table') {
|
||||
item.c = void 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (attrs.align) {
|
||||
styleObj['text-align'] = attrs.align;
|
||||
attrs.align = void 0;
|
||||
}
|
||||
// 压缩 style
|
||||
var styles = style.replace(/"/g, '"').replace(/&/g, '&').split(';');
|
||||
style = '';
|
||||
for (var i = 0, len = styles.length; i < len; i++) {
|
||||
var info = styles[i].split(':');
|
||||
if (info.length < 2) continue;
|
||||
let key = info[0].trim().toLowerCase(),
|
||||
value = info.slice(1).join(':').trim();
|
||||
if (value.includes('-webkit') || value.includes('-moz') || value.includes('-ms') || value.includes('-o') || value
|
||||
.includes(
|
||||
'safe'))
|
||||
style += `;${key}:${value}`;
|
||||
else if (!styleObj[key] || value.includes('import') || !styleObj[key].includes('import'))
|
||||
styleObj[key] = value;
|
||||
}
|
||||
if (node.name == 'img' && parseInt(styleObj.width || attrs.width) > screenWidth)
|
||||
styleObj.height = 'auto';
|
||||
for (var key in styleObj) {
|
||||
var value = styleObj[key];
|
||||
if (key.includes('flex') || key == 'order' || key == 'self-align') node.c = 1;
|
||||
// 填充链接
|
||||
if (value.includes('url')) {
|
||||
var j = value.indexOf('(');
|
||||
if (j++ != -1) {
|
||||
while (value[j] == '"' || value[j] == "'" || blankChar[value[j]]) j++;
|
||||
value = value.substr(0, j) + this.getUrl(value.substr(j));
|
||||
}
|
||||
}
|
||||
// 转换 rpx
|
||||
else if (value.includes('rpx'))
|
||||
value = value.replace(/[0-9.]+\s*rpx/g, $ => parseFloat($) * screenWidth / 750 + 'px');
|
||||
else if (key == 'white-space' && value.includes('pre'))
|
||||
this.pre = node.pre = true;
|
||||
style += `;${key}:${value}`;
|
||||
}
|
||||
style = style.substr(1);
|
||||
if (style) attrs.style = style;
|
||||
}
|
||||
// 节点出栈处理
|
||||
popNode(node) {
|
||||
// 空白符处理
|
||||
if (node.pre) {
|
||||
node.pre = this.pre = void 0;
|
||||
for (let i = this.STACK.length; i--;)
|
||||
if (this.STACK[i].pre)
|
||||
this.pre = true;
|
||||
}
|
||||
if (node.name == 'head' || (cfg.filter && cfg.filter(node, this) == false))
|
||||
return this.siblings().pop();
|
||||
var attrs = node.attrs;
|
||||
// 替换一些标签名
|
||||
if (node.name == 'picture') {
|
||||
node.name = 'img';
|
||||
if (!attrs.src && (node.children[0] || '').name == 'img')
|
||||
attrs.src = node.children[0].attrs.src;
|
||||
if (attrs.src && !attrs.ignore)
|
||||
attrs.i = (this.imgNum++).toString();
|
||||
return node.children = void 0;
|
||||
}
|
||||
if (cfg.blockTags[node.name]) node.name = 'div';
|
||||
else if (!cfg.trustTags[node.name]) node.name = 'span';
|
||||
// 处理列表
|
||||
if (node.c) {
|
||||
if (node.name == 'ul') {
|
||||
var floor = 1;
|
||||
for (let i = this.STACK.length; i--;)
|
||||
if (this.STACK[i].name == 'ul') floor++;
|
||||
if (floor != 1)
|
||||
for (let i = node.children.length; i--;)
|
||||
node.children[i].floor = floor;
|
||||
} else if (node.name == 'ol') {
|
||||
for (let i = 0, num = 1, child; child = node.children[i++];)
|
||||
if (child.name == 'li') {
|
||||
child.type = 'ol';
|
||||
child.num = ((num, type) => {
|
||||
if (type == 'a') return String.fromCharCode(97 + (num - 1) % 26);
|
||||
if (type == 'A') return String.fromCharCode(65 + (num - 1) % 26);
|
||||
if (type == 'i' || type == 'I') {
|
||||
num = (num - 1) % 99 + 1;
|
||||
var one = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX'],
|
||||
ten = ['X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC'],
|
||||
res = (ten[Math.floor(num / 10) - 1] || '') + (one[num % 10 - 1] || '');
|
||||
if (type == 'i') return res.toLowerCase();
|
||||
return res;
|
||||
}
|
||||
return num;
|
||||
})(num++, attrs.type) + '.';
|
||||
}
|
||||
}
|
||||
}
|
||||
// 处理表格的边框
|
||||
if (node.name == 'table') {
|
||||
var padding = attrs.cellpadding,
|
||||
spacing = attrs.cellspacing,
|
||||
border = attrs.border;
|
||||
if (node.c) {
|
||||
this.bubble();
|
||||
if (!padding) padding = 2;
|
||||
if (!spacing) spacing = 2;
|
||||
}
|
||||
if (border) attrs.style = `border:${border}px solid gray;${attrs.style || ''}`;
|
||||
if (spacing) attrs.style = `border-spacing:${spacing}px;${attrs.style || ''}`;
|
||||
if (border || padding)
|
||||
(function f(ns) {
|
||||
for (var i = 0, n; n = ns[i]; i++) {
|
||||
if (n.name == 'th' || n.name == 'td') {
|
||||
if (border) n.attrs.style = `border:${border}px solid gray;${n.attrs.style}`;
|
||||
if (padding) n.attrs.style = `padding:${padding}px;${n.attrs.style}`;
|
||||
} else f(n.children || []);
|
||||
}
|
||||
})(node.children)
|
||||
}
|
||||
this.CssHandler.pop && this.CssHandler.pop(node);
|
||||
// 自动压缩
|
||||
if (node.name == 'div' && !Object.keys(attrs).length) {
|
||||
var siblings = this.siblings();
|
||||
if (node.children.length == 1 && node.children[0].name == 'div')
|
||||
siblings[siblings.length - 1] = node.children[0];
|
||||
}
|
||||
}
|
||||
// 工具函数
|
||||
bubble() {
|
||||
for (var i = this.STACK.length, item; item = this.STACK[--i];) {
|
||||
if (cfg.richOnlyTags[item.name]) {
|
||||
if (item.name == 'table' && !Object.hasOwnProperty.call(item, 'c')) item.c = 1;
|
||||
return false;
|
||||
}
|
||||
item.c = 1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
getName = val => this.xml ? val : val.toLowerCase();
|
||||
getUrl(url) {
|
||||
if (url[0] == '/') {
|
||||
if (url[1] == '/') url = this.protocol + ':' + url;
|
||||
else if (this.domain) url = this.domain + url;
|
||||
} else if (this.domain && url.indexOf('data:') != 0 && !url.includes('://'))
|
||||
url = this.domain + '/' + url;
|
||||
return url;
|
||||
}
|
||||
isClose = () => this.data[this.i] == '>' || (this.data[this.i] == '/' && this.data[this.i + 1] == '>');
|
||||
section = () => this.data.substring(this.start, this.i);
|
||||
siblings = () => this.STACK.length ? this.STACK[this.STACK.length - 1].children : this.DOM;
|
||||
// 状态机
|
||||
Text(c) {
|
||||
if (c == '<') {
|
||||
var next = this.data[this.i + 1],
|
||||
isLetter = c => (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
|
||||
if (isLetter(next)) {
|
||||
this.setText();
|
||||
this.start = this.i + 1;
|
||||
this.state = this.TagName;
|
||||
} else if (next == '/') {
|
||||
this.setText();
|
||||
if (isLetter(this.data[++this.i + 1])) {
|
||||
this.start = this.i + 1;
|
||||
this.state = this.EndTag;
|
||||
} else
|
||||
this.Comment();
|
||||
} else if (next == '!') {
|
||||
this.setText();
|
||||
this.Comment();
|
||||
}
|
||||
}
|
||||
}
|
||||
Comment() {
|
||||
var key;
|
||||
if (this.data.substring(this.i + 2, this.i + 4) == '--') key = '-->';
|
||||
else if (this.data.substring(this.i + 2, this.i + 9) == '[CDATA[') key = ']]>';
|
||||
else key = '>';
|
||||
if ((this.i = this.data.indexOf(key, this.i + 2)) == -1) this.i = this.data.length;
|
||||
else this.i += key.length - 1;
|
||||
this.start = this.i + 1;
|
||||
this.state = this.Text;
|
||||
}
|
||||
TagName(c) {
|
||||
if (blankChar[c]) {
|
||||
this.tagName = this.section();
|
||||
while (blankChar[this.data[this.i]]) this.i++;
|
||||
if (this.isClose()) this.setNode();
|
||||
else {
|
||||
this.start = this.i;
|
||||
this.state = this.AttrName;
|
||||
}
|
||||
} else if (this.isClose()) {
|
||||
this.tagName = this.section();
|
||||
this.setNode();
|
||||
}
|
||||
}
|
||||
AttrName(c) {
|
||||
var blank = blankChar[c];
|
||||
if (blank) {
|
||||
this.attrName = this.section();
|
||||
c = this.data[this.i];
|
||||
}
|
||||
if (c == '=') {
|
||||
if (!blank) this.attrName = this.section();
|
||||
while (blankChar[this.data[++this.i]]);
|
||||
this.start = this.i--;
|
||||
this.state = this.AttrValue;
|
||||
} else if (blank) this.setAttr();
|
||||
else if (this.isClose()) {
|
||||
this.attrName = this.section();
|
||||
this.setAttr();
|
||||
}
|
||||
}
|
||||
AttrValue(c) {
|
||||
if (c == '"' || c == "'") {
|
||||
this.start++;
|
||||
if ((this.i = this.data.indexOf(c, this.i + 1)) == -1) return this.i = this.data.length;
|
||||
this.attrVal = this.section();
|
||||
this.i++;
|
||||
} else {
|
||||
for (; !blankChar[this.data[this.i]] && !this.isClose(); this.i++);
|
||||
this.attrVal = this.section();
|
||||
}
|
||||
this.setAttr();
|
||||
}
|
||||
EndTag(c) {
|
||||
if (blankChar[c] || c == '>' || c == '/') {
|
||||
var name = this.getName(this.section());
|
||||
for (var i = this.STACK.length; i--;)
|
||||
if (this.STACK[i].name == name) break;
|
||||
if (i != -1) {
|
||||
var node;
|
||||
while ((node = this.STACK.pop()).name != name);
|
||||
this.popNode(node);
|
||||
} else if (name == 'p' || name == 'br')
|
||||
this.siblings().push({
|
||||
name,
|
||||
attrs: {}
|
||||
});
|
||||
this.i = this.data.indexOf('>', this.i);
|
||||
this.start = this.i + 1;
|
||||
if (this.i == -1) this.i = this.data.length;
|
||||
else this.state = this.Text;
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = MpHtmlParser;
|
|
@ -0,0 +1,89 @@
|
|||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
/* 配置文件 */
|
||||
// #ifdef MP-WEIXIN
|
||||
const canIUse = wx.canIUse('editor'); // 高基础库标识,用于兼容
|
||||
// #endif
|
||||
module.exports = {
|
||||
// 过滤器函数
|
||||
filter: null,
|
||||
// 代码高亮函数
|
||||
highlight: null,
|
||||
// 文本处理函数
|
||||
onText: null,
|
||||
blankChar: makeMap(' ,\xA0,\t,\r,\n,\f'),
|
||||
// 块级标签,将被转为 div
|
||||
blockTags: makeMap('address,article,aside,body,caption,center,cite,footer,header,html,nav,section' + (
|
||||
// #ifdef MP-WEIXIN
|
||||
canIUse ? '' :
|
||||
// #endif
|
||||
',pre')),
|
||||
// 将被移除的标签
|
||||
ignoreTags: makeMap(
|
||||
'area,base,basefont,canvas,command,frame,input,isindex,keygen,link,map,meta,param,script,source,style,svg,textarea,title,track,use,wbr'
|
||||
// #ifdef MP-WEIXIN
|
||||
+ (canIUse ? ',rp' : '')
|
||||
// #endif
|
||||
// #ifndef APP-PLUS
|
||||
+ ',embed,iframe'
|
||||
// #endif
|
||||
),
|
||||
// 只能被 rich-text 显示的标签
|
||||
richOnlyTags: makeMap('a,colgroup,fieldset,legend,picture,table'
|
||||
// #ifdef MP-WEIXIN
|
||||
+ (canIUse ? ',bdi,bdo,caption,rt,ruby' : '')
|
||||
// #endif
|
||||
),
|
||||
// 自闭合的标签
|
||||
selfClosingTags: makeMap(
|
||||
'area,base,basefont,br,col,circle,ellipse,embed,frame,hr,img,input,isindex,keygen,line,link,meta,param,path,polygon,rect,source,track,use,wbr'
|
||||
),
|
||||
// 信任的属性
|
||||
trustAttrs: makeMap(
|
||||
'align,alt,app-id,author,autoplay,border,cellpadding,cellspacing,class,color,colspan,controls,data-src,dir,face,height,href,id,ignore,loop,media,muted,name,path,poster,rowspan,size,span,src,start,style,type,unit-id,width,xmlns'
|
||||
),
|
||||
// bool 型的属性
|
||||
boolAttrs: makeMap('autoplay,controls,ignore,loop,muted'),
|
||||
// 信任的标签
|
||||
trustTags: makeMap(
|
||||
'a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video'
|
||||
// #ifdef MP-WEIXIN
|
||||
+ (canIUse ? ',bdi,bdo,caption,pre,rt,ruby' : '')
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
+ ',embed,iframe'
|
||||
// #endif
|
||||
),
|
||||
// 默认的标签样式
|
||||
userAgentStyles: {
|
||||
address: 'font-style:italic',
|
||||
big: 'display:inline;font-size:1.2em',
|
||||
blockquote: 'background-color:#f6f6f6;border-left:3px solid #dbdbdb;color:#6c6c6c;padding:5px 0 5px 10px',
|
||||
caption: 'display:table-caption;text-align:center',
|
||||
center: 'text-align:center',
|
||||
cite: 'font-style:italic',
|
||||
dd: 'margin-left:40px',
|
||||
img: 'max-width:100%',
|
||||
mark: 'background-color:yellow',
|
||||
picture: 'max-width:100%',
|
||||
pre: 'font-family:monospace;white-space:pre;overflow:scroll',
|
||||
s: 'text-decoration:line-through',
|
||||
small: 'display:inline;font-size:0.8em',
|
||||
u: 'text-decoration:underline'
|
||||
}
|
||||
}
|
||||
|
||||
function makeMap(str) {
|
||||
var map = {},
|
||||
list = str.split(',');
|
||||
for (var i = list.length; i--;)
|
||||
map[list[i]] = true;
|
||||
return map;
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
var inlineTags = {
|
||||
abbr: 1,
|
||||
b: 1,
|
||||
big: 1,
|
||||
code: 1,
|
||||
del: 1,
|
||||
em: 1,
|
||||
i: 1,
|
||||
ins: 1,
|
||||
label: 1,
|
||||
q: 1,
|
||||
small: 1,
|
||||
span: 1,
|
||||
strong: 1
|
||||
}
|
||||
export default {
|
||||
// 从顶层标签的样式中取出一些给 rich-text
|
||||
getStyle: function(style) {
|
||||
if (style) {
|
||||
var i, j, res = '';
|
||||
if ((i = style.indexOf('display')) != -1)
|
||||
res = style.substring(i, (j = style.indexOf(';', i)) == -1 ? style.length : j);
|
||||
if ((i = style.indexOf('float')) != -1)
|
||||
res += ';' + style.substring(i, (j = style.indexOf(';', i)) == -1 ? style.length : j);
|
||||
return res;
|
||||
}
|
||||
},
|
||||
getNode: function(item) {
|
||||
return [item];
|
||||
},
|
||||
// 是否通过 rich-text 显示
|
||||
useRichText: function(item) {
|
||||
return !item.c && !inlineTags[item.name] && (item.attrs.style || '').indexOf('display:inline') == -1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
var inlineTags = {
|
||||
abbr: 1,
|
||||
b: 1,
|
||||
big: 1,
|
||||
code: 1,
|
||||
del: 1,
|
||||
em: 1,
|
||||
i: 1,
|
||||
ins: 1,
|
||||
label: 1,
|
||||
q: 1,
|
||||
small: 1,
|
||||
span: 1,
|
||||
strong: 1
|
||||
}
|
||||
module.exports = {
|
||||
// 从顶层标签的样式中取出一些给 rich-text
|
||||
getStyle: function(style) {
|
||||
if (style) {
|
||||
var i, j, res = '';
|
||||
if ((i = style.indexOf('display')) != -1)
|
||||
res = style.substring(i, (j = style.indexOf(';', i)) == -1 ? style.length : j);
|
||||
if ((i = style.indexOf('float')) != -1)
|
||||
res += ';' + style.substring(i, (j = style.indexOf(';', i)) == -1 ? style.length : j);
|
||||
return res;
|
||||
}
|
||||
},
|
||||
// 处理懒加载
|
||||
getNode: function(item, imgLoad) {
|
||||
if (!imgLoad && item.attrs.i != '0') {
|
||||
var img = {
|
||||
name: 'img',
|
||||
attrs: JSON.parse(JSON.stringify(item.attrs))
|
||||
}
|
||||
delete img.attrs.src;
|
||||
img.attrs.style += ';width:20px;height:20px';
|
||||
return [img];
|
||||
} else return [item];
|
||||
},
|
||||
// 是否通过 rich-text 显示
|
||||
useRichText: function(item) {
|
||||
return !item.c && !inlineTags[item.name] && (item.attrs.style || '').indexOf('display:inline') == -1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,485 @@
|
|||
<!--
|
||||
trees 递归显示组件
|
||||
github:https://github.com/jin-yufeng/Parser
|
||||
docs:https://jin-yufeng.github.io/Parser
|
||||
插件市场:https://ext.dcloud.net.cn/plugin?id=805
|
||||
author:JinYufeng
|
||||
update:2020/04/13
|
||||
-->
|
||||
<template>
|
||||
<view class="interlayer">
|
||||
<block v-for="(n, index) in nodes" v-bind:key="index">
|
||||
<!--图片-->
|
||||
<!--#ifdef MP-WEIXIN || MP-QQ || MP-ALIPAY || APP-PLUS-->
|
||||
<rich-text v-if="n.name=='img'" :id="n.attrs.id" class="_img" :style="''+handler.getStyle(n.attrs.style)" :nodes="handler.getNode(n,!lazyLoad||imgLoad)"
|
||||
:data-attrs="n.attrs" @tap="imgtap" @longpress="imglongtap" />
|
||||
<!--#endif-->
|
||||
<!--#ifdef MP-BAIDU || MP-TOUTIAO-->
|
||||
<rich-text v-if="n.name=='img'" :id="n.attrs.id" class="_img" :style="n.attrs.contain" :nodes='[n]' :data-attrs="n.attrs"
|
||||
@tap="imgtap" @longpress="imglongtap" />
|
||||
<!--#endif-->
|
||||
<!--文本-->
|
||||
<!--#ifdef MP-WEIXIN || MP-QQ || APP-PLUS-->
|
||||
<rich-text v-else-if="n.decode" class="_entity" :nodes="[n]"></rich-text>
|
||||
<!--#endif-->
|
||||
<text v-else-if="n.type=='text'" decode>{{n.text}}</text>
|
||||
<text v-else-if="n.name=='br'">\n</text>
|
||||
<!--视频-->
|
||||
<view v-else-if="n.name=='video'">
|
||||
<view v-if="(!loadVideo||n.lazyLoad)&&!(controls[n.attrs.id]&&controls[n.attrs.id].play)" :id="n.attrs.id" :class="'_video '+(n.attrs.class||'')"
|
||||
:style="n.attrs.style" @tap="_loadVideo" />
|
||||
<video v-else :id="n.attrs.id" :class="n.attrs.class" :style="n.attrs.style" :autoplay="n.attrs.autoplay||(controls[n.attrs.id]&&controls[n.attrs.id].play)"
|
||||
:controls="n.attrs.controls" :loop="n.attrs.loop" :muted="n.attrs.muted" :poster="n.attrs.poster" :src="n.attrs.source[(controls[n.attrs.id]&&controls[n.attrs.id].index)||0]"
|
||||
:unit-id="n.attrs['unit-id']" :data-id="n.attrs.id" data-from="video" data-source="source" @error="error" @play="play" />
|
||||
</view>
|
||||
<!--音频-->
|
||||
<audio v-else-if="n.name=='audio'" :class="n.attrs.class" :style="n.attrs.style" :author="n.attrs.author" :autoplay="n.attrs.autoplay"
|
||||
:controls="n.attrs.controls" :loop="n.attrs.loop" :name="n.attrs.name" :poster="n.attrs.poster" :src="n.attrs.source[(controls[n.attrs.id]&&controls[n.attrs.id].index)||0]"
|
||||
:data-id="n.attrs.id" data-from="audio" data-source="source" @error="error" @play="play" />
|
||||
<!--链接-->
|
||||
<view v-else-if="n.name=='a'" :class="'_a '+(n.attrs.class||'')" hover-class="_hover" :style="n.attrs.style"
|
||||
:data-attrs="n.attrs" @tap="linkpress">
|
||||
<trees class="_span" :nodes="n.children" />
|
||||
</view>
|
||||
<!--广告(按需打开注释)-->
|
||||
<!--#ifdef MP-WEIXIN || MP-QQ || MP-TOUTIAO-->
|
||||
<!--<ad v-else-if="n.name=='ad'" :class="n.attrs.class" :style="n.attrs.style" :unit-id="n.attrs['unit-id']"
|
||||
data-from="ad" @error="error" />-->
|
||||
<!--#endif-->
|
||||
<!--#ifdef MP-BAIDU-->
|
||||
<!--<ad v-else-if="n.name=='ad'" :class="n.attrs.class" :style="n.attrs.style" :appid="n.attrs.appid"
|
||||
:apid="n.attrs.apid" :type="n.attrs.type" data-from="ad" @error="error" />-->
|
||||
<!--#endif-->
|
||||
<!--#ifdef APP-PLUS-->
|
||||
<!--<ad v-else-if="n.name=='ad'" :class="n.attrs.class" :style="n.attrs.style" :adpid="n.attrs.adpid"
|
||||
data-from="ad" @error="error" />-->
|
||||
<!--#endif-->
|
||||
<!--列表-->
|
||||
<view v-else-if="n.name=='li'" :id="n.attrs.id" :class="n.attrs.class" :style="(n.attrs.style||'')+';display:flex'">
|
||||
<view v-if="n.type=='ol'" class="_ol-bef">{{n.num}}</view>
|
||||
<view v-else class="_ul-bef">
|
||||
<view v-if="n.floor%3==0" class="_ul-p1">█</view>
|
||||
<view v-else-if="n.floor%3==2" class="_ul-p2" />
|
||||
<view v-else class="_ul-p1" style="border-radius:50%">█</view>
|
||||
</view>
|
||||
<!--#ifdef MP-ALIPAY-->
|
||||
<view class="_li">
|
||||
<trees :nodes="n.children" />
|
||||
</view>
|
||||
<!--#endif-->
|
||||
<!--#ifndef MP-ALIPAY-->
|
||||
<trees class="_li" :nodes="n.children" :lazyLoad="lazyLoad" :loadVideo="loadVideo" />
|
||||
<!--#endif-->
|
||||
</view>
|
||||
<!--表格-->
|
||||
<view v-else-if="n.name=='table'&&n.c" :id="n.attrs.id" :class="n.attrs.class" :style="(n.attrs.style||'')+';display:table'">
|
||||
<view v-for="(tbody, i) in n.children" v-bind:key="i" :class="tbody.attrs.class" :style="(tbody.attrs.style||'')+(tbody.name[0]=='t'?';display:table-'+(tbody.name=='tr'?'row':'row-group'):'')">
|
||||
<view v-for="(tr, j) in tbody.children" v-bind:key="j" :class="tr.attrs.class" :style="(tr.attrs.style||'')+(tr.name[0]=='t'?';display:table-'+(tr.name=='tr'?'row':'cell'):'')">
|
||||
<trees v-if="tr.name=='td'" :nodes="tr.children" :lazyLoad="lazyLoad" :loadVideo="loadVideo" />
|
||||
<block v-else>
|
||||
<!--#ifdef MP-ALIPAY-->
|
||||
<view v-for="(td, k) in tr.children" v-bind:key="k" :class="td.attrs.class" :style="(td.attrs.style||'')+(td.name[0]=='t'?';display:table-'+(td.name=='tr'?'row':'cell'):'')">
|
||||
<trees :nodes="td.children" />
|
||||
</view>
|
||||
<!--#endif-->
|
||||
<!--#ifndef MP-ALIPAY-->
|
||||
<trees v-for="(td, k) in tr.children" v-bind:key="k" :class="td.attrs.class" :style="(td.attrs.style||'')+(td.name[0]=='t'?';display:table-'+(td.name=='tr'?'row':'cell'):'')"
|
||||
:nodes="td.children" :lazyLoad="lazyLoad" :loadVideo="loadVideo" />
|
||||
<!--#endif-->
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!--#ifdef APP-PLUS-->
|
||||
<iframe v-else-if="n.name=='iframe'" :style="n.attrs.style" :allowfullscreen="n.attrs.allowfullscreen" :frameborder="n.attrs.frameborder"
|
||||
:width="n.attrs.width" :height="n.attrs.height" :src="n.attrs.src" />
|
||||
<embed v-else-if="n.name=='embed'" :style="n.attrs.style" :width="n.attrs.width" :height="n.attrs.height" :src="n.attrs.src" />
|
||||
<!--#endif-->
|
||||
<!--富文本-->
|
||||
<!--#ifdef MP-WEIXIN || MP-QQ || MP-ALIPAY || APP-PLUS-->
|
||||
<rich-text v-else-if="handler.useRichText(n)" :id="n.attrs.id" :class="'_p __'+n.name" :nodes="[n]" />
|
||||
<!--#endif-->
|
||||
<!--#ifdef MP-BAIDU || MP-TOUTIAO-->
|
||||
<rich-text v-else-if="!(n.c||n.continue)" :id="n.attrs.id" :class="_p" :style="n.attrs.contain" :nodes="[n]" />
|
||||
<!--#endif-->
|
||||
<!--#ifdef MP-ALIPAY-->
|
||||
<view v-else :id="n.attrs.id" :class="'_'+n.name+' '+(n.attrs.class||'')" :style="n.attrs.style">
|
||||
<trees :nodes="n.children" />
|
||||
</view>
|
||||
<!--#endif-->
|
||||
<!--#ifndef MP-ALIPAY-->
|
||||
<trees v-else :class="(n.attrs.id||'')+' _'+n.name+' '+(n.attrs.class||'')" :style="n.attrs.style" :nodes="n.children"
|
||||
:lazyLoad="lazyLoad" :loadVideo="loadVideo" />
|
||||
<!--#endif-->
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
<script module="handler" lang="wxs" src="./handler.wxs"></script>
|
||||
<script module="handler" lang="sjs" src="./handler.sjs"></script>
|
||||
<script>
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
global.Parser = {};
|
||||
import trees from './trees'
|
||||
export default {
|
||||
components: {
|
||||
trees
|
||||
},
|
||||
name: 'trees',
|
||||
data() {
|
||||
return {
|
||||
controls: {},
|
||||
// #ifdef MP-WEIXIN || MP-QQ || APP-PLUS
|
||||
imgLoad: false,
|
||||
// #endif
|
||||
// #ifndef APP-PLUS
|
||||
loadVideo: true
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
props: {
|
||||
nodes: Array,
|
||||
// #ifdef MP-WEIXIN || MP-QQ || H5 || APP-PLUS
|
||||
lazyLoad: Boolean,
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
loadVideo: Boolean
|
||||
// #endif
|
||||
},
|
||||
mounted() {
|
||||
// 获取顶层组件
|
||||
this.top = this.$parent;
|
||||
while (this.top.$options.name != 'parser') {
|
||||
if (this.top.top) {
|
||||
this.top = this.top.top;
|
||||
break;
|
||||
}
|
||||
this.top = this.top.$parent;
|
||||
}
|
||||
},
|
||||
// #ifdef MP-WEIXIN || MP-QQ || APP-PLUS
|
||||
beforeDestroy() {
|
||||
if (this.observer)
|
||||
this.observer.disconnect();
|
||||
},
|
||||
// #endif
|
||||
methods: {
|
||||
// #ifndef MP-ALIPAY
|
||||
play(e) {
|
||||
if (this.top.videoContexts.length > 1 && this.top.autopause)
|
||||
for (var i = this.top.videoContexts.length; i--;)
|
||||
if (this.top.videoContexts[i].id != e.currentTarget.dataset.id)
|
||||
this.top.videoContexts[i].pause();
|
||||
},
|
||||
// #endif
|
||||
imgtap(e) {
|
||||
var attrs = e.currentTarget.dataset.attrs;
|
||||
if (!attrs.ignore) {
|
||||
var preview = true, data = {
|
||||
id: e.target.id,
|
||||
src: attrs.src,
|
||||
ignore: () => preview = false
|
||||
};
|
||||
global.Parser.onImgtap && global.Parser.onImgtap(data);
|
||||
this.top.$emit('imgtap', data);
|
||||
if (preview) {
|
||||
var urls = this.top.imgList,
|
||||
current = urls[attrs.i] ? parseInt(attrs.i) : (urls = [attrs.src], 0);
|
||||
uni.previewImage({
|
||||
current,
|
||||
urls
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
imglongtap(e) {
|
||||
var attrs = e.item.dataset.attrs;
|
||||
if (!attrs.ignore)
|
||||
this.top.$emit('imglongtap', {
|
||||
id: e.target.id,
|
||||
src: attrs.src
|
||||
})
|
||||
},
|
||||
linkpress(e) {
|
||||
var jump = true,
|
||||
attrs = e.currentTarget.dataset.attrs;
|
||||
attrs.ignore = () => jump = false;
|
||||
global.Parser.onLinkpress && global.Parser.onLinkpress(attrs);
|
||||
this.top.$emit('linkpress', attrs);
|
||||
if (jump) {
|
||||
// #ifdef MP
|
||||
if (attrs['app-id']) {
|
||||
return uni.navigateToMiniProgram({
|
||||
appId: attrs['app-id'],
|
||||
path: attrs.path
|
||||
})
|
||||
}
|
||||
// #endif
|
||||
if (attrs.href) {
|
||||
if (attrs.href[0] == '#') {
|
||||
if (this.top.useAnchor)
|
||||
this.top.navigateTo({
|
||||
id: attrs.href.substring(1)
|
||||
})
|
||||
} else if (attrs.href.indexOf('http') == 0 || attrs.href.indexOf('//') == 0) {
|
||||
// #ifdef APP-PLUS
|
||||
plus.runtime.openWeb(attrs.href);
|
||||
// #endif
|
||||
// #ifndef APP-PLUS
|
||||
uni.setClipboardData({
|
||||
data: attrs.href,
|
||||
success: () =>
|
||||
uni.showToast({
|
||||
title: '链接已复制'
|
||||
})
|
||||
})
|
||||
// #endif
|
||||
} else
|
||||
uni.navigateTo({
|
||||
url: attrs.href
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
error(e) {
|
||||
var context, target = e.currentTarget,
|
||||
source = target.dataset.from;
|
||||
if (source == 'video' || source == 'audio') {
|
||||
// 加载其他 source
|
||||
var index = this.controls[target.id] ? this.controls[target.id].index + 1 : 1;
|
||||
if (index < target.dataset.source.length)
|
||||
this.$set(this.controls, target.id + '.index', index);
|
||||
if (source == 'video') context = uni.createVideoContext(target.id, this);
|
||||
}
|
||||
this.top && this.top.$emit('error', {
|
||||
source,
|
||||
target,
|
||||
errMsg: e.detail.errMsg,
|
||||
errCode: e.detail.errCode,
|
||||
context
|
||||
});
|
||||
},
|
||||
_loadVideo(e) {
|
||||
this.$set(this.controls, e.currentTarget.id, {
|
||||
play: true,
|
||||
index: 0
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* 在这里引入自定义样式 */
|
||||
|
||||
/* 链接和图片效果 */
|
||||
._a {
|
||||
display: inline;
|
||||
color: #366092;
|
||||
word-break: break-all;
|
||||
padding: 1.5px 0 1.5px 0;
|
||||
}
|
||||
|
||||
._hover {
|
||||
opacity: 0.7;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
._img {
|
||||
display: inline-block;
|
||||
text-indent: 0;
|
||||
}
|
||||
|
||||
/* #ifdef MP-WEIXIN */
|
||||
:host {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
|
||||
/* #ifdef MP */
|
||||
.interlayer {
|
||||
align-content: inherit;
|
||||
align-items: inherit;
|
||||
display: inherit;
|
||||
flex-direction: inherit;
|
||||
flex-wrap: inherit;
|
||||
justify-content: inherit;
|
||||
width: 100%;
|
||||
white-space: inherit;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
|
||||
._b,
|
||||
._strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
._blockquote,
|
||||
._div,
|
||||
._p,
|
||||
._ol,
|
||||
._ul,
|
||||
._li {
|
||||
display: block;
|
||||
}
|
||||
|
||||
._code {
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
._del {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
._em,
|
||||
._i {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
._h1 {
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
._h2 {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
._h3 {
|
||||
font-size: 1.17em;
|
||||
}
|
||||
|
||||
._h5 {
|
||||
font-size: 0.83em;
|
||||
}
|
||||
|
||||
._h6 {
|
||||
font-size: 0.67em;
|
||||
}
|
||||
|
||||
._h1,
|
||||
._h2,
|
||||
._h3,
|
||||
._h4,
|
||||
._h5,
|
||||
._h6 {
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
._ins {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
._li {
|
||||
flex: 1;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
._ol-bef {
|
||||
margin-right: 5px;
|
||||
text-align: right;
|
||||
width: 36px;
|
||||
}
|
||||
|
||||
._ul-bef {
|
||||
line-height: normal;
|
||||
margin: 0 12px 0 23px;
|
||||
}
|
||||
|
||||
._ol-bef,
|
||||
._ul_bef {
|
||||
flex: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
._ul-p1 {
|
||||
display: inline-block;
|
||||
height: 0.3em;
|
||||
line-height: 0.3em;
|
||||
overflow: hidden;
|
||||
width: 0.3em;
|
||||
}
|
||||
|
||||
._ul-p2 {
|
||||
border: 0.05em solid black;
|
||||
border-radius: 50%;
|
||||
display: inline-block;
|
||||
height: 0.23em;
|
||||
width: 0.23em;
|
||||
}
|
||||
|
||||
._q::before {
|
||||
content: '"';
|
||||
}
|
||||
|
||||
._q::after {
|
||||
content: '"';
|
||||
}
|
||||
|
||||
._sub {
|
||||
font-size: smaller;
|
||||
vertical-align: sub;
|
||||
}
|
||||
|
||||
._sup {
|
||||
font-size: smaller;
|
||||
vertical-align: super;
|
||||
}
|
||||
|
||||
/* #ifndef MP-WEIXIN */
|
||||
._abbr,
|
||||
._b,
|
||||
._code,
|
||||
._del,
|
||||
._em,
|
||||
._i,
|
||||
._ins,
|
||||
._label,
|
||||
._q,
|
||||
._span,
|
||||
._strong,
|
||||
._sub,
|
||||
._sup {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
|
||||
/* #ifdef MP-WEIXIN || MP-QQ || MP-ALIPAY */
|
||||
.__bdo,
|
||||
.__bdi,
|
||||
.__ruby,
|
||||
.__rt,
|
||||
._entity {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
._video {
|
||||
background-color: black;
|
||||
display: inline-block;
|
||||
height: 225px;
|
||||
position: relative;
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
._video::after {
|
||||
border-color: transparent transparent transparent white;
|
||||
border-style: solid;
|
||||
border-width: 15px 0 15px 30px;
|
||||
content: '';
|
||||
left: 50%;
|
||||
margin: -15px 0 0 -15px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
}
|
||||
</style>
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,12 @@
|
|||
// import CryptoJS from './crypto-js.js'
|
||||
/**
|
||||
* @word 要加密的内容
|
||||
* @keyWord String 服务器随机返回的关键字
|
||||
* */
|
||||
export function aesEncrypt(word,keyWord="XwKsGlMcdPMEhR1B"){
|
||||
// var key = CryptoJS.enc.Utf8.parse(keyWord);
|
||||
// var srcs = CryptoJS.enc.Utf8.parse(word);
|
||||
// var encrypted = CryptoJS.AES.encrypt(srcs, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
|
||||
// return encrypted.toString();
|
||||
return word
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,544 @@
|
|||
<template>
|
||||
<view style="position: relative">
|
||||
<view class="verify-image-out" v-show="showImage">
|
||||
<view class="verify-image-panel" :style="{'width': imgSize.width,
|
||||
'height': imgSize.height,
|
||||
'margin-bottom': vSpace + 'px'}">
|
||||
<view class="verify-refresh" style="z-index:3" @click="refresh" v-show="showRefresh">
|
||||
<text class="iconfont icon-refresh"></text>
|
||||
</view>
|
||||
<image :src="pointBackImgBase?('data:image/png;base64,'+pointBackImgBase):defaultImg" id="image"
|
||||
ref="canvas" style="width:100%;height:100%;display:block"
|
||||
@click=" bindingClick? canvasClick($event): undefined"></image>
|
||||
<view v-for="(tempPoint, index) in tempPoints" :key="index" class="point-area" :style="{
|
||||
'background-color':'#1abd6c',
|
||||
color:'#fff',
|
||||
'z-index':9999,
|
||||
width:'20px',
|
||||
height:'20px',
|
||||
'text-align':'center',
|
||||
'line-height':'20px',
|
||||
'border-radius': '50%',
|
||||
position:'absolute',
|
||||
top:parseInt(tempPoint.y-10) + 'px',
|
||||
left:parseInt(tempPoint.x-10) + 'px'
|
||||
}">
|
||||
{{index + 1}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 'height': this.barSize.height, -->
|
||||
<view class="verify-bar-area" :style="{'width': imgSize.width,
|
||||
'color': barAreaColor,
|
||||
'border-color': barAreaBorderColor,
|
||||
'line-height':'40px'}">
|
||||
<text class="verify-msg">{{text}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script type="text/babel">
|
||||
/**
|
||||
* VerifyPoints
|
||||
* @description 点选
|
||||
* */
|
||||
import {aesEncrypt} from "./../utils/ase.js"
|
||||
import {getAjcaptcha,ajcaptchaCheck} from '@/api/api.js';
|
||||
|
||||
export default {
|
||||
name: 'VerifyPoints',
|
||||
props: {
|
||||
//弹出式pop,固定fixed
|
||||
mode: {
|
||||
type: String,
|
||||
default: 'fixed'
|
||||
},
|
||||
captchaType:{
|
||||
type:String,
|
||||
},
|
||||
//间隔
|
||||
vSpace: {
|
||||
type: Number,
|
||||
default: 5
|
||||
},
|
||||
imgSize: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {
|
||||
width: '310px',
|
||||
height: '155px'
|
||||
}
|
||||
}
|
||||
},
|
||||
barSize: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {
|
||||
width: '310px',
|
||||
height: '40px'
|
||||
}
|
||||
}
|
||||
},
|
||||
defaultImg: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
secretKey:'', //后端返回的加密秘钥 字段
|
||||
checkNum:3, //
|
||||
fontPos: [], // 选中的坐标信息
|
||||
checkPosArr: [], //用户点击的坐标
|
||||
num: 1, //点击的记数
|
||||
pointBackImgBase:'', //后端获取到的背景图片
|
||||
poinTextList:[], //后端返回的点击字体顺序
|
||||
backToken:'', //后端返回的token值
|
||||
imgRand: 0, //随机的背景图片
|
||||
setSize: {
|
||||
imgHeight: 0,
|
||||
imgWidth: 0,
|
||||
barHeight: 0,
|
||||
barWidth: 0
|
||||
},
|
||||
showImage: true,
|
||||
tempPoints: [],
|
||||
text: '',
|
||||
barAreaColor: '#fff',
|
||||
barAreaBorderColor: "#fff",
|
||||
showRefresh: true,
|
||||
bindingClick: true,
|
||||
imgLeft:'' ,
|
||||
imgTop:'',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
//加载页面
|
||||
this.fontPos.splice(0, this.fontPos.length)
|
||||
this.checkPosArr.splice(0, this.checkPosArr.length)
|
||||
this.num = 1
|
||||
this.$nextTick(() => {
|
||||
this.refresh();
|
||||
this.$parent.$emit('ready', this)
|
||||
})
|
||||
},
|
||||
canvasClick(e) {
|
||||
const query = uni.createSelectorQuery().in(this);
|
||||
query.select('#image').boundingClientRect(data => {
|
||||
this.imgLeft =Math.ceil(data.left)
|
||||
this.imgTop =Math.ceil(data.top)
|
||||
this.checkPosArr.push(this.getMousePos(this.$refs.canvas, e));
|
||||
if (this.num == this.checkNum) {
|
||||
this.num = this.createPoint(this.getMousePos(this.$refs.canvas, e));
|
||||
//按比例转换坐标值
|
||||
this.checkPosArr = this.pointTransfrom(this.checkPosArr,this.imgSize);
|
||||
//等创建坐标执行完
|
||||
setTimeout(() => {
|
||||
//发送后端请求
|
||||
var captchaVerification =this.secretKey? aesEncrypt(this.backToken+'---'+JSON.stringify(this.checkPosArr),this.secretKey):this.backToken+'---'+JSON.stringify(this.checkPosArr)
|
||||
let data = {
|
||||
captchaType:this.captchaType,
|
||||
"pointJson":this.secretKey? aesEncrypt(JSON.stringify(this.checkPosArr),this.secretKey):JSON.stringify(this.checkPosArr),
|
||||
"token":this.backToken
|
||||
}
|
||||
ajcaptchaCheck(data).then(result => {
|
||||
let res = result.data
|
||||
this.barAreaColor = '#4cae4c'
|
||||
this.barAreaBorderColor = '#5cb85c'
|
||||
this.text = '验证成功'
|
||||
this.bindingClick = false
|
||||
setTimeout(()=>{
|
||||
if (this.mode=='pop') {
|
||||
this.$parent.clickShow = false;
|
||||
}
|
||||
this.refresh();
|
||||
},1500)
|
||||
this.$parent.$emit('success', {captchaVerification})
|
||||
}).catch(res=>{
|
||||
this.$parent.$emit('error', this)
|
||||
this.barAreaColor = '#d9534f'
|
||||
this.barAreaBorderColor = '#d9534f'
|
||||
this.text = '验证失败'
|
||||
setTimeout(() => {
|
||||
this.refresh();
|
||||
}, 700);
|
||||
})
|
||||
}, 400);
|
||||
}
|
||||
if (this.num < this.checkNum) {
|
||||
this.num = this.createPoint(this.getMousePos(this.$refs.canvas, e));
|
||||
}
|
||||
}).exec();
|
||||
},
|
||||
//获取坐标
|
||||
getMousePos: function (obj, e) {
|
||||
let position = {
|
||||
x:Math.ceil(e.detail.x)-this.imgLeft,
|
||||
y:Math.ceil(e.detail.y)-this.imgTop,
|
||||
}
|
||||
return position
|
||||
},
|
||||
//创建坐标点
|
||||
createPoint: function (pos) {
|
||||
this.tempPoints.push(Object.assign({}, pos))
|
||||
return ++this.num;
|
||||
},
|
||||
refresh: function () {
|
||||
this.tempPoints.splice(0, this.tempPoints.length)
|
||||
this.barAreaColor = '#000'
|
||||
this.barAreaBorderColor = '#ddd'
|
||||
this.bindingClick = true
|
||||
|
||||
this.fontPos.splice(0, this.fontPos.length)
|
||||
this.checkPosArr.splice(0, this.checkPosArr.length)
|
||||
this.num = 1
|
||||
|
||||
this.getPictrue();
|
||||
|
||||
// this.text = '验证失败'
|
||||
this.showRefresh = true
|
||||
},
|
||||
// 请求背景图片和验证图片
|
||||
getPictrue(){
|
||||
let data = {
|
||||
captchaType:this.captchaType,
|
||||
clientUid: uni.getStorageSync('point'),
|
||||
ts: Date.now(), // 现在的时间戳
|
||||
}
|
||||
getAjcaptcha(data).then((result) => {
|
||||
let res = result.data
|
||||
this.pointBackImgBase = res.originalImageBase64
|
||||
this.backToken = res.token
|
||||
this.secretKey = res.secretKey
|
||||
this.poinTextList = res.wordList
|
||||
this.text = '请依次点击【' + this.poinTextList.join(",") + '】'
|
||||
}).catch(()=>{
|
||||
this.pointBackImgBase = null
|
||||
})
|
||||
},
|
||||
//坐标转换函数
|
||||
pointTransfrom(pointArr,imgSize){
|
||||
var newPointArr = pointArr.map(p=>{
|
||||
let x = Math.round(310 * p.x/parseInt(imgSize.width))
|
||||
let y =Math.round(155 * p.y/parseInt(imgSize.height))
|
||||
return {x,y}
|
||||
})
|
||||
// console.log(newPointArr,"newPointArr");
|
||||
return newPointArr
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
// type变化则全面刷新
|
||||
type: {
|
||||
immediate: true,
|
||||
handler() {
|
||||
this.init()
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// console.log(this.defaultImg)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.verifybox {
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
border-radius: 2px;
|
||||
border: 1px solid #e4e7eb;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, .3);
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.verifybox-top {
|
||||
padding: 0 15px;
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
text-align: left;
|
||||
font-size: 16px;
|
||||
color: #45494c;
|
||||
border-bottom: 1px solid #e4e7eb;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.verifybox-bottom {
|
||||
/* padding: 15px; */
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.verifybox-close {
|
||||
position: absolute;
|
||||
top: 13px;
|
||||
right: 9px;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 1001;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
background: rgba(0, 0, 0, .3);
|
||||
/* display: none; */
|
||||
transition: all .5s;
|
||||
}
|
||||
|
||||
.verify-tips {
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
bottom: 0px;
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
background-color: rgb(231, 27, 27, .5);
|
||||
line-height: 30px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.tips-enter,
|
||||
.tips-leave-to {
|
||||
bottom: -30px;
|
||||
}
|
||||
|
||||
.tips-enter-active,
|
||||
.tips-leave-active {
|
||||
transition: bottom .5s;
|
||||
}
|
||||
|
||||
/* ---------------------------- */
|
||||
/*常规验证码*/
|
||||
.verify-code {
|
||||
font-size: 20px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
margin-bottom: 5px;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.cerify-code-panel {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.verify-code-area {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.verify-input-area {
|
||||
float: left;
|
||||
width: 60%;
|
||||
padding-right: 10px;
|
||||
|
||||
}
|
||||
|
||||
.verify-change-area {
|
||||
line-height: 30px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.varify-input-code {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
height: 25px;
|
||||
}
|
||||
|
||||
.verify-change-code {
|
||||
color: #337AB7;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.verify-btn {
|
||||
width: 200px;
|
||||
height: 30px;
|
||||
background-color: #337AB7;
|
||||
color: #FFFFFF;
|
||||
border: none;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
|
||||
/*滑动验证码*/
|
||||
.verify-bar-area {
|
||||
position: relative;
|
||||
background: #FFFFFF;
|
||||
text-align: center;
|
||||
-webkit-box-sizing: content-box;
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
border: 1px solid #ddd;
|
||||
-webkit-border-radius: 4px;
|
||||
}
|
||||
|
||||
.verify-bar-area .verify-move-block {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0;
|
||||
background: #fff;
|
||||
cursor: pointer;
|
||||
-webkit-box-sizing: content-box;
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
box-shadow: 0 0 2px #888888;
|
||||
-webkit-border-radius: 1px;
|
||||
}
|
||||
|
||||
.verify-bar-area .verify-move-block:hover {
|
||||
background-color: #337ab7;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.verify-bar-area .verify-left-bar {
|
||||
position: absolute;
|
||||
top: -1px;
|
||||
left: -1px;
|
||||
background: #f0fff0;
|
||||
cursor: pointer;
|
||||
-webkit-box-sizing: content-box;
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.verify-image-panel {
|
||||
margin: 0;
|
||||
-webkit-box-sizing: content-box;
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
border-top: 1px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
border-radius: 3px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.verify-image-panel .verify-refresh {
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
text-align: center;
|
||||
padding: 5px;
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.verify-image-panel .icon-refresh {
|
||||
font-size: 20px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.verify-image-panel .verify-gap {
|
||||
background-color: #fff;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
border: 1px solid #fff;
|
||||
}
|
||||
|
||||
.verify-bar-area .verify-move-block .verify-sub-block {
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
z-index: 3;
|
||||
/* border: 1px solid #fff; */
|
||||
}
|
||||
|
||||
.verify-bar-area .verify-move-block .verify-icon {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.verify-bar-area .verify-msg {
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
/*字体图标的css*/
|
||||
/*@font-face {font-family: "iconfont";*/
|
||||
/*src: url('../fonts/iconfont.eot?t=1508229193188'); !* IE9*!*/
|
||||
/*src: url('../fonts/iconfont.eot?t=1508229193188#iefix') format('embedded-opentype'), !* IE6-IE8 *!*/
|
||||
/*url('data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAAaAAAsAAAAACUwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADMAAABCsP6z7U9TLzIAAAE8AAAARAAAAFZW7kiSY21hcAAAAYAAAAB3AAABuM+qBlRnbHlmAAAB+AAAAnQAAALYnrUwT2hlYWQAAARsAAAALwAAADYPNwajaGhlYQAABJwAAAAcAAAAJAfeA4dobXR4AAAEuAAAABMAAAAYF+kAAGxvY2EAAATMAAAADgAAAA4CvAGsbWF4cAAABNwAAAAfAAAAIAEVAF1uYW1lAAAE/AAAAUUAAAJtPlT+fXBvc3QAAAZEAAAAPAAAAE3oPPXPeJxjYGRgYOBikGPQYWB0cfMJYeBgYGGAAJAMY05meiJQDMoDyrGAaQ4gZoOIAgCKIwNPAHicY2Bk/sM4gYGVgYOpk+kMAwNDP4RmfM1gxMjBwMDEwMrMgBUEpLmmMDgwVDxbwtzwv4EhhrmBoQEozAiSAwAw1A0UeJzFkcENgCAMRX8RjCGO4gTe9eQcnhzAfXC2rqG/hYsT8MmD9gdS0gJIAAaykAjIBYHppCvuD8juR6zMJ67A89Zdn/f1aNPikUn8RvYo8G20CjKim6Rf6b9m34+WWd/vBr+oW8V6q3vF5qKlYrPRp4L0Ad5nGL8AeJxFUc9rE0EYnTezu8lMsrvtbrqb3TRt0rS7bdOmdI0JbWmCtiItIv5oi14qevCk9SQVLFiQgqAF8Q9QLKIHLx48FkHo3ZNnFUXwD5C2B6dO6sFhmI83w7z3fe8RnZCjb2yX5YlLhskkmScXCIFRxYBFiyjH9Rqtoqes9/g5i8WVuJyqDNTYLPwBI+cljXrkGynDhoU+nCgnjbhGY5yst+gMEq8IBIXwsjPU67CnEPm4b0su0h309Fd67da4XBhr55KSm17POk7gOE/Shq6nKdVsC7d9j+tcGPKVboc9u/0jtB/ZIA7PXTVLBef6o/paccjnwOYm3ELJetPuDrvV3gg91wlSXWY6H5qVwRzWf2TybrYYfSdqoXOwh/Qa8RWIjBTiSI3h614/vKSNRhONOrsnQi6Xf4nQFQDTmJE1NKbhI6crHEJO/+S5QPxhYJRRyvBFBP+5T9EPpEAIVzzRQIrjmJ6jY1WTo+NXTMchuBsKuS8PRZATSMl9oTA4uNLkeIA0V1UeqOoGQh7IAxGo+7T83fn3T+voqCNPPAUazUYUI7LgKSV1Jk2oUeghYGhZ+cKOe2FjVu5ZKEY2VkE13AK1+jI4r1KLbPlZfrKiPhOXKPRj7q9sj9XJ7LFHNmrKJS3VCdhXGSdKrtmoQaWeMjQVt0KD6sGPOx0oH2fgtzoNROxtNq8F3tzYM/n+TjKSX5qf2jx941276TIr9FjXxKr8eX/6bK4yuopwo9py1sw8F9kdw4AmurRpLUM3tYx5ZnKpfHPi8dzz19vJ6MjyxYUrpqeb1uLs3eGV6vr21pSqpeWkqonAN9oUyIiXpv8XvlN5e3icY2BkYGAA4n0vN4fG89t8ZeBmYQCBa9wPPRH0/wcsDMwmQC4HAxNIFABAfAqaAHicY2BkYGBu+N/AEMPCAAJAkpEBFbABAEcMAm94nGNhYGBgfsnAwMKAigESnwEBAAAAAAAAdgCkANoBCAFsAAB4nGNgZGBgYGMIZGBlAAEmIOYCQgaG/2A+AwARSAFzAHicZY9NTsMwEIVf+gekEqqoYIfkBWIBKP0Rq25YVGr3XXTfpk6bKokjx63UA3AejsAJOALcgDvwSCebNpbH37x5Y08A3OAHHo7fLfeRPVwyO3INF7gXrlN/EG6QX4SbaONVuEX9TdjHM6bCbXRheYPXuGL2hHdhDx18CNdwjU/hOvUv4Qb5W7iJO/wKt9Dx6sI+5l5XuI1HL/bHVi+cXqnlQcWhySKTOb+CmV7vkoWt0uqca1vEJlODoF9JU51pW91T7NdD5yIVWZOqCas6SYzKrdnq0AUb5/JRrxeJHoQm5Vhj/rbGAo5xBYUlDowxQhhkiMro6DtVZvSvsUPCXntWPc3ndFsU1P9zhQEC9M9cU7qy0nk6T4E9XxtSdXQrbsuelDSRXs1JErJCXta2VELqATZlV44RelzRiT8oZ0j/AAlabsgAAAB4nGNgYoAALgbsgI2RiZGZkYWRlZGNkZ2BsYI1OSM1OZs1OSe/OJW1KDM9o4S9KDWtKLU4g4EBAJ79CeQ=') format('woff'),*/
|
||||
/*url('../fonts/iconfont.ttf?t=1508229193188') format('truetype'), !* chrome, firefox, opera, Safari, Android, iOS 4.2+*!*/
|
||||
/*url('../fonts/iconfont.svg?t=1508229193188#iconfont') format('svg'); !* iOS 4.1- *!*/
|
||||
/*}*/
|
||||
|
||||
.iconfont {
|
||||
font-family: "iconfont" !important;
|
||||
font-size: 16px;
|
||||
font-style: normal;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.icon-check:before {
|
||||
content: " ";
|
||||
display: block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
position: absolute;
|
||||
margin: auto;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
z-index: 9999;
|
||||
background-image: url("@/static/images/arrow-good.png");
|
||||
background-size: contain;
|
||||
}
|
||||
|
||||
.icon-close:before {
|
||||
content: " ";
|
||||
display: block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
position: absolute;
|
||||
margin: auto;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
z-index: 9999;
|
||||
background-image: url("@/static/images/arrow-close.png");
|
||||
background-size: contain;
|
||||
}
|
||||
|
||||
.icon-right:before {
|
||||
content: " ";
|
||||
display: block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
position: absolute;
|
||||
margin: auto;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
background-size: cover;
|
||||
z-index: 9999;
|
||||
background-image: url("@/static/images/arrow-right.png");
|
||||
background-size: contain;
|
||||
}
|
||||
|
||||
.icon-refresh:before {
|
||||
content: " ";
|
||||
display: block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
position: absolute;
|
||||
margin: auto;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
z-index: 9999;
|
||||
background-image: url("@/static/images/refresh.png");
|
||||
background-size: contain;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,648 @@
|
|||
<template>
|
||||
<view style="position: relative;">
|
||||
<view v-if="type === '2'" class="verify-img-out" :style="{height: (parseInt(imgSize.height) + vSpace) + 'px'}">
|
||||
<view class="verify-img-panel" :style="{width: imgSize.width,
|
||||
height: imgSize.height,}">
|
||||
|
||||
<image :src="backImgBase?('data:image/png;base64,'+backImgBase):defaultImg" alt=""
|
||||
style="width:100%;height:100%;display:block"></image>
|
||||
<view class="verify-refresh" @click="refresh" v-show="showRefresh">
|
||||
<text class="iconfont icon-refresh"></text>
|
||||
</view>
|
||||
<transition name="tips">
|
||||
<text class="verify-tips" v-if="tipWords" :class="passFalg ? 'suc-bg':'err-bg'">{{tipWords}}</text>
|
||||
</transition>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 公共部分 -->
|
||||
<view class="verify-bar-area" :style="{width: imgSize.width,
|
||||
height: '40px',
|
||||
'line-height':'40px'}">
|
||||
<text class="verify-msg" v-text="text"></text>
|
||||
<view class="verify-left-bar"
|
||||
:style="{width: leftBarWidth?leftBarWidth:'40px', height: '40px', 'border-color': leftBarBorderColor, transaction: transitionWidth}">
|
||||
<text class="verify-msg" v-text="finishText"></text>
|
||||
<view class="verify-move-block" @touchstart="start" @touchend="end" @touchmove="move"
|
||||
:style="{width:'40px', height: '40px', 'background-color': moveBlockBackgroundColor, left: moveBlockLeft, transition: transitionLeft}">
|
||||
<text :class="['verify-icon iconfont', iconClass]" :style="{color: iconColor}"></text>
|
||||
<view v-if="type === '2'" class="verify-sub-block" :style="{'width':Math.floor(parseInt(imgSize.width)*47/310)+ 'px' ,
|
||||
'height': imgSize.height,
|
||||
'top':'-' + (parseInt(imgSize.height) + vSpace) + 'px',
|
||||
}">
|
||||
<image :src="'data:image/png;base64,'+blockBackImgBase" alt=""
|
||||
style="width:100%;height:100%;display:block"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
/**
|
||||
* VerifySlide
|
||||
* @description 滑块
|
||||
* */
|
||||
import {
|
||||
aesEncrypt
|
||||
} from "./../utils/ase.js"
|
||||
import {
|
||||
getAjcaptcha,
|
||||
ajcaptchaCheck
|
||||
} from '@/api/api.js';
|
||||
|
||||
export default {
|
||||
name: 'VerifySlide',
|
||||
props: {
|
||||
captchaType: {
|
||||
type: String,
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: '1'
|
||||
},
|
||||
//弹出式pop,固定fixed
|
||||
mode: {
|
||||
type: String,
|
||||
default: 'fixed'
|
||||
},
|
||||
vSpace: {
|
||||
type: Number,
|
||||
default: 5
|
||||
},
|
||||
explain: {
|
||||
type: String,
|
||||
default: '向右滑动完成验证'
|
||||
},
|
||||
imgSize: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {
|
||||
width: '310px',
|
||||
height: '155px'
|
||||
}
|
||||
}
|
||||
},
|
||||
blockSize: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {
|
||||
width: '50px',
|
||||
height: '50px'
|
||||
}
|
||||
}
|
||||
},
|
||||
barSize: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {
|
||||
width: '100%',
|
||||
height: '40px'
|
||||
}
|
||||
}
|
||||
},
|
||||
defaultImg: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
secretKey: '', //后端返回的加密秘钥 字段
|
||||
passFalg: false, //请求通过与否
|
||||
backImgBase: '', //验证码背景图片
|
||||
blockBackImgBase: '', //验证滑块的背景图片
|
||||
backToken: "", //后端返回的唯一token值
|
||||
startMoveTime: "", //移动开始的时间
|
||||
endMovetime: '', //移动结束的时间
|
||||
tipsBackColor: '', //提示词的北京颜色
|
||||
tipWords: '',
|
||||
text: '',
|
||||
finishText: '',
|
||||
setSize: {
|
||||
imgHeight: 0,
|
||||
imgWidth: 0,
|
||||
barHeight: 0,
|
||||
barWidth: 0
|
||||
},
|
||||
top: 0,
|
||||
left: 0,
|
||||
moveBlockLeft: undefined,
|
||||
leftBarWidth: undefined,
|
||||
// 移动中样式
|
||||
moveBlockBackgroundColor: undefined,
|
||||
leftBarBorderColor: '#ddd',
|
||||
iconColor: undefined,
|
||||
iconClass: 'icon-right',
|
||||
status: false, //鼠标状态
|
||||
isEnd: false, //是够验证完成
|
||||
showRefresh: true,
|
||||
transitionLeft: '',
|
||||
transitionWidth: ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.text = this.explain
|
||||
this.getPictrue();
|
||||
this.$nextTick(() => {
|
||||
this.$parent.$emit('ready', this)
|
||||
})
|
||||
},
|
||||
|
||||
//鼠标按下
|
||||
start: function(e) {
|
||||
this.startMoveTime = new Date().getTime(); //开始滑动的时间
|
||||
if (this.isEnd == false) {
|
||||
this.text = ''
|
||||
this.moveBlockBackgroundColor = '#337ab7'
|
||||
this.leftBarBorderColor = '#337AB7'
|
||||
this.iconColor = '#fff'
|
||||
e.stopPropagation();
|
||||
this.status = true;
|
||||
}
|
||||
},
|
||||
//鼠标移动
|
||||
move: function(e) {
|
||||
var query = uni.createSelectorQuery().in(this);
|
||||
this.barArea = query.select('.verify-bar-area')
|
||||
var bar_area_left, barArea_offsetWidth;
|
||||
this.barArea.boundingClientRect(data => {
|
||||
bar_area_left = Math.ceil(data.left)
|
||||
barArea_offsetWidth = Math.ceil(data.width)
|
||||
|
||||
if (this.status && this.isEnd == false) {
|
||||
if (!e.touches) { //兼容移动端
|
||||
var x = Math.ceil(e.clientX);
|
||||
} else { //兼容PC端
|
||||
var x = Math.ceil(e.touches[0].pageX);
|
||||
}
|
||||
// var bar_area_left = this.getLeft(this.barArea);
|
||||
|
||||
var move_block_left = x - bar_area_left //小方块相对于父元素的left值
|
||||
if (this.type !== '1') { //图片滑动
|
||||
if (move_block_left >= barArea_offsetWidth - parseInt(parseInt(this.blockSize
|
||||
.width) / 2) - 2) {
|
||||
move_block_left = barArea_offsetWidth - parseInt(parseInt(this.blockSize
|
||||
.width) / 2) - 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (move_block_left <= 0) {
|
||||
move_block_left = parseInt(parseInt(this.blockSize.width) / 2);
|
||||
}
|
||||
|
||||
//拖动后小方块的left值
|
||||
this.moveBlockLeft = (move_block_left - parseInt(parseInt(this.blockSize.width) / 2)) +
|
||||
"px"
|
||||
this.leftBarWidth = (move_block_left - parseInt(parseInt(this.blockSize.width) / 2)) +
|
||||
"px"
|
||||
|
||||
}
|
||||
}).exec();
|
||||
},
|
||||
|
||||
//鼠标松开
|
||||
end: function() {
|
||||
this.endMovetime = new Date().getTime();
|
||||
var _this = this;
|
||||
// 判断是否重合
|
||||
if (this.status && this.isEnd == false) {
|
||||
if (this.type !== '1') { //图片滑动
|
||||
var moveLeftDistance = parseInt((this.moveBlockLeft || '').replace('px', ''));
|
||||
|
||||
moveLeftDistance = moveLeftDistance * 310 / parseInt(this.imgSize.width)
|
||||
|
||||
var captchaVerification = this.secretKey ? aesEncrypt(this.backToken + '---' + JSON.stringify({
|
||||
x: moveLeftDistance,
|
||||
y: 5.0
|
||||
}), this.secretKey) : this.backToken + '---' + JSON.stringify({
|
||||
x: moveLeftDistance,
|
||||
y: 5.0
|
||||
})
|
||||
let data = {
|
||||
captchaType: this.captchaType,
|
||||
"pointJson": this.secretKey ? aesEncrypt(JSON.stringify({
|
||||
x: moveLeftDistance,
|
||||
y: 5.0
|
||||
}), this.secretKey) : JSON.stringify({
|
||||
x: moveLeftDistance,
|
||||
y: 5.0
|
||||
}),
|
||||
"token": this.backToken
|
||||
}
|
||||
ajcaptchaCheck(data).then((result) => {
|
||||
let res = result.data
|
||||
this.moveBlockBackgroundColor = '#5cb85c'
|
||||
this.leftBarBorderColor = '#5cb85c'
|
||||
this.iconColor = '#fff'
|
||||
this.iconClass = 'icon-check'
|
||||
this.showRefresh = true
|
||||
this.isEnd = true;
|
||||
setTimeout(() => {
|
||||
if (this.mode == 'pop') {
|
||||
this.$parent.clickShow = false;
|
||||
}
|
||||
this.refresh();
|
||||
}, 1500)
|
||||
this.passFalg = true
|
||||
this.tipWords =
|
||||
`${((this.endMovetime-this.startMoveTime)/1000).toFixed(2)}s验证成功`
|
||||
setTimeout(() => {
|
||||
this.tipWords = ""
|
||||
this.$emit('success', {
|
||||
captchaVerification
|
||||
})
|
||||
}, 1000)
|
||||
}).catch(res => {
|
||||
this.moveBlockBackgroundColor = '#d9534f'
|
||||
this.leftBarBorderColor = '#d9534f'
|
||||
this.iconColor = '#fff'
|
||||
this.iconClass = 'icon-close'
|
||||
this.passFalg = false
|
||||
setTimeout(() => {
|
||||
this.refresh();
|
||||
}, 1000);
|
||||
this.$parent.$emit('error', this)
|
||||
this.tipWords = "验证失败"
|
||||
setTimeout(() => {
|
||||
this.tipWords = ""
|
||||
}, 1000)
|
||||
})
|
||||
}
|
||||
this.status = false;
|
||||
}
|
||||
},
|
||||
refresh: function() {
|
||||
this.showRefresh = true
|
||||
this.finishText = ''
|
||||
this.transitionLeft = 'left .3s'
|
||||
this.moveBlockLeft = 0
|
||||
this.leftBarWidth = false
|
||||
this.transitionWidth = 'width .3s'
|
||||
this.leftBarBorderColor = '#ddd'
|
||||
this.moveBlockBackgroundColor = '#fff'
|
||||
this.iconColor = '#000'
|
||||
this.iconClass = 'icon-right'
|
||||
this.getPictrue()
|
||||
this.isEnd = false
|
||||
setTimeout(() => {
|
||||
this.transitionWidth = ''
|
||||
this.transitionLeft = ''
|
||||
this.text = this.explain
|
||||
}, 300)
|
||||
},
|
||||
|
||||
//获取left值
|
||||
getLeft: function(node) {
|
||||
let leftValue = 0;
|
||||
while (node) {
|
||||
leftValue += node.offsetLeft;
|
||||
node = node.offsetParent;
|
||||
}
|
||||
let finalvalue = leftValue;
|
||||
return finalvalue;
|
||||
},
|
||||
|
||||
// 请求背景图片和验证图片
|
||||
getPictrue() {
|
||||
let data = {
|
||||
captchaType: this.captchaType,
|
||||
clientUid: uni.getStorageSync('slider'),
|
||||
ts: Date.now(), // 现在的时间戳
|
||||
}
|
||||
getAjcaptcha(data).then((result) => {
|
||||
let res = result.data
|
||||
this.backImgBase = res.originalImageBase64
|
||||
this.blockBackImgBase = res.jigsawImageBase64
|
||||
this.backToken = res.token
|
||||
this.secretKey = res.secretKey
|
||||
}).catch(() => {
|
||||
this.backImgBase = null
|
||||
this.blockBackImgBase = null
|
||||
})
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
// type变化则全面刷新
|
||||
type: {
|
||||
immediate: true,
|
||||
handler() {
|
||||
this.init()
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.verifybox {
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
border-radius: 2px;
|
||||
border: 1px solid #e4e7eb;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, .3);
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.verifybox-top {
|
||||
padding: 0 15px;
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
text-align: left;
|
||||
font-size: 16px;
|
||||
color: #45494c;
|
||||
border-bottom: 1px solid #e4e7eb;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.verifybox-bottom {
|
||||
/* padding: 15px; */
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.verifybox-close {
|
||||
position: absolute;
|
||||
top: 13px;
|
||||
right: 9px;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 1001;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
background: rgba(0, 0, 0, .3);
|
||||
/* display: none; */
|
||||
transition: all .5s;
|
||||
}
|
||||
|
||||
.verify-tips {
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
bottom: 0px;
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
background-color: rgb(231, 27, 27, .5);
|
||||
line-height: 30px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.suc-bg {
|
||||
background-color: rgba(92, 184, 92, .5);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startcolorstr=#7f5CB85C, endcolorstr=#7f5CB85C);
|
||||
}
|
||||
|
||||
.err-bg {
|
||||
background-color: rgba(217, 83, 79, .5);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startcolorstr=#7fD9534F, endcolorstr=#7fD9534F);
|
||||
}
|
||||
|
||||
|
||||
.tips-enter,
|
||||
.tips-leave-to {
|
||||
bottom: -30px;
|
||||
}
|
||||
|
||||
.tips-enter-active,
|
||||
.tips-leave-active {
|
||||
transition: bottom .5s;
|
||||
}
|
||||
|
||||
/* ---------------------------- */
|
||||
/*常规验证码*/
|
||||
.verify-code {
|
||||
font-size: 20px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
margin-bottom: 5px;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.cerify-code-panel {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.verify-code-area {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.verify-input-area {
|
||||
float: left;
|
||||
width: 60%;
|
||||
padding-right: 10px;
|
||||
|
||||
}
|
||||
|
||||
.verify-change-area {
|
||||
line-height: 30px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.varify-input-code {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
height: 25px;
|
||||
}
|
||||
|
||||
.verify-change-code {
|
||||
color: #337AB7;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.verify-btn {
|
||||
width: 200px;
|
||||
height: 30px;
|
||||
background-color: #337AB7;
|
||||
color: #FFFFFF;
|
||||
border: none;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
|
||||
/*滑动验证码*/
|
||||
.verify-bar-area {
|
||||
position: relative;
|
||||
background: #FFFFFF;
|
||||
text-align: center;
|
||||
-webkit-box-sizing: content-box;
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
border: 1px solid #ddd;
|
||||
-webkit-border-radius: 4px;
|
||||
}
|
||||
|
||||
.verify-bar-area .verify-move-block {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0;
|
||||
background: #fff;
|
||||
cursor: pointer;
|
||||
-webkit-box-sizing: content-box;
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
box-shadow: 0 0 2px #888888;
|
||||
-webkit-border-radius: 1px;
|
||||
}
|
||||
|
||||
.verify-bar-area .verify-move-block:hover {
|
||||
background-color: #337ab7;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.verify-bar-area .verify-left-bar {
|
||||
position: absolute;
|
||||
top: -1px;
|
||||
left: -1px;
|
||||
background: #f0fff0;
|
||||
cursor: pointer;
|
||||
-webkit-box-sizing: content-box;
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.verify-img-panel {
|
||||
margin: 0;
|
||||
-webkit-box-sizing: content-box;
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
border-top: 1px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
border-radius: 3px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.verify-img-panel .verify-refresh {
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
text-align: center;
|
||||
padding: 5px;
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.verify-img-panel .icon-refresh {
|
||||
font-size: 20px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.verify-img-panel .verify-gap {
|
||||
background-color: #fff;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
border: 1px solid #fff;
|
||||
}
|
||||
|
||||
.verify-bar-area .verify-move-block .verify-sub-block {
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
z-index: 3;
|
||||
/* border: 1px solid #fff; */
|
||||
}
|
||||
|
||||
.verify-bar-area .verify-move-block .verify-icon {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.verify-bar-area .verify-msg {
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
/*字体图标的css*/
|
||||
/*@font-face {font-family: "iconfont";*/
|
||||
/*src: url('../fonts/iconfont.eot?t=1508229193188'); !* IE9*!*/
|
||||
/*src: url('../fonts/iconfont.eot?t=1508229193188#iefix') format('embedded-opentype'), !* IE6-IE8 *!*/
|
||||
/*url('data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAAaAAAsAAAAACUwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADMAAABCsP6z7U9TLzIAAAE8AAAARAAAAFZW7kiSY21hcAAAAYAAAAB3AAABuM+qBlRnbHlmAAAB+AAAAnQAAALYnrUwT2hlYWQAAARsAAAALwAAADYPNwajaGhlYQAABJwAAAAcAAAAJAfeA4dobXR4AAAEuAAAABMAAAAYF+kAAGxvY2EAAATMAAAADgAAAA4CvAGsbWF4cAAABNwAAAAfAAAAIAEVAF1uYW1lAAAE/AAAAUUAAAJtPlT+fXBvc3QAAAZEAAAAPAAAAE3oPPXPeJxjYGRgYOBikGPQYWB0cfMJYeBgYGGAAJAMY05meiJQDMoDyrGAaQ4gZoOIAgCKIwNPAHicY2Bk/sM4gYGVgYOpk+kMAwNDP4RmfM1gxMjBwMDEwMrMgBUEpLmmMDgwVDxbwtzwv4EhhrmBoQEozAiSAwAw1A0UeJzFkcENgCAMRX8RjCGO4gTe9eQcnhzAfXC2rqG/hYsT8MmD9gdS0gJIAAaykAjIBYHppCvuD8juR6zMJ67A89Zdn/f1aNPikUn8RvYo8G20CjKim6Rf6b9m34+WWd/vBr+oW8V6q3vF5qKlYrPRp4L0Ad5nGL8AeJxFUc9rE0EYnTezu8lMsrvtbrqb3TRt0rS7bdOmdI0JbWmCtiItIv5oi14qevCk9SQVLFiQgqAF8Q9QLKIHLx48FkHo3ZNnFUXwD5C2B6dO6sFhmI83w7z3fe8RnZCjb2yX5YlLhskkmScXCIFRxYBFiyjH9Rqtoqes9/g5i8WVuJyqDNTYLPwBI+cljXrkGynDhoU+nCgnjbhGY5yst+gMEq8IBIXwsjPU67CnEPm4b0su0h309Fd67da4XBhr55KSm17POk7gOE/Shq6nKdVsC7d9j+tcGPKVboc9u/0jtB/ZIA7PXTVLBef6o/paccjnwOYm3ELJetPuDrvV3gg91wlSXWY6H5qVwRzWf2TybrYYfSdqoXOwh/Qa8RWIjBTiSI3h614/vKSNRhONOrsnQi6Xf4nQFQDTmJE1NKbhI6crHEJO/+S5QPxhYJRRyvBFBP+5T9EPpEAIVzzRQIrjmJ6jY1WTo+NXTMchuBsKuS8PRZATSMl9oTA4uNLkeIA0V1UeqOoGQh7IAxGo+7T83fn3T+voqCNPPAUazUYUI7LgKSV1Jk2oUeghYGhZ+cKOe2FjVu5ZKEY2VkE13AK1+jI4r1KLbPlZfrKiPhOXKPRj7q9sj9XJ7LFHNmrKJS3VCdhXGSdKrtmoQaWeMjQVt0KD6sGPOx0oH2fgtzoNROxtNq8F3tzYM/n+TjKSX5qf2jx941276TIr9FjXxKr8eX/6bK4yuopwo9py1sw8F9kdw4AmurRpLUM3tYx5ZnKpfHPi8dzz19vJ6MjyxYUrpqeb1uLs3eGV6vr21pSqpeWkqonAN9oUyIiXpv8XvlN5e3icY2BkYGAA4n0vN4fG89t8ZeBmYQCBa9wPPRH0/wcsDMwmQC4HAxNIFABAfAqaAHicY2BkYGBu+N/AEMPCAAJAkpEBFbABAEcMAm94nGNhYGBgfsnAwMKAigESnwEBAAAAAAAAdgCkANoBCAFsAAB4nGNgZGBgYGMIZGBlAAEmIOYCQgaG/2A+AwARSAFzAHicZY9NTsMwEIVf+gekEqqoYIfkBWIBKP0Rq25YVGr3XXTfpk6bKokjx63UA3AejsAJOALcgDvwSCebNpbH37x5Y08A3OAHHo7fLfeRPVwyO3INF7gXrlN/EG6QX4SbaONVuEX9TdjHM6bCbXRheYPXuGL2hHdhDx18CNdwjU/hOvUv4Qb5W7iJO/wKt9Dx6sI+5l5XuI1HL/bHVi+cXqnlQcWhySKTOb+CmV7vkoWt0uqca1vEJlODoF9JU51pW91T7NdD5yIVWZOqCas6SYzKrdnq0AUb5/JRrxeJHoQm5Vhj/rbGAo5xBYUlDowxQhhkiMro6DtVZvSvsUPCXntWPc3ndFsU1P9zhQEC9M9cU7qy0nk6T4E9XxtSdXQrbsuelDSRXs1JErJCXta2VELqATZlV44RelzRiT8oZ0j/AAlabsgAAAB4nGNgYoAALgbsgI2RiZGZkYWRlZGNkZ2BsYI1OSM1OZs1OSe/OJW1KDM9o4S9KDWtKLU4g4EBAJ79CeQ=') format('woff'),*/
|
||||
/*url('../fonts/iconfont.ttf?t=1508229193188') format('truetype'), !* chrome, firefox, opera, Safari, Android, iOS 4.2+*!*/
|
||||
/*url('../fonts/iconfont.svg?t=1508229193188#iconfont') format('svg'); !* iOS 4.1- *!*/
|
||||
/*}*/
|
||||
|
||||
.iconfont {
|
||||
font-family: "iconfont" !important;
|
||||
font-size: 16px;
|
||||
font-style: normal;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.icon-check:before {
|
||||
content: " ";
|
||||
display: block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
position: absolute;
|
||||
margin: auto;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
z-index: 9999;
|
||||
background-image: url("@/static/images/arrow-good.png");
|
||||
background-size: contain;
|
||||
}
|
||||
|
||||
.icon-close:before {
|
||||
content: " ";
|
||||
display: block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
position: absolute;
|
||||
margin: auto;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
z-index: 9999;
|
||||
background-image: url("@/static/images/arrow-close.png");
|
||||
background-size: contain;
|
||||
}
|
||||
|
||||
.icon-right:before {
|
||||
content: " ";
|
||||
display: block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
position: absolute;
|
||||
margin: auto;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
background-size: cover;
|
||||
z-index: 9999;
|
||||
background-image: url("@/static/images/arrow-right.png");
|
||||
background-size: contain;
|
||||
}
|
||||
|
||||
.icon-refresh:before {
|
||||
content: " ";
|
||||
display: block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
position: absolute;
|
||||
margin: auto;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
z-index: 9999;
|
||||
background-image: url("@/static/images/refresh.png");
|
||||
background-size: contain;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,79 @@
|
|||
// #ifdef H5
|
||||
let VUE_APP_WS_URL = `ws://${location.hostname}?type=user`
|
||||
// #endif
|
||||
|
||||
let openPlantGrass = '-openPlantGrass-'
|
||||
let httpApi
|
||||
let httpApiTwo
|
||||
let httpApiThree
|
||||
let httpApiFour
|
||||
|
||||
// 在打包之前请检查当前环境是否正确
|
||||
const env = 'dev'; // 开发
|
||||
// const env = 'prod'; // 生产
|
||||
// const env = 'prew'; // 预上线
|
||||
|
||||
switch (env) {
|
||||
case 'prod':
|
||||
httpApi = 'https://shop.lihaink.cn' // 生产
|
||||
httpApiTwo = 'https://nk.lihaink.cn'
|
||||
httpApiThree = 'http://ceshi-oa.lihaink.cn'
|
||||
httpApiFour = 'https://worker-task.lihaink.cn'
|
||||
break;
|
||||
case 'prew':
|
||||
httpApi = 'https://test.shop.lihaink.cn' //预发布环境
|
||||
httpApiTwo = "https://nk.lihaink.cn"
|
||||
httpApiThree = 'http://ceshi-oa.lihaink.cn'
|
||||
httpApiFour = 'https://preview-worker-task.lihaink.cn'
|
||||
break;
|
||||
default:
|
||||
httpApi = "https://crmeb-test.shop.lihaink.cn" // 测试
|
||||
httpApiTwo = "https://nk.lihaink.cn"
|
||||
httpApiThree = 'http://ceshi-oa.lihaink.cn'
|
||||
httpApiFour = 'https://ceshi-worker-task.lihaink.cn'
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 聊天接口修改此字符 小程序聊天要求wss 例如:wss://mer.crmeb.net
|
||||
// let wsApi = 'ws://192.168.3.20:8324'
|
||||
let wsApi = 'wss://shop.lihaink.cn'
|
||||
|
||||
module.exports = {
|
||||
// 请求域名 格式: https://您的域名
|
||||
// #ifdef MP || APP-PLUS
|
||||
// HTTP_REQUEST_URL: httpApi,
|
||||
HTTP_REQUEST_URL: httpApi,
|
||||
HTTP_REQUEST_URL_TWO: httpApiTwo,
|
||||
HTTP_REQUEST_URL_THREE: httpApiThree,
|
||||
HTTP_REQUEST_URL_FOUR: httpApiFour,
|
||||
VUE_APP_WS_URL: `${wsApi}?type=user`,
|
||||
// #endif
|
||||
|
||||
// #ifdef H5
|
||||
//H5接口是浏览器地址
|
||||
HTTP_REQUEST_URL_FOUR: httpApiFour|| window.location.protocol + "//" + window.location.host,
|
||||
HTTP_REQUEST_URL: httpApi || window.location.protocol + "//" + window.location.host,
|
||||
HTTP_REQUEST_URL_TWO: httpApiTwo || window.location.protocol + "//" + window.location.host,
|
||||
// 聊天长连接地址
|
||||
VUE_APP_WS_URL: wsApi ? `${wsApi}?type=user` : VUE_APP_WS_URL,
|
||||
// #endif
|
||||
openPlantGrass: openPlantGrass,
|
||||
HEADER: {
|
||||
'content-type': 'application/json',
|
||||
//#ifdef H5
|
||||
'Form-type': navigator.userAgent.toLowerCase().indexOf("micromessenger") !== -1 ? 'wechat' : 'h5',
|
||||
//#endif
|
||||
//#ifdef MP
|
||||
'Form-type': 'routine',
|
||||
//#endif
|
||||
//#ifdef APP-PLUS
|
||||
'Form-type': 'app',
|
||||
//#endif
|
||||
},
|
||||
// 回话密钥名称 请勿修改此配置
|
||||
TOKENNAME: 'X-Token',
|
||||
// 缓存时间 0 永久
|
||||
EXPIRE: 0,
|
||||
};
|
|
@ -0,0 +1,41 @@
|
|||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
module.exports = {
|
||||
//token
|
||||
LOGIN_STATUS: 'LOGIN_STATUS_TOKEN',
|
||||
// uid
|
||||
UID:'UID',
|
||||
//<2F>û<EFBFBD>
|
||||
USER_INFO: 'USER_INFO',
|
||||
//token<65><6E><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
|
||||
EXPIRES_TIME: 'EXPIRES_TIME',
|
||||
//<2F>Ƿ<EFBFBD><C7B7><EFBFBD>Ȩ
|
||||
WX_AUTH: 'WX_AUTH',
|
||||
//<2F><><EFBFBD>ں<EFBFBD><DABA><EFBFBD>Ȩcode
|
||||
STATE_KEY: 'wx_authorize_state',
|
||||
//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
||||
LOGINTYPE: 'loginType',
|
||||
//<2F><><EFBFBD>ں<EFBFBD><DABA><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>
|
||||
BACK_URL: 'login_back_url',
|
||||
// С<><D0A1><EFBFBD><EFBFBD>code
|
||||
STATE_R_KEY: 'roution_authorize_state',
|
||||
//<2F><>ȨlogoС<6F><D0A1><EFBFBD><EFBFBD>
|
||||
LOGO_URL: 'LOGO_URL',
|
||||
//模板缓存
|
||||
SUBSCRIBE_MESSAGE: 'SUBSCRIBE_MESSAGE',
|
||||
|
||||
TIPS_KEY: 'TIPS_KEY',
|
||||
|
||||
SPREAD: 'spread',
|
||||
//缓存经度
|
||||
CACHE_LONGITUDE: 'LONGITUDE',
|
||||
//缓存纬度
|
||||
CACHE_LATITUDE: 'LATITUDE',
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<script>
|
||||
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
|
||||
CSS.supports('top: constant(a)'))
|
||||
document.write(
|
||||
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
|
||||
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
|
||||
</script>
|
||||
<title></title>
|
||||
<!--preload-links-->
|
||||
<!--app-context-->
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"><!--app-html--></div>
|
||||
<script type="module" src="/main.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,104 @@
|
|||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
import store from "../store";
|
||||
import Cache from '../utils/cache';
|
||||
// #ifdef H5
|
||||
// import { isWeixin } from "../utils";
|
||||
// import auth from './wechat';
|
||||
// #endif
|
||||
|
||||
import {
|
||||
LOGIN_STATUS,
|
||||
USER_INFO,
|
||||
EXPIRES_TIME,
|
||||
STATE_R_KEY
|
||||
} from './../config/cache';
|
||||
|
||||
function prePage() {
|
||||
let pages = getCurrentPages();
|
||||
console.log(pages)
|
||||
let prePage = pages[pages.length - 2];
|
||||
// #ifdef H5
|
||||
return prePage;
|
||||
// #endif
|
||||
//return prePage.$vm;
|
||||
}
|
||||
|
||||
export function toLogin(push, pathLogin) {
|
||||
store.commit("LOGOUT");
|
||||
let path = prePage();
|
||||
if (path) {
|
||||
path = path.router;
|
||||
if (path == undefined) {
|
||||
path = location.pathname + location.search;
|
||||
}
|
||||
}
|
||||
// #ifdef MP
|
||||
uni.navigateTo({
|
||||
url: '/page/users/login/login'
|
||||
})
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
else {
|
||||
path = location.pathname + location.search;
|
||||
}
|
||||
// #endif
|
||||
|
||||
if (!pathLogin)
|
||||
pathLogin = '/page/users/login/login'
|
||||
Cache.set('login_back_url', path);
|
||||
uni.navigateTo({
|
||||
url: '/pages/users/login/login'
|
||||
})
|
||||
// #ifdef H5
|
||||
if (isWeixin()) {
|
||||
// auth.oAuth(); // 微信授权
|
||||
uni.navigateTo({
|
||||
url: '/pages/users/login/login'
|
||||
})
|
||||
} else {
|
||||
if (path !== pathLogin) {
|
||||
push ? uni.navigateTo({
|
||||
url: '/pages/users/login/login'
|
||||
}) : uni.reLaunch({
|
||||
url: '/pages/users/login/login'
|
||||
});
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
uni.navigateTo({
|
||||
url: '/pages/users/login/login',
|
||||
})
|
||||
// #endif
|
||||
}
|
||||
|
||||
|
||||
export function checkLogin() {
|
||||
let token = Cache.get(LOGIN_STATUS);
|
||||
let expiresTime = Cache.get(EXPIRES_TIME) || 0;
|
||||
let newTime = Math.round(new Date() / 1000);
|
||||
if (expiresTime < newTime || !token) {
|
||||
Cache.clear(LOGIN_STATUS);
|
||||
Cache.clear(EXPIRES_TIME);
|
||||
Cache.clear(USER_INFO);
|
||||
Cache.clear(STATE_R_KEY);
|
||||
return false;
|
||||
} else {
|
||||
store.commit('UPDATE_LOGIN', token);
|
||||
let userInfo = Cache.get(USER_INFO, true);
|
||||
if (userInfo) {
|
||||
store.commit('UPDATE_USERINFO', userInfo);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,186 @@
|
|||
import store from '@/store';
|
||||
import { checkLogin } from './login';
|
||||
import { login } from '@/api/pubic.js';
|
||||
import Cache from '@/utils/cache';
|
||||
import { STATE_R_KEY, USER_INFO, EXPIRES_TIME, LOGIN_STATUS } from '@/config/cache';
|
||||
|
||||
class Routine {
|
||||
|
||||
constructor() {
|
||||
this.scopeUserInfo = 'scope.userInfo';
|
||||
}
|
||||
|
||||
async getUserCode() {
|
||||
let isAuth = await this.isAuth(),
|
||||
code = '';
|
||||
if (isAuth)
|
||||
code = await this.getCode();
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*/
|
||||
getUserInfo() {
|
||||
let that = this,
|
||||
code = this.getUserCode();
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.getUserInfo({
|
||||
lang: 'zh_CN',
|
||||
success(user) {
|
||||
if (code) user.code = code;
|
||||
resolve({ userInfo: user, islogin: false });
|
||||
},
|
||||
fail(res) {
|
||||
reject(res);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*/
|
||||
authorize() {
|
||||
let c2543fff3bfa6f144c2f06a7de6cd10c0b650cae = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
if (checkLogin())
|
||||
return resolve({
|
||||
userInfo: Cache.get(USER_INFO, true),
|
||||
islogin: true,
|
||||
});
|
||||
uni.authorize({
|
||||
scope: c2543fff3bfa6f144c2f06a7de6cd10c0b650cae.scopeUserInfo,
|
||||
success() {
|
||||
resolve({ islogin: false });
|
||||
},
|
||||
fail(res) {
|
||||
reject(res);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
async getCode() {
|
||||
let backUrlCRshlcICwGdGY = await this.getProvider();
|
||||
return new Promise((resolve, reject) => {
|
||||
if (Cache.has(STATE_R_KEY)) {
|
||||
return resolve(Cache.get(STATE_R_KEY));
|
||||
}
|
||||
uni.login({
|
||||
provider: backUrlCRshlcICwGdGY,
|
||||
success(res) {
|
||||
if (res.code) Cache.set(STATE_R_KEY, res.code, 10800);
|
||||
return resolve(res.code);
|
||||
},
|
||||
fail() {
|
||||
return reject(null);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取服务供应商
|
||||
*/
|
||||
getProvider() {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.getProvider({
|
||||
service: 'oauth',
|
||||
success(res) {
|
||||
resolve(res.provider);
|
||||
},
|
||||
fail() {
|
||||
resolve(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否授权
|
||||
*/
|
||||
isAuth() {
|
||||
let that = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.getSetting({
|
||||
success(res) {
|
||||
if (!res.authSetting[that.scopeUserInfo]) {
|
||||
resolve(true)
|
||||
} else {
|
||||
resolve(true);
|
||||
}
|
||||
},
|
||||
fail() {
|
||||
resolve(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
getUserProfile(code) {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.getUserProfile({
|
||||
lang: 'zh_CN',
|
||||
desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
|
||||
success(user) {
|
||||
if (code) user.code = code;
|
||||
resolve({
|
||||
userInfo: user,
|
||||
islogin: false
|
||||
});
|
||||
},
|
||||
fail(res) {
|
||||
reject(res);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 小程序比较版本信息
|
||||
* @param v1 当前版本
|
||||
* @param v2 进行比较的版本
|
||||
* @return boolen
|
||||
*
|
||||
*/
|
||||
compareVersion(v1, v2) {
|
||||
v1 = v1.split('.')
|
||||
v2 = v2.split('.')
|
||||
const len = Math.max(v1.length, v2.length)
|
||||
|
||||
while (v1.length < len) {
|
||||
v1.push('0')
|
||||
}
|
||||
while (v2.length < len) {
|
||||
v2.push('0')
|
||||
}
|
||||
|
||||
for (let i = 0; i < len; i++) {
|
||||
const num1 = parseInt(v1[i])
|
||||
const num2 = parseInt(v2[i])
|
||||
|
||||
if (num1 > num2) {
|
||||
return 1
|
||||
} else if (num1 < num2) {
|
||||
return -1
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
authUserInfo(data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
login(data).then(res => {
|
||||
let time = res.data.expires_time - Cache.time();
|
||||
store.commit('UPDATE_USERINFO', res.data.user);
|
||||
store.commit('LOGIN', { token: res.data.token, time: time });
|
||||
store.commit('SETUID', res.data.user.uid);
|
||||
Cache.set(EXPIRES_TIME, res.data.expires_time, time);
|
||||
Cache.set(USER_INFO, res.data.userInfo, time);
|
||||
return resolve(res);
|
||||
}).catch(res => {
|
||||
return reject(res);
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default new Routine();
|
|
@ -0,0 +1,474 @@
|
|||
// import uniCopy from '@/js_sdk/xb-copy/uni-copy.js'; // 拷贝功能插件
|
||||
// import compressImage from './compressImage.js'; // 解决图片旋转90°问题
|
||||
// const device = uni.getSystemInfoSync();
|
||||
// console.log("device:======================== " + JSON.stringify(device));
|
||||
/*
|
||||
参数说明
|
||||
@url
|
||||
要跳转的目标地址
|
||||
@opt
|
||||
要传给目标地址的参数
|
||||
可在目标页面的onLoad生命周期函数的第一个参数中获取
|
||||
*/
|
||||
|
||||
// 压栈跳转页面
|
||||
export function navigateTo(type, url, opt) {
|
||||
// H5端页面跳转目前不支持动画 (浏览器性能限制)
|
||||
let toUrl = url;
|
||||
let api = 'navigateTo';
|
||||
toUrl = opt ? toUrl + '?' + convertObj(opt) : toUrl;
|
||||
|
||||
switch (type) {
|
||||
case 1:
|
||||
api = 'navigateTo';
|
||||
break;
|
||||
case 2:
|
||||
api = 'redirectTo'; // 关闭当前页,跳转应用内某个页面
|
||||
break;
|
||||
case 3:
|
||||
api = 'reLaunch'; // 关闭所有页面,打开到应用内某个页面
|
||||
break;
|
||||
case 4:
|
||||
api = 'switchTab'; //跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面。
|
||||
break;
|
||||
default:
|
||||
api = 'navigateTo'
|
||||
break;
|
||||
}
|
||||
uni[api]({
|
||||
url: toUrl,
|
||||
animationType: 'slide-in-right',
|
||||
animationDuration: 200
|
||||
});
|
||||
}
|
||||
|
||||
// 关闭当前页面并返回上一页面 delta 标识返回几层
|
||||
export function navigateBack(delta) {
|
||||
uni.navigateBack({
|
||||
delta: delta
|
||||
});
|
||||
}
|
||||
|
||||
// setStorage 将数据存入缓存
|
||||
export function setStorage(key, val) {
|
||||
if (typeof val == 'string') {
|
||||
uni.setStorageSync(key, val);
|
||||
return val
|
||||
}
|
||||
uni.setStorageSync(key, JSON.stringify(val));
|
||||
}
|
||||
|
||||
// getStorage 从缓存中读取数据
|
||||
export function getStorage(key) {
|
||||
let uu = uni.getStorageSync(key);
|
||||
try {
|
||||
if (typeof JSON.parse(uu) != 'number') {
|
||||
uu = JSON.parse(uu);
|
||||
}
|
||||
} catch (e) {}
|
||||
return uu;
|
||||
}
|
||||
// 删除缓存中的数据
|
||||
export function removeStorage(key) {
|
||||
if (key) {
|
||||
uni.removeStorageSync(key);
|
||||
}
|
||||
}
|
||||
// 将缓存中的数据清空
|
||||
export function clearStorage() {
|
||||
try {
|
||||
uni.clearStorageSync();
|
||||
} catch (e) {
|
||||
throw new Error('处理失败');
|
||||
}
|
||||
}
|
||||
// 显示Toast
|
||||
/*
|
||||
@title 最多汉字数量7个
|
||||
@icon success loading none
|
||||
*/
|
||||
export function Toast(title, icon = 'none', obj = {}, duration = 700) {
|
||||
let toastData = {
|
||||
title: title,
|
||||
duration: duration,
|
||||
// position: 'center',
|
||||
mask: true,
|
||||
icon: icon ? icon : 'none',
|
||||
...obj
|
||||
};
|
||||
uni.showToast(toastData);
|
||||
}
|
||||
/*
|
||||
显示loading提示框,需要手动隐藏
|
||||
*/
|
||||
export function Loading(title = '正在加载...', obj = {}) {
|
||||
uni.showLoading({
|
||||
title: title,
|
||||
mask: true,
|
||||
...obj
|
||||
});
|
||||
}
|
||||
// 隐藏loading
|
||||
export function hideLoading() {
|
||||
try {
|
||||
uni.hideLoading();
|
||||
} catch (e) {
|
||||
//TODO handle the exception
|
||||
throw new Error('处理失败');
|
||||
}
|
||||
}
|
||||
// 模态框
|
||||
/*
|
||||
确定取消按钮的文字颜色可修改
|
||||
obj 对象中传入 cancelColor : rgb 即可修改取消按钮颜色
|
||||
obj 对象中传入 confirmColor : rgb 即可修改确认按钮颜色
|
||||
*/
|
||||
export function Modal(title = '提示', content = '这是一个模态弹窗!', obj = {
|
||||
showCancel: true,
|
||||
cancelText: '取消',
|
||||
confirmText: '确定'
|
||||
}) {
|
||||
// #ifdef APP-PLUS
|
||||
obj.cancelText = '确定';
|
||||
obj.confirmText = '取消';
|
||||
// #endif
|
||||
return new Promise((reslove, reject) => {
|
||||
uni.showModal({
|
||||
title: title,
|
||||
content: content,
|
||||
...obj,
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
reslove()
|
||||
}
|
||||
if (res.cancel) {
|
||||
reject()
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
/*
|
||||
显示操作菜单
|
||||
@itemList 操作菜单数组
|
||||
@itemColor 文字颜色
|
||||
*/
|
||||
export function ActionSheet(itemList, itemColor = "#000000") {
|
||||
return new Promise((reslove, reject) => {
|
||||
uni.showActionSheet({
|
||||
itemList: itemList,
|
||||
itemColor: itemColor,
|
||||
success: (res) => {
|
||||
reslove(res.tapIndex);
|
||||
},
|
||||
fail: function(res) {
|
||||
reject(res.errMsg);
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
//将页面滚动到目标位置。
|
||||
export function ScrollTo(ScrollTop) {
|
||||
uni.pageScrollTo({
|
||||
scrollTop: ScrollTop,
|
||||
duration: 300
|
||||
})
|
||||
}
|
||||
|
||||
// 获取用户信息
|
||||
export function GetUserInfo() {
|
||||
return new Promise((reslove, reject) => {
|
||||
uni.getUserInfo({
|
||||
success(res) {
|
||||
console.log(res);
|
||||
reslove(res);
|
||||
},
|
||||
fail(rej) {
|
||||
reject(rej);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 获取用户授权信息
|
||||
export function Authorize(scoped = 'scope.userInfo') {
|
||||
return new Promise((reslove, reject) => {
|
||||
uni.authorize({
|
||||
scope: scoped,
|
||||
success(res) {
|
||||
reslove(res);
|
||||
},
|
||||
fail(rej) {
|
||||
reject(rej);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 将对象转换成使用 & 连接的字符串
|
||||
export function convertObj(opt) {
|
||||
let str = '';
|
||||
let arr = [];
|
||||
Object.keys(opt).forEach(item => {
|
||||
arr.push(`${item}=${opt[item]}`);
|
||||
})
|
||||
str = arr.join('&');
|
||||
return str;
|
||||
}
|
||||
// 节流函数
|
||||
// 节流函数
|
||||
export function throttle(fn, delay) {
|
||||
var lastArgs;
|
||||
var timer;
|
||||
var delay = delay || 200;
|
||||
return function(...args) {
|
||||
lastArgs = args;
|
||||
if (!timer) {
|
||||
timer = setTimeout(() => {
|
||||
timer = null;
|
||||
fn.apply(this, lastArgs);
|
||||
}, delay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 调起相机
|
||||
export function chooseImage(count) {
|
||||
return new Promise((reslove, reject) => {
|
||||
uni.chooseImage({
|
||||
count: count, //默认9
|
||||
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
||||
sourceType: ['album', 'camera'], //从相册选择
|
||||
success: (res) => {
|
||||
reslove(res);
|
||||
// const tempFilePaths = res.tempFilePaths;
|
||||
// let tempPathList = [];
|
||||
// for (let i = 0; i < tempFilePaths.length; i++) {
|
||||
// const path = tempFilePaths[i];
|
||||
// const src = await compressImageHandler(path)
|
||||
// tempPathList.push(src);
|
||||
// }
|
||||
// reslove(tempPathList);
|
||||
},
|
||||
fail: (rej) => {
|
||||
reject(rej);
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
// function compressImageHandler(src) {
|
||||
// // console.log('platform===' + device.platform)
|
||||
// const tempPath = compressImage(src, device.platform);
|
||||
// // console.log('tempPath-----' + tempPath);
|
||||
// return tempPath
|
||||
// }
|
||||
//序列化对象和数组
|
||||
export function serialize(data) {
|
||||
if (data != null && data != '') {
|
||||
try {
|
||||
return JSON.parse(JSON.stringify(data));
|
||||
} catch (e) {
|
||||
if (data instanceof Array) {
|
||||
return [];
|
||||
}
|
||||
return {};
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
Date.prototype.format = function(fmt) {
|
||||
let o = {
|
||||
'M+': this.getMonth() + 1, //月份
|
||||
'd+': this.getDate(), //日
|
||||
'h+': this.getHours(), //小时
|
||||
'm+': this.getMinutes(), //分
|
||||
's+': this.getSeconds(), //秒
|
||||
'q+': Math.floor((this.getMonth() + 3) / 3), //季度
|
||||
S: this.getMilliseconds() //毫秒
|
||||
};
|
||||
|
||||
if (/(y+)/.test(fmt)) {
|
||||
fmt = fmt.replace(RegExp.$1, String(this.getFullYear()).substr(4 - RegExp.$1.length));
|
||||
}
|
||||
for (let k in o) {
|
||||
if (new RegExp('(' + k + ')').test(fmt)) {
|
||||
fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(String(o[k]).length));
|
||||
}
|
||||
}
|
||||
return fmt;
|
||||
};
|
||||
|
||||
//格式化日期
|
||||
export function formatDate(nS, format) {
|
||||
//日期格式化
|
||||
if (!nS) {
|
||||
return '';
|
||||
}
|
||||
format = format || 'yyyy-MM-dd hh:mm:ss';
|
||||
return new Date(nS).format(format);
|
||||
}
|
||||
|
||||
// 图片转base64
|
||||
export function pathToBase64(path) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
if (typeof window === 'object' && 'document' in window) {
|
||||
if (typeof FileReader === 'function') {
|
||||
var xhr = new XMLHttpRequest()
|
||||
xhr.open('GET', path, true)
|
||||
xhr.responseType = 'blob'
|
||||
xhr.onload = function() {
|
||||
if (this.status === 200) {
|
||||
let fileReader = new FileReader()
|
||||
fileReader.onload = function(e) {
|
||||
resolve(e.target.result)
|
||||
}
|
||||
fileReader.onerror = reject
|
||||
fileReader.readAsDataURL(this.response)
|
||||
}
|
||||
}
|
||||
xhr.onerror = reject
|
||||
xhr.send()
|
||||
return
|
||||
}
|
||||
var canvas = document.createElement('canvas')
|
||||
var c2x = canvas.getContext('2d')
|
||||
var img = new Image
|
||||
img.onload = function() {
|
||||
canvas.width = img.width
|
||||
canvas.height = img.height
|
||||
c2x.drawImage(img, 0, 0)
|
||||
resolve(canvas.toDataURL())
|
||||
canvas.height = canvas.width = 0
|
||||
}
|
||||
img.onerror = reject
|
||||
img.src = path
|
||||
return
|
||||
}
|
||||
if (typeof plus === 'object') {
|
||||
plus.io.resolveLocalFileSystemURL(getLocalFilePath(path), function(entry) {
|
||||
entry.file(function(file) {
|
||||
var fileReader = new plus.io.FileReader()
|
||||
fileReader.onload = function(data) {
|
||||
resolve(data.target.result)
|
||||
}
|
||||
fileReader.onerror = function(error) {
|
||||
reject(error)
|
||||
}
|
||||
fileReader.readAsDataURL(file)
|
||||
}, function(error) {
|
||||
reject(error)
|
||||
})
|
||||
}, function(error) {
|
||||
reject(error)
|
||||
})
|
||||
return
|
||||
}
|
||||
if (typeof wx === 'object' && wx.canIUse('getFileSystemManager')) {
|
||||
wx.getFileSystemManager().readFile({
|
||||
filePath: path,
|
||||
encoding: 'base64',
|
||||
success: function(res) {
|
||||
resolve('data:image/png;base64,' + res.data)
|
||||
},
|
||||
fail: function(error) {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
reject(new Error('not support'))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@value 要拷贝的内容
|
||||
*/
|
||||
// export function copyText(value) {
|
||||
// // 条件编译,以下代码仅在H5出现
|
||||
// //#ifdef H5
|
||||
// return new Promise((reslove, reject) => {
|
||||
// uniCopy({
|
||||
// content: value,
|
||||
// success: (res) => {
|
||||
// reslove(res);
|
||||
// },
|
||||
// error: (e) => {
|
||||
// reject(res)
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
|
||||
// //#endif
|
||||
|
||||
// // 以下代码在除H5以外的平台出现
|
||||
// //#ifndef H5
|
||||
|
||||
// //#endif
|
||||
// }
|
||||
|
||||
// 获取本周的第一天
|
||||
export function showWeekFirstDay() {
|
||||
var date = new Date();
|
||||
var weekday = date.getDay() || 7; //获取星期几,getDay()返回值是 0(周日) 到 6(周六) 之间的一个整数。0||7为7,即weekday的值为1-7
|
||||
date.setDate(date.getDate() - weekday + 1); //往前算(weekday-1)天,年份、月份会自动变化
|
||||
return formatDate(date, 'yyyy-MM-dd');
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 获取本月第一天
|
||||
export function showMonthFirstDay() {
|
||||
var MonthFirstDay = new Date().setDate(1);
|
||||
return formatDate(new Date(MonthFirstDay).getTime(), 'yyyy-MM-dd');
|
||||
}
|
||||
|
||||
var now = new Date(); //当前日期
|
||||
// var nowDayOfWeek = now.getDay(); //今天本周的第几天
|
||||
// var nowDay = now.getDate(); //当前日
|
||||
var nowMonth = now.getMonth(); //当前月
|
||||
var nowYear = now.getYear(); //当前年
|
||||
nowYear += (nowYear < 2000) ? 1900 : 0; //
|
||||
//获得本季度的开始月份
|
||||
function getQuarterStartMonth() {
|
||||
var quarterStartMonth = 0;
|
||||
if (nowMonth < 3) {
|
||||
quarterStartMonth = 0;
|
||||
}
|
||||
if (2 < nowMonth && nowMonth < 6) {
|
||||
quarterStartMonth = 3;
|
||||
}
|
||||
if (5 < nowMonth && nowMonth < 9) {
|
||||
quarterStartMonth = 6;
|
||||
}
|
||||
if (nowMonth > 8) {
|
||||
quarterStartMonth = 9;
|
||||
}
|
||||
return quarterStartMonth;
|
||||
}
|
||||
|
||||
//或的本季度的结束日期
|
||||
//获得本季度的开始日期
|
||||
export function getQuarterStartDate() {
|
||||
var quarterStartDate = new Date(nowYear, getQuarterStartMonth(), 1);
|
||||
return formatDate(quarterStartDate, 'yyyy-MM-dd');
|
||||
}
|
||||
// 删除数组中重复数据
|
||||
export function unique(data) {
|
||||
data = data || [];
|
||||
var n = {}; //存放新的数据
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var v = JSON.stringify(data[i]);
|
||||
if (typeof(v) == "undefined") {
|
||||
n[v] = 1;
|
||||
}
|
||||
}
|
||||
data.length = 0;
|
||||
for (var i in n) {
|
||||
data[data.length] = i;
|
||||
}
|
||||
return data;
|
||||
}
|
|
@ -0,0 +1,295 @@
|
|||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
// #ifdef H5
|
||||
import WechatJSSDK from "@/plugin/jweixin-module/index.js";
|
||||
|
||||
|
||||
import {
|
||||
getWechatConfig,
|
||||
wechatAuth,
|
||||
commonAuth
|
||||
} from "@/api/public";
|
||||
import {
|
||||
WX_AUTH,
|
||||
STATE_KEY,
|
||||
LOGINTYPE,
|
||||
BACK_URL
|
||||
} from '@/config/cache';
|
||||
import {
|
||||
parseQuery
|
||||
} from '@/utils';
|
||||
import store from '@/store';
|
||||
import Cache from '@/utils/cache';
|
||||
|
||||
class AuthWechat {
|
||||
|
||||
constructor() {
|
||||
//微信实例化对象
|
||||
this.instance = WechatJSSDK;
|
||||
//是否实例化
|
||||
this.status = false;
|
||||
|
||||
this.initConfig = {};
|
||||
|
||||
}
|
||||
|
||||
isAndroid() {
|
||||
let u = navigator.userAgent;
|
||||
return u.indexOf('Android') > -1 || u.indexOf('Adr') > -1;
|
||||
}
|
||||
|
||||
signLink() {
|
||||
if (typeof window.entryUrl === 'undefined' || window.entryUrl === '') {
|
||||
window.entryUrl = location.href
|
||||
}
|
||||
return /(Android)/i.test(navigator.userAgent) ? location.href : window.entryUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化wechat(分享配置)
|
||||
*/
|
||||
wechat() {
|
||||
return new Promise((resolve, reject) => {
|
||||
// if (this.status && !this.isAndroid()) return resolve(this.instance);
|
||||
getWechatConfig()
|
||||
.then(res => {
|
||||
this.instance.config(res.data);
|
||||
this.initConfig = res.data;
|
||||
this.status = true;
|
||||
this.instance.ready(() => {
|
||||
resolve(this.instance);
|
||||
})
|
||||
}).catch(err => {
|
||||
// console.log(err);
|
||||
this.status = false;
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证是否初始化
|
||||
*/
|
||||
verifyInstance() {
|
||||
let that = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
if (that.instance === null && !that.status) {
|
||||
that.wechat().then(res => {
|
||||
resolve(that.instance);
|
||||
}).catch(() => {
|
||||
return reject();
|
||||
})
|
||||
} else {
|
||||
return resolve(that.instance);
|
||||
}
|
||||
})
|
||||
}
|
||||
// 微信公众号的共享地址
|
||||
openAddress() {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.wechat().then(wx => {
|
||||
this.toPromise(wx.openAddress).then(res => {
|
||||
resolve(res);
|
||||
}).catch(err => {
|
||||
reject(err);
|
||||
});
|
||||
}).catch(err => {
|
||||
reject(err);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
// 使用微信内置地图查看位置接口;
|
||||
seeLocation(config) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.wechat().then(wx => {
|
||||
this.toPromise(wx.openLocation, config).then(res => {
|
||||
resolve(res);
|
||||
}).catch(err => {
|
||||
reject(err);
|
||||
});
|
||||
}).catch(err => {
|
||||
reject(err);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信支付
|
||||
* @param {Object} config
|
||||
*/
|
||||
pay(config) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.wechat().then((wx) => {
|
||||
this.toPromise(wx.chooseWXPay, config).then(res => {
|
||||
resolve(res);
|
||||
}).catch(res => {
|
||||
reject(res);
|
||||
});
|
||||
}).catch(res => {
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
toPromise(fn, config = {}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
fn({
|
||||
...config,
|
||||
success(res) {
|
||||
resolve(res);
|
||||
},
|
||||
fail(err) {
|
||||
reject(err);
|
||||
},
|
||||
complete(err) {
|
||||
reject(err);
|
||||
},
|
||||
cancel(err) {
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动去授权
|
||||
*/
|
||||
oAuth() {
|
||||
if (uni.getStorageSync(WX_AUTH) && store.state.app.token) return;
|
||||
const {
|
||||
code
|
||||
} = parseQuery();
|
||||
if (!code) return this.toAuth();
|
||||
}
|
||||
|
||||
clearAuthStatus() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 授权登陆获取token
|
||||
* @param {Object} code
|
||||
*/
|
||||
auth(code) {
|
||||
// console.log('授权登陆获取token');
|
||||
return new Promise((resolve, reject) => {
|
||||
let loginType = Cache.get(LOGINTYPE);
|
||||
commonAuth({
|
||||
auth: {
|
||||
type: 'wechat',
|
||||
auth: {
|
||||
code,
|
||||
spread: Cache.get("spread") ?? 0
|
||||
}
|
||||
}
|
||||
}).then(res => {
|
||||
const data = res.data;
|
||||
if (res.data.status == 200) {
|
||||
store.commit("LOGIN", {
|
||||
token: data.result.token,
|
||||
time: data.result.exp
|
||||
});
|
||||
store.commit("SETUID", data.result.user.uid);
|
||||
store.commit('UPDATE_USERINFO', data.result.user);
|
||||
Cache.set(WX_AUTH, code);
|
||||
Cache.clear(STATE_KEY);
|
||||
loginType && Cache.clear(LOGINTYPE);
|
||||
resolve();
|
||||
} else {
|
||||
uni.setStorageSync('auth_token', res.data.result.key);
|
||||
return uni.navigateTo({
|
||||
url: '/pages/users/login/index'
|
||||
})
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取跳转授权后的地址
|
||||
* @param {Object} appId
|
||||
*/
|
||||
getAuthUrl(appId) {
|
||||
const backUrlCRshlcICwGdGY = encodeURIComponent(
|
||||
`${location.origin}/pages/auth/index?back_url=` +
|
||||
encodeURIComponent(
|
||||
encodeURIComponent(
|
||||
uni.getStorageSync(BACK_URL) ?
|
||||
uni.getStorageSync(BACK_URL) :
|
||||
location.pathname + location.search
|
||||
)
|
||||
)
|
||||
);
|
||||
uni.removeStorageSync(BACK_URL);
|
||||
const state = encodeURIComponent(
|
||||
("" + Math.random()).split(".")[1] + "authorizestate"
|
||||
);
|
||||
uni.setStorageSync(STATE_KEY, state);
|
||||
return `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${backUrlCRshlcICwGdGY}&response_type=code&scope=snsapi_userinfo&state=${state}#wechat_redirect`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转自动登陆
|
||||
*/
|
||||
toAuth() {
|
||||
let c2543fff3bfa6f144c2f06a7de6cd10c0b650cae = this;
|
||||
this.wechat().then(wx => {
|
||||
window.location.replace(this.getAuthUrl(c2543fff3bfa6f144c2f06a7de6cd10c0b650cae.initConfig.appId));
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定事件
|
||||
* @param {Object} name 事件名
|
||||
* @param {Object} config 参数
|
||||
*/
|
||||
wechatEvevt(name, config) {
|
||||
let that = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
let configDefault = {
|
||||
fail(res) {
|
||||
// console.log(res, 11111);
|
||||
if (that.instance) return reject({
|
||||
is_ready: true,
|
||||
wx: that.instance
|
||||
});
|
||||
that.verifyInstance().then(wx => {
|
||||
return reject({
|
||||
is_ready: true,
|
||||
wx: wx
|
||||
});
|
||||
})
|
||||
},
|
||||
success(res) {
|
||||
return resolve(res, 2222);
|
||||
}
|
||||
};
|
||||
Object.assign(configDefault, config);
|
||||
that.wechat().then(wx => {
|
||||
if (typeof name === 'object') {
|
||||
name.forEach(item => {
|
||||
wx[item] && wx[item](configDefault)
|
||||
})
|
||||
} else {
|
||||
wx[name] && wx[name](configDefault)
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
isWeixin() {
|
||||
return navigator.userAgent.toLowerCase().indexOf("micromessenger") !== -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default new AuthWechat();
|
||||
// #endif
|
|
@ -0,0 +1,104 @@
|
|||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
import Vue from 'vue'
|
||||
import App from './App'
|
||||
import store from './store'
|
||||
import Cache from './utils/cache'
|
||||
import util from 'utils/util'
|
||||
import {
|
||||
HTTP_REQUEST_URL
|
||||
} from '@/config/app';
|
||||
import uView from '@/uni_modules/uview-ui'
|
||||
Vue.use(uView);
|
||||
Vue.prototype.$util = util;
|
||||
Vue.prototype.$Cache = Cache;
|
||||
Vue.prototype.$eventHub = new Vue();
|
||||
Vue.config.productionTip = false
|
||||
Vue.prototype.$bus = new Vue();
|
||||
// #ifdef H5
|
||||
import {
|
||||
parseQuery
|
||||
} from "./utils";
|
||||
import Auth from './libs/wechat';
|
||||
import {
|
||||
SPREAD
|
||||
} from './config/cache';
|
||||
// import wx from '@/node_modules/jweixin-module/lib/index'
|
||||
var __s = document.createElement('script');
|
||||
__s.src = HTTP_REQUEST_URL + "/api/script";
|
||||
document.head.appendChild(__s);
|
||||
Vue.prototype.$wechat = Auth;
|
||||
let cookieName = "VCONSOLE",
|
||||
query = parseQuery(),
|
||||
urlSpread = query["spread"],
|
||||
vconsole = query[cookieName.toLowerCase()],
|
||||
md5Crmeb = "b14d1e9baeced9bb7525ab19ee35f2d2", //CRMEB MD5 加密开启vconsole模式
|
||||
md5UnCrmeb = "3dca2162c4e101b7656793a1af20295c"; //UN_CREMB MD5 加密关闭vconsole模式
|
||||
|
||||
if (urlSpread !== undefined) {
|
||||
var spread = Cache.get(SPREAD);
|
||||
urlSpread = parseInt(urlSpread);
|
||||
if (!Number.isNaN(urlSpread) && spread !== urlSpread) {
|
||||
Cache.set("spread", urlSpread || 0);
|
||||
} else if (spread === 0 || typeof spread !== "number") {
|
||||
Cache.set("spread", urlSpread || 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (vconsole !== undefined) {
|
||||
if (vconsole === md5UnCrmeb && Cache.has(cookieName))
|
||||
Cache.clear(cookieName);
|
||||
} else vconsole = Cache.get(cookieName);
|
||||
|
||||
import VConsole from './components/vconsole.min.js'
|
||||
|
||||
if (vconsole !== undefined && vconsole === md5Crmeb) {
|
||||
Cache.set(cookieName, md5Crmeb, 3600);
|
||||
let vConsole = new VConsole();
|
||||
|
||||
}
|
||||
// 注册全局防抖指令
|
||||
Vue.directive('debounce', {
|
||||
inserted: (el, binding) => {
|
||||
let debounceTime = binding.value || 2000
|
||||
let timer
|
||||
el.addEventListener('click', e => {
|
||||
el.style.pointerEvents = 'none';
|
||||
if (!el.disabled) {
|
||||
timer = setTimeout(() => {
|
||||
el.style.pointerEvents = 'auto'
|
||||
}, debounceTime)
|
||||
}
|
||||
}, true)
|
||||
}
|
||||
})
|
||||
|
||||
// if(!!!Auth.isAndroid() && Auth.isWeixin()){
|
||||
// Auth.wechat()
|
||||
// }
|
||||
|
||||
// Auth.isWeixin() && Auth.oAuth();
|
||||
|
||||
// #endif
|
||||
|
||||
let appInfo = uni.getSystemInfo().then(res => {
|
||||
Vue.prototype.$appInfo = res[1];
|
||||
});
|
||||
|
||||
|
||||
App.mpType = 'app'
|
||||
|
||||
|
||||
const app = new Vue({
|
||||
...App,
|
||||
store,
|
||||
Cache
|
||||
})
|
||||
app.$mount();
|
|
@ -0,0 +1,209 @@
|
|||
{
|
||||
"name" : "lihaiCenter",
|
||||
"appid" : "__UNI__BBF059D",
|
||||
"description" : "",
|
||||
"versionName" : "1.0.0",
|
||||
"versionCode" : "100",
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
"usingComponents" : true,
|
||||
"nvueStyleCompiler" : "uni-app",
|
||||
"compilerVersion" : 3,
|
||||
"splashscreen" : {
|
||||
"alwaysShowBeforeRender" : false,
|
||||
"waiting" : true,
|
||||
"autoclose" : false,
|
||||
"delay" : 0
|
||||
},
|
||||
/* 模块配置 */
|
||||
"modules" : {
|
||||
"UniMP" : {
|
||||
"description" : "uni小程序"
|
||||
}
|
||||
},
|
||||
/* 应用发布信息 */
|
||||
"distribute" : {
|
||||
/* android打包配置 */
|
||||
"android" : {
|
||||
"permissions" : [
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||
]
|
||||
},
|
||||
/* ios打包配置 */
|
||||
"ios" : {
|
||||
"dSYMs" : false
|
||||
},
|
||||
/* SDK配置 */
|
||||
"sdkConfigs" : {
|
||||
"ad" : {},
|
||||
"oauth" : {}
|
||||
}
|
||||
},
|
||||
"nativePlugins" : {
|
||||
"JG-JCore" : {
|
||||
"JPUSH_APPKEY_IOS" : "",
|
||||
"JPUSH_CHANNEL_IOS" : "",
|
||||
"JPUSH_APPKEY_ANDROID" : "",
|
||||
"JPUSH_CHANNEL_ANDROID" : "",
|
||||
"__plugin_info__" : {
|
||||
"name" : "JG-JCore",
|
||||
"description" : "极光推送JCore插件",
|
||||
"platforms" : "Android,iOS",
|
||||
"url" : "",
|
||||
"android_package_name" : "",
|
||||
"ios_bundle_id" : "",
|
||||
"isCloud" : false,
|
||||
"bought" : -1,
|
||||
"pid" : "",
|
||||
"parameters" : {
|
||||
"JPUSH_APPKEY_IOS" : {
|
||||
"des" : "[iOS]极光portal配置应用信息时分配的AppKey",
|
||||
"key" : "JCore:APP_KEY",
|
||||
"value" : ""
|
||||
},
|
||||
"JPUSH_CHANNEL_IOS" : {
|
||||
"des" : "[iOS]用于统计分发渠道,不需要可填默认值developer-default",
|
||||
"key" : "JCore:CHANNEL",
|
||||
"value" : ""
|
||||
},
|
||||
"JPUSH_APPKEY_ANDROID" : {
|
||||
"des" : "[Android]极光portal配置应用信息时分配的AppKey",
|
||||
"key" : "JPUSH_APPKEY",
|
||||
"value" : ""
|
||||
},
|
||||
"JPUSH_CHANNEL_ANDROID" : {
|
||||
"des" : "[Android]用于统计分发渠道,不需要可填默认值developer-default",
|
||||
"key" : "JPUSH_CHANNEL",
|
||||
"value" : ""
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"JG-JPush" : {
|
||||
"JPUSH_ISPRODUCTION_IOS" : "",
|
||||
"JPUSH_ADVERTISINGID_IOS" : "",
|
||||
"JPUSH_DEFAULTINITJPUSH_IOS" : "",
|
||||
"JPUSH_OPPO_APPKEY" : "",
|
||||
"JPUSH_OPPO_APPID" : "",
|
||||
"JPUSH_OPPO_APPSECRET" : "",
|
||||
"JPUSH_VIVO_APPKEY" : "",
|
||||
"JPUSH_VIVO_APPID" : "",
|
||||
"JPUSH_MEIZU_APPKEY" : "",
|
||||
"JPUSH_MEIZU_APPID" : "",
|
||||
"JPUSH_XIAOMI_APPKEY" : "",
|
||||
"JPUSH_XIAOMI_APPID" : "",
|
||||
"__plugin_info__" : {
|
||||
"name" : "JG-JPush",
|
||||
"description" : "极光推送Hbuilder插件",
|
||||
"platforms" : "Android,iOS",
|
||||
"url" : "",
|
||||
"android_package_name" : "",
|
||||
"ios_bundle_id" : "",
|
||||
"isCloud" : false,
|
||||
"bought" : -1,
|
||||
"pid" : "",
|
||||
"parameters" : {
|
||||
"JPUSH_ISPRODUCTION_IOS" : {
|
||||
"des" : "[iOS]是否是生产环境,是填true,不是填false或者不填",
|
||||
"key" : "JPush:ISPRODUCTION",
|
||||
"value" : ""
|
||||
},
|
||||
"JPUSH_ADVERTISINGID_IOS" : {
|
||||
"des" : "[iOS]广告标识符(IDFA)如果不需要使用IDFA,可不填",
|
||||
"key" : "JPush:ADVERTISINGID",
|
||||
"value" : ""
|
||||
},
|
||||
"JPUSH_DEFAULTINITJPUSH_IOS" : {
|
||||
"des" : "[iOS]是否默认初始化,是填true,不是填false或者不填",
|
||||
"key" : "JPush:DEFAULTINITJPUSH",
|
||||
"value" : ""
|
||||
},
|
||||
"JPUSH_OPPO_APPKEY" : {
|
||||
"des" : "厂商OPPO-appkey,示例:OP-12345678",
|
||||
"key" : "OPPO_APPKEY",
|
||||
"value" : ""
|
||||
},
|
||||
"JPUSH_OPPO_APPID" : {
|
||||
"des" : "厂商OPPO-appId,示例:OP-12345678",
|
||||
"key" : "OPPO_APPID",
|
||||
"value" : ""
|
||||
},
|
||||
"JPUSH_OPPO_APPSECRET" : {
|
||||
"des" : "厂商OPPO-appSecret,示例:OP-12345678",
|
||||
"key" : "OPPO_APPSECRET",
|
||||
"value" : ""
|
||||
},
|
||||
"JPUSH_VIVO_APPKEY" : {
|
||||
"des" : "厂商VIVO-appkey,示例:12345678",
|
||||
"key" : "com.vivo.push.api_key",
|
||||
"value" : ""
|
||||
},
|
||||
"JPUSH_VIVO_APPID" : {
|
||||
"des" : "厂商VIVO-appId,示例:12345678",
|
||||
"key" : "com.vivo.push.app_id",
|
||||
"value" : ""
|
||||
},
|
||||
"JPUSH_MEIZU_APPKEY" : {
|
||||
"des" : "厂商MEIZU-appKey,示例:MZ-12345678",
|
||||
"key" : "MEIZU_APPKEY",
|
||||
"value" : ""
|
||||
},
|
||||
"JPUSH_MEIZU_APPID" : {
|
||||
"des" : "厂商MEIZU-appId,示例:MZ-12345678",
|
||||
"key" : "MEIZU_APPID",
|
||||
"value" : ""
|
||||
},
|
||||
"JPUSH_XIAOMI_APPKEY" : {
|
||||
"des" : "厂商XIAOMI-appKey,示例:MI-12345678",
|
||||
"key" : "XIAOMI_APPKEY",
|
||||
"value" : ""
|
||||
},
|
||||
"JPUSH_XIAOMI_APPID" : {
|
||||
"des" : "厂商XIAOMI-appId,示例:MI-12345678",
|
||||
"key" : "XIAOMI_APPID",
|
||||
"value" : ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
/* 快应用特有相关 */
|
||||
"quickapp" : {},
|
||||
/* 小程序特有相关 */
|
||||
"mp-weixin" : {
|
||||
"appid" : "",
|
||||
"setting" : {
|
||||
"urlCheck" : false
|
||||
},
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-alipay" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-baidu" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-toutiao" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"uniStatistics" : {
|
||||
"enable" : false
|
||||
},
|
||||
"vueVersion" : "2"
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
disabled: false,
|
||||
text: "获取验证码"
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
sendCode() {
|
||||
if (this.disabled) return;
|
||||
this.disabled = true;
|
||||
let n = 60;
|
||||
this.text = "剩余 " + n + "s";
|
||||
const run = setInterval(() => {
|
||||
n = n - 1;
|
||||
if (n < 0) {
|
||||
clearInterval(run);
|
||||
}
|
||||
this.text = "剩余 " + n + "s";
|
||||
if (this.text < "剩余 " + 0 + "s") {
|
||||
this.disabled = false;
|
||||
this.text = "重新获取";
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
};
|
|
@ -0,0 +1,25 @@
|
|||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
import { history } from '@/api/public.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
getHistory() {
|
||||
// console.log(this.$util.getNowUrl(),'page')
|
||||
history({
|
||||
page:this.$util.getNowUrl()
|
||||
}).then(res=>{})
|
||||
},
|
||||
}
|
||||
};
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,27 @@
|
|||
//
|
||||
// JGInforCollectionAuth.h
|
||||
// JCore
|
||||
//
|
||||
// Created by 豆瓣 on 2021/10/27.
|
||||
// Copyright © 2021 jiguang. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// 合规接口,是否授权极光采集一定的设备信息
|
||||
@interface JGInforCollectionAuthItems : NSObject
|
||||
/// 是否授权,默认YES
|
||||
@property(nonatomic,assign)BOOL isAuth;
|
||||
@end
|
||||
|
||||
@interface JGInforCollectionAuth : NSObject
|
||||
|
||||
/// 设备信息采集授权接口(合规接口)
|
||||
/// 请务必在调用初始化、功能性接口前调用此接口进行合规授权
|
||||
/// @param authBlock auth:YES 则极光认为您同意极光采集一定的设备信息
|
||||
+(void)JCollectionAuth:(void(^_Nullable)(JGInforCollectionAuthItems *authInfo))authBlock;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,17 @@
|
|||
//
|
||||
// JCoreModule.h
|
||||
// UniPluginJCore
|
||||
//
|
||||
// Created by huangshuni on 2021/1/21.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "DCUniModule.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface JCoreModule : DCUniModule
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,117 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>files</key>
|
||||
<dict>
|
||||
<key>Headers/JCoreModule.h</key>
|
||||
<data>
|
||||
4aMcBALZuuQeh2JQjJqqvSkc2mA=
|
||||
</data>
|
||||
<key>Info.plist</key>
|
||||
<data>
|
||||
06+wBVr403G+lX5fr/4efqHMj2A=
|
||||
</data>
|
||||
</dict>
|
||||
<key>files2</key>
|
||||
<dict>
|
||||
<key>Headers/JCoreModule.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
4aMcBALZuuQeh2JQjJqqvSkc2mA=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
h/0w2CaU3JBhKI3Pp4EiSWqLf/ZY1Ju+5+tBAdowZ5k=
|
||||
</data>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>rules</key>
|
||||
<dict>
|
||||
<key>^.*</key>
|
||||
<true/>
|
||||
<key>^.*\.lproj/</key>
|
||||
<dict>
|
||||
<key>optional</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1000</real>
|
||||
</dict>
|
||||
<key>^.*\.lproj/locversion.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1100</real>
|
||||
</dict>
|
||||
<key>^Base\.lproj/</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>1010</real>
|
||||
</dict>
|
||||
<key>^version.plist$</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>rules2</key>
|
||||
<dict>
|
||||
<key>.*\.dSYM($|/)</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>11</real>
|
||||
</dict>
|
||||
<key>^(.*/)?\.DS_Store$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>2000</real>
|
||||
</dict>
|
||||
<key>^.*</key>
|
||||
<true/>
|
||||
<key>^.*\.lproj/</key>
|
||||
<dict>
|
||||
<key>optional</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1000</real>
|
||||
</dict>
|
||||
<key>^.*\.lproj/locversion.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1100</real>
|
||||
</dict>
|
||||
<key>^Base\.lproj/</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>1010</real>
|
||||
</dict>
|
||||
<key>^Info\.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^PkgInfo$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^embedded\.provisionprofile$</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^version\.plist$</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"name": "JG-JCore",
|
||||
"id": "JG-JCore",
|
||||
"version": "1.1.3",
|
||||
"description": "极光推送JCore插件",
|
||||
"_dp_type":"nativeplugin",
|
||||
"_dp_nativeplugin":{
|
||||
"ios": {
|
||||
"plugins": [
|
||||
{
|
||||
"type": "module",
|
||||
"name": "JG-JCore",
|
||||
"class": "JCoreModule"
|
||||
}
|
||||
],
|
||||
"integrateType": "framework",
|
||||
"deploymentTarget": "11.0",
|
||||
"validArchitectures": [
|
||||
"arm64"
|
||||
],
|
||||
"parameters": {
|
||||
"JPUSH_APPKEY_IOS": {
|
||||
"des": "[iOS]极光portal配置应用信息时分配的AppKey",
|
||||
"key": "JCore:APP_KEY"
|
||||
},
|
||||
"JPUSH_CHANNEL_IOS": {
|
||||
"des": "[iOS]用于统计分发渠道,不需要可填默认值developer-default",
|
||||
"key": "JCore:CHANNEL"
|
||||
}
|
||||
}
|
||||
},
|
||||
"android": {
|
||||
"plugins": [
|
||||
{
|
||||
"type": "module",
|
||||
"name": "JG-JCore",
|
||||
"class": "cn.jiguang.uniplugin_jcore.JCoreModule"
|
||||
}
|
||||
],
|
||||
"integrateType": "aar",
|
||||
"minSdkVersion": "19",
|
||||
"permissions": [
|
||||
],
|
||||
"abis": [
|
||||
"armeabi-v7a",
|
||||
"arm64-v8a",
|
||||
"x86"
|
||||
],
|
||||
"parameters": {
|
||||
"JPUSH_APPKEY_ANDROID": {
|
||||
"des": "[Android]极光portal配置应用信息时分配的AppKey",
|
||||
"key": "JPUSH_APPKEY"
|
||||
},
|
||||
"JPUSH_CHANNEL_ANDROID":{
|
||||
"des": "[Android]用于统计分发渠道,不需要可填默认值developer-default",
|
||||
"key": "JPUSH_CHANNEL"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,798 @@
|
|||
/*
|
||||
* | | | | \ \ / / | | | | / _______|
|
||||
* | |____| | \ \/ / | |____| | / /
|
||||
* | |____| | \ / | |____| | | | _____
|
||||
* | | | | / \ | | | | | | |____ |
|
||||
* | | | | / /\ \ | | | | \ \______| |
|
||||
* | | | | /_/ \_\ | | | | \_________|
|
||||
*
|
||||
* Copyright (c) 2011 ~ 2017 Shenzhen HXHG. All rights reserved.
|
||||
*/
|
||||
|
||||
#define JPUSH_VERSION_NUMBER 3.4.0
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class CLRegion;
|
||||
@class UILocalNotification;
|
||||
@class CLLocation;
|
||||
@class UNNotificationCategory;
|
||||
@class UNNotificationSettings;
|
||||
@class UNNotificationRequest;
|
||||
@class UNNotification;
|
||||
@protocol JPUSHRegisterDelegate;
|
||||
@protocol JPUSHGeofenceDelegate;
|
||||
@protocol JPushInMessageDelegate;
|
||||
|
||||
typedef void (^JPUSHTagsOperationCompletion)(NSInteger iResCode, NSSet *iTags, NSInteger seq);
|
||||
typedef void (^JPUSHTagValidOperationCompletion)(NSInteger iResCode, NSSet *iTags, NSInteger seq, BOOL isBind);
|
||||
typedef void (^JPUSHAliasOperationCompletion)(NSInteger iResCode, NSString *iAlias, NSInteger seq);
|
||||
typedef void (^JPUSHInMssageCompletion)(NSInteger iResCode);
|
||||
|
||||
extern NSString *const kJPFNetworkIsConnectingNotification; // 正在连接中
|
||||
extern NSString *const kJPFNetworkDidSetupNotification; // 建立连接
|
||||
extern NSString *const kJPFNetworkDidCloseNotification; // 关闭连接
|
||||
extern NSString *const kJPFNetworkDidRegisterNotification; // 注册成功
|
||||
extern NSString *const kJPFNetworkFailedRegisterNotification; //注册失败
|
||||
extern NSString *const kJPFNetworkDidLoginNotification; // 登录成功
|
||||
extern NSString *const kJPFNetworkDidReceiveMessageNotification; // 收到消息(非APNS)
|
||||
extern NSString *const kJPFServiceErrorNotification; // 错误提示
|
||||
|
||||
typedef NS_OPTIONS(NSUInteger, JPAuthorizationOptions) {
|
||||
JPAuthorizationOptionNone = 0, // the application may not present any UI upon a notification being received
|
||||
JPAuthorizationOptionBadge = (1 << 0), // the application may badge its icon upon a notification being received
|
||||
JPAuthorizationOptionSound = (1 << 1), // the application may play a sound upon a notification being received
|
||||
JPAuthorizationOptionAlert = (1 << 2), // the application may display an alert upon a notification being received
|
||||
JPAuthorizationOptionCarPlay = (1 << 3), // The ability to display notifications in a CarPlay environment.
|
||||
JPAuthorizationOptionCriticalAlert NS_AVAILABLE_IOS(12.0) = (1 << 4) , //The ability to play sounds for critical alerts.
|
||||
JPAuthorizationOptionProvidesAppNotificationSettings NS_AVAILABLE_IOS(12.0) = (1 << 5) , //An option indicating the system should display a button for in-app notification settings.
|
||||
JPAuthorizationOptionProvisional NS_AVAILABLE_IOS(12.0) = (1 << 6) , //The ability to post noninterrupting notifications provisionally to the Notification Center.
|
||||
JPAuthorizationOptionAnnouncement NS_AVAILABLE_IOS(13.0) = (1 << 7) , //The ability for Siri to automatically read out messages over AirPods.
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSUInteger, JPAuthorizationStatus) {
|
||||
JPAuthorizationNotDetermined = 0, // The user has not yet made a choice regarding whether the application may post user notifications.
|
||||
JPAuthorizationStatusDenied, // The application is not authorized to post user notifications.
|
||||
JPAuthorizationStatusAuthorized, // The application is authorized to post user notifications.
|
||||
JPAuthorizationStatusProvisional NS_AVAILABLE_IOS(12.0), // The application is authorized to post non-interruptive user notifications.
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger,JPushInMessageContentType){
|
||||
JPushAdContentType = 1, //广告类型的inMessage
|
||||
JPushNotiContentType = 2, //通知类型的inMessage
|
||||
};
|
||||
|
||||
/*!
|
||||
* 通知注册实体类
|
||||
*/
|
||||
@interface JPUSHRegisterEntity : NSObject
|
||||
|
||||
/*!
|
||||
* 支持的类型
|
||||
* badge,sound,alert
|
||||
*/
|
||||
@property (nonatomic, assign) NSInteger types;
|
||||
/*!
|
||||
* 注入的类别
|
||||
* iOS10 UNNotificationCategory
|
||||
* iOS8-iOS9 UIUserNotificationCategory
|
||||
*/
|
||||
@property (nonatomic, strong) NSSet *categories;
|
||||
@end
|
||||
|
||||
/*!
|
||||
* 进行删除、查找推送实体类
|
||||
*/
|
||||
@interface JPushNotificationIdentifier : NSObject<NSCopying, NSCoding>
|
||||
|
||||
@property (nonatomic, copy) NSArray<NSString *> *identifiers; // 推送的标识数组
|
||||
@property (nonatomic, copy) UILocalNotification *notificationObj NS_DEPRECATED_IOS(4_0, 10_0); // iOS10以下可以传UILocalNotification对象数据,iOS10以上无效
|
||||
@property (nonatomic, assign) BOOL delivered NS_AVAILABLE_IOS(10_0); // 在通知中心显示的或待推送的标志,默认为NO,YES表示在通知中心显示的,NO表示待推送的
|
||||
@property (nonatomic, copy) void (^findCompletionHandler)(NSArray *results); // 用于查询回调,调用[findNotification:]方法前必须设置,results为返回相应对象数组,iOS10以下返回UILocalNotification对象数组;iOS10以上根据delivered传入值返回UNNotification或UNNotificationRequest对象数组(delivered传入YES,则返回UNNotification对象数组,否则返回UNNotificationRequest对象数组)
|
||||
|
||||
@end
|
||||
|
||||
/*!
|
||||
* 推送通知声音实体类
|
||||
* iOS10以上有效
|
||||
*/
|
||||
@interface JPushNotificationSound : NSObject <NSCopying, NSCoding>
|
||||
@property (nonatomic, copy) NSString *soundName; //普通通知铃声
|
||||
@property (nonatomic, copy) NSString *criticalSoundName NS_AVAILABLE_IOS(12.0); //警告通知铃声
|
||||
@property (nonatomic, assign) float criticalSoundVolume NS_AVAILABLE_IOS(12.0); //警告通知铃声音量,有效值在0~1之间,默认为1
|
||||
@end
|
||||
|
||||
|
||||
/*!
|
||||
* 推送内容实体类
|
||||
*/
|
||||
@interface JPushNotificationContent : NSObject<NSCopying, NSCoding>
|
||||
|
||||
@property (nonatomic, copy) NSString *title; // 推送标题
|
||||
@property (nonatomic, copy) NSString *subtitle; // 推送副标题
|
||||
@property (nonatomic, copy) NSString *body; // 推送内容
|
||||
@property (nonatomic, copy) NSNumber *badge; // 角标的数字。如果不需要改变角标传@(-1)
|
||||
@property (nonatomic, copy) NSString *action NS_DEPRECATED_IOS(8_0, 10_0); // 弹框的按钮显示的内容(IOS 8默认为"打开", 其他默认为"启动",iOS10以上无效)
|
||||
@property (nonatomic, copy) NSString *categoryIdentifier; // 行为分类标识
|
||||
@property (nonatomic, copy) NSDictionary *userInfo; // 本地推送时可以设置userInfo来增加附加信息,远程推送时设置的payload推送内容作为此userInfo
|
||||
@property (nonatomic, copy) NSString *sound; // 声音名称,不设置则为默认声音
|
||||
@property (nonatomic, copy) JPushNotificationSound *soundSetting NS_AVAILABLE_IOS(10.0); //推送声音实体
|
||||
@property (nonatomic, copy) NSArray *attachments NS_AVAILABLE_IOS(10_0); // 附件,iOS10以上有效,需要传入UNNotificationAttachment对象数组类型
|
||||
@property (nonatomic, copy) NSString *threadIdentifier NS_AVAILABLE_IOS(10_0); // 线程或与推送请求相关对话的标识,iOS10以上有效,可用来对推送进行分组
|
||||
@property (nonatomic, copy) NSString *launchImageName NS_AVAILABLE_IOS(10_0); // 启动图片名,iOS10以上有效,从推送启动时将会用到
|
||||
@property (nonatomic, copy) NSString *summaryArgument NS_AVAILABLE_IOS(12.0); //插入到通知摘要中的部分参数。iOS12以上有效。
|
||||
@property (nonatomic, assign) NSUInteger summaryArgumentCount NS_AVAILABLE_IOS(12.0); //插入到通知摘要中的项目数。iOS12以上有效。
|
||||
@property (nonatomic, copy) NSString *targetContentIdentifier NS_AVAILABLE_IOS(13.0); // An identifier for the content of the notification used by the system to customize the scene to be activated when tapping on a notification.
|
||||
|
||||
@end
|
||||
|
||||
|
||||
/*!
|
||||
* 推送触发方式实体类
|
||||
* 注:dateComponents、timeInterval、region在iOS10以上可选择其中一个参数传入有效值,如果同时传入值会根据优先级I、II、III使其中一种触发方式生效,fireDate为iOS10以下根据时间触发时须传入的参数
|
||||
*/
|
||||
@interface JPushNotificationTrigger : NSObject<NSCopying, NSCoding>
|
||||
|
||||
@property (nonatomic, assign) BOOL repeat; // 设置是否重复,默认为NO
|
||||
@property (nonatomic, copy) NSDate *fireDate NS_DEPRECATED_IOS(2_0, 10_0); // 用来设置触发推送的时间,iOS10以上无效
|
||||
@property (nonatomic, copy) CLRegion *region NS_AVAILABLE_IOS(8_0); // 用来设置触发推送的位置,iOS8以上有效,iOS10以上优先级为I,应用需要有允许使用定位的授权
|
||||
@property (nonatomic, copy) NSDateComponents *dateComponents NS_AVAILABLE_IOS(10_0); // 用来设置触发推送的日期时间,iOS10以上有效,优先级为II
|
||||
@property (nonatomic, assign) NSTimeInterval timeInterval NS_AVAILABLE_IOS(10_0); // 用来设置触发推送的时间,iOS10以上有效,优先级为III
|
||||
|
||||
@end
|
||||
|
||||
/*!
|
||||
* 注册或更新推送实体类
|
||||
*/
|
||||
@interface JPushNotificationRequest : NSObject<NSCopying, NSCoding>
|
||||
|
||||
@property (nonatomic, copy) NSString *requestIdentifier; // 推送请求标识
|
||||
@property (nonatomic, copy) JPushNotificationContent *content; // 设置推送的具体内容
|
||||
@property (nonatomic, copy) JPushNotificationTrigger *trigger; // 设置推送的触发方式
|
||||
@property (nonatomic, copy) void (^completionHandler)(id result); // 注册或更新推送成功回调,iOS10以上成功则result为UNNotificationRequest对象,失败则result为nil;iOS10以下成功result为UILocalNotification对象,失败则result为nil
|
||||
|
||||
@end
|
||||
|
||||
/*!
|
||||
* JPush 核心头文件
|
||||
*/
|
||||
@interface JPUSHService : NSObject
|
||||
|
||||
|
||||
///----------------------------------------------------
|
||||
/// @name Setup 启动相关
|
||||
///----------------------------------------------------
|
||||
|
||||
|
||||
/*!
|
||||
* @abstract 启动SDK
|
||||
*
|
||||
* @param launchingOption 启动参数.
|
||||
* @param appKey 一个JPush 应用必须的,唯一的标识. 请参考 JPush 相关说明文档来获取这个标识.
|
||||
* @param channel 发布渠道. 可选.
|
||||
* @param isProduction 是否生产环境. 如果为开发状态,设置为 NO; 如果为生产状态,应改为 YES.
|
||||
* App 证书环境取决于profile provision的配置,此处建议与证书环境保持一致.
|
||||
*
|
||||
* @discussion 提供SDK启动必须的参数, 来启动 SDK.
|
||||
* 此接口必须在 App 启动时调用, 否则 JPush SDK 将无法正常工作.
|
||||
*/
|
||||
+ (void)setupWithOption:(NSDictionary *)launchingOption
|
||||
appKey:(NSString *)appKey
|
||||
channel:(NSString *)channel
|
||||
apsForProduction:(BOOL)isProduction;
|
||||
|
||||
/*!
|
||||
* @abstract 启动SDK
|
||||
*
|
||||
* @param launchingOption 启动参数.
|
||||
* @param appKey 一个JPush 应用必须的,唯一的标识. 请参考 JPush 相关说明文档来获取这个标识.
|
||||
* @param channel 发布渠道. 可选.
|
||||
* @param isProduction 是否生产环境. 如果为开发状态,设置为 NO; 如果为生产状态,应改为 YES.
|
||||
* App 证书环境取决于profile provision的配置,此处建议与证书环境保持一致.
|
||||
* @param advertisingId 广告标识符(IDFA) 如果不需要使用IDFA,传nil.
|
||||
*
|
||||
* @discussion 提供SDK启动必须的参数, 来启动 SDK.
|
||||
* 此接口必须在 App 启动时调用, 否则 JPush SDK 将无法正常工作.
|
||||
*/
|
||||
+ (void)setupWithOption:(NSDictionary *)launchingOption
|
||||
appKey:(NSString *)appKey
|
||||
channel:(NSString *)channel
|
||||
apsForProduction:(BOOL)isProduction
|
||||
advertisingIdentifier:(NSString *)advertisingId;
|
||||
|
||||
|
||||
///----------------------------------------------------
|
||||
/// @name APNs about 通知相关
|
||||
///----------------------------------------------------
|
||||
|
||||
/*!
|
||||
* @abstract 注册要处理的远程通知类型
|
||||
*
|
||||
* @param types 通知类型
|
||||
* @param categories 类别组
|
||||
*
|
||||
*/
|
||||
+ (void)registerForRemoteNotificationTypes:(NSUInteger)types
|
||||
categories:(NSSet *)categories;
|
||||
/*!
|
||||
* @abstract 新版本的注册方法(兼容iOS10)
|
||||
*
|
||||
* @param config 注册通知配置
|
||||
* @param delegate 代理
|
||||
*
|
||||
*/
|
||||
+ (void)registerForRemoteNotificationConfig:(JPUSHRegisterEntity *)config delegate:(id<JPUSHRegisterDelegate>)delegate;
|
||||
|
||||
|
||||
+ (void)registerDeviceToken:(NSData *)deviceToken;
|
||||
|
||||
/*!
|
||||
* @abstract 处理收到的 APNs 消息
|
||||
*/
|
||||
+ (void)handleRemoteNotification:(NSDictionary *)remoteInfo;
|
||||
|
||||
/*!
|
||||
* @abstract 向极光服务器提交Token
|
||||
*
|
||||
* @param voipToken 推送使用的Voip Token
|
||||
*/
|
||||
+ (void)registerVoipToken:(NSData *)voipToken;
|
||||
|
||||
|
||||
/*!
|
||||
* @abstract 处理收到的 Voip 消息
|
||||
*
|
||||
* @param remoteInfo 下发的 Voip 内容
|
||||
*/
|
||||
+ (void)handleVoipNotification:(NSDictionary *)remoteInfo;
|
||||
|
||||
|
||||
/*!
|
||||
* @abstract 检测通知授权状态
|
||||
* @param completion 授权结果通过status值返回,详见JPAuthorizationStatus
|
||||
*/
|
||||
+ (void)requestNotificationAuthorization:(void (^)(JPAuthorizationStatus status))completion;
|
||||
|
||||
/*!
|
||||
* @abstract 跳转至系统设置页面,iOS8及以上有效
|
||||
*/
|
||||
+ (void)openSettingsForNotification:(void (^)(BOOL success))completionHandler NS_AVAILABLE_IOS(8_0);
|
||||
|
||||
/*!
|
||||
* Tags操作接口
|
||||
* 支持增加/覆盖/删除/清空/查询操作
|
||||
* 详情请参考文档:https://docs.jiguang.cn/jpush/client/iOS/ios_api/)
|
||||
*/
|
||||
|
||||
/**
|
||||
增加tags
|
||||
|
||||
@param tags 需要增加的tags集合
|
||||
@param completion 响应回调
|
||||
@param seq 请求序列号
|
||||
*/
|
||||
+ (void)addTags:(NSSet<NSString *> *)tags
|
||||
completion:(JPUSHTagsOperationCompletion)completion
|
||||
seq:(NSInteger)seq;
|
||||
|
||||
/**
|
||||
覆盖tags
|
||||
调用该接口会覆盖用户所有的tags
|
||||
|
||||
@param tags 需要设置的tags集合
|
||||
@param completion 响应回调
|
||||
@param seq 请求序列号
|
||||
*/
|
||||
+ (void)setTags:(NSSet<NSString *> *)tags
|
||||
completion:(JPUSHTagsOperationCompletion)completion
|
||||
seq:(NSInteger)seq;
|
||||
|
||||
/**
|
||||
删除指定tags
|
||||
|
||||
@param tags 需要删除的tags集合
|
||||
@param completion 响应回调
|
||||
@param seq 请求序列号
|
||||
*/
|
||||
+ (void)deleteTags:(NSSet<NSString *> *)tags
|
||||
completion:(JPUSHTagsOperationCompletion)completion
|
||||
seq:(NSInteger)seq;
|
||||
|
||||
/**
|
||||
清空所有tags
|
||||
@param completion 响应回调
|
||||
@param seq 请求序列号
|
||||
*/
|
||||
+ (void)cleanTags:(JPUSHTagsOperationCompletion)completion
|
||||
seq:(NSInteger)seq;
|
||||
|
||||
/**
|
||||
查询全部tags
|
||||
|
||||
@param completion 响应回调,请在回调中获取查询结果
|
||||
@param seq 请求序列号
|
||||
*/
|
||||
+ (void)getAllTags:(JPUSHTagsOperationCompletion)completion
|
||||
seq:(NSInteger)seq;
|
||||
|
||||
/**
|
||||
验证tag是否绑定
|
||||
|
||||
@param completion 响应回调,回调中查看是否绑定
|
||||
@param seq 请求序列号
|
||||
*/
|
||||
+ (void)validTag:(NSString *)tag
|
||||
completion:(JPUSHTagValidOperationCompletion)completion
|
||||
seq:(NSInteger)seq;
|
||||
|
||||
/**
|
||||
设置Alias
|
||||
|
||||
@param alias 需要设置的alias
|
||||
@param completion 响应回调
|
||||
@param seq 请求序列号
|
||||
*/
|
||||
+ (void)setAlias:(NSString *)alias
|
||||
completion:(JPUSHAliasOperationCompletion)completion
|
||||
seq:(NSInteger)seq;
|
||||
|
||||
/**
|
||||
删除alias
|
||||
|
||||
@param completion 响应回调
|
||||
@param seq 请求序列号
|
||||
*/
|
||||
+ (void)deleteAlias:(JPUSHAliasOperationCompletion)completion
|
||||
seq:(NSInteger)seq;
|
||||
|
||||
/**
|
||||
查询当前alias
|
||||
|
||||
@param completion 响应回调
|
||||
@param seq 请求序列号
|
||||
*/
|
||||
+ (void)getAlias:(JPUSHAliasOperationCompletion)completion
|
||||
seq:(NSInteger)seq;
|
||||
|
||||
|
||||
/*!
|
||||
* @abstract 过滤掉无效的 tags
|
||||
*
|
||||
* @discussion 如果 tags 数量超过限制数量, 则返回靠前的有效的 tags.
|
||||
* 建议设置 tags 前用此接口校验. SDK 内部也会基于此接口来做过滤.
|
||||
*/
|
||||
+ (NSSet *)filterValidTags:(NSSet *)tags;
|
||||
|
||||
///----------------------------------------------------
|
||||
/// @name Stats 统计功能
|
||||
///----------------------------------------------------
|
||||
|
||||
/*!
|
||||
* @abstract 开始记录页面停留
|
||||
*
|
||||
* @param pageName 页面名称
|
||||
* @discussion JCore 1.1.8 版本后,如需统计页面流,请使用 JAnalytics
|
||||
*/
|
||||
+ (void)startLogPageView:(NSString *)pageName __attribute__((deprecated("JCore 1.1.8 版本已过期")));
|
||||
|
||||
/*!
|
||||
* @abstract 停止记录页面停留
|
||||
*
|
||||
* @param pageName 页面
|
||||
* @discussion JCore 1.1.8 版本后,如需统计页面流,请使用 JAnalytics
|
||||
*/
|
||||
+ (void)stopLogPageView:(NSString *)pageName __attribute__((deprecated("JCore 1.1.8 版本已过期")));
|
||||
|
||||
/*!
|
||||
* @abstract 直接上报在页面的停留时间
|
||||
*
|
||||
* @param pageName 页面
|
||||
* @param seconds 停留的秒数
|
||||
* @discussion JCore 1.1.8 版本后,如需统计页面流,请使用 JAnalytics
|
||||
*/
|
||||
+ (void)beginLogPageView:(NSString *)pageName duration:(int)seconds __attribute__((deprecated("JCore 1.1.8 版本已过期")));
|
||||
|
||||
/*!
|
||||
* @abstract 开启Crash日志收集
|
||||
*
|
||||
* @discussion 默认是关闭状态.
|
||||
*/
|
||||
+ (void)crashLogON;
|
||||
|
||||
/*!
|
||||
* @abstract 地理位置上报
|
||||
*
|
||||
* @param latitude 纬度.
|
||||
* @param longitude 经度.
|
||||
*
|
||||
*/
|
||||
+ (void)setLatitude:(double)latitude longitude:(double)longitude;
|
||||
|
||||
/*!
|
||||
* @abstract 地理位置上报
|
||||
*
|
||||
* @param location 直接传递 CLLocation * 型的地理信息
|
||||
*
|
||||
* @discussion 需要链接 CoreLocation.framework 并且 #import <CoreLocation/CoreLocation.h>
|
||||
*/
|
||||
+ (void)setLocation:(CLLocation *)location;
|
||||
|
||||
/**
|
||||
设置地理围栏的最大个数
|
||||
默认值为 10 ,iOS系统默认地理围栏最大个数为20
|
||||
@param count 个数 count
|
||||
*/
|
||||
+ (void)setGeofenecMaxCount:(NSInteger)count;
|
||||
/**
|
||||
注册地理围栏的代理
|
||||
|
||||
@param delegate 代理
|
||||
@param launchOptions app启动完成是收到的字段参数
|
||||
*/
|
||||
+ (void)registerLbsGeofenceDelegate:(id<JPUSHGeofenceDelegate>)delegate withLaunchOptions:(NSDictionary *)launchOptions;
|
||||
|
||||
/**
|
||||
删除地理围栏
|
||||
|
||||
@param geofenceId 地理围栏id
|
||||
*/
|
||||
+ (void)removeGeofenceWithIdentifier:(NSString *)geofenceId;
|
||||
|
||||
///----------------------------------------------------
|
||||
/// @name Local Notification 本地通知
|
||||
///----------------------------------------------------
|
||||
/*!
|
||||
* @abstract 注册或更新推送 (支持iOS10,并兼容iOS10以下版本)
|
||||
*
|
||||
* JPush 2.1.9新接口
|
||||
* @param request JPushNotificationRequest类型,设置推送的属性,设置已有推送的request.requestIdentifier即更新已有的推送,否则为注册新推送,更新推送仅仅在iOS10以上有效,结果通过request.completionHandler返回
|
||||
* @discussion 旧的注册本地推送接口被废弃,使用此接口可以替换
|
||||
*
|
||||
*/
|
||||
+ (void)addNotification:(JPushNotificationRequest *)request;
|
||||
|
||||
/*!
|
||||
* @abstract 移除推送 (支持iOS10,并兼容iOS10以下版本)
|
||||
*
|
||||
* JPush 2.1.9新接口
|
||||
* @param identifier JPushNotificationIdentifier类型,iOS10以上identifier设置为nil,则移除所有在通知中心显示推送和待推送请求,也可以通过设置identifier.delivered和identifier.identifiers来移除相应在通知中心显示推送或待推送请求,identifier.identifiers如果设置为nil或空数组则移除相应标志下所有在通知中心显示推送或待推送请求;iOS10以下identifier设置为nil,则移除所有推送,identifier.delivered属性无效,另外可以通过identifier.notificationObj传入特定推送对象来移除此推送。
|
||||
* @discussion 旧的所有删除推送接口被废弃,使用此接口可以替换
|
||||
*
|
||||
*/
|
||||
+ (void)removeNotification:(JPushNotificationIdentifier *)identifier;
|
||||
|
||||
/*!
|
||||
* @abstract 查找推送 (支持iOS10,并兼容iOS10以下版本)
|
||||
*
|
||||
* JPush 2.1.9新接口
|
||||
* @param identifier JPushNotificationIdentifier类型,iOS10以上可以通过设置identifier.delivered和identifier.identifiers来查找相应在通知中心显示推送或待推送请求,identifier.identifiers如果设置为nil或空数组则返回相应标志下所有在通知中心显示推送或待推送请求;iOS10以下identifier.delivered属性无效,identifier.identifiers如果设置nil或空数组则返回所有未触发的推送。须要设置identifier.findCompletionHandler回调才能得到查找结果,通过(NSArray *results)返回相应对象数组。
|
||||
* @discussion 旧的查找推送接口被废弃,使用此接口可以替换
|
||||
*
|
||||
*/
|
||||
+ (void)findNotification:(JPushNotificationIdentifier *)identifier;
|
||||
|
||||
/*!
|
||||
* @abstract 本地推送,最多支持64个
|
||||
*
|
||||
* @param fireDate 本地推送触发的时间
|
||||
* @param alertBody 本地推送需要显示的内容
|
||||
* @param badge 角标的数字。如果不需要改变角标传-1
|
||||
* @param alertAction 弹框的按钮显示的内容(IOS 8默认为"打开", 其他默认为"启动")
|
||||
* @param notificationKey 本地推送标示符
|
||||
* @param userInfo 自定义参数,可以用来标识推送和增加附加信息
|
||||
* @param soundName 自定义通知声音,设置为nil为默认声音
|
||||
*
|
||||
* @discussion 最多支持 64 个定义,此方法被[addNotification:]方法取代
|
||||
*/
|
||||
+ (UILocalNotification *)setLocalNotification:(NSDate *)fireDate
|
||||
alertBody:(NSString *)alertBody
|
||||
badge:(int)badge
|
||||
alertAction:(NSString *)alertAction
|
||||
identifierKey:(NSString *)notificationKey
|
||||
userInfo:(NSDictionary *)userInfo
|
||||
soundName:(NSString *)soundName __attribute__((deprecated("JPush 2.1.9 版本已过期")));
|
||||
|
||||
/*!
|
||||
* @abstract 本地推送 (支持 iOS8 新参数)
|
||||
*
|
||||
* IOS8新参数
|
||||
* @param region 自定义参数
|
||||
* @param regionTriggersOnce 自定义参数
|
||||
* @param category 自定义参数
|
||||
* @discussion 此方法被[addNotification:]方法取代
|
||||
*/
|
||||
+ (UILocalNotification *)setLocalNotification:(NSDate *)fireDate
|
||||
alertBody:(NSString *)alertBody
|
||||
badge:(int)badge
|
||||
alertAction:(NSString *)alertAction
|
||||
identifierKey:(NSString *)notificationKey
|
||||
userInfo:(NSDictionary *)userInfo
|
||||
soundName:(NSString *)soundName
|
||||
region:(CLRegion *)region
|
||||
regionTriggersOnce:(BOOL)regionTriggersOnce
|
||||
category:(NSString *)category NS_AVAILABLE_IOS(8_0) __attribute__((deprecated("JPush 2.1.9 版本已过期")));
|
||||
|
||||
/*!
|
||||
* @abstract 前台展示本地推送
|
||||
*
|
||||
* @param notification 本地推送对象
|
||||
* @param notificationKey 需要前台显示的本地推送通知的标示符
|
||||
*
|
||||
* @discussion 默认App在前台运行时不会进行弹窗,在程序接收通知调用此接口可实现指定的推送弹窗。--iOS10以下还可继续使用,iOS10以上在[UNUserNotificationCenterDelegate willPresentNotification:withCompletionHandler:]方法中调用completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert);即可
|
||||
*/
|
||||
+ (void)showLocalNotificationAtFront:(UILocalNotification *)notification
|
||||
identifierKey:(NSString *)notificationKey __attribute__((deprecated("JPush 2.1.9 版本已过期")));
|
||||
/*!
|
||||
* @abstract 删除本地推送定义
|
||||
*
|
||||
* @param notificationKey 本地推送标示符
|
||||
* @discussion 此方法被[removeNotification:]方法取代
|
||||
*/
|
||||
+ (void)deleteLocalNotificationWithIdentifierKey:(NSString *)notificationKey __attribute__((deprecated("JPush 2.1.9 版本已过期")));
|
||||
|
||||
/*!
|
||||
* @abstract 删除本地推送定义
|
||||
* @discussion 此方法被[removeNotification:]方法取代
|
||||
*/
|
||||
+ (void)deleteLocalNotification:(UILocalNotification *)localNotification __attribute__((deprecated("JPush 2.1.9 版本已过期")));
|
||||
|
||||
/*!
|
||||
* @abstract 获取指定通知
|
||||
*
|
||||
* @param notificationKey 本地推送标示符
|
||||
* @return 本地推送对象数组, [array count]为0时表示没找到
|
||||
* @discussion 此方法被[findNotification:]方法取代
|
||||
*/
|
||||
+ (NSArray *)findLocalNotificationWithIdentifier:(NSString *)notificationKey __attribute__((deprecated("JPush 2.1.9 版本已过期")));
|
||||
|
||||
/*!
|
||||
* @abstract 清除所有本地推送对象
|
||||
* @discussion 此方法被[removeNotification:]方法取代
|
||||
*/
|
||||
+ (void)clearAllLocalNotifications __attribute__((deprecated("JPush 2.1.9 版本已过期")));
|
||||
|
||||
|
||||
///----------------------------------------------------
|
||||
/// @name Server badge 服务器端 badge 功能
|
||||
///----------------------------------------------------
|
||||
|
||||
/*!
|
||||
* @abstract 设置角标(到服务器)
|
||||
*
|
||||
* @param value 新的值. 会覆盖服务器上保存的值(这个用户)
|
||||
*
|
||||
* @discussion 本接口不会改变应用本地的角标值.
|
||||
* 本地仍须调用 UIApplication:setApplicationIconBadgeNumber 函数来设置脚标.
|
||||
*
|
||||
* 本接口用于配合 JPush 提供的服务器端角标功能.
|
||||
* 该功能解决的问题是, 服务器端推送 APNs 时, 并不知道客户端原来已经存在的角标是多少, 指定一个固定的数字不太合理.
|
||||
*
|
||||
* JPush 服务器端脚标功能提供:
|
||||
*
|
||||
* - 通过本 API 把当前客户端(当前这个用户的) 的实际 badge 设置到服务器端保存起来;
|
||||
* - 调用服务器端 API 发 APNs 时(通常这个调用是批量针对大量用户),
|
||||
* 使用 "+1" 的语义, 来表达需要基于目标用户实际的 badge 值(保存的) +1 来下发通知时带上新的 badge 值;
|
||||
*/
|
||||
+ (BOOL)setBadge:(NSInteger)value;
|
||||
|
||||
/*!
|
||||
* @abstract 重置脚标(为0)
|
||||
*
|
||||
* @discussion 相当于 [setBadge:0] 的效果.
|
||||
* 参考 [JPUSHService setBadge:] 说明来理解其作用.
|
||||
*/
|
||||
+ (void)resetBadge;
|
||||
|
||||
///----------------------------------------------------
|
||||
/// @name Other Feature 其他功能
|
||||
///----------------------------------------------------
|
||||
|
||||
/*!
|
||||
* @abstract 设置手机号码(到服务器)
|
||||
*
|
||||
* @param mobileNumber 手机号码. 会与用户信息一一对应。可为空,为空则清除号码
|
||||
* @param completion 响应回调。成功则error为空,失败则error带有错误码及错误信息
|
||||
*
|
||||
* @discussion 设置手机号码后,可实现“推送不到短信到”的通知方式,提高推送达到率。结果信息通过completion异步返回,也可将completion设置为nil不处理结果信息。
|
||||
*
|
||||
*/
|
||||
+ (void)setMobileNumber:(NSString *)mobileNumber completion:(void (^)(NSError *error))completion;
|
||||
|
||||
///----------------------------------------------------
|
||||
/// @name Logs and others 日志与其他
|
||||
///----------------------------------------------------
|
||||
|
||||
/*!
|
||||
* @abstract JPush标识此设备的 registrationID
|
||||
*
|
||||
* @discussion SDK注册成功后, 调用此接口获取到 registrationID 才能够获取到.
|
||||
*
|
||||
* JPush 支持根据 registrationID 来进行推送.
|
||||
* 如果你需要此功能, 应该通过此接口获取到 registrationID 后, 上报到你自己的服务器端, 并保存下来.
|
||||
* registrationIDCompletionHandler:是新增的获取registrationID的方法,需要在block中获取registrationID,resCode为返回码,模拟器调用此接口resCode返回1011,registrationID返回nil.
|
||||
* 更多的理解请参考 JPush 的文档网站.
|
||||
*/
|
||||
+ (NSString *)registrationID;
|
||||
|
||||
+ (void)registrationIDCompletionHandler:(void(^)(int resCode,NSString *registrationID))completionHandler;
|
||||
|
||||
/*!
|
||||
* @abstract 打开日志级别到 Debug
|
||||
*
|
||||
* @discussion JMessage iOS 的日志系统参考 Android 设计了级别.
|
||||
* 从低到高是: Verbose, Debug, Info, Warning, Error.
|
||||
* 对日志级别的进一步理解, 请参考 Android 相关的说明.
|
||||
*
|
||||
* SDK 默认开启的日志级别为: Info. 只显示必要的信息, 不打印调试日志.
|
||||
*
|
||||
* 请在SDK启动后调用本接口,调用本接口可打开日志级别为: Debug, 打印调试日志.
|
||||
*/
|
||||
+ (void)setDebugMode;
|
||||
|
||||
/*!
|
||||
* @abstract 关闭日志
|
||||
*
|
||||
* @discussion 关于日志级别的说明, 参考 [JPUSHService setDebugMode]
|
||||
*
|
||||
* 虽说是关闭日志, 但还是会打印 Warning, Error 日志. 这二种日志级别, 在程序运行正常时, 不应有打印输出.
|
||||
*
|
||||
* 建议在发布的版本里, 调用此接口, 关闭掉日志打印.
|
||||
*/
|
||||
+ (void)setLogOFF;
|
||||
|
||||
/*!
|
||||
* @abstract 设置SDK地理位置权限开关
|
||||
*
|
||||
* @discussion 关闭地理位置之后,SDK地理围栏的相关功能将受到影响,默认是开启。
|
||||
*
|
||||
*/
|
||||
+ (void)setLocationEanable:(BOOL)isEanble;
|
||||
|
||||
/*!
|
||||
* @abstract 设置应用内消息的代理
|
||||
*
|
||||
* @discussion 遵守JPushInMessageDelegate的代理对象
|
||||
*
|
||||
*/
|
||||
+ (void)setInMessageDelegate:(id<JPushInMessageDelegate>)inMessageDelegate;
|
||||
|
||||
|
||||
/*!
|
||||
* @abstract 主动拉取应用内消息的接口
|
||||
*
|
||||
* @discussion 拉取结果的回调
|
||||
*
|
||||
*/
|
||||
+ (void)pullInMessageCompletion:(JPUSHInMssageCompletion)completion;
|
||||
|
||||
///----------------------------------------------------
|
||||
///********************下列方法已过期********************
|
||||
///**************请使用新版tag/alias操作接口**************
|
||||
///----------------------------------------------------
|
||||
/// @name Tag alias setting 设置别名与标签
|
||||
///----------------------------------------------------
|
||||
|
||||
/*!
|
||||
* 下面的接口是可选的
|
||||
* 设置标签和(或)别名(若参数为nil,则忽略;若是空对象,则清空;详情请参考文档:https://docs.jiguang.cn/jpush/client/iOS/ios_api/)
|
||||
* setTags:alias:fetchCompletionHandle:是新的设置标签别名的方法,不再需要显示声明回调函数,只需要在block里面处理设置结果即可.
|
||||
* WARN: 使用block时需要注意循环引用问题
|
||||
*/
|
||||
+ (void) setTags:(NSSet *)tags
|
||||
alias:(NSString *)alias
|
||||
callbackSelector:(SEL)cbSelector
|
||||
target:(id)theTarget __attribute__((deprecated("JPush 2.1.1 版本已过期")));
|
||||
+ (void) setTags:(NSSet *)tags
|
||||
alias:(NSString *)alias
|
||||
callbackSelector:(SEL)cbSelector
|
||||
object:(id)theTarget __attribute__((deprecated("JPush 3.0.6 版本已过期")));
|
||||
+ (void) setTags:(NSSet *)tags
|
||||
callbackSelector:(SEL)cbSelector
|
||||
object:(id)theTarget __attribute__((deprecated("JPush 3.0.6 版本已过期")));
|
||||
+ (void)setTags:(NSSet *)tags
|
||||
alias:(NSString *)alias
|
||||
fetchCompletionHandle:(void (^)(int iResCode, NSSet *iTags, NSString *iAlias))completionHandler __attribute__((deprecated("JPush 3.0.6 版本已过期")));
|
||||
+ (void) setTags:(NSSet *)tags
|
||||
aliasInbackground:(NSString *)alias __attribute__((deprecated("JPush 3.0.6 版本已过期")));
|
||||
+ (void)setAlias:(NSString *)alias
|
||||
callbackSelector:(SEL)cbSelector
|
||||
object:(id)theTarget __attribute__((deprecated("JPush 3.0.6 版本已过期")));
|
||||
|
||||
@end
|
||||
|
||||
@class UNUserNotificationCenter;
|
||||
@class UNNotificationResponse;
|
||||
|
||||
@protocol JPUSHRegisterDelegate <NSObject>
|
||||
|
||||
/*
|
||||
* @brief handle UserNotifications.framework [willPresentNotification:withCompletionHandler:]
|
||||
* @param center [UNUserNotificationCenter currentNotificationCenter] 新特性用户通知中心
|
||||
* @param notification 前台得到的的通知对象
|
||||
* @param completionHandler 该callback中的options 请使用UNNotificationPresentationOptions
|
||||
*/
|
||||
- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(NSInteger options))completionHandler;
|
||||
/*
|
||||
* @brief handle UserNotifications.framework [didReceiveNotificationResponse:withCompletionHandler:]
|
||||
* @param center [UNUserNotificationCenter currentNotificationCenter] 新特性用户通知中心
|
||||
* @param response 通知响应对象
|
||||
* @param completionHandler
|
||||
*/
|
||||
- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler;
|
||||
|
||||
/*
|
||||
* @brief handle UserNotifications.framework [openSettingsForNotification:]
|
||||
* @param center [UNUserNotificationCenter currentNotificationCenter] 新特性用户通知中心
|
||||
* @param notification 当前管理的通知对象
|
||||
*/
|
||||
- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center openSettingsForNotification:(UNNotification *)notification NS_AVAILABLE_IOS(12.0);
|
||||
|
||||
/**
|
||||
* 监测通知授权状态返回的结果
|
||||
* @param status 授权通知状态,详见JPAuthorizationStatus
|
||||
* @param info 更多信息,预留参数
|
||||
*/
|
||||
- (void)jpushNotificationAuthorization:(JPAuthorizationStatus)status withInfo:(NSDictionary *)info;
|
||||
|
||||
@end
|
||||
|
||||
@protocol JPUSHGeofenceDelegate <NSObject>
|
||||
|
||||
/**
|
||||
进入地理围栏区域
|
||||
|
||||
@param geofenceId 地理围栏id
|
||||
@param userInfo 地理围栏触发时返回的信息
|
||||
@param error 错误信息
|
||||
*/
|
||||
- (void)jpushGeofenceIdentifer:(NSString *)geofenceId didEnterRegion:(NSDictionary *)userInfo error:(NSError *)error;
|
||||
|
||||
/**
|
||||
离开地理围栏区域
|
||||
|
||||
@param geofenceId 地理围栏id
|
||||
@param userInfo 地理围栏触发时返回的信息
|
||||
@param error 错误信息
|
||||
*/
|
||||
- (void)jpushGeofenceIdentifer:(NSString *)geofenceId didExitRegion:(NSDictionary *)userInfo error:(NSError *)error;
|
||||
|
||||
@end
|
||||
|
||||
@protocol JPushInMessageDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
/**
|
||||
*是否允许应用内消息弹出,默认为允许
|
||||
*/
|
||||
- (BOOL)jPushInMessageIsAllowedInMessagePop;
|
||||
|
||||
/**
|
||||
*应用内消息展示的回调
|
||||
*/
|
||||
- (void)jPushInMessageAlreadyPop __attribute__((deprecated("JPush 3.4.0 版本已过期")));;
|
||||
|
||||
/**
|
||||
*应用内消息已消失
|
||||
*/
|
||||
- (void)jPushInMessageAlreadyDisappear;
|
||||
|
||||
|
||||
/**
|
||||
inMessage展示的回调
|
||||
|
||||
@param messageType inMessage
|
||||
@param content 下发的数据,广告类的返回数据为空时返回的信息
|
||||
|
||||
*/
|
||||
- (void)jPushInMessageAlreadyPopInMessageType:(JPushInMessageContentType)messageType Content:(NSDictionary *)content;
|
||||
|
||||
/**
|
||||
inMessage点击的回调
|
||||
|
||||
@param messageType inMessage
|
||||
@param content 下发的数据,广告类的返回数据为空时返回的信息
|
||||
|
||||
*/
|
||||
- (void)jpushInMessagedidClickInMessageType:(JPushInMessageContentType)messageType Content:(NSDictionary *)content;
|
||||
|
||||
@end
|
|
@ -0,0 +1,17 @@
|
|||
//
|
||||
// JPushModule.h
|
||||
// UniPluginJPush
|
||||
//
|
||||
// Created by huangshuni on 2021/1/12.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "DCUniModule.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface JPushModule : DCUniModule
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,117 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>files</key>
|
||||
<dict>
|
||||
<key>Headers/JPushModule.h</key>
|
||||
<data>
|
||||
hAItQbWWuw4mOOySo6FeWH3MYsA=
|
||||
</data>
|
||||
<key>Info.plist</key>
|
||||
<data>
|
||||
mdxdKDpLHqtEZTfNMy6MBCyizi8=
|
||||
</data>
|
||||
</dict>
|
||||
<key>files2</key>
|
||||
<dict>
|
||||
<key>Headers/JPushModule.h</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
hAItQbWWuw4mOOySo6FeWH3MYsA=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
LHaZ7SfsmEBYhVCf3bEBp8fHG5II1obOplOf4kj6EZQ=
|
||||
</data>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>rules</key>
|
||||
<dict>
|
||||
<key>^.*</key>
|
||||
<true/>
|
||||
<key>^.*\.lproj/</key>
|
||||
<dict>
|
||||
<key>optional</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1000</real>
|
||||
</dict>
|
||||
<key>^.*\.lproj/locversion.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1100</real>
|
||||
</dict>
|
||||
<key>^Base\.lproj/</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>1010</real>
|
||||
</dict>
|
||||
<key>^version.plist$</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>rules2</key>
|
||||
<dict>
|
||||
<key>.*\.dSYM($|/)</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>11</real>
|
||||
</dict>
|
||||
<key>^(.*/)?\.DS_Store$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>2000</real>
|
||||
</dict>
|
||||
<key>^.*</key>
|
||||
<true/>
|
||||
<key>^.*\.lproj/</key>
|
||||
<dict>
|
||||
<key>optional</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1000</real>
|
||||
</dict>
|
||||
<key>^.*\.lproj/locversion.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1100</real>
|
||||
</dict>
|
||||
<key>^Base\.lproj/</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>1010</real>
|
||||
</dict>
|
||||
<key>^Info\.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^PkgInfo$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^embedded\.provisionprofile$</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^version\.plist$</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,138 @@
|
|||
{
|
||||
"name": "JG-JPush",
|
||||
"id": "JG-JPush",
|
||||
"version": "1.0.3",
|
||||
"description": "极光推送Hbuilder插件",
|
||||
"_dp_type":"nativeplugin",
|
||||
"_dp_nativeplugin":{
|
||||
"ios": {
|
||||
"plugins": [{
|
||||
"type": "module",
|
||||
"name": "JG-JPush",
|
||||
"class": "JPushModule"
|
||||
}],
|
||||
"hooksClass": "JPushProxy",
|
||||
"integrateType": "framework",
|
||||
"deploymentTarget": "9.0",
|
||||
"frameworks": [
|
||||
"CFNetwork.framework",
|
||||
"CoreFoundation.framework",
|
||||
"CoreTelephony.framework",
|
||||
"SystemConfiguration.framework",
|
||||
"CoreGraphics.framework",
|
||||
"Foundation.framework",
|
||||
"UIKit.framework",
|
||||
"Security.framework",
|
||||
"libz.tbd",
|
||||
"AdSupport.framework",
|
||||
"UserNotifications.framework",
|
||||
"libresolv.tbd",
|
||||
"WebKit.framework",
|
||||
"AppTrackingTransparency.framework",
|
||||
"StoreKit.framework"
|
||||
],
|
||||
"resources": [
|
||||
|
||||
],
|
||||
"capabilities": {
|
||||
"entitlements": {
|
||||
"aps-environment":"development"
|
||||
}
|
||||
},
|
||||
"privacies": [
|
||||
"NSLocationAlwaysAndWhenInUseUsageDescription",
|
||||
"NSLocationAlwaysUsageDescription",
|
||||
"NSLocationWhenInUseUsageDescription"
|
||||
],
|
||||
"parameters": {
|
||||
"JPUSH_ISPRODUCTION_IOS": {
|
||||
"des": "[iOS]是否是生产环境,是填true,不是填false或者不填",
|
||||
"key": "JPush:ISPRODUCTION"
|
||||
},
|
||||
"JPUSH_ADVERTISINGID_IOS": {
|
||||
"des": "[iOS]广告标识符(IDFA)如果不需要使用IDFA,可不填",
|
||||
"key": "JPush:ADVERTISINGID"
|
||||
},
|
||||
"JPUSH_DEFAULTINITJPUSH_IOS": {
|
||||
"des": "[iOS]是否默认初始化,是填true,不是填false或者不填",
|
||||
"key": "JPush:DEFAULTINITJPUSH"
|
||||
}
|
||||
}
|
||||
},
|
||||
"android": {
|
||||
"plugins": [
|
||||
{
|
||||
"type": "module",
|
||||
"name": "JG-JPush",
|
||||
"class": "cn.jiguang.uniplugin_jpush.JPushModule"
|
||||
}
|
||||
],
|
||||
"integrateType": "aar",
|
||||
"minSdkVersion": "19",
|
||||
"permissions": [
|
||||
"${applicationId}.permission.JPUSH_MESSAGE",
|
||||
"android.permission.RECEIVE_USER_PRESENT",
|
||||
"android.permission.INTERNET",
|
||||
"android.permission.READ_PHONE_STATE",
|
||||
"android.permission.WRITE_EXTERNAL_STORAGE",
|
||||
"android.permission.READ_EXTERNAL_STORAGE",
|
||||
"android.permission.WRITE_SETTINGS",
|
||||
"android.permission.MOUNT_UNMOUNT_FILESYSTEMS",
|
||||
"android.permission.ACCESS_NETWORK_STATE",
|
||||
"android.permission.ACCESS_WIFI_STATE",
|
||||
"com.huawei.android.launcher.permission.CHANGE_BADGE",
|
||||
"android.permission.VIBRATE",
|
||||
"android.permission.SYSTEM_ALERT_WINDOW",
|
||||
"android.permission.ACCESS_COARSE_LOCATION",
|
||||
"android.permission.CHANGE_WIFI_STATE",
|
||||
"android.permission.ACCESS_FINE_LOCATION",
|
||||
"android.permission.ACCESS_BACKGROUND_LOCATION",
|
||||
"android.permission.ACCESS_LOCATION_EXTRA_COMMANDS",
|
||||
"android.permission.CHANGE_NETWORK_STATE",
|
||||
"android.permission.GET_TASKS",
|
||||
"android.permission.QUERY_ALL_PACKAGES",
|
||||
"${applicationId}.permission.MIPUSH_RECEIVE",
|
||||
"com.coloros.mcs.permission.RECIEVE_MCS_MESSAGE",
|
||||
"com.heytap.mcs.permission.RECIEVE_MCS_MESSAGE"
|
||||
],
|
||||
"parameters": {
|
||||
"JPUSH_OPPO_APPKEY": {
|
||||
"des": "厂商OPPO-appkey,示例:OP-12345678",
|
||||
"key": "OPPO_APPKEY"
|
||||
},
|
||||
"JPUSH_OPPO_APPID":{
|
||||
"des": "厂商OPPO-appId,示例:OP-12345678",
|
||||
"key": "OPPO_APPID"
|
||||
},
|
||||
"JPUSH_OPPO_APPSECRET":{
|
||||
"des": "厂商OPPO-appSecret,示例:OP-12345678",
|
||||
"key": "OPPO_APPSECRET"
|
||||
},
|
||||
"JPUSH_VIVO_APPKEY":{
|
||||
"des": "厂商VIVO-appkey,示例:12345678",
|
||||
"key": "com.vivo.push.api_key"
|
||||
},
|
||||
"JPUSH_VIVO_APPID":{
|
||||
"des": "厂商VIVO-appId,示例:12345678",
|
||||
"key": "com.vivo.push.app_id"
|
||||
},
|
||||
"JPUSH_MEIZU_APPKEY":{
|
||||
"des": "厂商MEIZU-appKey,示例:MZ-12345678",
|
||||
"key": "MEIZU_APPKEY"
|
||||
},
|
||||
"JPUSH_MEIZU_APPID":{
|
||||
"des": "厂商MEIZU-appId,示例:MZ-12345678",
|
||||
"key": "MEIZU_APPID"
|
||||
},
|
||||
"JPUSH_XIAOMI_APPKEY":{
|
||||
"des": "厂商XIAOMI-appKey,示例:MI-12345678",
|
||||
"key": "XIAOMI_APPKEY"
|
||||
},
|
||||
"JPUSH_XIAOMI_APPID":{
|
||||
"des": "厂商XIAOMI-appId,示例:MI-12345678",
|
||||
"key": "XIAOMI_APPID"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
{
|
||||
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
||||
{
|
||||
"path": "pages/index/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "首页"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/center/center",
|
||||
"style": {
|
||||
"navigationBarTitleText": "控制台",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
}, {
|
||||
"path": "pages/my/my",
|
||||
"style": {
|
||||
"navigationBarTitleText": "个人",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
}
|
||||
,{
|
||||
"path" : "pages/login/login",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText": "登录",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}
|
||||
,{
|
||||
"path": "uni_modules/guyue-updater/pages/updater",
|
||||
"style": {
|
||||
"app-plus": {
|
||||
"animationDuration": 200,
|
||||
"animationType": "fade-in",
|
||||
"background": "transparent",
|
||||
"backgroundColorTop": "transparent",
|
||||
"bounce": "none",
|
||||
"popGesture": "none",
|
||||
"scrollIndicator": false,
|
||||
"titleNView": false
|
||||
},
|
||||
"backgroundColor": "transparent",
|
||||
"disableScroll": true,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "里海中心平台",
|
||||
"navigationBarBackgroundColor": "#F8F8F8",
|
||||
"backgroundColor": "#F8F8F8"
|
||||
},
|
||||
"tabBar": {
|
||||
"color": "#282828",
|
||||
"selectedColor": "#0122C7",
|
||||
"borderStyle": "white",
|
||||
"backgroundColor": "#ffffff",
|
||||
"list": [
|
||||
{
|
||||
"pagePath": "pages/index/index",
|
||||
"text": "首页"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/center/center",
|
||||
"text": "控制台"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/my/my",
|
||||
"text": "个人"
|
||||
}
|
||||
]
|
||||
},
|
||||
"uniIdRouter": {}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
<template>
|
||||
<view class=""></view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
onLoad() {},
|
||||
onShow() {},
|
||||
methods: {},
|
||||
onPullDownRefresh() {
|
||||
uni.stopPullDownRefresh()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
</style>
|
|
@ -0,0 +1,33 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<view>
|
||||
<button @click="test">测试</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import mp from "@/utils/uniMP.js"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
test() {
|
||||
mp.loadMP({
|
||||
id: '__UNI__3A527D1',
|
||||
file: '/static/wgt/__UNI__3A527D1.wgt'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
</style>
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,23 @@
|
|||
<template>
|
||||
<view class=""></view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
onLoad() {},
|
||||
onShow() {},
|
||||
methods: {},
|
||||
onPullDownRefresh() {
|
||||
uni.stopPullDownRefresh()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
</style>
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,973 @@
|
|||
/*!
|
||||
* clipboard.js v2.0.6
|
||||
* https://clipboardjs.com/
|
||||
*
|
||||
* Licensed MIT © Zeno Rocha
|
||||
*/
|
||||
(function webpackUniversalModuleDefinition(root, factory) {
|
||||
if(typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports = factory();
|
||||
else if(typeof define === 'function' && define.amd)
|
||||
define([], factory);
|
||||
else if(typeof exports === 'object')
|
||||
exports["ClipboardJS"] = factory();
|
||||
else
|
||||
root["ClipboardJS"] = factory();
|
||||
})(this, function() {
|
||||
return /******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 6);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ([
|
||||
/* 0 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
function select(element) {
|
||||
var selectedText;
|
||||
|
||||
if (element.nodeName === 'SELECT') {
|
||||
element.focus();
|
||||
|
||||
selectedText = element.value;
|
||||
}
|
||||
else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
|
||||
var isReadOnly = element.hasAttribute('readonly');
|
||||
|
||||
if (!isReadOnly) {
|
||||
element.setAttribute('readonly', '');
|
||||
}
|
||||
|
||||
element.select();
|
||||
element.setSelectionRange(0, element.value.length);
|
||||
|
||||
if (!isReadOnly) {
|
||||
element.removeAttribute('readonly');
|
||||
}
|
||||
|
||||
selectedText = element.value;
|
||||
}
|
||||
else {
|
||||
if (element.hasAttribute('contenteditable')) {
|
||||
element.focus();
|
||||
}
|
||||
|
||||
var selection = window.getSelection();
|
||||
var range = document.createRange();
|
||||
|
||||
range.selectNodeContents(element);
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range);
|
||||
|
||||
selectedText = selection.toString();
|
||||
}
|
||||
|
||||
return selectedText;
|
||||
}
|
||||
|
||||
module.exports = select;
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 1 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
function E () {
|
||||
// Keep this empty so it's easier to inherit from
|
||||
// (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
|
||||
}
|
||||
|
||||
E.prototype = {
|
||||
on: function (name, callback, ctx) {
|
||||
var e = this.e || (this.e = {});
|
||||
|
||||
(e[name] || (e[name] = [])).push({
|
||||
fn: callback,
|
||||
ctx: ctx
|
||||
});
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
once: function (name, callback, ctx) {
|
||||
var self = this;
|
||||
function listener () {
|
||||
self.off(name, listener);
|
||||
callback.apply(ctx, arguments);
|
||||
};
|
||||
|
||||
listener._ = callback
|
||||
return this.on(name, listener, ctx);
|
||||
},
|
||||
|
||||
emit: function (name) {
|
||||
var data = [].slice.call(arguments, 1);
|
||||
var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
|
||||
var i = 0;
|
||||
var len = evtArr.length;
|
||||
|
||||
for (i; i < len; i++) {
|
||||
evtArr[i].fn.apply(evtArr[i].ctx, data);
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
off: function (name, callback) {
|
||||
var e = this.e || (this.e = {});
|
||||
var evts = e[name];
|
||||
var liveEvents = [];
|
||||
|
||||
if (evts && callback) {
|
||||
for (var i = 0, len = evts.length; i < len; i++) {
|
||||
if (evts[i].fn !== callback && evts[i].fn._ !== callback)
|
||||
liveEvents.push(evts[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove event from queue to prevent memory leak
|
||||
// Suggested by https://github.com/lazd
|
||||
// Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
|
||||
|
||||
(liveEvents.length)
|
||||
? e[name] = liveEvents
|
||||
: delete e[name];
|
||||
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = E;
|
||||
module.exports.TinyEmitter = E;
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 2 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var is = __webpack_require__(3);
|
||||
var delegate = __webpack_require__(4);
|
||||
|
||||
/**
|
||||
* Validates all params and calls the right
|
||||
* listener function based on its target type.
|
||||
*
|
||||
* @param {String|HTMLElement|HTMLCollection|NodeList} target
|
||||
* @param {String} type
|
||||
* @param {Function} callback
|
||||
* @return {Object}
|
||||
*/
|
||||
function listen(target, type, callback) {
|
||||
if (!target && !type && !callback) {
|
||||
throw new Error('Missing required arguments');
|
||||
}
|
||||
|
||||
if (!is.string(type)) {
|
||||
throw new TypeError('Second argument must be a String');
|
||||
}
|
||||
|
||||
if (!is.fn(callback)) {
|
||||
throw new TypeError('Third argument must be a Function');
|
||||
}
|
||||
|
||||
if (is.node(target)) {
|
||||
return listenNode(target, type, callback);
|
||||
}
|
||||
else if (is.nodeList(target)) {
|
||||
return listenNodeList(target, type, callback);
|
||||
}
|
||||
else if (is.string(target)) {
|
||||
return listenSelector(target, type, callback);
|
||||
}
|
||||
else {
|
||||
throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an event listener to a HTML element
|
||||
* and returns a remove listener function.
|
||||
*
|
||||
* @param {HTMLElement} node
|
||||
* @param {String} type
|
||||
* @param {Function} callback
|
||||
* @return {Object}
|
||||
*/
|
||||
function listenNode(node, type, callback) {
|
||||
node.addEventListener(type, callback);
|
||||
|
||||
return {
|
||||
destroy: function() {
|
||||
node.removeEventListener(type, callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an event listener to a list of HTML elements
|
||||
* and returns a remove listener function.
|
||||
*
|
||||
* @param {NodeList|HTMLCollection} nodeList
|
||||
* @param {String} type
|
||||
* @param {Function} callback
|
||||
* @return {Object}
|
||||
*/
|
||||
function listenNodeList(nodeList, type, callback) {
|
||||
Array.prototype.forEach.call(nodeList, function(node) {
|
||||
node.addEventListener(type, callback);
|
||||
});
|
||||
|
||||
return {
|
||||
destroy: function() {
|
||||
Array.prototype.forEach.call(nodeList, function(node) {
|
||||
node.removeEventListener(type, callback);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an event listener to a selector
|
||||
* and returns a remove listener function.
|
||||
*
|
||||
* @param {String} selector
|
||||
* @param {String} type
|
||||
* @param {Function} callback
|
||||
* @return {Object}
|
||||
*/
|
||||
function listenSelector(selector, type, callback) {
|
||||
return delegate(document.body, selector, type, callback);
|
||||
}
|
||||
|
||||
module.exports = listen;
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 3 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
/**
|
||||
* Check if argument is a HTML element.
|
||||
*
|
||||
* @param {Object} value
|
||||
* @return {Boolean}
|
||||
*/
|
||||
exports.node = function(value) {
|
||||
return value !== undefined
|
||||
&& value instanceof HTMLElement
|
||||
&& value.nodeType === 1;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if argument is a list of HTML elements.
|
||||
*
|
||||
* @param {Object} value
|
||||
* @return {Boolean}
|
||||
*/
|
||||
exports.nodeList = function(value) {
|
||||
var type = Object.prototype.toString.call(value);
|
||||
|
||||
return value !== undefined
|
||||
&& (type === '[object NodeList]' || type === '[object HTMLCollection]')
|
||||
&& ('length' in value)
|
||||
&& (value.length === 0 || exports.node(value[0]));
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if argument is a string.
|
||||
*
|
||||
* @param {Object} value
|
||||
* @return {Boolean}
|
||||
*/
|
||||
exports.string = function(value) {
|
||||
return typeof value === 'string'
|
||||
|| value instanceof String;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if argument is a function.
|
||||
*
|
||||
* @param {Object} value
|
||||
* @return {Boolean}
|
||||
*/
|
||||
exports.fn = function(value) {
|
||||
var type = Object.prototype.toString.call(value);
|
||||
|
||||
return type === '[object Function]';
|
||||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 4 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var closest = __webpack_require__(5);
|
||||
|
||||
/**
|
||||
* Delegates event to a selector.
|
||||
*
|
||||
* @param {Element} element
|
||||
* @param {String} selector
|
||||
* @param {String} type
|
||||
* @param {Function} callback
|
||||
* @param {Boolean} useCapture
|
||||
* @return {Object}
|
||||
*/
|
||||
function _delegate(element, selector, type, callback, useCapture) {
|
||||
var listenerFn = listener.apply(this, arguments);
|
||||
|
||||
element.addEventListener(type, listenerFn, useCapture);
|
||||
|
||||
return {
|
||||
destroy: function() {
|
||||
element.removeEventListener(type, listenerFn, useCapture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delegates event to a selector.
|
||||
*
|
||||
* @param {Element|String|Array} [elements]
|
||||
* @param {String} selector
|
||||
* @param {String} type
|
||||
* @param {Function} callback
|
||||
* @param {Boolean} useCapture
|
||||
* @return {Object}
|
||||
*/
|
||||
function delegate(elements, selector, type, callback, useCapture) {
|
||||
// Handle the regular Element usage
|
||||
if (typeof elements.addEventListener === 'function') {
|
||||
return _delegate.apply(null, arguments);
|
||||
}
|
||||
|
||||
// Handle Element-less usage, it defaults to global delegation
|
||||
if (typeof type === 'function') {
|
||||
// Use `document` as the first parameter, then apply arguments
|
||||
// This is a short way to .unshift `arguments` without running into deoptimizations
|
||||
return _delegate.bind(null, document).apply(null, arguments);
|
||||
}
|
||||
|
||||
// Handle Selector-based usage
|
||||
if (typeof elements === 'string') {
|
||||
elements = document.querySelectorAll(elements);
|
||||
}
|
||||
|
||||
// Handle Array-like based usage
|
||||
return Array.prototype.map.call(elements, function (element) {
|
||||
return _delegate(element, selector, type, callback, useCapture);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds closest match and invokes callback.
|
||||
*
|
||||
* @param {Element} element
|
||||
* @param {String} selector
|
||||
* @param {String} type
|
||||
* @param {Function} callback
|
||||
* @return {Function}
|
||||
*/
|
||||
function listener(element, selector, type, callback) {
|
||||
return function(e) {
|
||||
e.delegateTarget = closest(e.target, selector);
|
||||
|
||||
if (e.delegateTarget) {
|
||||
callback.call(element, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = delegate;
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 5 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
var DOCUMENT_NODE_TYPE = 9;
|
||||
|
||||
/**
|
||||
* A polyfill for Element.matches()
|
||||
*/
|
||||
if (typeof Element !== 'undefined' && !Element.prototype.matches) {
|
||||
var proto = Element.prototype;
|
||||
|
||||
proto.matches = proto.matchesSelector ||
|
||||
proto.mozMatchesSelector ||
|
||||
proto.msMatchesSelector ||
|
||||
proto.oMatchesSelector ||
|
||||
proto.webkitMatchesSelector;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the closest parent that matches a selector.
|
||||
*
|
||||
* @param {Element} element
|
||||
* @param {String} selector
|
||||
* @return {Function}
|
||||
*/
|
||||
function closest (element, selector) {
|
||||
while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
|
||||
if (typeof element.matches === 'function' &&
|
||||
element.matches(selector)) {
|
||||
return element;
|
||||
}
|
||||
element = element.parentNode;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = closest;
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 6 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
|
||||
// EXTERNAL MODULE: ./node_modules/select/src/select.js
|
||||
var src_select = __webpack_require__(0);
|
||||
var select_default = /*#__PURE__*/__webpack_require__.n(src_select);
|
||||
|
||||
// CONCATENATED MODULE: ./src/clipboard-action.js
|
||||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Inner class which performs selection from either `text` or `target`
|
||||
* properties and then executes copy or cut operations.
|
||||
*/
|
||||
|
||||
var clipboard_action_ClipboardAction = function () {
|
||||
/**
|
||||
* @param {Object} options
|
||||
*/
|
||||
function ClipboardAction(options) {
|
||||
_classCallCheck(this, ClipboardAction);
|
||||
|
||||
this.resolveOptions(options);
|
||||
this.initSelection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines base properties passed from constructor.
|
||||
* @param {Object} options
|
||||
*/
|
||||
|
||||
|
||||
_createClass(ClipboardAction, [{
|
||||
key: 'resolveOptions',
|
||||
value: function resolveOptions() {
|
||||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
this.action = options.action;
|
||||
this.container = options.container;
|
||||
this.emitter = options.emitter;
|
||||
this.target = options.target;
|
||||
this.text = options.text;
|
||||
this.trigger = options.trigger;
|
||||
|
||||
this.selectedText = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Decides which selection strategy is going to be applied based
|
||||
* on the existence of `text` and `target` properties.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'initSelection',
|
||||
value: function initSelection() {
|
||||
if (this.text) {
|
||||
this.selectFake();
|
||||
} else if (this.target) {
|
||||
this.selectTarget();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a fake textarea element, sets its value from `text` property,
|
||||
* and makes a selection on it.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'selectFake',
|
||||
value: function selectFake() {
|
||||
var _this = this;
|
||||
|
||||
var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
|
||||
|
||||
this.removeFake();
|
||||
|
||||
this.fakeHandlerCallback = function () {
|
||||
return _this.removeFake();
|
||||
};
|
||||
this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
|
||||
|
||||
this.fakeElem = document.createElement('textarea');
|
||||
// Prevent zooming on iOS
|
||||
this.fakeElem.style.fontSize = '12pt';
|
||||
// Reset box model
|
||||
this.fakeElem.style.border = '0';
|
||||
this.fakeElem.style.padding = '0';
|
||||
this.fakeElem.style.margin = '0';
|
||||
// Move element out of screen horizontally
|
||||
this.fakeElem.style.position = 'absolute';
|
||||
this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
|
||||
// Move element to the same position vertically
|
||||
var yPosition = window.pageYOffset || document.documentElement.scrollTop;
|
||||
this.fakeElem.style.top = yPosition + 'px';
|
||||
|
||||
this.fakeElem.setAttribute('readonly', '');
|
||||
this.fakeElem.value = this.text;
|
||||
|
||||
this.container.appendChild(this.fakeElem);
|
||||
|
||||
this.selectedText = select_default()(this.fakeElem);
|
||||
this.copyText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Only removes the fake element after another click event, that way
|
||||
* a user can hit `Ctrl+C` to copy because selection still exists.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'removeFake',
|
||||
value: function removeFake() {
|
||||
if (this.fakeHandler) {
|
||||
this.container.removeEventListener('click', this.fakeHandlerCallback);
|
||||
this.fakeHandler = null;
|
||||
this.fakeHandlerCallback = null;
|
||||
}
|
||||
|
||||
if (this.fakeElem) {
|
||||
this.container.removeChild(this.fakeElem);
|
||||
this.fakeElem = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects the content from element passed on `target` property.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'selectTarget',
|
||||
value: function selectTarget() {
|
||||
this.selectedText = select_default()(this.target);
|
||||
this.copyText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the copy operation based on the current selection.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'copyText',
|
||||
value: function copyText() {
|
||||
var succeeded = void 0;
|
||||
|
||||
try {
|
||||
succeeded = document.execCommand(this.action);
|
||||
} catch (err) {
|
||||
succeeded = false;
|
||||
}
|
||||
|
||||
this.handleResult(succeeded);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires an event based on the copy operation result.
|
||||
* @param {Boolean} succeeded
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'handleResult',
|
||||
value: function handleResult(succeeded) {
|
||||
this.emitter.emit(succeeded ? 'success' : 'error', {
|
||||
action: this.action,
|
||||
text: this.selectedText,
|
||||
trigger: this.trigger,
|
||||
clearSelection: this.clearSelection.bind(this)
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves focus away from `target` and back to the trigger, removes current selection.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'clearSelection',
|
||||
value: function clearSelection() {
|
||||
if (this.trigger) {
|
||||
this.trigger.focus();
|
||||
}
|
||||
document.activeElement.blur();
|
||||
window.getSelection().removeAllRanges();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the `action` to be performed which can be either 'copy' or 'cut'.
|
||||
* @param {String} action
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'destroy',
|
||||
|
||||
|
||||
/**
|
||||
* Destroy lifecycle.
|
||||
*/
|
||||
value: function destroy() {
|
||||
this.removeFake();
|
||||
}
|
||||
}, {
|
||||
key: 'action',
|
||||
set: function set() {
|
||||
var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
|
||||
|
||||
this._action = action;
|
||||
|
||||
if (this._action !== 'copy' && this._action !== 'cut') {
|
||||
throw new Error('Invalid "action" value, use either "copy" or "cut"');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the `action` property.
|
||||
* @return {String}
|
||||
*/
|
||||
,
|
||||
get: function get() {
|
||||
return this._action;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the `target` property using an element
|
||||
* that will be have its content copied.
|
||||
* @param {Element} target
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'target',
|
||||
set: function set(target) {
|
||||
if (target !== undefined) {
|
||||
if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
|
||||
if (this.action === 'copy' && target.hasAttribute('disabled')) {
|
||||
throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
|
||||
}
|
||||
|
||||
if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
|
||||
throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
|
||||
}
|
||||
|
||||
this._target = target;
|
||||
} else {
|
||||
throw new Error('Invalid "target" value, use a valid Element');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the `target` property.
|
||||
* @return {String|HTMLElement}
|
||||
*/
|
||||
,
|
||||
get: function get() {
|
||||
return this._target;
|
||||
}
|
||||
}]);
|
||||
|
||||
return ClipboardAction;
|
||||
}();
|
||||
|
||||
/* harmony default export */ var clipboard_action = (clipboard_action_ClipboardAction);
|
||||
// EXTERNAL MODULE: ./node_modules/tiny-emitter/index.js
|
||||
var tiny_emitter = __webpack_require__(1);
|
||||
var tiny_emitter_default = /*#__PURE__*/__webpack_require__.n(tiny_emitter);
|
||||
|
||||
// EXTERNAL MODULE: ./node_modules/good-listener/src/listen.js
|
||||
var listen = __webpack_require__(2);
|
||||
var listen_default = /*#__PURE__*/__webpack_require__.n(listen);
|
||||
|
||||
// CONCATENATED MODULE: ./src/clipboard.js
|
||||
var clipboard_typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
||||
|
||||
var clipboard_createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
function clipboard_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Base class which takes one or more elements, adds event listeners to them,
|
||||
* and instantiates a new `ClipboardAction` on each click.
|
||||
*/
|
||||
|
||||
var clipboard_Clipboard = function (_Emitter) {
|
||||
_inherits(Clipboard, _Emitter);
|
||||
|
||||
/**
|
||||
* @param {String|HTMLElement|HTMLCollection|NodeList} trigger
|
||||
* @param {Object} options
|
||||
*/
|
||||
function Clipboard(trigger, options) {
|
||||
clipboard_classCallCheck(this, Clipboard);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
|
||||
|
||||
_this.resolveOptions(options);
|
||||
_this.listenClick(trigger);
|
||||
return _this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines if attributes would be resolved using internal setter functions
|
||||
* or custom functions that were passed in the constructor.
|
||||
* @param {Object} options
|
||||
*/
|
||||
|
||||
|
||||
clipboard_createClass(Clipboard, [{
|
||||
key: 'resolveOptions',
|
||||
value: function resolveOptions() {
|
||||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
|
||||
this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
|
||||
this.text = typeof options.text === 'function' ? options.text : this.defaultText;
|
||||
this.container = clipboard_typeof(options.container) === 'object' ? options.container : document.body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a click event listener to the passed trigger.
|
||||
* @param {String|HTMLElement|HTMLCollection|NodeList} trigger
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'listenClick',
|
||||
value: function listenClick(trigger) {
|
||||
var _this2 = this;
|
||||
|
||||
this.listener = listen_default()(trigger, 'click', function (e) {
|
||||
return _this2.onClick(e);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines a new `ClipboardAction` on each click event.
|
||||
* @param {Event} e
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'onClick',
|
||||
value: function onClick(e) {
|
||||
var trigger = e.delegateTarget || e.currentTarget;
|
||||
|
||||
if (this.clipboardAction) {
|
||||
this.clipboardAction = null;
|
||||
}
|
||||
|
||||
this.clipboardAction = new clipboard_action({
|
||||
action: this.action(trigger),
|
||||
target: this.target(trigger),
|
||||
text: this.text(trigger),
|
||||
container: this.container,
|
||||
trigger: trigger,
|
||||
emitter: this
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Default `action` lookup function.
|
||||
* @param {Element} trigger
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'defaultAction',
|
||||
value: function defaultAction(trigger) {
|
||||
return getAttributeValue('action', trigger);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default `target` lookup function.
|
||||
* @param {Element} trigger
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'defaultTarget',
|
||||
value: function defaultTarget(trigger) {
|
||||
var selector = getAttributeValue('target', trigger);
|
||||
|
||||
if (selector) {
|
||||
return document.querySelector(selector);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the support of the given action, or all actions if no action is
|
||||
* given.
|
||||
* @param {String} [action]
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'defaultText',
|
||||
|
||||
|
||||
/**
|
||||
* Default `text` lookup function.
|
||||
* @param {Element} trigger
|
||||
*/
|
||||
value: function defaultText(trigger) {
|
||||
return getAttributeValue('text', trigger);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy lifecycle.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'destroy',
|
||||
value: function destroy() {
|
||||
this.listener.destroy();
|
||||
|
||||
if (this.clipboardAction) {
|
||||
this.clipboardAction.destroy();
|
||||
this.clipboardAction = null;
|
||||
}
|
||||
}
|
||||
}], [{
|
||||
key: 'isSupported',
|
||||
value: function isSupported() {
|
||||
var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
|
||||
|
||||
var actions = typeof action === 'string' ? [action] : action;
|
||||
var support = !!document.queryCommandSupported;
|
||||
|
||||
actions.forEach(function (action) {
|
||||
support = support && !!document.queryCommandSupported(action);
|
||||
});
|
||||
|
||||
return support;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Clipboard;
|
||||
}(tiny_emitter_default.a);
|
||||
|
||||
/**
|
||||
* Helper function to retrieve attribute value.
|
||||
* @param {String} suffix
|
||||
* @param {Element} element
|
||||
*/
|
||||
|
||||
|
||||
function getAttributeValue(suffix, element) {
|
||||
var attribute = 'data-clipboard-' + suffix;
|
||||
|
||||
if (!element.hasAttribute(attribute)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return element.getAttribute(attribute);
|
||||
}
|
||||
|
||||
/* harmony default export */ var clipboard = __webpack_exports__["default"] = (clipboard_Clipboard);
|
||||
|
||||
/***/ })
|
||||
/******/ ])["default"];
|
||||
});
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,300 @@
|
|||
.em {
|
||||
display: inline-block;
|
||||
height: 1em;
|
||||
width: 1em;
|
||||
overflow: hidden;
|
||||
line-height: 18px;
|
||||
font-size: 22px;
|
||||
vertical-align: middle;
|
||||
margin-top: -4px;
|
||||
color: transparent !important;
|
||||
background-size: 4100%;
|
||||
}
|
||||
/* 陀螺酱 */
|
||||
.em.em-tlj-1 {
|
||||
background-position: 0% 0%;
|
||||
}
|
||||
.em.em-tlj-2 {
|
||||
background-position: 0% 2.5%;
|
||||
}
|
||||
.em.em-tlj-3 {
|
||||
background-position: 0% 5%;
|
||||
}
|
||||
.em.em-tlj-4 {
|
||||
background-position: 0% 7.5%;
|
||||
}
|
||||
.em.em-tlj-5 {
|
||||
background-position: 0% 10%;
|
||||
}
|
||||
.em.em-tlj-6 {
|
||||
background-position: 0% 12.5%;
|
||||
}
|
||||
.em.em-tlj-7 {
|
||||
background-position: 0% 15%;
|
||||
}
|
||||
.em.em-tlj-8 {
|
||||
background-position: 0% 17.5%;
|
||||
}
|
||||
.em.em-tlj-9 {
|
||||
background-position: 0% 20%;
|
||||
}
|
||||
.em.em-tlj-10 {
|
||||
background-position: 0% 22.5%;
|
||||
}
|
||||
.em.em-tlj-11 {
|
||||
background-position: 0% 25%;
|
||||
}
|
||||
.em.em-tlj-12 {
|
||||
background-position: 0% 27.5%;
|
||||
}
|
||||
.em.em-tlj-13 {
|
||||
background-position: 0% 30%;
|
||||
}
|
||||
.em.em-tlj-14 {
|
||||
background-position: 0% 32.5%;
|
||||
}
|
||||
.em.em-tlj-15 {
|
||||
background-position: 0% 35%;
|
||||
}
|
||||
.em.em-tlj-16 {
|
||||
background-position: 0% 37.5%;
|
||||
}
|
||||
.em.em-tlj-17 {
|
||||
background-position: 0% 40%;
|
||||
}
|
||||
.em.em-tlj-18 {
|
||||
background-position: 0% 42.5%;
|
||||
}
|
||||
.em.em-tlj-19 {
|
||||
background-position: 0% 45%;
|
||||
}
|
||||
.em.em-tlj-20 {
|
||||
background-position: 0% 47.5%;
|
||||
}
|
||||
.em.em-tlj-21 {
|
||||
background-position: 0% 50%;
|
||||
}
|
||||
.em.em-tlj-22 {
|
||||
background-position: 0% 52.5%;
|
||||
}
|
||||
.em.em-tlj-23 {
|
||||
background-position: 0% 55%;
|
||||
}
|
||||
.em.em-tlj-24 {
|
||||
background-position: 0% 57.5%;
|
||||
}
|
||||
.em.em-tlj-25 {
|
||||
background-position: 0% 60%;
|
||||
}
|
||||
.em.em-tlj-26 {
|
||||
background-position: 0% 62.5%;
|
||||
}
|
||||
.em.em-tlj-27 {
|
||||
background-position: 0% 65%;
|
||||
}
|
||||
.em.em-tlj-28 {
|
||||
background-position: 0% 67.5%;
|
||||
}
|
||||
.em.em-tlj-29 {
|
||||
background-position: 0% 70%;
|
||||
}
|
||||
.em.em-tlj-30 {
|
||||
background-position: 0% 72.5%;
|
||||
}
|
||||
.em.em-tlj-31 {
|
||||
background-position: 0% 75%;
|
||||
}
|
||||
.em.em-tlj-32 {
|
||||
background-position: 0% 77.5%;
|
||||
}
|
||||
.em.em-tlj-33 {
|
||||
background-position: 0% 80%;
|
||||
}
|
||||
.em.em-tlj-34 {
|
||||
background-position: 0% 82.5%;
|
||||
}
|
||||
.em.em-tlj-35 {
|
||||
background-position: 0% 85%;
|
||||
}
|
||||
.em.em-tlj-36 {
|
||||
background-position: 0% 87.5%;
|
||||
}
|
||||
.em.em-tlj-37 {
|
||||
background-position: 0% 90%;
|
||||
}
|
||||
.em.em-tlj-38 {
|
||||
background-position: 0% 92.5%;
|
||||
}
|
||||
.em.em-tlj-39 {
|
||||
background-position: 0% 95%;
|
||||
}
|
||||
.em.em-tlj-40 {
|
||||
background-position: 0% 97.5%;
|
||||
}
|
||||
.em.em-tlj-41 {
|
||||
background-position: 0% 100%;
|
||||
}.em.em-tlj-42 {
|
||||
background-position: 2.5% 0%;
|
||||
}
|
||||
.em.em-tlj-43 {
|
||||
background-position: 2.5% 2.5%;
|
||||
}
|
||||
.em.em-tlj-44 {
|
||||
background-position: 2.5% 5%;
|
||||
}
|
||||
.em.em-tlj-45 {
|
||||
background-position: 2.5% 7.5%;
|
||||
}
|
||||
.em.em-tlj-46 {
|
||||
background-position: 2.5% 10%;
|
||||
}
|
||||
.em.em-tlj-47 {
|
||||
background-position: 2.5% 12.5%;
|
||||
}
|
||||
.em.em-tlj-48 {
|
||||
background-position: 2.5% 15%;
|
||||
}
|
||||
.em.em-tlj-49 {
|
||||
background-position: 2.5% 17.5%;
|
||||
}
|
||||
.em.em-tlj-50 {
|
||||
background-position: 2.5% 20%;
|
||||
}
|
||||
.em.em-tlj-51 {
|
||||
background-position: 2.5% 22.5%;
|
||||
}
|
||||
.em.em-tlj-52 {
|
||||
background-position: 2.5% 25%;
|
||||
}
|
||||
.em.em-tlj-53 {
|
||||
background-position: 2.5% 27.5%;
|
||||
}
|
||||
.em.em-tlj-54 {
|
||||
background-position: 2.5% 30%;
|
||||
}
|
||||
.em.em-tlj-55 {
|
||||
background-position: 2.5% 32.5%;
|
||||
}
|
||||
.em.em-tlj-56 {
|
||||
background-position: 2.5% 35%;
|
||||
}
|
||||
.em.em-tlj-57 {
|
||||
background-position: 2.5% 37.5%;
|
||||
}
|
||||
.em.em-tlj-58 {
|
||||
background-position: 2.5% 40%;
|
||||
}
|
||||
.em.em-tlj-59 {
|
||||
background-position: 2.5% 42.5%;
|
||||
}
|
||||
.em.em-tlj-60 {
|
||||
background-position: 2.5% 45%;
|
||||
}
|
||||
.em.em-tlj-61 {
|
||||
background-position: 2.5% 47.5%;
|
||||
}
|
||||
.em.em-tlj-62 {
|
||||
background-position: 2.5% 50%;
|
||||
}
|
||||
.em.em-tlj-63 {
|
||||
background-position: 2.5% 52.5%;
|
||||
}
|
||||
.em.em-tlj-64 {
|
||||
background-position: 2.5% 55%;
|
||||
}
|
||||
.em.em-tlj-65 {
|
||||
background-position: 2.5% 57.5%;
|
||||
}
|
||||
.em.em-tlj-66 {
|
||||
background-position: 2.5% 60%;
|
||||
}
|
||||
.em.em-tlj-67 {
|
||||
background-position: 2.5% 62.5%;
|
||||
}
|
||||
.em.em-tlj-68 {
|
||||
background-position: 2.5% 65%;
|
||||
}
|
||||
.em.em-tlj-69 {
|
||||
background-position: 2.5% 67.5%;
|
||||
}
|
||||
.em.em-tlj-70 {
|
||||
background-position: 2.5% 70%;
|
||||
}
|
||||
.em.em-tlj-71 {
|
||||
background-position: 2.5% 72.5%;
|
||||
}
|
||||
.em.em-tlj-72 {
|
||||
background-position: 2.5% 75%;
|
||||
}
|
||||
.em.em-tlj-73 {
|
||||
background-position: 2.5% 77.5%;
|
||||
}
|
||||
.em.em-tlj-74 {
|
||||
background-position: 2.5% 80%;
|
||||
}
|
||||
.em.em-tlj-75 {
|
||||
background-position: 2.5% 82.5%;
|
||||
}
|
||||
.em.em-tlj-76 {
|
||||
background-position: 2.5% 85%;
|
||||
}
|
||||
.em.em-tlj-77 {
|
||||
background-position: 2.5% 87.5%;
|
||||
}
|
||||
.em.em-tlj-78 {
|
||||
background-position: 2.5% 90%;
|
||||
}
|
||||
.em.em-tlj-79 {
|
||||
background-position: 2.5% 92.5%;
|
||||
}
|
||||
.em.em-tlj-80 {
|
||||
background-position: 2.5% 95%;
|
||||
}
|
||||
.em.em-tlj-81 {
|
||||
background-position: 2.5% 97.5%;
|
||||
}
|
||||
.em.em-tlj-82 {
|
||||
background-position: 2.5% 100%;
|
||||
}
|
||||
.em.em-tlj-83 {
|
||||
background-position: 5% 0%
|
||||
}
|
||||
.em.em-tlj-84 {
|
||||
background-position: 5% 2.5%
|
||||
}
|
||||
.em.em-tlj-85 {
|
||||
background-position: 5% 5%
|
||||
}
|
||||
.em.em-tlj-86 {
|
||||
background-position: 5% 7.5%
|
||||
}
|
||||
.em.em-tlj-87 {
|
||||
background-position: 5% 10%
|
||||
}
|
||||
.em.em-tlj-88 {
|
||||
background-position: 5% 12.5%
|
||||
}
|
||||
.em.em-tlj-89 {
|
||||
background-position: 5% 15%
|
||||
}
|
||||
.em.em-tlj-90 {
|
||||
background-position: 5% 17.5%
|
||||
}
|
||||
.em.em-tlj-91 {
|
||||
background-position: 5% 20%
|
||||
}
|
||||
.em.em-tlj-92 {
|
||||
background-position: 5% 22.5%
|
||||
}
|
||||
.em.em-tlj-93 {
|
||||
background-position: 5% 25%
|
||||
}
|
||||
.em.em-tlj-94 {
|
||||
background-position: 5% 27.5%
|
||||
}
|
||||
.em.em-tlj-95 {
|
||||
background-position: 5% 30%
|
||||
}
|
||||
.em.em-tlj-96 {
|
||||
background-position: 5% 32.5%
|
||||
}
|
File diff suppressed because one or more lines are too long
Binary file not shown.
After Width: | Height: | Size: 1.6 MiB |
Binary file not shown.
After Width: | Height: | Size: 898 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.1 MiB |
Binary file not shown.
After Width: | Height: | Size: 943 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.1 MiB |
Binary file not shown.
After Width: | Height: | Size: 862 KiB |
|
@ -0,0 +1,147 @@
|
|||
function getLocalFilePath(path) {
|
||||
if (path.indexOf('_www') === 0 || path.indexOf('_doc') === 0 || path.indexOf('_documents') === 0 || path.indexOf('_downloads') === 0) {
|
||||
return path
|
||||
}
|
||||
if (path.indexOf('file://') === 0) {
|
||||
return path
|
||||
}
|
||||
if (path.indexOf('/storage/emulated/0/') === 0) {
|
||||
return path
|
||||
}
|
||||
if (path.indexOf('/') === 0) {
|
||||
var localFilePath = plus.io.convertAbsoluteFileSystem(path)
|
||||
if (localFilePath !== path) {
|
||||
return localFilePath
|
||||
} else {
|
||||
path = path.substr(1)
|
||||
}
|
||||
}
|
||||
return '_www/' + path
|
||||
}
|
||||
|
||||
export function pathToBase64(path) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
if (typeof window === 'object' && 'document' in window) {
|
||||
if (typeof FileReader === 'function') {
|
||||
var xhr = new XMLHttpRequest()
|
||||
xhr.open('GET', path, true)
|
||||
xhr.responseType = 'blob'
|
||||
xhr.onload = function() {
|
||||
if (this.status === 200) {
|
||||
let fileReader = new FileReader()
|
||||
fileReader.onload = function(e) {
|
||||
resolve(e.target.result)
|
||||
}
|
||||
fileReader.onerror = reject
|
||||
fileReader.readAsDataURL(this.response)
|
||||
}
|
||||
}
|
||||
xhr.onerror = reject
|
||||
xhr.send()
|
||||
return
|
||||
}
|
||||
var canvas = document.createElement('canvas')
|
||||
var c2x = canvas.getContext('2d')
|
||||
var img = new Image
|
||||
img.onload = function() {
|
||||
canvas.width = img.width
|
||||
canvas.height = img.height
|
||||
c2x.drawImage(img, 0, 0)
|
||||
resolve(canvas.toDataURL())
|
||||
canvas.height = canvas.width = 0
|
||||
}
|
||||
img.onerror = reject
|
||||
img.src = path
|
||||
return
|
||||
}
|
||||
if (typeof plus === 'object') {
|
||||
plus.io.resolveLocalFileSystemURL(getLocalFilePath(path), function(entry) {
|
||||
entry.file(function(file) {
|
||||
var fileReader = new plus.io.FileReader()
|
||||
fileReader.onload = function(data) {
|
||||
resolve(data.target.result)
|
||||
}
|
||||
fileReader.onerror = function(error) {
|
||||
reject(error)
|
||||
}
|
||||
fileReader.readAsDataURL(file)
|
||||
}, function(error) {
|
||||
reject(error)
|
||||
})
|
||||
}, function(error) {
|
||||
reject(error)
|
||||
})
|
||||
return
|
||||
}
|
||||
if (typeof wx === 'object' && wx.canIUse('getFileSystemManager')) {
|
||||
wx.getFileSystemManager().readFile({
|
||||
filePath: path,
|
||||
encoding: 'base64',
|
||||
success: function(res) {
|
||||
resolve('data:image/png;base64,' + res.data)
|
||||
},
|
||||
fail: function(error) {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
reject(new Error('not support'))
|
||||
})
|
||||
}
|
||||
|
||||
export function base64ToPath(base64) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
if (typeof window === 'object' && 'document' in window) {
|
||||
base64 = base64.split(',')
|
||||
var type = base64[0].match(/:(.*?);/)[1]
|
||||
var str = atob(base64[1])
|
||||
var n = str.length
|
||||
var array = new Uint8Array(n)
|
||||
while (n--) {
|
||||
array[n] = str.charCodeAt(n)
|
||||
}
|
||||
return resolve((window.URL || window.webkitURL).createObjectURL(new Blob([array], { type: type })))
|
||||
}
|
||||
var extName = base64.match(/data\:\S+\/(\S+);/)
|
||||
if (extName) {
|
||||
extName = extName[1]
|
||||
} else {
|
||||
reject(new Error('base64 error'))
|
||||
}
|
||||
var fileName = Date.now() + '.' + extName
|
||||
if (typeof plus === 'object') {
|
||||
var bitmap = new plus.nativeObj.Bitmap('bitmap' + Date.now())
|
||||
bitmap.loadBase64Data(base64, function() {
|
||||
var filePath = '_doc/uniapp_temp/' + fileName
|
||||
bitmap.save(filePath, {}, function() {
|
||||
bitmap.clear()
|
||||
resolve(filePath)
|
||||
}, function(error) {
|
||||
bitmap.clear()
|
||||
reject(error)
|
||||
})
|
||||
}, function(error) {
|
||||
bitmap.clear()
|
||||
reject(error)
|
||||
})
|
||||
return
|
||||
}
|
||||
if (typeof wx === 'object' && wx.canIUse('getFileSystemManager')) {
|
||||
var filePath = wx.env.USER_DATA_PATH + '/' + fileName
|
||||
wx.getFileSystemManager().writeFile({
|
||||
filePath: filePath,
|
||||
data: base64.replace(/^data:\S+\/\S+;base64,/, ''),
|
||||
encoding: 'base64',
|
||||
success: function() {
|
||||
resolve(filePath)
|
||||
},
|
||||
fail: function(error) {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
reject(new Error('not support'))
|
||||
})
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,211 @@
|
|||
@charset "UTF-8";
|
||||
* {scrollbar-color: #e5e5e5 #f7f7f9;scrollbar-width: thin;}
|
||||
html {margin: 0 auto;max-width: 1200px;}
|
||||
body {overflow-x: hidden;}
|
||||
.font-color,.font-color-red {color:#fc4141!important}
|
||||
.bg-color{background-color:#e93323!important}
|
||||
.icon-color{color: #ff3c2b}
|
||||
.cart-color {color: #ff3700 !important;border:1px solid #ff3700 !important}
|
||||
.padding20{padding: 20rpx}
|
||||
.pad20 {padding: 0 20rpx}
|
||||
.padding30{padding: 30rpx}
|
||||
.pad30{padding: 0 30rpx}
|
||||
.pull-left{float: left;}
|
||||
.pull-right{float: right;}
|
||||
.clearfix:after{content:'';display:block;height:0;clear:both}
|
||||
.clearfix{zoom:1}
|
||||
.acea-row {display:-webkit-box;display:-moz-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-lines: multiple;
|
||||
-moz-box-lines:multiple;-o-box-lines:multiple;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}
|
||||
.acea-row.row-middle {
|
||||
-webkit-box-align: center;
|
||||
-moz-box-align: center;
|
||||
-o-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
-webkit-align-items: center;
|
||||
align-items: center
|
||||
}
|
||||
.acea-row.row-top {
|
||||
-webkit-box-align: start;
|
||||
-moz-box-align: start;
|
||||
-o-box-align: start;
|
||||
-ms-flex-align: start;
|
||||
-webkit-align-items: flex-start;
|
||||
align-items: flex-start
|
||||
}
|
||||
.acea-row.row-bottom {
|
||||
-webkit-box-align: end;
|
||||
-moz-box-align: end;
|
||||
-o-box-align: end;
|
||||
-ms-flex-align: end;
|
||||
-webkit-align-items: flex-end;
|
||||
align-items: flex-end
|
||||
}
|
||||
.acea-row.row-center {
|
||||
-webkit-box-pack: center;
|
||||
-moz-box-pack: center;
|
||||
-o-box-pack: center;
|
||||
-ms-flex-pack: center;
|
||||
-webkit-justify-content: center;
|
||||
justify-content: center
|
||||
}
|
||||
.acea-row.row-right {
|
||||
-webkit-box-pack: end;
|
||||
-moz-box-pack: end;
|
||||
-o-box-pack: end;
|
||||
-ms-flex-pack: end;
|
||||
-webkit-justify-content: flex-end;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.acea-row.row-left {
|
||||
-webkit-box-pack: start;
|
||||
-moz-box-pack: start;
|
||||
-o-box-pack: start;
|
||||
-ms-flex-pack: start;
|
||||
-webkit-justify-content: flex-start;
|
||||
justify-content: flex-start
|
||||
}
|
||||
.acea-row.row-between {
|
||||
-webkit-box-pack: justify;
|
||||
-moz-box-pack: justify;
|
||||
-o-box-pack: justify;
|
||||
-ms-flex-pack: justify;
|
||||
-webkit-justify-content: space-between;
|
||||
justify-content: space-between
|
||||
}
|
||||
.acea-row.row-around {
|
||||
justify-content: space-around;
|
||||
-webkit-justify-content: space-around
|
||||
}
|
||||
.acea-row.row-column-around {
|
||||
-webkit-flex-direction: column;
|
||||
-ms-flex-direction: column;
|
||||
flex-direction: column;
|
||||
justify-content: space-around;
|
||||
-webkit-justify-content: space-around
|
||||
}
|
||||
.acea-row.row-column {
|
||||
-webkit-box-orient: vertical;
|
||||
-moz-box-orient: vertical;
|
||||
-o-box-orient: vertical;
|
||||
-webkit-flex-direction: column;
|
||||
-ms-flex-direction: column;
|
||||
flex-direction: column
|
||||
}
|
||||
.acea-row.row-column-between {
|
||||
-webkit-box-orient: vertical;
|
||||
-moz-box-orient: vertical;
|
||||
-o-box-orient: vertical;
|
||||
-webkit-flex-direction: column;
|
||||
-ms-flex-direction: column;
|
||||
flex-direction: column;
|
||||
-webkit-box-pack: justify;
|
||||
-moz-box-pack: justify;
|
||||
-o-box-pack: justify;
|
||||
-ms-flex-pack: justify;
|
||||
-webkit-justify-content: space-between;
|
||||
justify-content: space-between
|
||||
}
|
||||
.acea-row.row-center-wrapper {
|
||||
-webkit-box-align: center;
|
||||
-moz-box-align: center;
|
||||
-o-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
-webkit-align-items: center;
|
||||
align-items: center;
|
||||
-webkit-box-pack: center;
|
||||
-moz-box-pack: center;
|
||||
-o-box-pack: center;
|
||||
-ms-flex-pack: center;
|
||||
-webkit-justify-content: center;
|
||||
justify-content: center
|
||||
}
|
||||
.acea-row.row-between-wrapper {
|
||||
-webkit-box-align: center;
|
||||
-moz-box-align: center;
|
||||
-o-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
-webkit-align-items: center;
|
||||
align-items: center;
|
||||
-webkit-box-pack: justify;
|
||||
-moz-box-pack: justify;
|
||||
-o-box-pack: justify;
|
||||
-ms-flex-pack: justify;
|
||||
-webkit-justify-content: space-between;
|
||||
justify-content: space-between
|
||||
}
|
||||
.start {
|
||||
width: 122rpx;
|
||||
height: 30rpx;
|
||||
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHoAAADMCAYAAAC8yreMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA4BpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDpDMDg0NEE2QTVFNUQxMUU4QUI3RkNGOTgwNDYyRUZDOCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDozODU5QzVENDMwRjcxMUU5OTQ0QzlEOTQ5RkE1MTlBRiIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDozODU5QzVEMzMwRjcxMUU5OTQ0QzlEOTQ5RkE1MTlBRiIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOCAoV2luZG93cykiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpkN2ZhZTM5NC0wNmE4LTkzNGYtODA0OS0zNjBjNTcxOTU2YjAiIHN0UmVmOmRvY3VtZW50SUQ9ImFkb2JlOmRvY2lkOnBob3Rvc2hvcDpmYWI1M2NhMC04MWE1LTE5NGItYmJlYi1jMzI2MjIwNmNhOTYiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4ctYL1AAAHsElEQVR42uycS4gcVRiFq5Mm4yuKihoVlKg7IVlkI4oGFV9R4wPSJChBMW5ECYooKuIbEReCBBGJEDS+BkVJYEIMJgvJIossFATxCW58boRJEDEZz83cDk3TXc/7T9Xt+g783O7p6tP/9Km6dbvp+jpzc3MJmnwt4i0gaETQiKBRM+UWY8OVpt9XXXySakcZ34Xwp/fR3mWO6LWqW/Wilxnte5b+re29TNB3+fEeozfL0r+1vXdGTRmdTmfc9HGGG1Rd1d+qZecc/PGfcVPI2Bc19Kf3uSBHdM+/mNNpqtsD77WW/q3uvTtmDzpPw9kDxm5XW6q6b2jTB7XtrEZXc35vc/rNV7LQ/vQ+2rs75v/Zproux45yhWrniL/vUq1JeZ6lP70XmLpvVr1SYoo5qnrBrQ4ztrP0p/eiizFND9dreHdgOknTr25lqEXCvrwLGgt/ei+xGNOTP9ewUrUn48XclLGi/2J5ZelP7wVX3TJxJ/f3Mjbbpu3+KrOctPSn9+Ifr9ZWfLxOf3rPE7TOF1Mabhg68e/yy/q+1mi7bpn/xNKf3osd0deqTva3f1ZdpenCLeFXq37wfz9ddWXJvdbSn94LBH2bH9/2J/79/hzypV8wvD60XVFZ+tN7xhcmgzrRnQv0AjtHLBgOa9is6eOzCm+WpT+9p32ORpMnfmFC0IigEUEjgkYEjQgaETQiaETQBI0IGhE0ImhE0IigEUGj8oIaEEfvTtPT0ytVF5bxh3gQl/9TqkcWauqGeFCDv47kM5P5y2PP1+0lpkH7K+9v9HfX6/4JIf8ZS/+Ye/dap/pI5U4Nt1gf0RAP6vO/WrVX9YnqjqJPhnjQoN5Tpu0LNPzS6/XcZTmHdH9WdZbu/1kp6ARqQC29Kzw39d+rOqL6V7XY33Y/5n9pYNOtqpdd4BqX+G3dNqck81dgzuQN2l15766gf7zgDHHUN/RcxnaW/jH3fkC1QbVbR+v7Y88Rvd5BDZsGdhA3qzykWqXaP+o5EA8a2LuCe0DDparHFOqhHKvxLaovtO3Wcf4QDxrYuwJ7Q8Nbqu0KckVKyO5Kyu2qF/shl151Qw2ox1/BfaXhbtVrKZs9r7pT234T6uMV1IB6/N3F8N+mPP6dX7BV/xwNNaA+f786n+kvuFT3qzYMPL5n4Euaykc01ID6/N3HuL0K91yNH/odaKnuu3P3Mt1264SbQgUNNaAGfwU55fNxX3e+qXrCLbhUbpH2tF9pO4Dcqdp2cYig+1feb1LNDi1GDqs26+Y1Fc5Dlv4x977azwSX+AXXTwMLNTd7rPOzhfti5vIsM4gHDdIgxllH6XJ3tPrVd9qRf5GGWW33R/9vI78bIeh2iJ8SETQiaETQiKARQSOCRgSNCBoRNEEjgkYEjQgaETQiaETQiKARQSMnYDXheneqApSx9AZWE16lgTKW3sBqAqoqUMbSG1hNWFUCylh6A6sJq0pAGUtvYDUBYDJ+aq0MlLH0BlZTsHdLoAywmmL+1r2bAWUSYDX5/ReqdwugjKl32gv6N8xdcP1OxnTopruNg6yOPG+Whf9C9u6+wNDwrOoZvclfjwnCXfr6pOrRQdZI1vse2htYTYXeQwNlLL2B1VTvPRhQxtIbWE01mEySBATKWHoDq6nWe5IEBMpYegOrqdB7aKCMpTewmmq9BwXKWHrDMCkoU6AMsBpUVfyUiKARQSOCRgSNCBoRNCJoRNCIoAkaETQiaETQiKARQSOCRgSNMtQmholTFQ4IDJOwsva3ZIxY+8MwySNLxoi1PwyTYrJkjFj7wzApIEvGiLU/DJOcU58ZY8TaH4bJ6DfFjANi7Q/DpJi/JWPE2h+GSVKQYWLBAbH2h2FSkmESmgNi7Q/DpKS/JWPE2h+GSXFZMkas/YN5Z7I7xnBAdvsvNvpzzTEOiI66/0p8SWLqnwxxQPwixl1P/IF/vM8B+bhkGJb+wbwnnWGSJLaMEWt/GCY5v2gwY4xY+8MwKSZLxoi1PwyT1H/IkANi7Q/DBFUWPyUiaETQiKARQSOCRgSNCBoRNCJogkYEjQgaETQiaETQiKARQaMMNY1h4tRUDggMk/BqJAck5t4bxzBpMgck5t4bxTDxaiwHJObem8YwcWosByTm3mthmKRMT43mgMTcey0Mk1g5IDH3XhfDJEoOSMy918owiY0DEnPvtTNMYuKAxNx77QyTmDggMffeFIZJFByQmHuvnWHSf34SAQck5t6bwDBJkkg4IDH3XjvDJCYOSMy9N4FhEg0HJObeR56jh5bnGxM/Z6TIfXbeVxKS8b2bDcaxOvR3Z7tFe+2M/6q1Kd5R9Q7DpCXip0QEjQgaETQiaETQiKARQSOCRgRN0IigEUEjgkYEjQgamQhqQDt6L3tEt5IaEHPvhYNuMzUg5t7LHNGtpQbE3HuZoFtLDYi590UFp4/jV977yzmPXXkfcHoy8297790xxlADWkI8gBowYb13oAZAPDj+IT2BGhB975mLMagBk9F73lU31IDIe+/mfEGoAZH3nveIhhoQee95FmNT/nPbDn/OeLh/UbYeW67hVdWnyTwXdL0eO1JwQRPUn95LLsYSqAET0XueczTUgAnoHeJBS8RPiQgaETQiaNRM/S/AAOykxVBJG5QXAAAAAElFTkSuQmCC');
|
||||
background-repeat: no-repeat;
|
||||
background-size: 122rpx auto;
|
||||
}
|
||||
.start.star5{background-position:0 3rpx;}
|
||||
.start.star4{background-position:0 -30rpx;}
|
||||
.start.star3{background-position:0 -70rpx;}
|
||||
.start.star2{background-position:0 -105rpx;}
|
||||
.start.star1{background-position:0 -140rpx;}
|
||||
.start.star0{background-position:0 -175rpx;}
|
||||
*{box-sizing:border-box}
|
||||
page{font-size: 28rpx;background-color:#f5f5f5;color: #333}
|
||||
body,html{height:unset}
|
||||
button{padding:0;margin:0;line-height:normal;background-color:#fff}
|
||||
button::after {border:0}
|
||||
radio .wx-radio-input {border-radius:50%;width:38rpx;height:38rpx}
|
||||
radio .wx-radio-input.wx-radio-input-checked{border:1px solid #e93323;background-color:#e93323;}
|
||||
radio .uni-radio-input{border-radius:50%;width:38rpx;height:38rpx}
|
||||
radio .uni-radio-input.uni-radio-input-checked{border: 1px solid #e93323;background-color: #e93323;}
|
||||
checkbox .wx-checkbox-input{width:38rpx;height:38rpx}
|
||||
checkbox .wx-checkbox-input.wx-checkbox-input-checked::before{color: #fff!important;}
|
||||
checkbox .uni-checkbox-input{width: 38rpx;height: 38rpx}
|
||||
checkbox .uni-checkbox-input.uni-checkbox-input-checked,
|
||||
checkbox .wx-checkbox-input.wx-checkbox-input-checked{border:1px solid #e93323!important;background-color:#e93323!important;color:#fff!important;}
|
||||
checkbox .uni-checkbox-input.uni-checkbox-input-checked::before{font-size: 35rpx}
|
||||
.line1{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||
.line2{word-break:break-all;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;white-space:pre-wrap;}
|
||||
.mask{position:fixed;top: 0;left:0;right:0;bottom:0;background-color:#000;opacity:.5;z-index:30}
|
||||
@keyframes load {
|
||||
from {
|
||||
transform: rotate(0)
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg)
|
||||
}
|
||||
}
|
||||
@-webkit-keyframes load {
|
||||
from {
|
||||
transform: rotate(0)
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg)
|
||||
}
|
||||
}
|
||||
.loadingpic{animation:load 3s linear 1s infinite;--webkit-animation:load 3s linear 1s infinite}
|
||||
.loading-list{animation:load linear 1s infinite;-webkit-animation:load linear 1s infinite;font-size:40rpx;margin-right:22rpx}
|
||||
.loading{width:100%;height:100rpx;line-height:100rpx;align-items:center;justify-content:center;position:relative;text-align:center}
|
||||
.loading .line {
|
||||
position: absolute;
|
||||
width: 450rpx;
|
||||
left: 150rpx;
|
||||
top: 50rpx;
|
||||
height: 1px;
|
||||
border-top: 1px solid #eee
|
||||
}
|
||||
.loading .text {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
padding: 0 20rpx;
|
||||
background: #fff;
|
||||
z-index: 2;
|
||||
color: #777
|
||||
}
|
||||
.loadingicon .loading {
|
||||
animation: load linear 1s infinite;
|
||||
font-size: 45rpx;
|
||||
color: #000
|
||||
}
|
||||
.loadingicon {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
overflow: hidden
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,26 @@
|
|||
/* Logo 字体 */
|
||||
@font-face {
|
||||
font-family: "iconfont";
|
||||
src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834');
|
||||
src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834#iefix') format('embedded-opentype'),
|
||||
url('https://at.alicdn.com/t/font_985780_km7mi63cihi.woff?t=1545807318834') format('woff'),
|
||||
url('https://at.alicdn.com/t/font_985780_km7mi63cihi.ttf?t=1545807318834') format('truetype'),
|
||||
url('https://at.alicdn.com/t/font_985780_km7mi63cihi.svg?t=1545807318834#iconfont') format('svg');
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
font-family: "iconfont" !important;
|
||||
font-size: 16px;
|
||||
font-style: normal;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.icon-dianzan2:before {
|
||||
content: "\e61f";
|
||||
}
|
||||
|
||||
.icon-dianzan3:before {
|
||||
content: "\e601";
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,19 @@
|
|||
@font-face {
|
||||
font-family: "iconlihai";
|
||||
/* Project id 4057568 */
|
||||
src: url('//at.alicdn.com/t/c/font_4057568_ebzei8v5onu.woff2?t=1683613050891') format('woff2'),
|
||||
url('//at.alicdn.com/t/c/font_4057568_ebzei8v5onu.woff?t=1683613050891') format('woff'),
|
||||
url('//at.alicdn.com/t/c/font_4057568_ebzei8v5onu.ttf?t=1683613050891') format('truetype');
|
||||
}
|
||||
|
||||
.iconlihai {
|
||||
font-family: "iconlihai" !important;
|
||||
font-size: 16px;
|
||||
font-style: normal;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.lihai-gengduo:before {
|
||||
content: "\e624";
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
@font-face {
|
||||
font-family: "icontan"; /* Project id 3552766 */
|
||||
src: url('//at.alicdn.com/t/c/font_3552766_bmogttr4zyj.woff2?t=1688542944134') format('woff2'),
|
||||
url('//at.alicdn.com/t/c/font_3552766_bmogttr4zyj.woff?t=1688542944134') format('woff'),
|
||||
url('//at.alicdn.com/t/c/font_3552766_bmogttr4zyj.ttf?t=1688542944134') format('truetype');
|
||||
}
|
||||
|
||||
.icontan {
|
||||
font-family: "icontan" !important;
|
||||
font-size: 16px;
|
||||
font-style: normal;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.tan-a-lujing17324:before {
|
||||
content: "\e602";
|
||||
}
|
||||
|
||||
.tan-xianhuo:before {
|
||||
content: "\e601";
|
||||
}
|
||||
|
||||
.tan-dianpu:before {
|
||||
content: "\e600";
|
||||
}
|
||||
|
||||
.tan-clock:before {
|
||||
content: "\e627";
|
||||
}
|
||||
|
||||
.tan-ditu_dingwei_o:before {
|
||||
content: "\ebbb";
|
||||
}
|
||||
|
||||
.tan-f24gl-telephone:before {
|
||||
content: "\e953";
|
||||
}
|
||||
|
||||
.tan-sound-Mute:before {
|
||||
content: "\e766";
|
||||
}
|
||||
|
||||
.tan-vehivles:before {
|
||||
content: "\e76b";
|
||||
}
|
||||
|
||||
.tan-shoes:before {
|
||||
content: "\e76c";
|
||||
}
|
||||
|
||||
.tan-aviation:before {
|
||||
content: "\e770";
|
||||
}
|
||||
|
||||
.tan-landtransportation:before {
|
||||
content: "\e773";
|
||||
}
|
||||
|
||||
.tan-dingwei:before {
|
||||
content: "\e8c4";
|
||||
}
|
||||
|
||||
.tan-favorites-fill:before {
|
||||
content: "\e721";
|
||||
}
|
||||
|
||||
.tan-rmb:before {
|
||||
content: "\e761";
|
||||
}
|
||||
|
||||
.tan-scanning:before {
|
||||
content: "\e762";
|
||||
}
|
||||
|
||||
.tan-raw:before {
|
||||
content: "\e75e";
|
||||
}
|
||||
|
||||
.tan-service:before {
|
||||
content: "\e764";
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue