ok
This commit is contained in:
15
app.js
15
app.js
@@ -22,12 +22,21 @@ App({
|
|||||||
|
|
||||||
const that = this;
|
const that = this;
|
||||||
// 获取系统信息
|
// 获取系统信息
|
||||||
const systemInfo = wx.getSystemInfoSync();
|
// const systemInfo = wx.getSystemInfoSync();
|
||||||
|
|
||||||
|
const windowInfo = wx.getWindowInfo()
|
||||||
|
|
||||||
|
|
||||||
// 胶囊按钮位置信息
|
// 胶囊按钮位置信息
|
||||||
const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
|
const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
|
||||||
// 导航栏高度 = 状态栏高度 + 44
|
// 导航栏高度 = 状态栏高度 + 44
|
||||||
that.globalData.navBarHeight = systemInfo.statusBarHeight + 44;
|
// that.globalData.navBarHeight = systemInfo.statusBarHeight + 44;
|
||||||
that.globalData.menuRight = systemInfo.screenWidth - menuButtonInfo.right;
|
that.globalData.navBarHeight = windowInfo.statusBarHeight + 44;
|
||||||
|
// that.globalData.menuRight = systemInfo.screenWidth - menuButtonInfo.right;
|
||||||
|
that.globalData.menuRight = windowInfo.screenWidth - menuButtonInfo.right;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
that.globalData.menuTop = menuButtonInfo.top;
|
that.globalData.menuTop = menuButtonInfo.top;
|
||||||
that.globalData.menuHeight = menuButtonInfo.height;
|
that.globalData.menuHeight = menuButtonInfo.height;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
// pages/details/details.js
|
// pages/details/details.js
|
||||||
|
|
||||||
|
|
||||||
|
const request = require('../../utils/request')
|
||||||
|
const ui = require('../../utils/ui')
|
||||||
|
const wxParse = require("../../wxParse/wxParse.js");
|
||||||
|
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -6,15 +12,127 @@ Page({
|
|||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
|
|
||||||
|
navTitle: "详情",
|
||||||
|
date: "",
|
||||||
|
title: "",
|
||||||
|
content: "",
|
||||||
|
aid: 0,
|
||||||
|
isDow: false,
|
||||||
|
ext_download_link: ""
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
|
let that = this;
|
||||||
|
if (!options.aid) {
|
||||||
|
wx.navigateBack()
|
||||||
|
this.triggerEvent('onBack')
|
||||||
|
}
|
||||||
|
that.setData({
|
||||||
|
aid: options.aid
|
||||||
|
})
|
||||||
|
that.GetDetailsInfo()
|
||||||
|
console.log(options);
|
||||||
|
//
|
||||||
},
|
},
|
||||||
|
|
||||||
|
initContent() {
|
||||||
|
let that = this;
|
||||||
|
console.log(that.data.content);
|
||||||
|
if (that.data.content.length > 0) {
|
||||||
|
wxParse.wxParse('content', 'html', that.data.content, that, 0);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
GetDetailsInfo() {
|
||||||
|
let that = this;
|
||||||
|
request.request({
|
||||||
|
method: "GET",
|
||||||
|
// https://app.19year.cn/api.php/doc/details?id=51
|
||||||
|
url: "/api.php/doc/details?id=" + that.data.aid
|
||||||
|
}).then(res => {
|
||||||
|
if (res.data.code === 1) {
|
||||||
|
|
||||||
|
that.setData({
|
||||||
|
title: res.data.data.title,
|
||||||
|
date: res.data.data.date,
|
||||||
|
content: res.data.data.content,
|
||||||
|
ext_download_link: res.data.data.ext_download_link,
|
||||||
|
})
|
||||||
|
if (res.data.data.ext_download_link.length > 0) {
|
||||||
|
that.setData({
|
||||||
|
isDow: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
that.initContent()
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
console.log('ERROR')
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
downloadFileOpen() {
|
||||||
|
let that = this;
|
||||||
|
let link = that.data.ext_download_link
|
||||||
|
wx.setClipboardData({
|
||||||
|
data: link,
|
||||||
|
success: function (res) {
|
||||||
|
wx.getClipboardData({
|
||||||
|
success: function (res) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '复制成功'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//复制到剪切板
|
||||||
|
// wx.setClipboardData({
|
||||||
|
// data: link,
|
||||||
|
// success(res) {
|
||||||
|
// console.log('copy success');
|
||||||
|
// //获取剪切板的纸
|
||||||
|
// // wx.getClipboardData({
|
||||||
|
// // success(res) {
|
||||||
|
// // console.log(res) // data
|
||||||
|
// // that.copyContent = res.data
|
||||||
|
// // }
|
||||||
|
// // })
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// wx.showLoading({
|
||||||
|
// title: '下载中',
|
||||||
|
// })
|
||||||
|
//下载文件
|
||||||
|
// wx.downloadFile({
|
||||||
|
// url: link,
|
||||||
|
// success (res) {
|
||||||
|
// if (res.statusCode === 200) {
|
||||||
|
// const filePath = res.tempFilePath
|
||||||
|
// wx.openDocument({
|
||||||
|
// filePath: filePath,
|
||||||
|
// showMenu:true, //关键点
|
||||||
|
// success: function (res) {
|
||||||
|
// console.log('打开文档成功')
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面初次渲染完成
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,19 +1,24 @@
|
|||||||
<list-nav-bar title="WeixinWeixinWeixin" background="#3c8bf6" showNavBtn="{{true}}"></list-nav-bar>
|
|
||||||
|
<import src="../../wxParse/wxParse.wxml"></import>
|
||||||
|
|
||||||
|
<list-nav-bar title="{{navTitle}}" background="#3c8bf6" showNavBtn="{{true}}"></list-nav-bar>
|
||||||
<scroll-view style="height: 100%;overflow:hidden;" scroll-y type="list">
|
<scroll-view style="height: 100%;overflow:hidden;" scroll-y type="list">
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<view class="title">
|
<view class="title">
|
||||||
<text>快速操作手册试用版</text>
|
<text>{{title}}</text>
|
||||||
<text class="date">2024.08.14 15:26</text>
|
<text class="date">{{date}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<view class="text">
|
<view class="text">
|
||||||
北京欧华莱菌科技有限公司自1993年创建以来在中国市场推广超声波封口焊接设备,致力于传播先进技术,为众多的国内大型知名企业提供高品质焊接技术,成为中国企业走向世界舞台不可或缺的坚实后盾。先后为中国的制冷业,汽车制造业,电子元器件,塑料件,手机电池及汽车气囊业提供各类先进的焊接设备提供及时优质的条件保障和售后服务,为客户在生产效率及成本控制上作出巨大贡献,得到广大用户的认可,取得客户的信任并得到广泛的应用,伴随中国驰名品牌的发展而发展,成长而成长。经过我们不懈的努力,30多年来国内使用我公司提供的设备和技术的公司达到80多家,目前有超过500台各类设备在国内的制冷及其他领域广泛使用。北京欧华莱菌科技有限公司自1993年创建以来在中国市场推广超声波封口焊接设备,致力于传播先进技术,为众多的国内大型知名企业提供高品质焊接技术,成为中国企业走向世界舞台不可或缺的坚实后盾。先后为中国的制冷业,汽车制造业,电子元器件,塑料件,手机电池及汽车气囊业提供各类先进的焊接设备提供及时优质的条件保障和售后服务,为客户在生产效率及成本控制上作出巨大贡献,得到广大用户的认可,取得客户的信任并得到广泛的应用,伴随中国驰名品牌的发展而发展,成长而成长。经过我们不懈的努力,30多年来国内使用我公司提供的设备和技术的公司达到80多家,目前有超过500台各类设备在国内的制冷及其他领域广泛使用。北京欧华莱菌科技有限公司自1993年创建以来在中国市场推广超声波封口焊接设备,致力于传播先进技术,为众多的国内大型知名企业提供高品质焊接技术,成为中国企业走向世界舞台不可或缺的坚实后盾。先后为中国的制冷业,汽车制造业,电子元器件,塑料件,手机电池及汽车气囊业提供各类先进的焊接设备提供及时优质的条件保障和售后服务,为客户在生产效率及成本控制上作出巨大贡献,得到广大用户的认可,取得客户的信任并得到广泛的应用,伴随中国驰名品牌的发展而发展,成长而成长。经过我们不懈的努力,30多年来国内使用我公司提供的设备和技术的公司达到80多家,目前有超过500台各类设备在国内的制冷及其他领域广泛使用。
|
<!-- {{content}} -->
|
||||||
|
<!-- <template is="wxParse" data="{{wxParseData:content}}"></template> -->
|
||||||
|
<template is="wxParse" data="{{wxParseData:content.nodes}}"/>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
<view class='btn-view'>
|
<view class='btn-view' wx:if="{{isDow}}">
|
||||||
<button style="background: #3c8bf6;;border-radius: 60rpx;width: 85%;color: #fff;font-size: 30rpx;font-weight: normal;">附件下载</button>
|
<button bind:tap="downloadFileOpen" style="background: #3c8bf6;;border-radius: 60rpx;width: 85%;color: #fff;font-size: 30rpx;font-weight: normal;">附件下载</button>
|
||||||
</view>
|
</view>
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
@import "../../wxParse/wxParse.wxss";
|
||||||
|
|
||||||
page {
|
page {
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
|
|||||||
@@ -1,145 +0,0 @@
|
|||||||
<view class="container">
|
|
||||||
<view class="header-background"></view>
|
|
||||||
<view class="search-box">
|
|
||||||
<view class="search">
|
|
||||||
<view class="search_in">
|
|
||||||
<image src="../../images/search.png"></image>
|
|
||||||
<input type="text" placeholder="请输入故障代码或关键词" />
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 故障码快速查询 -->
|
|
||||||
<view class="quick-search-box">
|
|
||||||
<view class="quick-search">
|
|
||||||
<view class="section-title">故障码快速查询</view>
|
|
||||||
<view class="code-grid">
|
|
||||||
<block wx:for="{{codes}}" wx:key="index">
|
|
||||||
<view class="code-button">{{item}}</view>
|
|
||||||
</block>
|
|
||||||
</view>
|
|
||||||
<view class="pagination">
|
|
||||||
<button class="pagination-button btn-disabled">上一页</button>
|
|
||||||
<button class="pagination-button btn-background">下一页</button>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<view class="group-item-box">
|
|
||||||
<view class="group-item">
|
|
||||||
<view class="group-item-header">
|
|
||||||
<view class="group-item-header-tip"></view>
|
|
||||||
<view class="group-item-header-title">常见问题解决</view>
|
|
||||||
<view class="group-item-header-tip">
|
|
||||||
<view class="group-item-header-tip-txt">全部</view>
|
|
||||||
<image class="group-item-header-tip-image" src="../../images/jt.png"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="group-txt-item">
|
|
||||||
<text class="group-txt-item-bullet">•</text>
|
|
||||||
<text class="group-txt-item-text">超出焊接时间</text>
|
|
||||||
<text class="group-txt-item-text-time">08.04 00:48</text>
|
|
||||||
</view>
|
|
||||||
<view class="group-txt-item">
|
|
||||||
<text class="group-txt-item-bullet">•</text>
|
|
||||||
<text class="group-txt-item-text">超出焊接时间</text>
|
|
||||||
<text class="group-txt-item-text-time">08.04 00:48</text>
|
|
||||||
</view>
|
|
||||||
<view class="group-txt-item">
|
|
||||||
<text class="group-txt-item-bullet">•</text>
|
|
||||||
<text class="group-txt-item-text">超出焊接时间</text>
|
|
||||||
<text class="group-txt-item-text-time">08.04 00:48</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="group-item-box">
|
|
||||||
<view class="group-item">
|
|
||||||
<view class="group-item-header">
|
|
||||||
<view class="group-item-header-tip"></view>
|
|
||||||
<view class="group-item-header-title">常见问题解决</view>
|
|
||||||
<view class="group-item-header-tip">
|
|
||||||
<view class="group-item-header-tip-txt">全部</view>
|
|
||||||
<image class="group-item-header-tip-image" src="../../images/jt.png"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="group-txt-item">
|
|
||||||
<text class="group-txt-item-bullet">•</text>
|
|
||||||
<text class="group-txt-item-text">超出焊接时间</text>
|
|
||||||
<text class="group-txt-item-text-time">08.04 00:48</text>
|
|
||||||
</view>
|
|
||||||
<view class="group-txt-item">
|
|
||||||
<text class="group-txt-item-bullet">•</text>
|
|
||||||
<text class="group-txt-item-text">超出焊接时间</text>
|
|
||||||
<text class="group-txt-item-text-time">08.04 00:48</text>
|
|
||||||
</view>
|
|
||||||
<view class="group-txt-item">
|
|
||||||
<text class="group-txt-item-bullet">•</text>
|
|
||||||
<text class="group-txt-item-text">超出焊接时间</text>
|
|
||||||
<text class="group-txt-item-text-time">08.04 00:48</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
<view class="group-item-box">
|
|
||||||
<view class="group-item">
|
|
||||||
<view class="group-item-header">
|
|
||||||
<view class="group-item-header-tip"></view>
|
|
||||||
<view class="group-item-header-title">常见问题解决</view>
|
|
||||||
<view class="group-item-header-tip">
|
|
||||||
<view class="group-item-header-tip-txt">全部</view>
|
|
||||||
<image class="group-item-header-tip-image" src="../../images/jt.png"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="group-txt-item">
|
|
||||||
<text class="group-txt-item-bullet">•</text>
|
|
||||||
<text class="group-txt-item-text">超出焊接时间</text>
|
|
||||||
<text class="group-txt-item-text-time">08.04 00:48</text>
|
|
||||||
</view>
|
|
||||||
<view class="group-txt-item">
|
|
||||||
<text class="group-txt-item-bullet">•</text>
|
|
||||||
<text class="group-txt-item-text">超出焊接时间</text>
|
|
||||||
<text class="group-txt-item-text-time">08.04 00:48</text>
|
|
||||||
</view>
|
|
||||||
<view class="group-txt-item">
|
|
||||||
<text class="group-txt-item-bullet">•</text>
|
|
||||||
<text class="group-txt-item-text">超出焊接时间</text>
|
|
||||||
<text class="group-txt-item-text-time">08.04 00:48</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
<view class="group-item-box">
|
|
||||||
<view class="group-item">
|
|
||||||
<view class="group-item-header">
|
|
||||||
<view class="group-item-header-tip"></view>
|
|
||||||
<view class="group-item-header-title">常见问题解决</view>
|
|
||||||
<view class="group-item-header-tip">
|
|
||||||
<view class="group-item-header-tip-txt">全部</view>
|
|
||||||
<image class="group-item-header-tip-image" src="../../images/jt.png"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="group-txt-item">
|
|
||||||
<text class="group-txt-item-bullet">•</text>
|
|
||||||
<text class="group-txt-item-text">超出焊接时间</text>
|
|
||||||
<text class="group-txt-item-text-time">08.04 00:48</text>
|
|
||||||
</view>
|
|
||||||
<view class="group-txt-item">
|
|
||||||
<text class="group-txt-item-bullet">•</text>
|
|
||||||
<text class="group-txt-item-text">超出焊接时间</text>
|
|
||||||
<text class="group-txt-item-text-time">08.04 00:48</text>
|
|
||||||
</view>
|
|
||||||
<view class="group-txt-item">
|
|
||||||
<text class="group-txt-item-bullet">•</text>
|
|
||||||
<text class="group-txt-item-text">超出焊接时间</text>
|
|
||||||
<text class="group-txt-item-text-time">08.04 00:48</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
@@ -158,7 +158,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view> -->
|
</view> -->
|
||||||
|
|
||||||
<view class="copyright">iuu by © 2017-2024版权所有</view>
|
<!-- <view class="copyright">iuu by © 2017-2024版权所有</view> -->
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
@@ -3,179 +3,178 @@ const request = require('../../utils/request')
|
|||||||
const ui = require('../../utils/ui')
|
const ui = require('../../utils/ui')
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面的初始数据
|
* 页面的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
categoryName: "",
|
categoryName: "",
|
||||||
categoryId: 0,
|
categoryId: 0,
|
||||||
total_count: 0,
|
total_count: 0,
|
||||||
total_pages: 0,
|
total_pages: 0,
|
||||||
has_next: false,
|
has_next: false,
|
||||||
has_next: false,
|
has_next: false,
|
||||||
current_page: 1,
|
current_page: 1,
|
||||||
list: []
|
list: [],
|
||||||
},
|
scrollHeight:0
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
let that = this;
|
let that = this;
|
||||||
if (!options.cid) {
|
if (!options.cid) {
|
||||||
wx.navigateBack()
|
wx.navigateBack()
|
||||||
this.triggerEvent('onBack')
|
this.triggerEvent('onBack')
|
||||||
}
|
}
|
||||||
that.setData({
|
that.setListHeight()
|
||||||
categoryId: options.cid
|
|
||||||
})
|
|
||||||
that.GetCategoryInfo()
|
|
||||||
that.GetList()
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
GetCategoryInfo() {
|
|
||||||
let that = this;
|
|
||||||
request.request({
|
|
||||||
method: "GET",
|
|
||||||
url: "/api.php/doc/category_info?cid=" + that.data.categoryId
|
|
||||||
}).then(res => {
|
|
||||||
if (res.data.code === 1) {
|
|
||||||
that.setData({
|
that.setData({
|
||||||
categoryName: res.data.data.data.name,
|
categoryId: options.cid
|
||||||
categoryId: res.data.data.data.scode,
|
|
||||||
})
|
})
|
||||||
}
|
that.GetCategoryInfo()
|
||||||
}).catch(err => {
|
that.GetList()
|
||||||
console.log('ERROR')
|
},
|
||||||
});
|
/**
|
||||||
},
|
* 设置列表高度
|
||||||
GetList() {
|
*/
|
||||||
let that = this;
|
setListHeight: function () {
|
||||||
request.request({
|
let that = this;
|
||||||
method: "GET",
|
const windowInfo = wx.getWindowInfo()
|
||||||
url: "/api.php/doc/list?cid=" + that.data.categoryId + "&pageSize=16"
|
|
||||||
}).then(res => {
|
|
||||||
if (res.data.code === 1) {
|
|
||||||
that.setData({
|
that.setData({
|
||||||
list: res.data.data.data,
|
scrollHeight: windowInfo.windowHeight - 90,
|
||||||
current_page: res.data.data.current_page,
|
});
|
||||||
has_next: res.data.data.has_next,
|
// wx.getSystemInfo({
|
||||||
has_prev: res.data.data.has_prev,
|
// success: function (res) {
|
||||||
total_count: res.data.data.total_count,
|
// that.setData({
|
||||||
total_pages: res.data.data.total_pages,
|
// scrollHeight: res.windowHeight - 90,
|
||||||
})
|
// });
|
||||||
}
|
// }
|
||||||
// ui.showToast(res.data.errorMsg)
|
// });
|
||||||
}).catch(err => {
|
},
|
||||||
console.log('ERROR')
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
jumpPage(e) {
|
/**
|
||||||
let jumpType = e.currentTarget.dataset.jumptype;
|
* 下拉到底加载数据
|
||||||
console.log(jumpType == 2);
|
*/
|
||||||
if (jumpType == 2) {
|
bindDownLoad() {
|
||||||
wx.navigateTo({
|
let that = this;
|
||||||
url: "/pages/details/details?id=1"
|
// 已经是最后一页
|
||||||
})
|
if (that.data.has_next) {
|
||||||
|
that.setData({
|
||||||
|
current_page: that.data.current_page + 1
|
||||||
|
});
|
||||||
|
this.GetList();
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
GetCategoryInfo() {
|
||||||
|
let that = this;
|
||||||
|
request.request({
|
||||||
|
method: "GET",
|
||||||
|
url: "/api.php/doc/category_info?cid=" + that.data.categoryId
|
||||||
|
}).then(res => {
|
||||||
|
if (res.data.code === 1) {
|
||||||
|
that.setData({
|
||||||
|
categoryName: res.data.data.data.name,
|
||||||
|
categoryId: res.data.data.data.scode,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
console.log('ERROR')
|
||||||
|
});
|
||||||
|
},
|
||||||
|
GetList() {
|
||||||
|
let that = this;
|
||||||
|
request.request({
|
||||||
|
method: "GET",
|
||||||
|
url: "/api.php/doc/list?cid=" + that.data.categoryId + "&pageSize=16&page=" + that.data.current_page
|
||||||
|
}).then(res => {
|
||||||
|
if (res.data.code === 1) {
|
||||||
|
that.setData({
|
||||||
|
list: that.data.list.concat(res.data.data.data),
|
||||||
|
current_page: res.data.data.current_page,
|
||||||
|
has_next: res.data.data.has_next,
|
||||||
|
has_prev: res.data.data.has_prev,
|
||||||
|
total_count: res.data.data.total_count,
|
||||||
|
total_pages: res.data.data.total_pages,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// ui.showToast(res.data.errorMsg)
|
||||||
|
}).catch(err => {
|
||||||
|
console.log('ERROR')
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
jumpPage(e) {
|
||||||
|
let jumpType = e.currentTarget.dataset.jumptype;
|
||||||
|
// 文章id
|
||||||
|
let aid = e.currentTarget.dataset.aid;
|
||||||
|
console.log(jumpType == 2);
|
||||||
|
if (jumpType == 2 && aid) {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: "/pages/details/details?aid="+aid
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage() {
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 页面上拉触底事件的处理函数
|
|
||||||
*/
|
|
||||||
onReachBottom() {
|
|
||||||
console.log(111);
|
|
||||||
// if (this.data.has_next) {
|
|
||||||
// that.setData({
|
|
||||||
// current_page: this.current_page + 1
|
|
||||||
// })
|
|
||||||
// //加载下一页
|
|
||||||
// this.GetList();
|
|
||||||
// } else {
|
|
||||||
// ui.showToast({
|
|
||||||
// icon: "none",
|
|
||||||
// title: '没有更多数据了'
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
|
|
||||||
loadData: function () {
|
|
||||||
wx.request({
|
|
||||||
url: 'http://test.com', //假的后台接口
|
|
||||||
method: 'POST',
|
|
||||||
data: {
|
|
||||||
pageSize: this.pageSize,
|
|
||||||
pageNum: this.pageNum,
|
|
||||||
},
|
|
||||||
success: function (res) {
|
|
||||||
this.pageNum = res.data.content.pageNum;
|
|
||||||
this.totalPage = res.data.content.totalPageNum;
|
|
||||||
this.resultData = res.data.content.rows;
|
|
||||||
},
|
|
||||||
fail: function (res) {
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生命周期函数--监听页面初次渲染完成
|
|
||||||
*/
|
|
||||||
onReady() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生命周期函数--监听页面显示
|
|
||||||
*/
|
|
||||||
onShow() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生命周期函数--监听页面隐藏
|
|
||||||
*/
|
|
||||||
onHide() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生命周期函数--监听页面卸载
|
|
||||||
*/
|
|
||||||
onUnload() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 页面相关事件处理函数--监听用户下拉动作
|
|
||||||
*/
|
|
||||||
onPullDownRefresh() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 页面上拉触底事件的处理函数
|
|
||||||
*/
|
|
||||||
onReachBottom() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户点击右上角分享
|
|
||||||
*/
|
|
||||||
onShareAppMessage() {
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<!-- <navigation-bar title="Weixin" back="{{false}}" color="black" background="#3c8bf6"></navigation-bar> -->
|
<!-- <navigation-bar title="Weixin" back="{{false}}" color="black" background="#3c8bf6"></navigation-bar> -->
|
||||||
|
|
||||||
<list-nav-bar title="{{categoryName}}" background="#3c8bf6" showNavBtn="{{true}}"></list-nav-bar>
|
<list-nav-bar title="{{categoryName}}" background="#3c8bf6" showNavBtn="{{true}}"></list-nav-bar>
|
||||||
<scroll-view style="height: 100%; overflow:hidden;" scroll-y type="list">
|
<scroll-view bindscrolltolower="bindDownLoad" style="height: {{scrollHeight}}px; overflow:hidden;" scroll-y type="list">
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<block wx:for="{{list}}" wx:for-index="index" wx:for-item="itemArt">
|
<block wx:for="{{list}}" wx:for-index="index" wx:for-item="itemArt">
|
||||||
<view class="card" bind:tap="jumpPage" data-aid="{{itemArt.id}}" data-jumpType="2">
|
<view class="card" bind:tap="jumpPage" data-aid="{{itemArt.id}}" data-jumpType="2">
|
||||||
@@ -11,7 +11,6 @@
|
|||||||
<text class="title">{{itemArt.title}}</text>
|
<text class="title">{{itemArt.title}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="details">
|
<view class="details">
|
||||||
<!-- 查看详情 -->
|
|
||||||
<text class="group-item-header-tip-txt">查看详情</text>
|
<text class="group-item-header-tip-txt">查看详情</text>
|
||||||
<image class="details-icon" src="../../images/jt.png"></image>
|
<image class="details-icon" src="../../images/jt.png"></image>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
// pages/list/list.js
|
// pages/list/list.js
|
||||||
|
|
||||||
|
const request = require('../../utils/request')
|
||||||
|
const ui = require('../../utils/ui')
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -6,15 +9,25 @@ Page({
|
|||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
searchName : "",
|
searchName : "",
|
||||||
|
title:"搜索",
|
||||||
|
total_count: 0,
|
||||||
|
total_pages: 0,
|
||||||
|
has_next: false,
|
||||||
|
has_next: false,
|
||||||
|
current_page: 1,
|
||||||
|
list: [],
|
||||||
|
|
||||||
|
scrollHeight:0
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
jumpPage(e) {
|
jumpPage(e) {
|
||||||
let jumpType = e.currentTarget.dataset.jumptype;
|
let jumpType = e.currentTarget.dataset.jumptype;
|
||||||
|
let aid = e.currentTarget.dataset.aid;
|
||||||
console.log(jumpType == 2);
|
console.log(jumpType == 2);
|
||||||
if (jumpType == 2) {
|
if (jumpType == 2) {
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: "/pages/details/details?id=1"
|
url: "/pages/details/details?aid=" +aid
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// wx.navigateTo({
|
// wx.navigateTo({
|
||||||
@@ -23,13 +36,78 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
GetList() {
|
||||||
|
let that = this;
|
||||||
|
request.request({
|
||||||
|
method: "GET",
|
||||||
|
url: "/api.php/doc/list?keyword=" + that.data.searchName + "&pageSize=16&page=" + that.data.current_page
|
||||||
|
}).then(res => {
|
||||||
|
if (res.data.code === 1) {
|
||||||
|
that.setData({
|
||||||
|
list: that.data.list.concat(res.data.data.data),
|
||||||
|
current_page: res.data.data.current_page,
|
||||||
|
has_next: res.data.data.has_next,
|
||||||
|
has_prev: res.data.data.has_prev,
|
||||||
|
total_count: res.data.data.total_count,
|
||||||
|
total_pages: res.data.data.total_pages,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// ui.showToast(res.data.errorMsg)
|
||||||
|
}).catch(err => {
|
||||||
|
console.log('ERROR')
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置列表高度
|
||||||
|
*/
|
||||||
|
setListHeight: function () {
|
||||||
|
let that = this;
|
||||||
|
const windowInfo = wx.getWindowInfo()
|
||||||
|
that.setData({
|
||||||
|
scrollHeight: windowInfo.windowHeight - 90,
|
||||||
|
});
|
||||||
|
// wx.getSystemInfo({
|
||||||
|
// success: function (res) {
|
||||||
|
// that.setData({
|
||||||
|
// scrollHeight: res.windowHeight - 90,
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下拉到底加载数据
|
||||||
|
*/
|
||||||
|
bindDownLoad() {
|
||||||
|
let that = this;
|
||||||
|
// 已经是最后一页
|
||||||
|
if (that.data.has_next) {
|
||||||
|
that.setData({
|
||||||
|
current_page: that.data.current_page + 1
|
||||||
|
});
|
||||||
|
this.GetList();
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
if (!options.search) {
|
||||||
|
wx.navigateBack()
|
||||||
|
this.triggerEvent('onBack')
|
||||||
|
}
|
||||||
console.log(options);
|
console.log(options);
|
||||||
that.setData({searchName:options.search})
|
that.setData({searchName:options.search})
|
||||||
|
that.setListHeight()
|
||||||
|
that.GetList()
|
||||||
// that.data.searchName = options.search;
|
// that.data.searchName = options.search;
|
||||||
// if (that.sea)
|
// if (that.sea)
|
||||||
// console.log(options);
|
// console.log(options);
|
||||||
|
|||||||
@@ -1,22 +1,7 @@
|
|||||||
<!-- <list-nav-bar title="Weixin" back="{{false}}" color="black" background="#3c8bf6"></list-nav-bar> -->
|
<!-- <list-nav-bar title="Weixin" back="{{false}}" color="black" background="#3c8bf6"></list-nav-bar> -->
|
||||||
<!-- <navigation-bar title="Weixin" back="{{false}}" color="black" background="#3c8bf6"></navigation-bar> -->
|
<!-- <navigation-bar title="Weixin" back="{{false}}" color="black" background="#3c8bf6"></navigation-bar> -->
|
||||||
|
|
||||||
<list-nav-bar title="WeixinWeixinWeixin" background="#3c8bf6" showNavBtn="{{true}}"></list-nav-bar>
|
<list-nav-bar title="{{title}}" background="#3c8bf6" showNavBtn="{{true}}"></list-nav-bar>
|
||||||
|
|
||||||
|
|
||||||
<!-- <view class="index-search-box dis-flex">
|
|
||||||
|
|
||||||
<view class="index-cont-search">
|
|
||||||
<icon class="text-center" color="rgba(0,0,0,0.4)" size="15" type="search"></icon>
|
|
||||||
<text>搜索商品</text>
|
|
||||||
</view>
|
|
||||||
</navigator>
|
|
||||||
<view bindtap="onChangeShowState" class="list-right f-28">
|
|
||||||
<text class="iconfont icon-tubiao_kuaizhuangpailie" wx:if="{{showView}}"></text>
|
|
||||||
<text class="iconfont icon-tubiao_liebiaopailie" wx:else></text>
|
|
||||||
</view>
|
|
||||||
</view> -->
|
|
||||||
|
|
||||||
|
|
||||||
<view class="search-box">
|
<view class="search-box">
|
||||||
<navigator hover-class="none" openType="navigateBack" url="../search/index">
|
<navigator hover-class="none" openType="navigateBack" url="../search/index">
|
||||||
@@ -30,149 +15,20 @@
|
|||||||
</navigator>
|
</navigator>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<scroll-view style="height: 100%;overflow:hidden;" scroll-y type="list">
|
<scroll-view bindscrolltolower="bindDownLoad" style="height: {{scrollHeight}}px;overflow:hidden;" scroll-y type="list">
|
||||||
<view class="container">
|
<view class="container">
|
||||||
|
<block wx:for="{{list}}" wx:for-index="index" wx:for-item="itemArt">
|
||||||
<view class="card" bind:tap="jumpPage" data-jumpType="2">
|
<view class="card" bind:tap="jumpPage" data-aid="{{itemArt.id}}" data-jumpType="2">
|
||||||
<view class="card-header">
|
<view class="card-header">
|
||||||
<view class="dot"></view>
|
<view class="dot"></view>
|
||||||
<text class="title">超出焊接时间</text>
|
<text class="title">{{itemArt.title}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="details">
|
||||||
|
<!-- 查看详情 -->
|
||||||
|
<text class="group-item-header-tip-txt">查看详情</text>
|
||||||
|
<image class="details-icon" src="../../images/jt.png"></image>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="details">
|
</block>
|
||||||
<!-- 查看详情 -->
|
|
||||||
<text class="group-item-header-tip-txt">查看详情</text>
|
|
||||||
<image class="details-icon" src="../../images/jt.png"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
<view class="card" bind:tap="jumpPage" data-jumpType="2">
|
|
||||||
<view class="card-header">
|
|
||||||
<view class="dot"></view>
|
|
||||||
<text class="title">超出焊接时间</text>
|
|
||||||
</view>
|
|
||||||
<view class="details">
|
|
||||||
<!-- 查看详情 -->
|
|
||||||
<text class="group-item-header-tip-txt">查看详情</text>
|
|
||||||
<image class="details-icon" src="../../images/jt.png"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
<view class="card" bind:tap="jumpPage" data-jumpType="2">
|
|
||||||
<view class="card-header">
|
|
||||||
<view class="dot"></view>
|
|
||||||
<text class="title">超出焊接时间</text>
|
|
||||||
</view>
|
|
||||||
<view class="details">
|
|
||||||
<!-- 查看详情 -->
|
|
||||||
<text class="group-item-header-tip-txt">查看详情</text>
|
|
||||||
<image class="details-icon" src="../../images/jt.png"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
<view class="card" bind:tap="jumpPage" data-jumpType="2">
|
|
||||||
<view class="card-header">
|
|
||||||
<view class="dot"></view>
|
|
||||||
<text class="title">超出焊接时间</text>
|
|
||||||
</view>
|
|
||||||
<view class="details">
|
|
||||||
<!-- 查看详情 -->
|
|
||||||
<text class="group-item-header-tip-txt">查看详情</text>
|
|
||||||
<image class="details-icon" src="../../images/jt.png"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
<view class="card" bind:tap="jumpPage" data-jumpType="2">
|
|
||||||
<view class="card-header">
|
|
||||||
<view class="dot"></view>
|
|
||||||
<text class="title">超出焊接时间</text>
|
|
||||||
</view>
|
|
||||||
<view class="details">
|
|
||||||
<!-- 查看详情 -->
|
|
||||||
<text class="group-item-header-tip-txt">查看详情</text>
|
|
||||||
<image class="details-icon" src="../../images/jt.png"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
<view class="card" bind:tap="jumpPage" data-jumpType="2">
|
|
||||||
<view class="card-header">
|
|
||||||
<view class="dot"></view>
|
|
||||||
<text class="title">超出焊接时间</text>
|
|
||||||
</view>
|
|
||||||
<view class="details">
|
|
||||||
<!-- 查看详情 -->
|
|
||||||
<text class="group-item-header-tip-txt">查看详情</text>
|
|
||||||
<image class="details-icon" src="../../images/jt.png"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
<view class="card" bind:tap="jumpPage" data-jumpType="2">
|
|
||||||
<view class="card-header">
|
|
||||||
<view class="dot"></view>
|
|
||||||
<text class="title">超出焊接时间</text>
|
|
||||||
</view>
|
|
||||||
<view class="details">
|
|
||||||
<!-- 查看详情 -->
|
|
||||||
<text class="group-item-header-tip-txt">查看详情</text>
|
|
||||||
<image class="details-icon" src="../../images/jt.png"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
<view class="card" bind:tap="jumpPage" data-jumpType="2">
|
|
||||||
<view class="card-header">
|
|
||||||
<view class="dot"></view>
|
|
||||||
<text class="title">超出焊接时间</text>
|
|
||||||
</view>
|
|
||||||
<view class="details">
|
|
||||||
<!-- 查看详情 -->
|
|
||||||
<text class="group-item-header-tip-txt">查看详情</text>
|
|
||||||
<image class="details-icon" src="../../images/jt.png"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
<view class="card" bind:tap="jumpPage" data-jumpType="2">
|
|
||||||
<view class="card-header">
|
|
||||||
<view class="dot"></view>
|
|
||||||
<text class="title">超出焊接时间</text>
|
|
||||||
</view>
|
|
||||||
<view class="details">
|
|
||||||
<!-- 查看详情 -->
|
|
||||||
<text class="group-item-header-tip-txt">查看详情</text>
|
|
||||||
<image class="details-icon" src="../../images/jt.png"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
<view class="card" bind:tap="jumpPage" data-jumpType="2">
|
|
||||||
<view class="card-header">
|
|
||||||
<view class="dot"></view>
|
|
||||||
<text class="title">超出焊接时间</text>
|
|
||||||
</view>
|
|
||||||
<view class="details">
|
|
||||||
<!-- 查看详情 -->
|
|
||||||
<text class="group-item-header-tip-txt">查看详情</text>
|
|
||||||
<image class="details-icon" src="../../images/jt.png"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
<view class="card" bind:tap="jumpPage" data-jumpType="2">
|
|
||||||
<view class="card-header">
|
|
||||||
<view class="dot"></view>
|
|
||||||
<text class="title">超出焊接时间</text>
|
|
||||||
</view>
|
|
||||||
<view class="details">
|
|
||||||
<!-- 查看详情 -->
|
|
||||||
<text class="group-item-header-tip-txt">查看详情</text>
|
|
||||||
<image class="details-icon" src="../../images/jt.png"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
@@ -65,7 +65,7 @@ Page({
|
|||||||
/**
|
/**
|
||||||
* 清空最近搜索记录
|
* 清空最近搜索记录
|
||||||
*/
|
*/
|
||||||
clearSearch: function () {
|
clearSearch() {
|
||||||
wx.removeStorageSync('recentSearch');
|
wx.removeStorageSync('recentSearch');
|
||||||
this.getRecentSearch();
|
this.getRecentSearch();
|
||||||
},
|
},
|
||||||
@@ -73,7 +73,7 @@ Page({
|
|||||||
/**
|
/**
|
||||||
* 跳转到最近搜索
|
* 跳转到最近搜索
|
||||||
*/
|
*/
|
||||||
goSearch: function (e) {
|
goSearch(e) {
|
||||||
console.log(e.target.dataset.text);
|
console.log(e.target.dataset.text);
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: '../s-list/s-list?search=' + e.target.dataset.text,
|
url: '../s-list/s-list?search=' + e.target.dataset.text,
|
||||||
|
|||||||
302
wxParse/html2json.js
Normal file
302
wxParse/html2json.js
Normal file
@@ -0,0 +1,302 @@
|
|||||||
|
/**
|
||||||
|
* html2Json 改造来自: https://github.com/Jxck/html2json
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* author: Di (微信小程序开发工程师)
|
||||||
|
* organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
|
||||||
|
* 垂直微信小程序开发交流社区
|
||||||
|
*
|
||||||
|
* github地址: https://github.com/icindy/wxParse
|
||||||
|
*
|
||||||
|
* for: 微信小程序富文本解析
|
||||||
|
* detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
|
||||||
|
*/
|
||||||
|
|
||||||
|
var __placeImgeUrlHttps = "https";
|
||||||
|
var __emojisReg = '';
|
||||||
|
var __emojisBaseSrc = '';
|
||||||
|
var __emojis = {};
|
||||||
|
var wxDiscode = require('./wxDiscode.js');
|
||||||
|
var HTMLParser = require('./htmlparser.js');
|
||||||
|
// 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
|
||||||
|
var block = makeMap("br,a,code,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,ins,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,button,cite,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("wxxxcode-style,script,style,view,scroll-view,block");
|
||||||
|
function makeMap(str) {
|
||||||
|
var obj = {}, items = str.split(",");
|
||||||
|
for (var i = 0; i < items.length; i++)
|
||||||
|
obj[items[i]] = true;
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
function q(v) {
|
||||||
|
return '"' + v + '"';
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeDOCTYPE(html) {
|
||||||
|
return html
|
||||||
|
.replace(/<\?xml.*\?>\n/, '')
|
||||||
|
.replace(/<.*!doctype.*\>\n/, '')
|
||||||
|
.replace(/<.*!DOCTYPE.*\>\n/, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
function trimHtml(html) {
|
||||||
|
return html
|
||||||
|
.replace(/\r?\n+/g, '')
|
||||||
|
.replace(/<!--.*?-->/ig, '')
|
||||||
|
.replace(/\/\*.*?\*\//ig, '')
|
||||||
|
.replace(/[ ]+</ig, '<')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function html2json(html, bindName) {
|
||||||
|
//处理字符串
|
||||||
|
html = removeDOCTYPE(html);
|
||||||
|
html = trimHtml(html);
|
||||||
|
html = wxDiscode.strDiscode(html);
|
||||||
|
//生成node节点
|
||||||
|
var bufArray = [];
|
||||||
|
var results = {
|
||||||
|
node: bindName,
|
||||||
|
nodes: [],
|
||||||
|
images:[],
|
||||||
|
imageUrls:[]
|
||||||
|
};
|
||||||
|
var index = 0;
|
||||||
|
HTMLParser(html, {
|
||||||
|
start: function (tag, attrs, unary) {
|
||||||
|
//debug(tag, attrs, unary);
|
||||||
|
// node for this element
|
||||||
|
var node = {
|
||||||
|
node: 'element',
|
||||||
|
tag: tag,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (bufArray.length === 0) {
|
||||||
|
node.index = index.toString()
|
||||||
|
index += 1
|
||||||
|
} else {
|
||||||
|
var parent = bufArray[0];
|
||||||
|
if (parent.nodes === undefined) {
|
||||||
|
parent.nodes = [];
|
||||||
|
}
|
||||||
|
node.index = parent.index + '.' + parent.nodes.length
|
||||||
|
}
|
||||||
|
|
||||||
|
if (block[tag]) {
|
||||||
|
node.tagType = "block";
|
||||||
|
} else if (inline[tag]) {
|
||||||
|
node.tagType = "inline";
|
||||||
|
} else if (closeSelf[tag]) {
|
||||||
|
node.tagType = "closeSelf";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (attrs.length !== 0) {
|
||||||
|
node.attr = attrs.reduce(function (pre, attr) {
|
||||||
|
var name = attr.name;
|
||||||
|
var value = attr.value;
|
||||||
|
if (name == 'class') {
|
||||||
|
console.dir(value);
|
||||||
|
// value = value.join("")
|
||||||
|
node.classStr = value;
|
||||||
|
}
|
||||||
|
// has multi attibutes
|
||||||
|
// make it array of attribute
|
||||||
|
if (name == 'style') {
|
||||||
|
console.dir(value);
|
||||||
|
// value = value.join("")
|
||||||
|
node.styleStr = value;
|
||||||
|
}
|
||||||
|
if (value.match(/ /)) {
|
||||||
|
value = value.split(' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// if attr already exists
|
||||||
|
// merge it
|
||||||
|
if (pre[name]) {
|
||||||
|
if (Array.isArray(pre[name])) {
|
||||||
|
// already array, push to last
|
||||||
|
pre[name].push(value);
|
||||||
|
} else {
|
||||||
|
// single value, make it array
|
||||||
|
pre[name] = [pre[name], value];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// not exist, put it
|
||||||
|
pre[name] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pre;
|
||||||
|
}, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
//对img添加额外数据
|
||||||
|
if (node.tag === 'img') {
|
||||||
|
node.imgIndex = results.images.length;
|
||||||
|
var imgUrl = node.attr.src;
|
||||||
|
if (imgUrl[0] == '') {
|
||||||
|
imgUrl.splice(0, 1);
|
||||||
|
}
|
||||||
|
imgUrl = wxDiscode.urlToHttpUrl(imgUrl, __placeImgeUrlHttps);
|
||||||
|
node.attr.src = imgUrl;
|
||||||
|
node.from = bindName;
|
||||||
|
results.images.push(node);
|
||||||
|
results.imageUrls.push(imgUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理font标签样式属性
|
||||||
|
if (node.tag === 'font') {
|
||||||
|
var fontSize = ['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', '-webkit-xxx-large'];
|
||||||
|
var styleAttrs = {
|
||||||
|
'color': 'color',
|
||||||
|
'face': 'font-family',
|
||||||
|
'size': 'font-size'
|
||||||
|
};
|
||||||
|
if (!node.attr.style) node.attr.style = [];
|
||||||
|
if (!node.styleStr) node.styleStr = '';
|
||||||
|
for (var key in styleAttrs) {
|
||||||
|
if (node.attr[key]) {
|
||||||
|
var value = key === 'size' ? fontSize[node.attr[key]-1] : node.attr[key];
|
||||||
|
node.attr.style.push(styleAttrs[key]);
|
||||||
|
node.attr.style.push(value);
|
||||||
|
node.styleStr += styleAttrs[key] + ': ' + value + ';';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//临时记录source资源
|
||||||
|
if(node.tag === 'source'){
|
||||||
|
results.source = node.attr.src;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unary) {
|
||||||
|
// if this tag doesn't have end tag
|
||||||
|
// like <img src="hoge.png"/>
|
||||||
|
// add to parents
|
||||||
|
var parent = bufArray[0] || results;
|
||||||
|
if (parent.nodes === undefined) {
|
||||||
|
parent.nodes = [];
|
||||||
|
}
|
||||||
|
parent.nodes.push(node);
|
||||||
|
} else {
|
||||||
|
bufArray.unshift(node);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
end: function (tag) {
|
||||||
|
//debug(tag);
|
||||||
|
// merge into parent tag
|
||||||
|
var node = bufArray.shift();
|
||||||
|
if (node.tag !== tag) console.error('invalid state: mismatch end tag');
|
||||||
|
|
||||||
|
//当有缓存source资源时于于video补上src资源
|
||||||
|
if(node.tag === 'video' && results.source){
|
||||||
|
node.attr.src = results.source;
|
||||||
|
delete results.source;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bufArray.length === 0) {
|
||||||
|
results.nodes.push(node);
|
||||||
|
} else {
|
||||||
|
var parent = bufArray[0];
|
||||||
|
if (parent.nodes === undefined) {
|
||||||
|
parent.nodes = [];
|
||||||
|
}
|
||||||
|
parent.nodes.push(node);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
chars: function (text) {
|
||||||
|
//debug(text);
|
||||||
|
var node = {
|
||||||
|
node: 'text',
|
||||||
|
text: text,
|
||||||
|
textArray:transEmojiStr(text)
|
||||||
|
};
|
||||||
|
|
||||||
|
if (bufArray.length === 0) {
|
||||||
|
node.index = index.toString()
|
||||||
|
index += 1
|
||||||
|
results.nodes.push(node);
|
||||||
|
} else {
|
||||||
|
var parent = bufArray[0];
|
||||||
|
if (parent.nodes === undefined) {
|
||||||
|
parent.nodes = [];
|
||||||
|
}
|
||||||
|
node.index = parent.index + '.' + parent.nodes.length
|
||||||
|
parent.nodes.push(node);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
comment: function (text) {
|
||||||
|
//debug(text);
|
||||||
|
// var node = {
|
||||||
|
// node: 'comment',
|
||||||
|
// text: text,
|
||||||
|
// };
|
||||||
|
// var parent = bufArray[0];
|
||||||
|
// if (parent.nodes === undefined) {
|
||||||
|
// parent.nodes = [];
|
||||||
|
// }
|
||||||
|
// parent.nodes.push(node);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return results;
|
||||||
|
};
|
||||||
|
|
||||||
|
function transEmojiStr(str){
|
||||||
|
// var eReg = new RegExp("["+__reg+' '+"]");
|
||||||
|
// str = str.replace(/\[([^\[\]]+)\]/g,':$1:')
|
||||||
|
|
||||||
|
var emojiObjs = [];
|
||||||
|
//如果正则表达式为空
|
||||||
|
if(__emojisReg.length == 0 || !__emojis){
|
||||||
|
var emojiObj = {}
|
||||||
|
emojiObj.node = "text";
|
||||||
|
emojiObj.text = str;
|
||||||
|
array = [emojiObj];
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
//这个地方需要调整
|
||||||
|
str = str.replace(/\[([^\[\]]+)\]/g,':$1:')
|
||||||
|
var eReg = new RegExp("[:]");
|
||||||
|
var array = str.split(eReg);
|
||||||
|
for(var i = 0; i < array.length; i++){
|
||||||
|
var ele = array[i];
|
||||||
|
var emojiObj = {};
|
||||||
|
if(__emojis[ele]){
|
||||||
|
emojiObj.node = "element";
|
||||||
|
emojiObj.tag = "emoji";
|
||||||
|
emojiObj.text = __emojis[ele];
|
||||||
|
emojiObj.baseSrc= __emojisBaseSrc;
|
||||||
|
}else{
|
||||||
|
emojiObj.node = "text";
|
||||||
|
emojiObj.text = ele;
|
||||||
|
}
|
||||||
|
emojiObjs.push(emojiObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
return emojiObjs;
|
||||||
|
}
|
||||||
|
|
||||||
|
function emojisInit(reg='',baseSrc="/wxParse/emojis/",emojis){
|
||||||
|
__emojisReg = reg;
|
||||||
|
__emojisBaseSrc=baseSrc;
|
||||||
|
__emojis=emojis;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
html2json: html2json,
|
||||||
|
emojisInit:emojisInit
|
||||||
|
};
|
||||||
192
wxParse/htmlparser.js
Normal file
192
wxParse/htmlparser.js
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* htmlParser改造自: https://github.com/blowsie/Pure-JavaScript-HTML5-Parser
|
||||||
|
*
|
||||||
|
* author: Di (微信小程序开发工程师)
|
||||||
|
* organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
|
||||||
|
* 垂直微信小程序开发交流社区
|
||||||
|
*
|
||||||
|
* github地址: https://github.com/icindy/wxParse
|
||||||
|
*
|
||||||
|
* for: 微信小程序富文本解析
|
||||||
|
* detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
|
||||||
|
*/
|
||||||
|
// 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*(\/?)>/,
|
||||||
|
endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/,
|
||||||
|
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
|
||||||
|
var block = makeMap("a,address,code,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,ins,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,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("wxxxcode-style,script,style,view,scroll-view,block");
|
||||||
|
|
||||||
|
function HTMLParser(html, handler) {
|
||||||
|
var index, chars, match, stack = [], 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 = ''
|
||||||
|
while (index === 0) {
|
||||||
|
text += "<";
|
||||||
|
html = html.substring(1);
|
||||||
|
index = html.indexOf("<");
|
||||||
|
}
|
||||||
|
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 {
|
||||||
|
tagName = tagName.toLowerCase();
|
||||||
|
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 = {}, items = str.split(",");
|
||||||
|
for (var i = 0; i < items.length; i++)
|
||||||
|
obj[items[i]] = true;
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = HTMLParser;
|
||||||
2532
wxParse/showdown.js
Normal file
2532
wxParse/showdown.js
Normal file
File diff suppressed because it is too large
Load Diff
207
wxParse/wxDiscode.js
Normal file
207
wxParse/wxDiscode.js
Normal file
@@ -0,0 +1,207 @@
|
|||||||
|
// HTML 支持的数学符号
|
||||||
|
function strNumDiscode(str){
|
||||||
|
str = str.replace(/∀/g, '∀');
|
||||||
|
str = str.replace(/∂/g, '∂');
|
||||||
|
str = str.replace(/&exists;/g, '∃');
|
||||||
|
str = str.replace(/∅/g, '∅');
|
||||||
|
str = str.replace(/∇/g, '∇');
|
||||||
|
str = str.replace(/∈/g, '∈');
|
||||||
|
str = str.replace(/∉/g, '∉');
|
||||||
|
str = str.replace(/∋/g, '∋');
|
||||||
|
str = str.replace(/∏/g, '∏');
|
||||||
|
str = str.replace(/∑/g, '∑');
|
||||||
|
str = str.replace(/−/g, '−');
|
||||||
|
str = str.replace(/∗/g, '∗');
|
||||||
|
str = str.replace(/√/g, '√');
|
||||||
|
str = str.replace(/∝/g, '∝');
|
||||||
|
str = str.replace(/∞/g, '∞');
|
||||||
|
str = str.replace(/∠/g, '∠');
|
||||||
|
str = str.replace(/∧/g, '∧');
|
||||||
|
str = str.replace(/∨/g, '∨');
|
||||||
|
str = str.replace(/∩/g, '∩');
|
||||||
|
str = str.replace(/∩/g, '∪');
|
||||||
|
str = str.replace(/∫/g, '∫');
|
||||||
|
str = str.replace(/∴/g, '∴');
|
||||||
|
str = str.replace(/∼/g, '∼');
|
||||||
|
str = str.replace(/≅/g, '≅');
|
||||||
|
str = str.replace(/≈/g, '≈');
|
||||||
|
str = str.replace(/≠/g, '≠');
|
||||||
|
str = str.replace(/≤/g, '≤');
|
||||||
|
str = str.replace(/≥/g, '≥');
|
||||||
|
str = str.replace(/⊂/g, '⊂');
|
||||||
|
str = str.replace(/⊃/g, '⊃');
|
||||||
|
str = str.replace(/⊄/g, '⊄');
|
||||||
|
str = str.replace(/⊆/g, '⊆');
|
||||||
|
str = str.replace(/⊇/g, '⊇');
|
||||||
|
str = str.replace(/⊕/g, '⊕');
|
||||||
|
str = str.replace(/⊗/g, '⊗');
|
||||||
|
str = str.replace(/⊥/g, '⊥');
|
||||||
|
str = str.replace(/⋅/g, '⋅');
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
//HTML 支持的希腊字母
|
||||||
|
function strGreeceDiscode(str){
|
||||||
|
str = str.replace(/Α/g, 'Α');
|
||||||
|
str = str.replace(/Β/g, 'Β');
|
||||||
|
str = str.replace(/Γ/g, 'Γ');
|
||||||
|
str = str.replace(/Δ/g, 'Δ');
|
||||||
|
str = str.replace(/Ε/g, 'Ε');
|
||||||
|
str = str.replace(/Ζ/g, 'Ζ');
|
||||||
|
str = str.replace(/Η/g, 'Η');
|
||||||
|
str = str.replace(/Θ/g, 'Θ');
|
||||||
|
str = str.replace(/Ι/g, 'Ι');
|
||||||
|
str = str.replace(/Κ/g, 'Κ');
|
||||||
|
str = str.replace(/Λ/g, 'Λ');
|
||||||
|
str = str.replace(/Μ/g, 'Μ');
|
||||||
|
str = str.replace(/Ν/g, 'Ν');
|
||||||
|
str = str.replace(/Ξ/g, 'Ν');
|
||||||
|
str = str.replace(/Ο/g, 'Ο');
|
||||||
|
str = str.replace(/Π/g, 'Π');
|
||||||
|
str = str.replace(/Ρ/g, 'Ρ');
|
||||||
|
str = str.replace(/Σ/g, 'Σ');
|
||||||
|
str = str.replace(/Τ/g, 'Τ');
|
||||||
|
str = str.replace(/Υ/g, 'Υ');
|
||||||
|
str = str.replace(/Φ/g, 'Φ');
|
||||||
|
str = str.replace(/Χ/g, 'Χ');
|
||||||
|
str = str.replace(/Ψ/g, 'Ψ');
|
||||||
|
str = str.replace(/Ω/g, 'Ω');
|
||||||
|
|
||||||
|
str = str.replace(/α/g, 'α');
|
||||||
|
str = str.replace(/β/g, 'β');
|
||||||
|
str = str.replace(/γ/g, 'γ');
|
||||||
|
str = str.replace(/δ/g, 'δ');
|
||||||
|
str = str.replace(/ε/g, 'ε');
|
||||||
|
str = str.replace(/ζ/g, 'ζ');
|
||||||
|
str = str.replace(/η/g, 'η');
|
||||||
|
str = str.replace(/θ/g, 'θ');
|
||||||
|
str = str.replace(/ι/g, 'ι');
|
||||||
|
str = str.replace(/κ/g, 'κ');
|
||||||
|
str = str.replace(/λ/g, 'λ');
|
||||||
|
str = str.replace(/μ/g, 'μ');
|
||||||
|
str = str.replace(/ν/g, 'ν');
|
||||||
|
str = str.replace(/ξ/g, 'ξ');
|
||||||
|
str = str.replace(/ο/g, 'ο');
|
||||||
|
str = str.replace(/π/g, 'π');
|
||||||
|
str = str.replace(/ρ/g, 'ρ');
|
||||||
|
str = str.replace(/ς/g, 'ς');
|
||||||
|
str = str.replace(/σ/g, 'σ');
|
||||||
|
str = str.replace(/τ/g, 'τ');
|
||||||
|
str = str.replace(/υ/g, 'υ');
|
||||||
|
str = str.replace(/φ/g, 'φ');
|
||||||
|
str = str.replace(/χ/g, 'χ');
|
||||||
|
str = str.replace(/ψ/g, 'ψ');
|
||||||
|
str = str.replace(/ω/g, 'ω');
|
||||||
|
str = str.replace(/ϑ/g, 'ϑ');
|
||||||
|
str = str.replace(/ϒ/g, 'ϒ');
|
||||||
|
str = str.replace(/ϖ/g, 'ϖ');
|
||||||
|
str = str.replace(/·/g, '·');
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
function strcharacterDiscode(str){
|
||||||
|
// 加入常用解析
|
||||||
|
str = str.replace(/ /g, ' ');
|
||||||
|
str = str.replace(/"/g, "'");
|
||||||
|
str = str.replace(/&/g, '&');
|
||||||
|
// str = str.replace(/</g, '‹');
|
||||||
|
// str = str.replace(/>/g, '›');
|
||||||
|
|
||||||
|
str = str.replace(/</g, '<');
|
||||||
|
str = str.replace(/>/g, '>');
|
||||||
|
str = str.replace(/•/g, '•');
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
// HTML 支持的其他实体
|
||||||
|
function strOtherDiscode(str){
|
||||||
|
str = str.replace(/Œ/g, 'Œ');
|
||||||
|
str = str.replace(/œ/g, 'œ');
|
||||||
|
str = str.replace(/Š/g, 'Š');
|
||||||
|
str = str.replace(/š/g, 'š');
|
||||||
|
str = str.replace(/Ÿ/g, 'Ÿ');
|
||||||
|
str = str.replace(/ƒ/g, 'ƒ');
|
||||||
|
str = str.replace(/ˆ/g, 'ˆ');
|
||||||
|
str = str.replace(/˜/g, '˜');
|
||||||
|
str = str.replace(/ /g, '');
|
||||||
|
str = str.replace(/ /g, '');
|
||||||
|
str = str.replace(/ /g, '');
|
||||||
|
str = str.replace(/‌/g, '');
|
||||||
|
str = str.replace(/‍/g, '');
|
||||||
|
str = str.replace(/‎/g, '');
|
||||||
|
str = str.replace(/‏/g, '');
|
||||||
|
str = str.replace(/–/g, '–');
|
||||||
|
str = str.replace(/—/g, '—');
|
||||||
|
str = str.replace(/‘/g, '‘');
|
||||||
|
str = str.replace(/’/g, '’');
|
||||||
|
str = str.replace(/‚/g, '‚');
|
||||||
|
str = str.replace(/“/g, '“');
|
||||||
|
str = str.replace(/”/g, '”');
|
||||||
|
str = str.replace(/„/g, '„');
|
||||||
|
str = str.replace(/†/g, '†');
|
||||||
|
str = str.replace(/‡/g, '‡');
|
||||||
|
str = str.replace(/•/g, '•');
|
||||||
|
str = str.replace(/…/g, '…');
|
||||||
|
str = str.replace(/‰/g, '‰');
|
||||||
|
str = str.replace(/′/g, '′');
|
||||||
|
str = str.replace(/″/g, '″');
|
||||||
|
str = str.replace(/‹/g, '‹');
|
||||||
|
str = str.replace(/›/g, '›');
|
||||||
|
str = str.replace(/‾/g, '‾');
|
||||||
|
str = str.replace(/€/g, '€');
|
||||||
|
str = str.replace(/™/g, '™');
|
||||||
|
|
||||||
|
str = str.replace(/←/g, '←');
|
||||||
|
str = str.replace(/↑/g, '↑');
|
||||||
|
str = str.replace(/→/g, '→');
|
||||||
|
str = str.replace(/↓/g, '↓');
|
||||||
|
str = str.replace(/↔/g, '↔');
|
||||||
|
str = str.replace(/↵/g, '↵');
|
||||||
|
str = str.replace(/⌈/g, '⌈');
|
||||||
|
str = str.replace(/⌉/g, '⌉');
|
||||||
|
|
||||||
|
str = str.replace(/⌊/g, '⌊');
|
||||||
|
str = str.replace(/⌋/g, '⌋');
|
||||||
|
str = str.replace(/◊/g, '◊');
|
||||||
|
str = str.replace(/♠/g, '♠');
|
||||||
|
str = str.replace(/♣/g, '♣');
|
||||||
|
str = str.replace(/♥/g, '♥');
|
||||||
|
|
||||||
|
str = str.replace(/♦/g, '♦');
|
||||||
|
str = str.replace(/'/g, '\'');
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
function strMoreDiscode(str){
|
||||||
|
str = str.replace(/\r\n/g,"");
|
||||||
|
str = str.replace(/\n/g,"");
|
||||||
|
|
||||||
|
str = str.replace(/code/g,"wxxxcode-style");
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
function strDiscode(str){
|
||||||
|
str = strNumDiscode(str);
|
||||||
|
str = strGreeceDiscode(str);
|
||||||
|
str = strcharacterDiscode(str);
|
||||||
|
str = strOtherDiscode(str);
|
||||||
|
str = strMoreDiscode(str);
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
function urlToHttpUrl(url,rep){
|
||||||
|
|
||||||
|
var patt1 = new RegExp("^//");
|
||||||
|
var result = patt1.test(url);
|
||||||
|
if(result){
|
||||||
|
url = rep+":"+url;
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
strDiscode:strDiscode,
|
||||||
|
urlToHttpUrl:urlToHttpUrl
|
||||||
|
}
|
||||||
158
wxParse/wxParse.js
Normal file
158
wxParse/wxParse.js
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
/**
|
||||||
|
* author: Di (微信小程序开发工程师)
|
||||||
|
* organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
|
||||||
|
* 垂直微信小程序开发交流社区
|
||||||
|
*
|
||||||
|
* github地址: https://github.com/icindy/wxParse
|
||||||
|
*
|
||||||
|
* for: 微信小程序富文本解析
|
||||||
|
* detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* utils函数引入
|
||||||
|
**/
|
||||||
|
import showdown from './showdown.js';
|
||||||
|
import HtmlToJson from './html2json.js';
|
||||||
|
/**
|
||||||
|
* 配置及公有属性
|
||||||
|
**/
|
||||||
|
var realWindowWidth = 0;
|
||||||
|
var realWindowHeight = 0;
|
||||||
|
wx.getSystemInfo({
|
||||||
|
success: function (res) {
|
||||||
|
realWindowWidth = res.windowWidth
|
||||||
|
realWindowHeight = res.windowHeight
|
||||||
|
}
|
||||||
|
})
|
||||||
|
/**
|
||||||
|
* 主函数入口区
|
||||||
|
**/
|
||||||
|
function wxParse(bindName = 'wxParseData', type='html', data='<div class="color:red;">数据不能为空</div>', target,imagePadding) {
|
||||||
|
var that = target;
|
||||||
|
var transData = {};//存放转化后的数据
|
||||||
|
if (type == 'html') {
|
||||||
|
transData = HtmlToJson.html2json(data, bindName);
|
||||||
|
console.log(JSON.stringify(transData, ' ', ' '));
|
||||||
|
} else if (type == 'md' || type == 'markdown') {
|
||||||
|
var converter = new showdown.Converter();
|
||||||
|
var html = converter.makeHtml(data);
|
||||||
|
transData = HtmlToJson.html2json(html, bindName);
|
||||||
|
console.log(JSON.stringify(transData, ' ', ' '));
|
||||||
|
}
|
||||||
|
transData.view = {};
|
||||||
|
transData.view.imagePadding = 0;
|
||||||
|
if(typeof(imagePadding) != 'undefined'){
|
||||||
|
transData.view.imagePadding = imagePadding
|
||||||
|
}
|
||||||
|
var bindData = {};
|
||||||
|
bindData[bindName] = transData;
|
||||||
|
that.setData(bindData)
|
||||||
|
that.wxParseImgLoad = wxParseImgLoad;
|
||||||
|
that.wxParseImgTap = wxParseImgTap;
|
||||||
|
}
|
||||||
|
// 图片点击事件
|
||||||
|
function wxParseImgTap(e) {
|
||||||
|
var that = this;
|
||||||
|
var nowImgUrl = e.target.dataset.src;
|
||||||
|
var tagFrom = e.target.dataset.from;
|
||||||
|
if (typeof (tagFrom) != 'undefined' && tagFrom.length > 0) {
|
||||||
|
wx.previewImage({
|
||||||
|
current: nowImgUrl, // 当前显示图片的http链接
|
||||||
|
urls: that.data[tagFrom].imageUrls // 需要预览的图片http链接列表
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片视觉宽高计算函数区
|
||||||
|
**/
|
||||||
|
function wxParseImgLoad(e) {
|
||||||
|
var that = this;
|
||||||
|
var tagFrom = e.target.dataset.from;
|
||||||
|
var idx = e.target.dataset.idx;
|
||||||
|
if (typeof (tagFrom) != 'undefined' && tagFrom.length > 0) {
|
||||||
|
calMoreImageInfo(e, idx, that, tagFrom)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 假循环获取计算图片视觉最佳宽高
|
||||||
|
function calMoreImageInfo(e, idx, that, bindName) {
|
||||||
|
var temData = that.data[bindName];
|
||||||
|
if (!temData || temData.images.length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var temImages = temData.images;
|
||||||
|
//因为无法获取view宽度 需要自定义padding进行计算,稍后处理
|
||||||
|
var recal = wxAutoImageCal(e.detail.width, e.detail.height,that,bindName);
|
||||||
|
// temImages[idx].width = recal.imageWidth;
|
||||||
|
// temImages[idx].height = recal.imageheight;
|
||||||
|
// temData.images = temImages;
|
||||||
|
// var bindData = {};
|
||||||
|
// bindData[bindName] = temData;
|
||||||
|
// that.setData(bindData);
|
||||||
|
var index = temImages[idx].index
|
||||||
|
var key = `${bindName}`
|
||||||
|
for (var i of index.split('.')) key+=`.nodes[${i}]`
|
||||||
|
var keyW = key + '.width'
|
||||||
|
var keyH = key + '.height'
|
||||||
|
that.setData({
|
||||||
|
[keyW]: recal.imageWidth,
|
||||||
|
[keyH]: recal.imageheight,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算视觉优先的图片宽高
|
||||||
|
function wxAutoImageCal(originalWidth, originalHeight,that,bindName) {
|
||||||
|
//获取图片的原始长宽
|
||||||
|
var windowWidth = 0, windowHeight = 0;
|
||||||
|
var autoWidth = 0, autoHeight = 0;
|
||||||
|
var results = {};
|
||||||
|
var padding = that.data[bindName].view.imagePadding;
|
||||||
|
windowWidth = realWindowWidth-2*padding;
|
||||||
|
windowHeight = realWindowHeight;
|
||||||
|
//判断按照那种方式进行缩放
|
||||||
|
// console.log("windowWidth" + windowWidth);
|
||||||
|
if (originalWidth > windowWidth) {//在图片width大于手机屏幕width时候
|
||||||
|
autoWidth = windowWidth;
|
||||||
|
// console.log("autoWidth" + autoWidth);
|
||||||
|
autoHeight = (autoWidth * originalHeight) / originalWidth;
|
||||||
|
// console.log("autoHeight" + autoHeight);
|
||||||
|
results.imageWidth = autoWidth;
|
||||||
|
results.imageheight = autoHeight;
|
||||||
|
} else {//否则展示原来的数据
|
||||||
|
results.imageWidth = originalWidth;
|
||||||
|
results.imageheight = originalHeight;
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
function wxParseTemArray(temArrayName,bindNameReg,total,that){
|
||||||
|
var array = [];
|
||||||
|
var temData = that.data;
|
||||||
|
var obj = null;
|
||||||
|
for(var i = 0; i < total; i++){
|
||||||
|
var simArr = temData[bindNameReg+i].nodes;
|
||||||
|
array.push(simArr);
|
||||||
|
}
|
||||||
|
|
||||||
|
temArrayName = temArrayName || 'wxParseTemArray';
|
||||||
|
obj = JSON.parse('{"'+ temArrayName +'":""}');
|
||||||
|
obj[temArrayName] = array;
|
||||||
|
that.setData(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置emojis
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
function emojisInit(reg='',baseSrc="/wxParse/emojis/",emojis){
|
||||||
|
HtmlToJson.emojisInit(reg,baseSrc,emojis);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
wxParse: wxParse,
|
||||||
|
wxParseTemArray:wxParseTemArray,
|
||||||
|
emojisInit:emojisInit
|
||||||
|
}
|
||||||
|
|
||||||
967
wxParse/wxParse.wxml
Normal file
967
wxParse/wxParse.wxml
Normal file
@@ -0,0 +1,967 @@
|
|||||||
|
<!--**
|
||||||
|
* author: Di (微信小程序开发工程师)
|
||||||
|
* organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
|
||||||
|
* 垂直微信小程序开发交流社区
|
||||||
|
*
|
||||||
|
* github地址: https://github.com/icindy/wxParse
|
||||||
|
*
|
||||||
|
* for: 微信小程序富文本解析
|
||||||
|
* detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
|
||||||
|
*/-->
|
||||||
|
|
||||||
|
<!--基础元素-->
|
||||||
|
<template name="wxParseVideo">
|
||||||
|
<!--增加video标签支持,并循环添加-->
|
||||||
|
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
|
||||||
|
<video class="{{item.classStr}} wxParse-{{item.tag}}-video" src="{{item.attr.src}}"></video>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template name="wxParseImg">
|
||||||
|
<image class="{{item.classStr}} wxParse-{{item.tag}}" data-from="{{item.from}}" data-src="{{item.attr.src}}" data-idx="{{item.imgIndex}}" src="{{item.attr.src}}" mode="aspectFit" bindload="wxParseImgLoad" bindtap="wxParseImgTap" mode="widthFix" style="width:{{item.width}}px;"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template name="WxEmojiView">
|
||||||
|
<view class="WxEmojiView wxParse-inline" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.textArray}}" wx:key="">
|
||||||
|
<block class="{{item.text == '\\n' ? 'wxParse-hide':''}}" wx:if="{{item.node == 'text'}}">{{item.text}}</block>
|
||||||
|
<block wx:elif="{{item.node == 'element'}}">
|
||||||
|
<image class="wxEmoji" src="{{item.baseSrc}}{{item.text}}" />
|
||||||
|
</block>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template name="WxParseBr">
|
||||||
|
<text>\n</text>
|
||||||
|
</template>
|
||||||
|
<!--入口模版-->
|
||||||
|
|
||||||
|
<template name="wxParse">
|
||||||
|
<block wx:for="{{wxParseData}}" wx:key="">
|
||||||
|
<template is="wxParse0" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<!--循环模版-->
|
||||||
|
<template name="wxParse0">
|
||||||
|
<!--<template is="wxParse1" data="{{item}}" />-->
|
||||||
|
<!--判断是否是标签节点-->
|
||||||
|
<block wx:if="{{item.node == 'element'}}">
|
||||||
|
<block wx:if="{{item.tag == 'button'}}">
|
||||||
|
<button type="default" size="mini">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse1" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</button>
|
||||||
|
</block>
|
||||||
|
<!--li类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'li'}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-li" style="{{item.styleStr}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-inner">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-text">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-circle"></view>
|
||||||
|
</view>
|
||||||
|
<view class="{{item.classStr}} wxParse-li-text">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse1" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--video类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'video'}}">
|
||||||
|
<template is="wxParseVideo" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--img类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'img'}}">
|
||||||
|
<template is="wxParseImg" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--a类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'a'}}">
|
||||||
|
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse1" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
<block wx:elif="{{item.tag == 'table'}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse1" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<block wx:elif="{{item.tag == 'br'}}">
|
||||||
|
<template is="WxParseBr"></template>
|
||||||
|
</block>
|
||||||
|
<!--其他块级标签-->
|
||||||
|
<block wx:elif="{{item.tagType == 'block'}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse1" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--内联标签-->
|
||||||
|
<view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse1" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--判断是否是文本节点-->
|
||||||
|
<block wx:elif="{{item.node == 'text'}}">
|
||||||
|
<!--如果是,直接进行-->
|
||||||
|
<template is="WxEmojiView" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!--循环模版-->
|
||||||
|
<template name="wxParse1">
|
||||||
|
<!--<template is="wxParse2" data="{{item}}" />-->
|
||||||
|
<!--判断是否是标签节点-->
|
||||||
|
<block wx:if="{{item.node == 'element'}}">
|
||||||
|
<block wx:if="{{item.tag == 'button'}}">
|
||||||
|
<button type="default" size="mini">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse2" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</button>
|
||||||
|
</block>
|
||||||
|
<!--li类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'li'}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-li" style="{{item.styleStr}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-inner">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-text">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-circle"></view>
|
||||||
|
</view>
|
||||||
|
<view class="{{item.classStr}} wxParse-li-text">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse2" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--video类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'video'}}">
|
||||||
|
<template is="wxParseVideo" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--img类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'img'}}">
|
||||||
|
<template is="wxParseImg" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--a类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'a'}}">
|
||||||
|
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse2" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<block wx:elif="{{item.tag == 'br'}}">
|
||||||
|
<template is="WxParseBr"></template>
|
||||||
|
</block>
|
||||||
|
<!--其他块级标签-->
|
||||||
|
<block wx:elif="{{item.tagType == 'block'}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse2" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--内联标签-->
|
||||||
|
<view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse2" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--判断是否是文本节点-->
|
||||||
|
<block wx:elif="{{item.node == 'text'}}">
|
||||||
|
<!--如果是,直接进行-->
|
||||||
|
<template is="WxEmojiView" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<!--循环模版-->
|
||||||
|
<template name="wxParse2">
|
||||||
|
<!--<template is="wxParse3" data="{{item}}" />-->
|
||||||
|
<!--判断是否是标签节点-->
|
||||||
|
<block wx:if="{{item.node == 'element'}}">
|
||||||
|
<block wx:if="{{item.tag == 'button'}}">
|
||||||
|
<button type="default" size="mini">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse3" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</button>
|
||||||
|
</block>
|
||||||
|
<!--li类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'li'}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-li" style="{{item.styleStr}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-inner">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-text">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-circle"></view>
|
||||||
|
</view>
|
||||||
|
<view class="{{item.classStr}} wxParse-li-text">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse3" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--video类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'video'}}">
|
||||||
|
<template is="wxParseVideo" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--img类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'img'}}">
|
||||||
|
<template is="wxParseImg" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--a类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'a'}}">
|
||||||
|
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse3" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<block wx:elif="{{item.tag == 'br'}}">
|
||||||
|
<template is="WxParseBr"></template>
|
||||||
|
</block>
|
||||||
|
<!--其他块级标签-->
|
||||||
|
<block wx:elif="{{item.tagType == 'block'}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse3" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--内联标签-->
|
||||||
|
<view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse3" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--判断是否是文本节点-->
|
||||||
|
<block wx:elif="{{item.node == 'text'}}">
|
||||||
|
<!--如果是,直接进行-->
|
||||||
|
<template is="WxEmojiView" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!--循环模版-->
|
||||||
|
<template name="wxParse3">
|
||||||
|
<!--<template is="wxParse4" data="{{item}}" />-->
|
||||||
|
<!--判断是否是标签节点-->
|
||||||
|
<block wx:if="{{item.node == 'element'}}">
|
||||||
|
<block wx:if="{{item.tag == 'button'}}">
|
||||||
|
<button type="default" size="mini">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse4" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</button>
|
||||||
|
</block>
|
||||||
|
<!--li类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'li'}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-li" style="{{item.styleStr}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-inner">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-text">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-circle"></view>
|
||||||
|
</view>
|
||||||
|
<view class="{{item.classStr}} wxParse-li-text">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse4" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--video类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'video'}}">
|
||||||
|
<template is="wxParseVideo" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--img类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'img'}}">
|
||||||
|
<template is="wxParseImg" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--a类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'a'}}">
|
||||||
|
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse4" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<block wx:elif="{{item.tag == 'br'}}">
|
||||||
|
<template is="WxParseBr"></template>
|
||||||
|
</block>
|
||||||
|
<!--其他块级标签-->
|
||||||
|
<block wx:elif="{{item.tagType == 'block'}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse4" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--内联标签-->
|
||||||
|
<view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse4" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--判断是否是文本节点-->
|
||||||
|
<block wx:elif="{{item.node == 'text'}}">
|
||||||
|
<!--如果是,直接进行-->
|
||||||
|
<template is="WxEmojiView" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!--循环模版-->
|
||||||
|
<template name="wxParse4">
|
||||||
|
<!--<template is="wxParse5" data="{{item}}" />-->
|
||||||
|
<!--判断是否是标签节点-->
|
||||||
|
<block wx:if="{{item.node == 'element'}}">
|
||||||
|
<block wx:if="{{item.tag == 'button'}}">
|
||||||
|
<button type="default" size="mini">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse5" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</button>
|
||||||
|
</block>
|
||||||
|
<!--li类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'li'}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-li" style="{{item.styleStr}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-inner">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-text">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-circle"></view>
|
||||||
|
</view>
|
||||||
|
<view class="{{item.classStr}} wxParse-li-text">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse5" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--video类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'video'}}">
|
||||||
|
<template is="wxParseVideo" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--img类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'img'}}">
|
||||||
|
<template is="wxParseImg" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--a类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'a'}}">
|
||||||
|
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse5" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<block wx:elif="{{item.tag == 'br'}}">
|
||||||
|
<template is="WxParseBr"></template>
|
||||||
|
</block>
|
||||||
|
<!--其他块级标签-->
|
||||||
|
<block wx:elif="{{item.tagType == 'block'}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse5" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--内联标签-->
|
||||||
|
<view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse5" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--判断是否是文本节点-->
|
||||||
|
<block wx:elif="{{item.node == 'text'}}">
|
||||||
|
<!--如果是,直接进行-->
|
||||||
|
<template is="WxEmojiView" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!--循环模版-->
|
||||||
|
<template name="wxParse5">
|
||||||
|
<!--<template is="wxParse6" data="{{item}}" />-->
|
||||||
|
<!--判断是否是标签节点-->
|
||||||
|
<block wx:if="{{item.node == 'element'}}">
|
||||||
|
<block wx:if="{{item.tag == 'button'}}">
|
||||||
|
<button type="default" size="mini">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse6" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</button>
|
||||||
|
</block>
|
||||||
|
<!--li类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'li'}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-li" style="{{item.styleStr}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-inner">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-text">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-circle"></view>
|
||||||
|
</view>
|
||||||
|
<view class="{{item.classStr}} wxParse-li-text">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse6" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--video类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'video'}}">
|
||||||
|
<template is="wxParseVideo" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--img类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'img'}}">
|
||||||
|
<template is="wxParseImg" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--a类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'a'}}">
|
||||||
|
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse6" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<block wx:elif="{{item.tag == 'br'}}">
|
||||||
|
<template is="WxParseBr"></template>
|
||||||
|
</block>
|
||||||
|
<!--其他块级标签-->
|
||||||
|
<block wx:elif="{{item.tagType == 'block'}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse6" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--内联标签-->
|
||||||
|
<view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse6" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--判断是否是文本节点-->
|
||||||
|
<block wx:elif="{{item.node == 'text'}}">
|
||||||
|
<!--如果是,直接进行-->
|
||||||
|
<template is="WxEmojiView" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!--循环模版-->
|
||||||
|
<template name="wxParse6">
|
||||||
|
<!--<template is="wxParse7" data="{{item}}" />-->
|
||||||
|
<!--判断是否是标签节点-->
|
||||||
|
<block wx:if="{{item.node == 'element'}}">
|
||||||
|
<block wx:if="{{item.tag == 'button'}}">
|
||||||
|
<button type="default" size="mini">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse7" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</button>
|
||||||
|
</block>
|
||||||
|
<!--li类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'li'}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-li" style="{{item.styleStr}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-inner">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-text">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-circle"></view>
|
||||||
|
</view>
|
||||||
|
<view class="{{item.classStr}} wxParse-li-text">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse7" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--video类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'video'}}">
|
||||||
|
<template is="wxParseVideo" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--img类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'img'}}">
|
||||||
|
<template is="wxParseImg" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--a类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'a'}}">
|
||||||
|
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse7" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<block wx:elif="{{item.tag == 'br'}}">
|
||||||
|
<template is="WxParseBr"></template>
|
||||||
|
</block>
|
||||||
|
<!--其他块级标签-->
|
||||||
|
<block wx:elif="{{item.tagType == 'block'}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse7" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--内联标签-->
|
||||||
|
<view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse7" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--判断是否是文本节点-->
|
||||||
|
<block wx:elif="{{item.node == 'text'}}">
|
||||||
|
<!--如果是,直接进行-->
|
||||||
|
<template is="WxEmojiView" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
<!--循环模版-->
|
||||||
|
<template name="wxParse7">
|
||||||
|
<!--<template is="wxParse8" data="{{item}}" />-->
|
||||||
|
<!--判断是否是标签节点-->
|
||||||
|
<block wx:if="{{item.node == 'element'}}">
|
||||||
|
<block wx:if="{{item.tag == 'button'}}">
|
||||||
|
<button type="default" size="mini">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse8" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</button>
|
||||||
|
</block>
|
||||||
|
<!--li类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'li'}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-li" style="{{item.styleStr}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-inner">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-text">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-circle"></view>
|
||||||
|
</view>
|
||||||
|
<view class="{{item.classStr}} wxParse-li-text">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse8" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--video类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'video'}}">
|
||||||
|
<template is="wxParseVideo" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--img类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'img'}}">
|
||||||
|
<template is="wxParseImg" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--a类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'a'}}">
|
||||||
|
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse8" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<block wx:elif="{{item.tag == 'br'}}">
|
||||||
|
<template is="WxParseBr"></template>
|
||||||
|
</block>
|
||||||
|
<!--其他块级标签-->
|
||||||
|
<block wx:elif="{{item.tagType == 'block'}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse8" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--内联标签-->
|
||||||
|
<view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse8" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--判断是否是文本节点-->
|
||||||
|
<block wx:elif="{{item.node == 'text'}}">
|
||||||
|
<!--如果是,直接进行-->
|
||||||
|
<template is="WxEmojiView" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!--循环模版-->
|
||||||
|
<template name="wxParse8">
|
||||||
|
<!--<template is="wxParse9" data="{{item}}" />-->
|
||||||
|
<!--判断是否是标签节点-->
|
||||||
|
<block wx:if="{{item.node == 'element'}}">
|
||||||
|
<block wx:if="{{item.tag == 'button'}}">
|
||||||
|
<button type="default" size="mini">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse9" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</button>
|
||||||
|
</block>
|
||||||
|
<!--li类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'li'}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-li" style="{{item.styleStr}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-inner">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-text">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-circle"></view>
|
||||||
|
</view>
|
||||||
|
<view class="{{item.classStr}} wxParse-li-text">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse9" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--video类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'video'}}">
|
||||||
|
<template is="wxParseVideo" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--img类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'img'}}">
|
||||||
|
<template is="wxParseImg" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--a类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'a'}}">
|
||||||
|
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse9" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<block wx:elif="{{item.tag == 'br'}}">
|
||||||
|
<template is="WxParseBr"></template>
|
||||||
|
</block>
|
||||||
|
<!--其他块级标签-->
|
||||||
|
<block wx:elif="{{item.tagType == 'block'}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse9" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--内联标签-->
|
||||||
|
<view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse9" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--判断是否是文本节点-->
|
||||||
|
<block wx:elif="{{item.node == 'text'}}">
|
||||||
|
<!--如果是,直接进行-->
|
||||||
|
<template is="WxEmojiView" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!--循环模版-->
|
||||||
|
<template name="wxParse9">
|
||||||
|
<!--<template is="wxParse10" data="{{item}}" />-->
|
||||||
|
<!--判断是否是标签节点-->
|
||||||
|
<block wx:if="{{item.node == 'element'}}">
|
||||||
|
<block wx:if="{{item.tag == 'button'}}">
|
||||||
|
<button type="default" size="mini">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse10" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</button>
|
||||||
|
</block>
|
||||||
|
<!--li类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'li'}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-li" style="{{item.styleStr}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-inner">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-text">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-circle"></view>
|
||||||
|
</view>
|
||||||
|
<view class="{{item.classStr}} wxParse-li-text">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse10" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--video类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'video'}}">
|
||||||
|
<template is="wxParseVideo" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--img类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'img'}}">
|
||||||
|
<template is="wxParseImg" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--a类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'a'}}">
|
||||||
|
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse10" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<block wx:elif="{{item.tag == 'br'}}">
|
||||||
|
<template is="WxParseBr"></template>
|
||||||
|
</block>
|
||||||
|
<!--其他块级标签-->
|
||||||
|
<block wx:elif="{{item.tagType == 'block'}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse10" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--内联标签-->
|
||||||
|
<view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse10" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--判断是否是文本节点-->
|
||||||
|
<block wx:elif="{{item.node == 'text'}}">
|
||||||
|
<!--如果是,直接进行-->
|
||||||
|
<template is="WxEmojiView" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!--循环模版-->
|
||||||
|
<template name="wxParse10">
|
||||||
|
<!--<template is="wxParse11" data="{{item}}" />-->
|
||||||
|
<!--判断是否是标签节点-->
|
||||||
|
<block wx:if="{{item.node == 'element'}}">
|
||||||
|
<block wx:if="{{item.tag == 'button'}}">
|
||||||
|
<button type="default" size="mini">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse11" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</button>
|
||||||
|
</block>
|
||||||
|
<!--li类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'li'}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-li" style="{{item.styleStr}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-inner">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-text">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-circle"></view>
|
||||||
|
</view>
|
||||||
|
<view class="{{item.classStr}} wxParse-li-text">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse11" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--video类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'video'}}">
|
||||||
|
<template is="wxParseVideo" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--img类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'img'}}">
|
||||||
|
<template is="wxParseImg" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--a类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'a'}}">
|
||||||
|
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse11" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<block wx:elif="{{item.tag == 'br'}}">
|
||||||
|
<template is="WxParseBr"></template>
|
||||||
|
</block>
|
||||||
|
<!--其他块级标签-->
|
||||||
|
<block wx:elif="{{item.tagType == 'block'}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse11" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--内联标签-->
|
||||||
|
<view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse11" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--判断是否是文本节点-->
|
||||||
|
<block wx:elif="{{item.node == 'text'}}">
|
||||||
|
<!--如果是,直接进行-->
|
||||||
|
<template is="WxEmojiView" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!--循环模版-->
|
||||||
|
<template name="wxParse11">
|
||||||
|
<!--<template is="wxParse12" data="{{item}}" />-->
|
||||||
|
<!--判断是否是标签节点-->
|
||||||
|
<block wx:if="{{item.node == 'element'}}">
|
||||||
|
<block wx:if="{{item.tag == 'button'}}">
|
||||||
|
<button type="default" size="mini">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse12" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</button>
|
||||||
|
</block>
|
||||||
|
<!--li类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'li'}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-li" style="{{item.styleStr}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-inner">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-text">
|
||||||
|
<view class="{{item.classStr}} wxParse-li-circle"></view>
|
||||||
|
</view>
|
||||||
|
<view class="{{item.classStr}} wxParse-li-text">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse12" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--video类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'video'}}">
|
||||||
|
<template is="wxParseVideo" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--img类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'img'}}">
|
||||||
|
<template is="wxParseImg" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--a类型-->
|
||||||
|
<block wx:elif="{{item.tag == 'a'}}">
|
||||||
|
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse12" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<block wx:elif="{{item.tag == 'br'}}">
|
||||||
|
<template is="WxParseBr"></template>
|
||||||
|
</block>
|
||||||
|
<!--其他块级标签-->
|
||||||
|
<block wx:elif="{{item.tagType == 'block'}}">
|
||||||
|
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse12" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--内联标签-->
|
||||||
|
<view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
|
||||||
|
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
|
||||||
|
<template is="wxParse12" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<!--判断是否是文本节点-->
|
||||||
|
<block wx:elif="{{item.node == 'text'}}">
|
||||||
|
<!--如果是,直接进行-->
|
||||||
|
<template is="WxEmojiView" data="{{item}}" />
|
||||||
|
</block>
|
||||||
|
|
||||||
|
</template>
|
||||||
206
wxParse/wxParse.wxss
Normal file
206
wxParse/wxParse.wxss
Normal file
@@ -0,0 +1,206 @@
|
|||||||
|
|
||||||
|
/**
|
||||||
|
* author: Di (微信小程序开发工程师)
|
||||||
|
* organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
|
||||||
|
* 垂直微信小程序开发交流社区
|
||||||
|
*
|
||||||
|
* github地址: https://github.com/icindy/wxParse
|
||||||
|
*
|
||||||
|
* for: 微信小程序富文本解析
|
||||||
|
* detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
|
||||||
|
*/
|
||||||
|
|
||||||
|
.wxParse{
|
||||||
|
margin: 0 5px;
|
||||||
|
font-family: Helvetica,sans-serif;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #666;
|
||||||
|
line-height: 1.8;
|
||||||
|
}
|
||||||
|
view{
|
||||||
|
word-break:break-all; overflow:auto;
|
||||||
|
}
|
||||||
|
.wxParse-inline{
|
||||||
|
display: inline;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
/*//标题 */
|
||||||
|
.wxParse-div{margin: 0;padding: 0;}
|
||||||
|
.wxParse-h1{ font-size:2em; margin: .67em 0 }
|
||||||
|
.wxParse-h2{ font-size:1.5em; margin: .75em 0 }
|
||||||
|
.wxParse-h3{ font-size:1.17em; margin: .83em 0 }
|
||||||
|
.wxParse-h4{ margin: 1.12em 0}
|
||||||
|
.wxParse-h5 { font-size:.83em; margin: 1.5em 0 }
|
||||||
|
.wxParse-h6{ font-size:.75em; margin: 1.67em 0 }
|
||||||
|
|
||||||
|
.wxParse-h1 {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 400;
|
||||||
|
margin-bottom: .9em;
|
||||||
|
}
|
||||||
|
.wxParse-h2 {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 400;
|
||||||
|
margin-bottom: .34em;
|
||||||
|
}
|
||||||
|
.wxParse-h3 {
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 15px;
|
||||||
|
margin-bottom: .34em;
|
||||||
|
}
|
||||||
|
.wxParse-h4 {
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 14px;
|
||||||
|
margin-bottom: .24em;
|
||||||
|
}
|
||||||
|
.wxParse-h5 {
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 13px;
|
||||||
|
margin-bottom: .14em;
|
||||||
|
}
|
||||||
|
.wxParse-h6 {
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 12px;
|
||||||
|
margin-bottom: .04em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wxParse-h1, .wxParse-h2, .wxParse-h3, .wxParse-h4, .wxParse-h5, .wxParse-h6, .wxParse-b, .wxParse-strong { font-weight: bolder }
|
||||||
|
|
||||||
|
.wxParse-i,.wxParse-cite,.wxParse-em,.wxParse-var,.wxParse-address{font-style:italic}
|
||||||
|
.wxParse-pre,.wxParse-tt,.wxParse-code,.wxParse-kbd,.wxParse-samp{font-family:monospace}
|
||||||
|
.wxParse-pre{white-space:pre}
|
||||||
|
.wxParse-big{font-size:1.17em}
|
||||||
|
.wxParse-small,.wxParse-sub,.wxParse-sup{font-size:.83em}
|
||||||
|
.wxParse-sub{vertical-align:sub}
|
||||||
|
.wxParse-sup{vertical-align:super}
|
||||||
|
.wxParse-s,.wxParse-strike,.wxParse-del{text-decoration:line-through}
|
||||||
|
/*wxparse-自定义个性化的css样式*/
|
||||||
|
/*增加video的css样式*/
|
||||||
|
.wxParse-strong,.wxParse-s{display: inline}
|
||||||
|
.wxParse-a{
|
||||||
|
color: deepskyblue;
|
||||||
|
word-break:break-all;
|
||||||
|
overflow:auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wxParse-video{
|
||||||
|
text-align: center;
|
||||||
|
margin: 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wxParse-video-video{
|
||||||
|
width:100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wxParse-img{
|
||||||
|
/*background-color: #efefef;*/
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wxParse-blockquote {
|
||||||
|
margin: 0;
|
||||||
|
padding:10px 0 10px 5px;
|
||||||
|
font-family:Courier, Calibri,"宋体";
|
||||||
|
background:#f5f5f5;
|
||||||
|
border-left: 3px solid #dbdbdb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wxParse-code,.wxParse-wxxxcode-style{
|
||||||
|
display: inline;
|
||||||
|
background:#f5f5f5;
|
||||||
|
}
|
||||||
|
.wxParse-ul{
|
||||||
|
margin: 20rpx 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wxParse-li,.wxParse-li-inner{
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
margin: 10rpx 0;
|
||||||
|
}
|
||||||
|
.wxParse-li-text{
|
||||||
|
|
||||||
|
align-items: center;
|
||||||
|
line-height: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wxParse-li-circle{
|
||||||
|
display: inline-flex;
|
||||||
|
width: 5px;
|
||||||
|
height: 5px;
|
||||||
|
background-color: #333;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wxParse-li-square{
|
||||||
|
display: inline-flex;
|
||||||
|
width: 10rpx;
|
||||||
|
height: 10rpx;
|
||||||
|
background-color: #333;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
.wxParse-li-ring{
|
||||||
|
display: inline-flex;
|
||||||
|
width: 10rpx;
|
||||||
|
height: 10rpx;
|
||||||
|
border: 2rpx solid #333;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: #fff;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*.wxParse-table{
|
||||||
|
width: 100%;
|
||||||
|
height: 400px;
|
||||||
|
}
|
||||||
|
.wxParse-thead,.wxParse-tfoot,.wxParse-tr{
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
.wxParse-th,.wxParse-td{
|
||||||
|
display: flex;
|
||||||
|
width: 580px;
|
||||||
|
overflow: auto;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
.wxParse-u {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
.wxParse-hide{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.WxEmojiView{
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.wxEmoji{
|
||||||
|
width: 16px;
|
||||||
|
height:16px;
|
||||||
|
}
|
||||||
|
.wxParse-tr{
|
||||||
|
display: flex;
|
||||||
|
border-right:1px solid #e0e0e0;
|
||||||
|
border-bottom:1px solid #e0e0e0;
|
||||||
|
border-top:1px solid #e0e0e0;
|
||||||
|
}
|
||||||
|
.wxParse-th,
|
||||||
|
.wxParse-td{
|
||||||
|
flex:1;
|
||||||
|
padding:5px;
|
||||||
|
font-size:28rpx;
|
||||||
|
border-left:1px solid #e0e0e0;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
.wxParse-td:last{
|
||||||
|
border-top:1px solid #e0e0e0;
|
||||||
|
}
|
||||||
|
.wxParse-th{
|
||||||
|
background:#f0f0f0;
|
||||||
|
border-top:1px solid #e0e0e0;
|
||||||
|
}
|
||||||
|
.wxParse-del{
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
.wxParse-figure {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user