初始项目

This commit is contained in:
liupopo
2023-02-11 12:55:02 +08:00
parent 1748bda84a
commit 0b89e36064
3363 changed files with 506201 additions and 1 deletions

View File

@@ -0,0 +1,444 @@
import store from '../store/index';
export default {
// qq 237524947 wx15d4269d3210863d
//BASEURI: 'http://localhost:8083/api/',
BASEURI: 'http://127.0.0.1:8083/api/',
ADMINURI: 'http://127.0.0.1:8085/',
ESURI: 'http://127.0.0.1:8081/',
h5Appid: 'wxb4660f37187c0b8e', // h5微信登录的appId 暂时测试用
source: 1, //1 weixinApplet 2 h5Source 3 pcSource 4 android 5ios
es: {
simpleSearchList: 'esProduct/search/simple', //简单搜索
search: 'esProduct/search', //综合搜索、筛选、排序
},
/**
* 接口名称
*/
index: {
sysInfo: 'single/home/sysInfo',
submitLocaltion: 'single/home/submitLocaltion',
getAppletOpenId: 'applet/getAppletOpenId', // 获取openId
getWxPhone: 'applet/getWxPhone', // 获取手机号
logout: 'single/home/logout',
appletLogin_by_weixin: 'applet/login_by_weixin1', // 登录(手机号:phone 密码:password)
login: 'single/home/login', // 登录(手机号:phone 密码:password)
appLogin: 'single/home/appLogin',
simpleReg: 'single/home/simpleReg', // 登录(手机号:phone 密码:password)
home: 'single/home/content', //首页展示
home1: 'single/home/content1', //首页展示
homeFlashPromotionList: 'single/home/homeFlashPromotionList', // 秒杀列表
bannerList: 'single/home/bannerList', // 首页banner
updatePassword: 'single/home/updatePassword', // 修改密码
loginByCode: 'single/home/loginByCode', // 手机和验证码登录
reg: 'single/home/reg', // 注册
sendCodes: 'single/home/sms/codes', // 获取验证码
acceptCoupon: 'single/sms/add', // 获取优惠券
listMemberCoupon: 'single/sms/listMemberCoupon', // 优惠券列表
couponList: 'single/home/couponList', // 优惠券
selectNotRecive: 'single/home/selectNotRecive', // 可领取的优惠券
userInfo: 'single/home/userInfo', // 用户信息
userSampleInfo: 'single/home/userSampleInfo', // 用户信息
groupActivityDetail: 'single/sms/group.activity.getdetial', // 查询团购详情信息
groupActivityList: 'single/sms/groupActivityList', // 查询商品团购列表
logs: 'single/home/logs', // 记录日志
diyDetail: 'single/sms/diyDetail',
homeNewProduct: 'single/sms/homeNewProduct/list', //首页新品推荐列表
homeBrand: 'single/sms/homeBrand/list', //首页品牌推荐列表
homeRecommendProduct: 'single/sms/homeRecommendProduct/list', //首页人气推荐列表
homeRecommendSubject: 'single/sms/homeRecommendSubject/list', //首页专题推荐列表
nearShopList: 'single/store/dis/shopList', //附近门店
nearStoreList: 'single/store/dis/storeList', // 附近商户
shoplist: 'single/store/shoplist', //查询门店管理
shopDetail: 'single/store/shopDetail', // 门店详情
storeClassList: 'single/store/storeClass/list', // 商户内部分类
storeCommentList: 'single/store/storeComment/list', // 商户评论
noticeList: 'single/home/notice/list',
noticeDetail: 'single/home/notice/detail',
},
member: {
applyMember: 'single/user/applyMember', // 会员升级等级
memberLevelList: 'single/user/memberLevel/list', // 查询会员等级列表
getInviteData: 'single/user/getInviteData',
inviteUser: 'single/user/inviteUser',
inviteMoney: 'single/user/inviteMoney',
currentMember: 'single/user/currentMember',
updateMember: 'single/user/updateMember',
resetPassword: 'single/user/resetPassword',
schoolList: 'single/user/school/list', // 查询学校列表
schoolDetail: 'single/user/schoolDetail', // 查询拼团商品详情信息
getAreaByPid: 'single/user/getAreaByPid', // 根据pid查询区域
bindSchool: 'single/user/bindSchool', // 会员绑定学校
bindArea: 'single/user/bindArea', // 会员绑定区域
applyStore: 'single/store/applyStore', // 商户入驻
storeDetail: 'single/store/detail', // 商户详情
storeDetail1: 'single/store/detail1', // 商户详情 带用户
store: 'single/store/home', // 商户主页
storeList: 'single/store/store/list', // 商户列表
memberTagList: 'single/user/memberTag/list', // 商户列表
addStoreComment: 'single/store/addStoreComment', // 商户addStoreComment
memberBlanceLogList: 'single/user/memberBlanceLog/list',
},
build: {
getBuildNoticeByPage: 'single/build/getBuildNoticeByPage', // 所有社区和房间
getBuildWuyeCompanyByPage: 'single/build/getBuildWuyeCompanyByPage', // 所有社区和房间
groupList: 'single/build/groupList', // 所有社区和房间
communityList: 'single/build/communityList', // 所有社区和房间
nearCommunityList: 'single/build/near/communityList', // 周边社区
floorList: 'single/build/floorList', // 所有社区和房间
allCommunity: 'single/build/allCommunity', // 所有社区和房间
bindCommunity: 'single/build/bindCommunity', // 绑定小区和房间
home: 'single/build/home', // 首页内容页信息展示
applyCommunity: 'single/build/applyCommunity', // 社区入驻
},
goods: {
tagGoodsList: 'single/pms/tag/goods', // 查询标签商品
goodsPromoto: 'single/sms/detail', // 单个商品的优惠详情
secskillDetail: 'single/pms/secskill/detail', // 查询秒杀商品详情信息
groupGoodsDetail: 'single/pms/goodsGroup/detail', // 查询拼团商品详情信息
groupHotGoodsList: 'single/pms/groupHotGoods/list', // 查询生效拼团商品列表
giftDetail: 'single/pms/gift/detail', // 查询商品详情信息
giftList: 'single/pms/gift/list', // 查询商品列表
paiMaiDetail: 'single/pms/paimai/detail', // 查询商品详情信息
updatePaiMai: 'single/pms/updatePaiMai', // 参与竞价
typeGiftList: 'single/pms/typeGiftList', //查询商品类型下的商品列表
addView: 'single/pms/addView', // 查询商品详情信息
viewList: 'single/pms/viewList', // 查询商品列表
goodsDetail: 'single/pms/goods/detail', // 查询商品详情信息
goodsList: 'single/pms/goods/list', // 查询商品列表
productAttrCategoryList: 'single/pms/productAttrCategory/list', // 查询商品属性分类列表
categoryList: 'single/pms/productCategory/list', // 查询商品分类列表
createGoods: 'single/pms/createGoods', //创建商品
brandList: 'single/pms/brand/list', // 根据条件查询所有品牌表列表
consultList: 'single/pms/consult/list', // 取某个商品的评价
categoryAndGoodsList: 'single/pms/categoryAndGoodsList/list', // 查询商品属性分类列表和商品
typeGoodsList: 'single/pms/typeGoodsList', //查询商品类型下的商品列表
typeGoodsList1: 'single/pms/typeGoodsList1', //查询商品类型下的商品列表
areaGoodsList: 'single/pms/areaGoodsList', //查询商品类型下的商品列表
typeList: 'single/pms/typeList', //查询商品类型下的商品列表
getGoodsTypes: 'single/pms/getGoodsTypes', // 查询分类
recommendBrand: 'single/pms/recommendBrand/list', // 查询首页推荐品牌
newProductList: 'single/pms/newProductList/list', //查询首页新品
hotProductList: 'single/pms/hotProductList/list', // 查询热销商品
listCollect: 'collection/listCollect', // 显示关注列表
deleteCollect: 'collection/delete', // 删除收藏中的某个商品
favoriteSave: 'collection/favoriteSave', // 添加/商品收藏
listAddress: 'address/list', // 显示所有收货地址
deleteAddress: 'address/delete', // 删除
addressSave: 'address/save', // 添加
setDefaultAddress: 'address/address-set-default', // 设为默认地址
getItemDefautl: 'address/getItemDefautl', // 显示默认收货地址
},
order: {
getRefundReason: 'single/oms/order/getRefundReason', // 查询售后原因
saveOmsOrderReturnApply: 'single/oms/saveOmsOrderReturnApply', // 添加售后
aftersaleslist: 'single/oms/order/aftersaleslist', // 查询售后列表
aftersalesinfo: 'single/oms/aftersalesinfo', // 查询售后详情
addGroup: 'single/oms/addGroup', // 发起拼团
acceptGroup: 'single/oms/acceptGroup', // 提交拼团
sampleOrderList: 'single/oms/sampleOrderList', // 查询订单列表
orderList: 'single/oms/order/list', // 查询订单列表
orderDetail: 'single/oms/detail', // 查询订单列表
preGroupActivityOrder: 'single/oms/preGroupActivityOrder', // 预览订单团购
preOrder: 'single/oms/submitPreview', // 预览订单
bookOrder: 'single/oms/generateOrder', // 生成订单
submitStorePreview: 'single/oms/submitStorePreview', // 预览订单
generateStoreOrder: 'single/oms/generateStoreOrder', // 生成订单
closeOrder: 'single/oms/closeOrder', // 关闭订单
confimDelivery: 'single/oms/confimDelivery', //确认收货
applyRefund: 'single/oms/applyRefund', // 申请退款
logisticbyapi: 'single/oms/logisticbyapi', // 查看物流
orderevaluate: 'single/oms/orderevaluate', //订单评价
addCart: 'cart/addCart', // 添加商品到购物车
cartList: 'cart/list', // 获取某个会员的购物车列表
promotionCartList: 'cart/list/promotion', // 获取某个会员的购物车列表,包括促销信息
updateQuantity: 'cart/update/quantity', //修改购物车中某个商品的数量
deleteCart: 'cart/delete', // 删除购物车中的某个商品
clearCart: 'cart/clear', // 清空购物车
paymentlist: 'pay/paymentlist', // 查询订单列表
jifenPay: 'pay/jifenPay', // 积分兑换
balancePay: 'pay/balancePay', // 余额支付
weixinAppletPay: 'pay/weixinAppletPay', // 微信小程序支付
//支付宝
aliAppPay: 'aliPay/appPay', // 支付宝app支付
aliWapPay: 'aliPay/wapPay', // 支付宝支付
wapPayNoSdk: 'aliPay/wapPayNoSdk', // 支付宝支付
pcPay: 'aliPay/pcPay', // 支付宝支付
aliPay: 'aliPay/tradePay', // 支付宝支付 String authCode, String scene
aliPrecreatePay: 'aliPay/tradePrecreatePay', // 支付宝扫码支付
aliRefund: 'aliPay/tradePrecreatePay', // 支付宝退款
//微信
wapPay: 'wxPay/wapPay', //微信H5 支付 注意必须再web页面中发起支付且域名已添加到开发配置中
webPay: 'wxPay/webPay', //公众号支付
scanCode1: 'wxPay/scanCode1', //扫码支付模式一 已测试
scanCode2: 'wxPay/scanCode2', //扫码支付模式二 已测试
appPay: 'wxPay/appPay', //微信APP支付
micropay: 'wxPay/micropay', //微信刷卡支付
miniAppPay: 'wxPay/miniAppPay', //微信小程序支付
refund: 'wxPay/refund', //微信退款 String transactionId,String outTradeNo
authCodeToOpenid: 'wxPay/authCodeToOpenid', //openId采用 网页授权获取 access_token APISnsAccessTokenApi获取
//银联支付
frontConsume: 'unionPay/frontConsume', //PC网关支付 B2C跟B2B查询区别就在于bizType的不同
frontConsume2: 'unionPay/frontConsume2', //B2B的网关支付 B2C跟B2B查询区别就在于bizType的不同
wapConsume: 'unionPay/wapConsume', //WAP支付 请在手机paymentlist端访问此action
appConsume: 'unionPay/appConsume', //APP支付获取tn
frontrefund: 'unionPay/refund', //
//京东
jdappPay: 'JDPay/appPay', //App 支付
saveOrder: 'JDPay/saveOrder', //String payType PC H5 支付
customerPay: 'JDPay/customerPay', //商户二维码支付
fkmPay: 'JDPay/fkmPay', //刷卡支付 String token, String amount
jdrefund: 'JDPay/refund', //微信APP支付
},
cms: {
subjectList: 'single/cms/subject/list', // 查询文章列表
subjectCategoryList: 'single/cms/subjectCategory/list', // 查询文章分类列表
subjectCommentList: 'single/cms/subjectComment/list', // 查询文章评论列表
recommendSubjectList: 'single/cms/recommendSubjectList/list', //查询首页推荐文章
topicList: 'single/cms/topic/list', // 查询专题列表
topicDetail: 'single/cms/topic/detail', // 专题详情
subjectDetail: 'single/cms/subject/detail', // 文章详情
createSubject: 'single/cms/createSubject', // 创建文章
},
/**
商户端后台接口
**/
admin: {
login: 'sys/sysUser/login', // 登录(手机号:phone 密码:password)
orderStatic: 'home/orderStatic', // 订单统计
goodsStatic: 'home/goodsStatic', // 商品统计
userStatic: 'home/userStatic', //会员统计
orderDayStatic: 'home/orderDayStatic', //订单日统计
dayStatic: 'home/dayStatic', //订单日统计
bannerList: 'sms/SmsHomeAdvertise/list', // 首页banner
memberList: 'ums/UmsMember/list', // 查询学校列表
storeDetail: 'sys/SysStore/storeDetail', // 查询拼团商品详情信息
schoolList: 'single/user/school/list', // 查询学校列表
schoolDetail: 'single/user/schoolDetail', // 查询拼团商品详情信息
getAreaByPid: 'single/user/getAreaByPid', // 根据pid查询区域
bindSchool: 'single/user/bindSchool', // 会员绑定学校
bindArea: 'single/user/bindArea', // 会员绑定区域
goodsDetail: 'single/pms/goods/detail', // 查询商品详情信息
goodsList: 'pms/PmsProduct/goods/list', // 查询商品列表
updatePublishStatus: 'pms/PmsProduct/publishStatus',
updateReComStatus: 'pms/PmsProduct/updateReComStatus',
delivery: 'oms/OmsOrder/delivery', // 订单发货
orderList: 'oms/OmsOrder/order/list', // 查询订单列表
orderDetail: 'single/oms/detail', // 查询订单列表
subjectList: 'single/cms/subject/list', // 查询文章列表
},
/**
* 封装请求async await 封装uni.request 对应portal 项目
* method post/get
* endpoint 接口方法名
* data 所需传递参数
* load 是否需要loading
*/
async apiCall(method, endpoint, data, load) {
if (load) {
uni.showLoading({
title: '请稍候',
mask: true
});
}
let token = uni.getStorageSync('token') || '';
let fullurl = this.BASEURI + endpoint;
var contentType = 'application/x-www-form-urlencoded';
data.authorization = token;
//console.log(endpoint);
let [error, res] = await uni.request({
url: fullurl,
data: data,
method: method,
header: {
//'Content-Type': 'application/x-www-form-urlencoded',
'content-type': contentType,
// 'authorization1': Authorization || ''
},
});
console.log('fullurl,',fullurl)
console.log('data,',data)
console.log('token,',token)
console.log('error,',error)
console.log('res,',res)
if (load) {
uni.hideLoading();
}
if (undefined == res || 'undefined' == res) {
console.log('index');
uni.navigateTo({
url: `/pages/public/login`
})
}
if (res.data.msg == 'User token expired!') {
console.log('User token expired');
uni.showToast({
title: '请先登录',
icon: 'none'
});
uni.navigateTo({
url: `/pages/public/login`
})
}
if (res.data.msg == '请先登录' || res.data.code == 100) {
console.log("100=" + res.data);
uni.showToast({
title: '请先登录',
icon: 'none'
});
uni.navigateTo({
url: `/pages/public/login`
})
}
console.log(res.data);
console.log(fullurl);
console.log(res.data.data);
if (res.data.code == 200) {
return res.data.data;
} else {
if (res.data) {
if (!res.data.msg) {
res.data.msg = res.data.data;
}
uni.showToast({
title: res.data.msg,
icon: 'none'
});
this.$api.msg(res.data.msg);
}
}
},
/**
* 封装请求async await 封装uni.request 对应admin 项目
* method post/get
* endpoint 接口方法名
* data 所需传递参数
* load 是否需要loading
*/
async apiAdminCall(method, endpoint, data, load) {
if (load) {
uni.showLoading({
title: '请稍候',
mask: true
});
}
let token = uni.getStorageSync('adminToken') || '';
let fullurl = this.ADMINURI + endpoint;
var contentType = 'application/json';
data.Authorization = token;
//console.log(endpoint);
let [error, res] = await uni.request({
url: fullurl,
data: data,
method: method,
header: {
//'Content-Type': 'application/x-www-form-urlencoded',
'content-type': contentType,
// 'authorization1': Authorization || ''
},
});
if (load) {
uni.hideLoading();
}
console.log(res);
if (undefined == res || 'undefined' == res) {
console.log('index');
uni.navigateTo({
url: `/pages/index/index`
})
}
if (res.data.msg == 'User token expired!') {
console.log('User token expired');
uni.showToast({
title: '请先登录',
icon: 'none'
});
uni.navigateTo({
url: `/pages/public/login`
})
}
if (res.data.msg == '请先登录' || res.data.code == 100) {
console.log("100=" + res.data);
uni.showToast({
title: '请先登录',
icon: 'none'
});
uni.navigateTo({
url: `/pagesC/seller/login`
})
}
if (res.data.code == 200) {
console.log(res.data.data);
return res.data.data;
} else {
console.log(res.data);
if (res.data && res.data.msg) {
uni.showToast({
title: res.data.msg,
icon: 'none'
});
this.$api.msg(res.data.msg);
}
}
},
/**
* 封装请求async await 封装uni.request 对应search 项目
* method post/get
* endpoint 接口方法名
* data 所需传递参数
* load 是否需要loading
*/
async apiEsCall(method, endpoint, data, load) {
if (!load) {
uni.showLoading({
title: '请稍候',
mask: true
});
}
let fullurl = this.ESURI + endpoint;
//let fullurl = 'http://localhost:8085/api/' + endpoint;
let Authorization = `${store.state.userInfo.tokenHead}${store.state.userInfo.token}`;
let [error, res] = await uni.request({
url: fullurl,
data: data,
method: method,
header: {
'Content-Type': 'application/x-www-form-urlencoded',
// 'content-type': 'application/json',
'Authorization': Authorization || ''
},
});
console.log(error);
if (!load) {
uni.hideLoading();
}
return res;
},
}

View File

@@ -0,0 +1,22 @@
module.exports = {
error:'',
isJSON : function (str){
if (typeof str == 'string') {
try {
var obj=JSON.parse(str);
if(typeof obj == 'object' && obj ){
return true;
}else{
return false;
}
} catch(e) {
console.log('error'+str+'!!!'+e);
return false;
}
}
},
isNumber : function (checkVal){
var reg = /^-?[1-9][0-9]?.?[0-9]*$/;
return reg.test(checkVal);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,43 @@
// date.js
export function formatDate(date, fmt) {
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
}
let o = {
'M+': date.getMonth() + 1,
'd+': date.getDate(),
'h+': date.getHours(),
'm+': date.getMinutes(),
's+': date.getSeconds()
};
for (let k in o) {
if (new RegExp(`(${k})`).test(fmt)) {
let str = o[k] + '';
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : padLeftZero(str));
}
}
return fmt;
}
function padLeftZero(str) {
return ('00' + str).substr(str.length);
}
export function str2Date(dateStr, separator) {
if (!separator) {
separator = "-";
}
let dateArr = dateStr.split(separator);
let year = parseInt(dateArr[0]);
let month;
//处理月份为04这样的情况
if (dateArr[1].indexOf("0") == 0) {
month = parseInt(dateArr[1].substring(1));
} else {
month = parseInt(dateArr[1]);
}
let day = parseInt(dateArr[2]);
let date = new Date(year, month - 1, day);
return date;
}

View File

@@ -0,0 +1,352 @@
/*
* HTML5 Parser By Sam Blowes
*
* Designed for HTML5 documents
*
* Original code by John Resig (ejohn.org)
* http://ejohn.org/blog/pure-javascript-html-parser/
* Original code by Erik Arvidsson, Mozilla Public License
* http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
*
* ----------------------------------------------------------------------------
* License
* ----------------------------------------------------------------------------
*
* This code is triple licensed using Apache Software License 2.0,
* Mozilla Public License or GNU Public License
*
* ////////////////////////////////////////////////////////////////////////////
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* ////////////////////////////////////////////////////////////////////////////
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Simple HTML Parser.
*
* The Initial Developer of the Original Code is Erik Arvidsson.
* Portions created by Erik Arvidssson are Copyright (C) 2004. All Rights
* Reserved.
*
* ////////////////////////////////////////////////////////////////////////////
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ----------------------------------------------------------------------------
* Usage
* ----------------------------------------------------------------------------
*
* // Use like so:
* HTMLParser(htmlString, {
* start: function(tag, attrs, unary) {},
* end: function(tag) {},
* chars: function(text) {},
* comment: function(text) {}
* });
*
* // or to get an XML string:
* HTMLtoXML(htmlString);
*
* // or to get an XML DOM Document
* HTMLtoDOM(htmlString);
*
* // or to inject into an existing document/DOM node
* HTMLtoDOM(htmlString, document);
* HTMLtoDOM(htmlString, document.body);
*
*/
// Regular Expressions for parsing tags and attributes
var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/;
var endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/;
var attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g; // Empty Elements - HTML 5
var empty = makeMap('area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr'); // Block Elements - HTML 5
// fixed by xxx 将 ins 标签从块级名单中移除
var block = makeMap('a,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video'); // Inline Elements - HTML 5
var inline = makeMap('abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var'); // Elements that you can, intentionally, leave open
// (and which close themselves)
var closeSelf = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr'); // Attributes that have their values filled in disabled="disabled"
var fillAttrs = makeMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected'); // Special Elements (can contain anything)
var special = makeMap('script,style');
function HTMLParser(html, handler) {
var index;
var chars;
var match;
var stack = [];
var last = html;
stack.last = function () {
return this[this.length - 1];
};
while (html) {
chars = true; // Make sure we're not in a script or style element
if (!stack.last() || !special[stack.last()]) {
// Comment
if (html.indexOf('<!--') == 0) {
index = html.indexOf('-->');
if (index >= 0) {
if (handler.comment) {
handler.comment(html.substring(4, index));
}
html = html.substring(index + 3);
chars = false;
} // end tag
} else if (html.indexOf('</') == 0) {
match = html.match(endTag);
if (match) {
html = html.substring(match[0].length);
match[0].replace(endTag, parseEndTag);
chars = false;
} // start tag
} else if (html.indexOf('<') == 0) {
match = html.match(startTag);
if (match) {
html = html.substring(match[0].length);
match[0].replace(startTag, parseStartTag);
chars = false;
}
}
if (chars) {
index = html.indexOf('<');
var text = index < 0 ? html : html.substring(0, index);
html = index < 0 ? '' : html.substring(index);
if (handler.chars) {
handler.chars(text);
}
}
} else {
html = html.replace(new RegExp('([\\s\\S]*?)<\/' + stack.last() + '[^>]*>'), function (all, text) {
text = text.replace(/<!--([\s\S]*?)-->|<!\[CDATA\[([\s\S]*?)]]>/g, '$1$2');
if (handler.chars) {
handler.chars(text);
}
return '';
});
parseEndTag('', stack.last());
}
if (html == last) {
throw 'Parse Error: ' + html;
}
last = html;
} // Clean up any remaining tags
parseEndTag();
function parseStartTag(tag, tagName, rest, unary) {
tagName = tagName.toLowerCase();
if (block[tagName]) {
while (stack.last() && inline[stack.last()]) {
parseEndTag('', stack.last());
}
}
if (closeSelf[tagName] && stack.last() == tagName) {
parseEndTag('', tagName);
}
unary = empty[tagName] || !!unary;
if (!unary) {
stack.push(tagName);
}
if (handler.start) {
var attrs = [];
rest.replace(attr, function (match, name) {
var value = arguments[2] ? arguments[2] : arguments[3] ? arguments[3] : arguments[4] ? arguments[4] : fillAttrs[name] ? name : '';
attrs.push({
name: name,
value: value,
escaped: value.replace(/(^|[^\\])"/g, '$1\\\"') // "
});
});
if (handler.start) {
handler.start(tagName, attrs, unary);
}
}
}
function parseEndTag(tag, tagName) {
// If no tag name is provided, clean shop
if (!tagName) {
var pos = 0;
} // Find the closest opened tag of the same type
else {
for (var pos = stack.length - 1; pos >= 0; pos--) {
if (stack[pos] == tagName) {
break;
}
}
}
if (pos >= 0) {
// Close all the open elements, up the stack
for (var i = stack.length - 1; i >= pos; i--) {
if (handler.end) {
handler.end(stack[i]);
}
} // Remove the open elements from the stack
stack.length = pos;
}
}
}
function makeMap(str) {
var obj = {};
var items = str.split(',');
for (var i = 0; i < items.length; i++) {
obj[items[i]] = true;
}
return obj;
}
function removeDOCTYPE(html) {
return html.replace(/<\?xml.*\?>\n/, '').replace(/<!doctype.*>\n/, '').replace(/<!DOCTYPE.*>\n/, '');
}
function parseAttrs(attrs) {
return attrs.reduce(function (pre, attr) {
var value = attr.value;
var name = attr.name;
if (pre[name]) {
pre[name] = pre[name] + " " + value;
} else {
pre[name] = value;
}
return pre;
}, {});
}
function parseHtml(html) {
html = removeDOCTYPE(html);
var stacks = [];
var results = {
node: 'root',
children: []
};
HTMLParser(html, {
start: function start(tag, attrs, unary) {
var node = {
name: tag
};
if (attrs.length !== 0) {
node.attrs = parseAttrs(attrs);
}
if (unary) {
var parent = stacks[0] || results;
if (!parent.children) {
parent.children = [];
}
parent.children.push(node);
} else {
stacks.unshift(node);
}
},
end: function end(tag) {
var node = stacks.shift();
if (node.name !== tag) console.error('invalid state: mismatch end tag');
if (stacks.length === 0) {
results.children.push(node);
} else {
var parent = stacks[0];
if (!parent.children) {
parent.children = [];
}
parent.children.push(node);
}
},
chars: function chars(text) {
var node = {
type: 'text',
text: text
};
if (stacks.length === 0) {
results.children.push(node);
} else {
var parent = stacks[0];
if (!parent.children) {
parent.children = [];
}
parent.children.push(node);
}
},
comment: function comment(text) {
var node = {
node: 'comment',
text: text
};
var parent = stacks[0];
if (!parent.children) {
parent.children = [];
}
parent.children.push(node);
}
});
return results.children;
}
export default parseHtml;

View File

@@ -0,0 +1,32 @@
const listData = [{
content: "好评",
create_time: "2019-04-12",
header_img: "http://cs.zhangkaixing.com/face/face_2.jpg",
user_name: "测试1",
rate:5,
imgs:[]
},
{
content: "中评",
create_time: "2019-04-12",
header_img: "http://cs.zhangkaixing.com/face/face_12.jpg",
user_name: "测试2",
rate:4,
imgs:[
'http://cs.zhangkaixing.com/face/face.jpg',
'http://cs.zhangkaixing.com/face/p10.jpg',
'http://cs.zhangkaixing.com/face/face_14.jpg',
'http://cs.zhangkaixing.com/face/face.jpg',
'http://cs.zhangkaixing.com/face/p10.jpg',
]
},
{
content: "",
create_time: "2019-04-12",
header_img: "http://cs.zhangkaixing.com/face/face_15.jpg",
user_name: "测试3",
rate:2,
imgs:[]
}]
export default listData

View File

@@ -0,0 +1,71 @@
//#ifdef H5
/** clipboard.js v2.0.4**/
!function(t,e){try{window.ClipboardJS=e();}catch(e){};"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return function(n){var o={};function r(t){if(o[t])return o[t].exports;var e=o[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,r),e.l=!0,e.exports}
return r.m=n,r.c=o,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){function o(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}
return function(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),t}}(),a=o(n(1)),c=o(n(3)),u=o(n(4));function o(t){return t&&t.__esModule?t:{default:t}}
var l=function(t){function o(t,e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(o.__proto__||Object.getPrototypeOf(o)).call(this));return n.resolveOptions(e),n.listenClick(t),n}
return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(o,c.default),i(o,[{key:"resolveOptions",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof t.action?t.action:this.defaultAction,this.target="function"==typeof t.target?t.target:this.defaultTarget,this.text="function"==typeof t.text?t.text:this.defaultText,this.container="object"===r(t.container)?t.container:document.body}},{key:"listenClick",value:function(t){var e=this;this.listener=(0,u.default)(t,"click",function(t){return e.onClick(t)})}},{key:"onClick",value:function(t){var e=t.delegateTarget||t.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new a.default({action:this.action(e),target:this.target(e),text:this.text(e),container:this.container,trigger:e,emitter:this})}},{key:"defaultAction",value:function(t){return s("action",t)||'copy'}},{key:"defaultTarget",value:function(t){var e=s("target",t);if(e){return document.querySelector(e)}}},{key:"defaultText",value:function(t){return s("text",t)||this.text}},{key:"destroy",value:function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:["copy","cut"],e="string"==typeof t?[t]:t,n=!!document.queryCommandSupported;return e.forEach(function(t){n=n&&!!document.queryCommandSupported(t)}),n}}]),o}();function s(t,e){var n="data-clipboard-"+t;let isFun=e&&typeof e.hasAttribute==='function';if(isFun&&e.hasAttribute(n)){return e.getAttribute(n)}}
t.exports=l},function(t,e,n){"use strict";var o,r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){function o(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}
return function(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),t}}(),a=n(2),c=(o=a)&&o.__esModule?o:{default:o};var u=function(){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.resolveOptions(t),this.initSelection()}
return i(e,[{key:"resolveOptions",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.action=t.action,this.container=t.container,this.emitter=t.emitter,this.target=t.target,this.text=t.text,this.trigger=t.trigger,this.selectedText=""}},{key:"initSelection",value:function(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function(){var t=this,e="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return t.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[e?"right":"left"]="-9999px";var n=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=n+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.container.appendChild(this.fakeElem),this.selectedText=(0,c.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function(){this.selectedText=(0,c.default)(this.target),this.copyText()}},{key:"copyText",value:function(){var e=void 0;try{e=document.execCommand(this.action)}catch(t){e=!1}
this.handleResult(e)}},{key:"handleResult",value:function(t){this.emitter.emit(t?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function(){this.trigger&&this.trigger.focus(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function(){this.removeFake()}},{key:"action",set:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=t,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function(){return this._action}},{key:"target",set:function(t){if(void 0!==t){if(!t||"object"!==(void 0===t?"undefined":r(t))||1!==t.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&t.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(t.hasAttribute("readonly")||t.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=t}},get:function(){return this._target}}]),e}();t.exports=u},function(t,e){t.exports=function(t){var e;if("SELECT"===t.nodeName)t.focus(),e=t.value;else if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName){var n=t.hasAttribute("readonly");n||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),n||t.removeAttribute("readonly"),e=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var o=window.getSelection(),r=document.createRange();r.selectNodeContents(t),o.removeAllRanges(),o.addRange(r),e=o.toString()}
return e}},function(t,e){function n(){}
n.prototype={on:function(t,e,n){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var o=this;function r(){o.off(t,r),e.apply(n,arguments)}
return r._=e,this.on(t,r,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),o=0,r=n.length;o<r;o++)n[o].fn.apply(n[o].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),o=n[t],r=[];if(o&&e)for(var i=0,a=o.length;i<a;i++)o[i].fn!==e&&o[i].fn._!==e&&r.push(o[i]);return r.length?n[t]=r:delete n[t],this}},t.exports=n},function(t,e,n){var d=n(5),h=n(6);t.exports=function(t,e,n){if(!t&&!e&&!n)throw new Error("Missing required arguments");if(!d.string(e))throw new TypeError("Second argument must be a String");if(!d.fn(n))throw new TypeError("Third argument must be a Function");if(d.node(t))return s=e,f=n,(l=t).addEventListener(s,f),{destroy:function(){l.removeEventListener(s,f)}};if(d.nodeList(t))return a=t,c=e,u=n,Array.prototype.forEach.call(a,function(t){t.addEventListener(c,u)}),{destroy:function(){Array.prototype.forEach.call(a,function(t){t.removeEventListener(c,u)})}};if(d.string(t))return o=t,r=e,i=n,h(document.body,o,r,i);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList");var o,r,i,a,c,u,l,s,f}},function(t,n){n.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType},n.nodeList=function(t){var e=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===e||"[object HTMLCollection]"===e)&&"length"in t&&(0===t.length||n.node(t[0]))},n.string=function(t){return"string"==typeof t||t instanceof String},n.fn=function(t){return"[object Function]"===Object.prototype.toString.call(t)}},function(t,e,n){var a=n(7);function i(t,e,n,o,r){var i=function(e,n,t,o){return function(t){t.delegateTarget=a(t.target,n),t.delegateTarget&&o.call(e,t)}}.apply(this,arguments);return t.addEventListener(n,i,r),{destroy:function(){t.removeEventListener(n,i,r)}}}
t.exports=function(t,e,n,o,r){return"function"==typeof t.addEventListener?i.apply(null,arguments):"function"==typeof n?i.bind(null,document).apply(null,arguments):("string"==typeof t&&(t=document.querySelectorAll(t)),Array.prototype.map.call(t,function(t){return i(t,e,n,o,r)}))}},function(t,e){if("undefined"!=typeof Element&&!Element.prototype.matches){var n=Element.prototype;n.matches=n.matchesSelector||n.mozMatchesSelector||n.msMatchesSelector||n.oMatchesSelector||n.webkitMatchesSelector}
t.exports=function(t,e){for(;t&&9!==t.nodeType;){if("function"==typeof t.matches&&t.matches(e))return t;t=t.parentNode}}}])});let Types={isFunction:function(obj){var type=Object.prototype.toString.call(obj)
return type=='[object Function]'},isObject:function(obj){var type=Object.prototype.toString.call(obj)
return type=='[object Object]'},isString:function(obj){var type=Object.prototype.toString.call(obj)
return type=='[object String]'}}
uni.setClipboardData=function(options){let emptyFun=function(){}
let config={data:null,event:null,success:emptyFun,fail:emptyFun,complete:emptyFun}
if(options&&Types.isObject(options)){config=Object.assign({},config,options)}
if(options&&Types.isString(options)){config=Object.assign({},config,{data:options})}
let data=config.data
let success=config.success||emptyFun
let fail=config.fail||emptyFun
let complete=config.complete||emptyFun
let e=config.event||window.event||{}
let cb=new ClipboardJS('.null',{text:()=>data})
cb.on('success',function(res){
window.__clipboard__=data;
success&&Types.isFunction(success)&&success({data:res.text})
complete&&Types.isFunction(complete)&&complete()
cb.off('error')
cb.off('success')
cb.destroy()})
cb.on('error',function(err){fail&&Types.isFunction(fail)&&fail(err)
complete&&Types.isFunction(complete)&&complete()
cb.off('error')
cb.off('success')
cb.destroy()})
cb.onClick(e)};
uni.getClipboardData=function(options){let emptyFun=function(){}
let config={data:null,event:null,success:emptyFun,fail:emptyFun,complete:emptyFun}
if(options&&Types.isObject(options)){config=Object.assign({},config,options)}
let success=config.success||emptyFun
let fail=config.fail||emptyFun
let complete=config.complete||emptyFun
if(window.__clipboard__!==undefined){success&&Types.isFunction(success)&&success({data:window.__clipboard__})}else{fail&&Types.isFunction(fail)&&fail({data:null})}
complete&&Types.isFunction(complete)&&complete()};
function fileDownLoad(data){var linkElement=document.createElement('a')
linkElement.setAttribute('href',data.blob)
linkElement.setAttribute('downLoad',data.name)
linkElement.click()}
uni.saveImageToPhotosAlbum=uni.saveVideoToPhotosAlbum=function(options){let emptyFun=function(){}
let config={filePath:null,success:emptyFun,fail:emptyFun,complete:emptyFun}
if(options&&Types.isObject(options)){config=Object.assign({},config,options)}
if(options&&Types.isString(options)){config=Object.assign({},config,{filePath:options})}
let filePath=config.filePath
let success=config.success||emptyFun
let fail=config.fail||emptyFun
let complete=config.complete||emptyFun
if(!filePath){fail&&Types.isFunction(fail)&&fail({msg:'no File'})
complete&&Types.isFunction(complete)&&complete()
return}
let names=filePath.split('/')
let name=names[names.length-1]
uni.downloadFile({url:filePath,success:function(res){let tempFilePath=res.tempFilePath
fileDownLoad({name:name,blob:tempFilePath})
success&&Types.isFunction(success)&&success({filePath:filePath})},fail:function(err){fail&&Types.isFunction(fail)&&fail({msg:err})},complete:function(){complete&&Types.isFunction(complete)&&complete()}})}
//#endif