@@ -0,0 +1,64 @@ | |||
const Http = require("./utils/HttpBasics.js") | |||
const config = require("./config/config.js"); | |||
App({ | |||
data:{ | |||
}, | |||
globalData:{ | |||
token: null, | |||
imgHttps: 'https://formall.oss-accelerate.aliyuncs.com/douyin/drawable-xhdpi/', | |||
platform:null,//手机型号 | |||
}, | |||
onLaunch: function () { | |||
let that = this | |||
this.logn(); | |||
try { | |||
var res = tt.getSystemInfoSync(); | |||
that.statusBarHeight = res.statusBarHeight | |||
console.log(`手机型号为 ${res.platform}`); | |||
this.globalData.platform = res.platform | |||
} catch (error) { | |||
console.log(`获取系统信息失败`); | |||
} | |||
}, | |||
statusBarHeight: 0, | |||
logn(){ | |||
tt.login({ | |||
success:(res=>{ | |||
let {code} = res | |||
Http.post({ | |||
url:config.api.login, | |||
data:{ | |||
code:code, | |||
appId:'tt9da4eb19029c2bb301' | |||
} | |||
}).then(res=>{ | |||
Http.setToken(res.data.token); | |||
this.globalData.token = res.data.token | |||
if (this.tokenCallback) { | |||
this.tokenCallback(res.data.token); | |||
} | |||
}).catch(err=>{ | |||
console.log(err); | |||
tt.showModal({ | |||
title: '提示', | |||
showCancel: false, | |||
content: '登录失败,请重新尝试', | |||
success: (res) => { | |||
if (res.cancel) { | |||
//点击取消,默认隐藏弹框 | |||
} else { | |||
//点击确定 | |||
wx.reLaunch({ | |||
url: '/pages/index/index', | |||
}) | |||
} | |||
} | |||
}); | |||
}) | |||
}), | |||
}); | |||
} | |||
}) |
@@ -0,0 +1,56 @@ | |||
{ | |||
"pages":[ | |||
"pages/index/index", | |||
"pages/category/category", | |||
"pages/ranking/ranking", | |||
"pages/search/search", | |||
"pages/user/user", | |||
"pages/course/course", | |||
"pages/sponsor/sponsor", | |||
"pages/order/order", | |||
"pages/classDetails/classDetails", | |||
"pages/mianAttention/mianAttention", | |||
"pages/mianCollect/mianCollect", | |||
"pages/UpHome/UpHome", | |||
"pages/publicity/publicity", | |||
"pages/upEnter/upEnter" | |||
], | |||
"usingComponents": {}, | |||
"window":{ | |||
"backgroundTextStyle":"light", | |||
"navigationBarBackgroundColor": "#000033", | |||
"navigationBarTitleText": "知播堂", | |||
"navigationBarTextStyle":"#fff", | |||
"navigationStyle":"custom" | |||
}, | |||
"tabBar": { | |||
"custom": true, | |||
"color": "#90A3AC", | |||
"selectedColor": "#07E881", | |||
"backgroundColor": "#171C2A", | |||
"borderStyle": "black", | |||
"list": [ | |||
{ | |||
"pagePath": "pages/index/index", | |||
"text": "首页", | |||
"iconPath": "assets/images/home_btn_ic_sy.png", | |||
"selectedIconPath": "assets/images/home_btn_ic_sy1.png" | |||
}, | |||
{ | |||
"pagePath": "pages/course/course", | |||
"text": "课程", | |||
"iconPath": "assets/images/home_btn_ic_kc.png", | |||
"selectedIconPath": "assets/images/home_btn_ic_kc1.png" | |||
}, | |||
{ | |||
"pagePath": "pages/user/user", | |||
"text": "我的", | |||
"iconPath": "assets/images/home_btn_ic_wd.png", | |||
"selectedIconPath": "assets/images/home_btn_ic_wd1.png" | |||
} | |||
] | |||
} | |||
} |
@@ -0,0 +1,16 @@ | |||
.Box{ | |||
width: 96%; | |||
margin: 0 2%; | |||
background-color: #0E1119; | |||
} | |||
#BoxBg{ | |||
background-color: #0E1119; | |||
overflow: hidden; | |||
font-size: 28rpx; | |||
min-height: 100vh; | |||
color: #535E75; | |||
} | |||
.oh{ | |||
overflow: hidden; | |||
} |
@@ -0,0 +1,62 @@ | |||
let app = getApp(); | |||
Component({ | |||
data: { | |||
home_a_img:[], | |||
selected: 0, | |||
"color": "#abb1be", | |||
"selectedColor": "#FD782D", | |||
"list": [{ | |||
"pagePath": "/pages/index/index", | |||
"iconPath": "assets/images/home_btn_ic_sy.png", | |||
"selectedIconPath": "assets/images/home_btn_ic_sy1.png", | |||
"text": "首页" | |||
}, | |||
{ | |||
"pagePath": "/pages/course/course", | |||
"iconPath": "assets/images/home_btn_ic_kc.png", | |||
"selectedIconPath": "assets/images/home_btn_ic_kc1.png", | |||
"text": "课程" | |||
}, | |||
{ | |||
"pagePath": "/pages/user/user", | |||
"iconPath": "assets/images/home_btn_ic_wd.png", | |||
"selectedIconPath": "assets/images/home_btn_ic_wd1.png", | |||
"text": "我的" | |||
}, | |||
] | |||
}, | |||
// lifetimes: { | |||
// attached: function () { | |||
// // 在组件实例进入页面节点树时执行 | |||
// }, | |||
// }, | |||
attached() { | |||
}, | |||
methods: { | |||
switchTab(e) { | |||
// this.setData({ | |||
// list: this.data.home_a_img | |||
// }) | |||
// console.log(this.data.home_a_img) | |||
const data = e.currentTarget.dataset; | |||
this.setData({ | |||
selected: data.index | |||
}) | |||
console.log(data.index) | |||
const url = data.path; | |||
if (data.index == 0 || data.index == 3) { | |||
this.getTemplateId() | |||
} | |||
tt.switchTab({ | |||
url | |||
}); | |||
}, | |||
} | |||
}) |
@@ -0,0 +1,3 @@ | |||
{ | |||
"component": true | |||
} |
@@ -0,0 +1,8 @@ | |||
<!--miniprogram/custom-tab-bar/index.wxml--> | |||
<view class="tab-bar" wx:if="{{list.length!=0}}"> | |||
<view class="tab-bar-border"></view> | |||
<view wx:for="{{list}}" wx:key="index" class="tab-bar-item" data-path="{{item.pagePath}}" data-index="{{index}}" bindtap="switchTab"> | |||
<image src="{{selected === index ? item.selectedIconPath : item.iconPath}}"></image> | |||
<view style="color: {{selected === index ? selectedColor : color}}">{{item.text}}</view> | |||
</view> | |||
</view> |
@@ -0,0 +1,40 @@ | |||
.tab-bar { | |||
position: fixed; | |||
bottom: 0; | |||
left: 0; | |||
right: 0; | |||
height: 70rpx; | |||
padding: 10rpx; | |||
background: white; | |||
display: flex; | |||
padding-bottom: env(safe-area-inset-bottom); | |||
overflow: hidden; | |||
} | |||
.tab-bar-border { | |||
background-color: rgba(0, 0, 0, 0.33); | |||
position: absolute; | |||
left: 0; | |||
top: 0; | |||
width: 100%; | |||
height: 1px; | |||
transform: scaleY(0.5); | |||
} | |||
.tab-bar-item { | |||
flex: 1; | |||
text-align: center; | |||
display: flex; | |||
justify-content: center; | |||
align-items: center; | |||
flex-direction: column; | |||
} | |||
.tab-bar-item image { | |||
width: 46rpx; | |||
height: 46rpx; | |||
} | |||
.tab-bar-item view { | |||
font-size: 20rpx; | |||
} |
@@ -0,0 +1 @@ | |||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="128px" height="128.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#202020" d="M962.986667 480.426667l-422.4-379.733334a42.666667 42.666667 0 0 0-57.173334 0l-422.4 379.733334a42.666667 42.666667 0 0 0 57.173334 63.146666l9.813333-8.533333V896a42.666667 42.666667 0 0 0 42.666667 42.666667h682.666666a42.666667 42.666667 0 0 0 42.666667-42.666667v-360.96l9.813333 8.533333a42.666667 42.666667 0 0 0 28.586667 11.093334 42.666667 42.666667 0 0 0 31.573333-14.08 42.666667 42.666667 0 0 0-2.986666-60.16zM469.333333 853.333333v-170.666666h85.333334v170.666666z m341.333334-384v384h-170.666667v-213.333333a42.666667 42.666667 0 0 0-42.666667-42.666667h-170.666666a42.666667 42.666667 0 0 0-42.666667 42.666667v213.333333H213.333333v-384a61.013333 61.013333 0 0 0 0-9.386666l298.666667-270.08 298.666667 270.08a61.013333 61.013333 0 0 0 0 9.386666z" /></svg> |
@@ -0,0 +1,65 @@ | |||
const app = getApp() | |||
Component({ | |||
properties: { | |||
background: { | |||
type: String, | |||
value: '#F4F5F9' | |||
}, | |||
color: { | |||
type: String, | |||
value: '#000' | |||
}, | |||
text: { | |||
type: String, | |||
value: 'Wechat' | |||
}, | |||
showLocationIf: { | |||
type: Boolean, | |||
value: false | |||
}, | |||
back: { | |||
type: Boolean, | |||
value: false | |||
}, | |||
home: { | |||
type: Boolean, | |||
value: false | |||
} | |||
}, | |||
data: { | |||
array: ['A广场', 'B广场-北京西单'], | |||
index: 1, | |||
statusBarHeight: app.statusBarHeight + 'px', | |||
navigationBarHeight: (app.statusBarHeight + 44) + 'px', | |||
imgHttps: app.globalData.imgHttps, | |||
}, | |||
methods: { | |||
backHome: function () { | |||
wx.switchTab({ | |||
url: '/index/index', | |||
}) | |||
}, | |||
bindPickerChange: function (e) { | |||
console.log('picker发送选择改变,携带值为', e.detail.value) | |||
this.setData({ | |||
index: e.detail.value | |||
}) | |||
}, | |||
back: function () { | |||
wx.navigateBack({ | |||
delta: 1 | |||
}) | |||
} | |||
}, | |||
attached: function(){ | |||
let pages = getCurrentPages(); | |||
if (pages.length <= 1) { | |||
this.setData({ | |||
back: false | |||
}) | |||
} | |||
} | |||
}) |
@@ -0,0 +1,3 @@ | |||
{ | |||
"component": true | |||
} |
@@ -0,0 +1,21 @@ | |||
<view class="navbar" style="background:{{background}}!important;"> | |||
<view style="{{'height: ' + statusBarHeight}}"></view> | |||
<view class='title-container'> | |||
<view class='capsule' tt:if="{{ back || home}}"> | |||
<view bindtap='back' tt:if="{{back}}"> | |||
<image style="left:36%;" src='./img/back.png'></image> | |||
</view> | |||
<view bindtap='backHome' tt:if="{{home}}"> | |||
<image src='img/home.svg' style="width:90%;"></image> | |||
</view> | |||
</view> | |||
<view class='title' style="color:{{color}}!important">{{text}}</view> | |||
<picker bindchange="bindPickerChange" tt:if="{{showLocationIf}}" class="pick-box" value="{{index}}" range="{{array}}"> | |||
<icon class='iconfont icon-daohangdizhiweizhi'></icon> | |||
<view class="picker locations"> | |||
{{array[index]}} | |||
</view> | |||
</picker> | |||
</view> | |||
</view> |
@@ -0,0 +1,91 @@ | |||
.navbar { | |||
width: 100vw; | |||
background-color: #F4F5F9; | |||
position: fixed; | |||
left: 0; | |||
top: 0; | |||
overflow: hidden; | |||
z-index: 400000000; | |||
} | |||
.title-container { | |||
height: 44px; | |||
display: flex; | |||
align-items: center; | |||
position: relative; | |||
} | |||
.capsule { | |||
margin-left: 10px; | |||
height: 32px; | |||
/* border: 1px solid #e1e1e3; */ | |||
border-radius: 60px; | |||
display: flex; | |||
align-items: center; | |||
padding: 0 20rpx; | |||
/* background: #fff!important; */ | |||
} | |||
.capsule > view { | |||
width: 35px; | |||
height: 60%; | |||
position: relative; | |||
} | |||
.capsule > view:nth-child(2) { | |||
border-left: 1px solid #777; | |||
} | |||
.capsule image { | |||
width: 70%; | |||
height: 100%; | |||
position: absolute; | |||
left: 50%; | |||
top: 50%; | |||
transform: translate(-50%,-50%); | |||
} | |||
.title { | |||
color: #000; | |||
position: absolute; | |||
left: 104px; | |||
right: 104px; | |||
font-weight: 600; | |||
font-size: 32rpx; | |||
text-align: center; | |||
overflow: hidden; | |||
text-overflow: ellipsis; | |||
white-space: nowrap; | |||
} | |||
@font-face { | |||
font-family: 'iconfont'; /* project id 1353695 */ | |||
src: url('//at.alicdn.com/t/font_1353695_nyv2ld9xqk8.eot'); | |||
src: url('//at.alicdn.com/t/font_1353695_nyv2ld9xqk8.eot?#iefix') format('embedded-opentype'), | |||
url('//at.alicdn.com/t/font_1353695_nyv2ld9xqk8.woff2') format('woff2'), | |||
url('//at.alicdn.com/t/font_1353695_nyv2ld9xqk8.woff') format('woff'), | |||
url('//at.alicdn.com/t/font_1353695_nyv2ld9xqk8.ttf') format('truetype'), | |||
url('//at.alicdn.com/t/font_1353695_nyv2ld9xqk8.svg#iconfont') format('svg'); | |||
} | |||
.iconfont { | |||
font-family: "iconfont" !important; | |||
font-size: 16px; | |||
font-style: normal; | |||
-webkit-font-smoothing: antialiased; | |||
-moz-osx-font-smoothing: grayscale; | |||
} | |||
.icon-daohangdizhiweizhi:before { | |||
content: "\e787"; | |||
} | |||
.locations{ | |||
font-size: 28rpx; | |||
display: inline-block; | |||
width: 200rpx; | |||
overflow: hidden; | |||
text-overflow:ellipsis; | |||
white-space: nowrap; | |||
} | |||
.pick-box{ | |||
width: 260rpx; | |||
padding-left: 20rpx; | |||
} |
@@ -0,0 +1,59 @@ | |||
const app = getApp() | |||
//Component Object | |||
Component({ | |||
properties: { | |||
titil:{//弹框标题 | |||
type:String, | |||
value:'提示', | |||
}, | |||
text:{//弹框内容 | |||
type:String, | |||
value:'告知当前状态,信息和解决方法 告知当前状态', | |||
}, | |||
assistant:{//副操作标题 | |||
type:String, | |||
value:'', | |||
}, | |||
advocate:{//主操作标题 | |||
type:String, | |||
value:'', | |||
}, | |||
wayAdvocate:{//主操作方法 | |||
type:Function, | |||
}, | |||
url:{//跳转的路径 | |||
type:String, | |||
}, | |||
hidText:{//关闭提示框文案 | |||
type:String, | |||
value:'确认', | |||
} | |||
}, | |||
data: { | |||
}, | |||
methods: { | |||
wayAssistant:function(){ | |||
this.triggerEvent('hie',{data:false}); | |||
}, | |||
go:function() { | |||
this.triggerEvent('go',{url:false}); | |||
} | |||
}, | |||
created: function() { | |||
}, | |||
attached: function() { | |||
}, | |||
ready: function() { | |||
console.log(this.properties.url,"666"); | |||
}, | |||
moved: function() { | |||
}, | |||
detached: function() { | |||
}, | |||
}); | |||
@@ -0,0 +1,3 @@ | |||
{ | |||
"component": true | |||
} |
@@ -0,0 +1,9 @@ | |||
<view class="prompt"> | |||
<view class="titil">{{titil}}</view> | |||
<view class="text">{{text}}</view> | |||
<view class="btnBox oh"> | |||
<view class="assistant" bindtap="wayAssistant" tt:if="{{assistant}}">{{assistant}}</view> | |||
<navigator tt:if="{{url}}" class="advocate" url="{{url}}" open-type="" hover-class="className">{{advocate}}</navigator> | |||
<view class="back" bindtap="wayAssistant">{{hidText}}</view> | |||
</view> | |||
</view> |
@@ -0,0 +1,66 @@ | |||
.prompt{ | |||
position: fixed; | |||
width: 80%; | |||
height: 300rpx; | |||
background-color: #222633; | |||
border-radius: 20rpx; | |||
left: 10%; | |||
top: 30%; | |||
z-index: 1000000; | |||
} | |||
.titil{ | |||
text-align: center; | |||
height: 80rpx; | |||
line-height: 80rpx; | |||
font-size: 36rpx; | |||
font-family: OPPOSans; | |||
font-weight: 500; | |||
color: #FFFFFF; | |||
margin-top: 20rpx; | |||
} | |||
.text{ | |||
width: 90%; | |||
height: 70rpx; | |||
overflow: hidden; | |||
margin: 0 auto; | |||
font-family: OPPOSans; | |||
font-weight: 500; | |||
color: #8790A8; | |||
line-height: 36rpx; | |||
text-align: center; | |||
font-size: 32rpx; | |||
margin-bottom: 30rpx; | |||
margin-top: 10rpx; | |||
} | |||
.btnBox{ | |||
border-top: 1rpx solid #3D4253; | |||
} | |||
.assistant{ | |||
width: 49%; | |||
float: left; | |||
height: 90rpx; | |||
text-align: center; | |||
line-height: 90rpx; | |||
color: #FFFFFF; | |||
font-size: 36rpx; | |||
border-right: 1rpx solid #3D4253; | |||
} | |||
.advocate{ | |||
width: 49%; | |||
float: left; | |||
height: 90rpx; | |||
text-align: center; | |||
line-height: 90rpx; | |||
color: #07E881; | |||
font-size: 36rpx; | |||
/* border-left: 1rpx solid #3D4253; */ | |||
} | |||
.back{ | |||
width: 100%; | |||
float: left; | |||
height: 90rpx; | |||
text-align: center; | |||
line-height: 90rpx; | |||
color: #FFFFFF; | |||
font-size: 36rpx; | |||
} |
@@ -0,0 +1,25 @@ | |||
let config = { | |||
api:{ | |||
login:"/user/login", | |||
getColumn:"/wxBusiness/listAll",//获取分类 | |||
columnLsit:"/ttCoupon/list",//分类列表 | |||
classDetails:"/ttCoupon/findById",//课程详情 | |||
getViodUrl:"/ttCoupon/videoDetial",//获取视频地址 | |||
iscollect:"/ttCoupon/iscollect",//是否收藏 | |||
Tcollect:"/ttCoupon/collectCoupon",//收藏 | |||
Fcollect:"/ttCoupon/cancelCollect",//取消收藏 | |||
order:"/order/save",//订单 | |||
pay:"/order/createPay",//获取支付orderInfo | |||
ifPayOk:"/order/updateOrderStatus",//判读是否支付成功 | |||
getOrderLsit:'/order/list',//获取订单列表 | |||
getAuthor:"/merchant/listV1",//查询作者 | |||
checkUserInfo:"/user/checkWechatStatus",//用户是否授权 | |||
userInfo:"/user/getUserInfo",//用户授权 | |||
mainCollet:"/ttCoupon/collectList",//我的收藏 | |||
getUpUser:"/merchant/findById",//up类容 | |||
getPublicity:"/wxCampaign/list",//轮播图 | |||
getPublicityDetail:"/wxCampaign/findById",//宣传页详情 | |||
apply:"/upSettlein/add",//提交入住申请 | |||
} | |||
} | |||
module.exports = config; |
@@ -0,0 +1,86 @@ | |||
const app = getApp() | |||
const config = require("../../config/config") | |||
const Http = require("../../utils/HttpBasics.js") | |||
const navigationBarHeight = (getApp().statusBarHeight + 44)+"px" | |||
Page({ | |||
data:{ | |||
imgHttps:app.globalData.imgHttps, | |||
navigationBarHeight, | |||
id:"",//upid | |||
name:'',//upName | |||
indexFlog:1,//选着类别 | |||
upData:{},//作者信息 | |||
pageNum:1, | |||
classList:[],//课程列表 | |||
dNum:"",//但课程数 | |||
zNum:"",//专栏数 | |||
}, | |||
getClass(){//课程list | |||
Http.get({ | |||
url:config.api.columnLsit, | |||
data:{ | |||
merchantId:this.data.id, | |||
type:this.data.indexFlog, | |||
pageNum:this.data.pageNum, | |||
pageSize: 6 | |||
} | |||
}).then(res=>{ | |||
if(this.data.pageNum>1){ | |||
let temp = this.data.classList | |||
temp.push(...res.data.list) | |||
this.setData({ | |||
classList:temp | |||
}) | |||
}else{ | |||
this.setData({ | |||
classList:res.data.list | |||
}) | |||
} | |||
}) | |||
}, | |||
setIndex(e){ | |||
let index = e.currentTarget.dataset.index | |||
console.log(index); | |||
this.setData({ | |||
indexFlog:index, | |||
pageNum:1, | |||
classList:[] | |||
}) | |||
this.getClass() | |||
}, | |||
getUpData(){ | |||
Http.get({ | |||
url:config.api.getUpUser, | |||
data:{ | |||
id:this.data.id | |||
} | |||
}).then(res=>{ | |||
console.log(res.data); | |||
this.setData({ | |||
upData:res.data | |||
}) | |||
}).catch(err=>{ | |||
tt.showToast({ | |||
title: err.message, // 内容 | |||
icon:"none" | |||
}); | |||
}) | |||
}, | |||
onLoad(options){ | |||
this.setData({ | |||
id:options.id, | |||
name:options.name | |||
}) | |||
this.getUpData() | |||
this.getClass() | |||
}, | |||
onReachBottom() { | |||
console.log("到底了"); | |||
this.setData({ | |||
pageNum:this.data.pageNum+1 | |||
}) | |||
this.getClass() | |||
} | |||
}) |
@@ -0,0 +1,6 @@ | |||
{ | |||
"usingComponents": { | |||
"navbar": "../../components/navbar/navbar" | |||
} | |||
} |
@@ -0,0 +1,37 @@ | |||
<view id="BoxBg"> | |||
<view class="Box"> | |||
<navbar back text="{{name}}" background="#0E1119" color="#fff"></navbar> | |||
<view style="height:{{navigationBarHeight}} "></view> | |||
<image class="backImg" src="{{imgHttps+'upzy_tab_bnt.png'}}" mode="" /> | |||
<image src="{{upData.imgUrl}}" mode="" class="headImg" /> | |||
<view class="nameBox oh"> | |||
<view class="userName">{{upData.name}}</view> | |||
</view> | |||
<view class="text">{{upData.introduction}}</view> | |||
<view class="classifyBox oh"> | |||
<view class="singleBox"> | |||
<view class="{{indexFlog==1?'singleText_a':'singleText'}}" bindtap="setIndex" data-index="{{1}}">专栏</view> | |||
<view class="singleXian" tt:if="{{indexFlog==1}}"></view> | |||
</view> | |||
<view class="multiBox"> | |||
<view class="{{indexFlog==2?'singleText_a':'singleText'}}" bindtap="setIndex" data-index="{{2}}">单课程</view> | |||
<view class="singleXian" tt:if="{{indexFlog==2}}"></view> | |||
</view> | |||
</view> | |||
<navigator class="classBox oh" tt:for="{{classList}}" url="/pages/classDetails/classDetails?id={{item.id}}&title={{item.title}}" open-type=""hover-class="className"> | |||
<image class="classImg" src="{{item.coverImg}}" mode="" /> | |||
<view class="textBox"> | |||
<view class="titile">{{item.title}}</view> | |||
<!-- <view class="cont">{{item.}}</view> --> | |||
<view class="moreBox oh"> | |||
<image class="user" src="{{item.merchantPic}}" mode="" /> | |||
<view class="userText">{{item.merchantName}}</view> | |||
</view> | |||
</view> | |||
</navigator> | |||
</view> | |||
</view> |
@@ -0,0 +1,146 @@ | |||
.Box{ | |||
min-height: 100vh; | |||
position: relative; | |||
} | |||
.backImg{ | |||
width: 100%; | |||
height: 400rpx; | |||
} | |||
.headImg{ | |||
position: absolute; | |||
border: 1rpx solid #07E881; | |||
width: 200rpx; | |||
height: 200rpx; | |||
border-radius: 50%; | |||
top: 480rpx; | |||
left: 50rpx; | |||
} | |||
.nameBox{ | |||
margin-top: 180rpx; | |||
} | |||
.userName{ | |||
height: 50rpx; | |||
font-size: 40rpx; | |||
font-family: PingFang SC; | |||
font-weight: 800; | |||
color: #FFFFFF; | |||
text-align:center; | |||
float: left; | |||
margin-left: 20px; | |||
} | |||
.text{ | |||
width: 90%; | |||
margin: 20rpx auto; | |||
height: 120rpx; | |||
overflow: hidden; | |||
font-size: 28rpx; | |||
font-family: PingFang SC; | |||
font-weight: 500; | |||
color: #666D80; | |||
line-height: 36rpx; | |||
} | |||
.classifyBox{ | |||
height: 120rpx; | |||
background: #121620; | |||
} | |||
.singleBox{ | |||
float: left; | |||
margin-left: 30rpx; | |||
} | |||
.multiBox{ | |||
float: left; | |||
text-align: center; | |||
} | |||
.singleXian{ | |||
width: 60rpx; | |||
height: 2rpx; | |||
background-color: #07E881; | |||
margin-left: 30rpx; | |||
} | |||
.singleText{ | |||
font-size: 30rpx; | |||
font-family: OPPOSans; | |||
font-weight: 500; | |||
color: #97A1BD; | |||
line-height: 35rpx; | |||
padding: 10px 0; | |||
margin-left: 20rpx; | |||
} | |||
.singleText_a{ | |||
font-size: 30rpx; | |||
font-family: OPPOSans; | |||
font-weight: bold; | |||
color: #FFFFFF; | |||
line-height: 35rpx; | |||
padding: 10px 0; | |||
margin-left: 20rpx; | |||
} | |||
.classBox{ | |||
margin: 20rpx; | |||
} | |||
.classImg{ | |||
float: left; | |||
width: 300rpx; | |||
height: 200rpx; | |||
border-radius: 12rpx; | |||
} | |||
.textBox{ | |||
float: left; | |||
margin-left: 10px; | |||
} | |||
.titile{ | |||
width: 350rpx; | |||
height: 40rpx; | |||
line-height: 40rpx; | |||
font-size: 36rpx; | |||
font-family: PingFang SC; | |||
font-weight: 500; | |||
color: #FEFEFE; | |||
margin-bottom: 19rpx; | |||
overflow:hidden; | |||
text-overflow:ellipsis; | |||
display:-webkit-box; | |||
-webkit-box-orient:vertical; | |||
-webkit-line-clamp:1 | |||
} | |||
.cont{ | |||
width: 360rpx; | |||
height: 30rpx; | |||
line-height: 30rpx; | |||
font-size: 26rpx; | |||
font-family: PingFang SC; | |||
font-weight: 400; | |||
color: #6E768A; | |||
font-weight: 560; | |||
overflow:hidden; | |||
text-overflow:ellipsis; | |||
display:-webkit-box; | |||
-webkit-box-orient:vertical; | |||
-webkit-line-clamp:1; | |||
} | |||
.moreBox{ | |||
margin-top: 30rpx; | |||
position: relative; | |||
} | |||
.user{ | |||
float: left; | |||
width: 60rpx; | |||
height: 60rpx; | |||
border-radius: 50%; | |||
background-color: beige; | |||
} | |||
.userText{ | |||
width: 200rpx; | |||
text-align: center; | |||
height: 60rpx; | |||
line-height: 60rpx; | |||
background: #222735; | |||
border-radius: 50rpx; | |||
font-family: PingFang SC; | |||
font-weight: 500; | |||
font-size: 26rpx; | |||
color: #8790A8; | |||
} |
@@ -0,0 +1,105 @@ | |||
const app = getApp() | |||
const navigationBarHeight = (getApp().statusBarHeight + 44)+"px" | |||
const navigationBarHeight2 = (getApp().statusBarHeight + 44) | |||
const config = require("../../config/config.js"); | |||
const Http = require("../../utils/HttpBasics") | |||
Page({ | |||
data: { | |||
navigationBarHeight, | |||
navigationBarHeight2, | |||
activityFlag: 0, | |||
column: [], | |||
id:"",//选中分类id | |||
pageNum:1, | |||
dataLsit:[],//数据列表 | |||
inputValue:'',//搜索框值 | |||
}, | |||
setActiviy(e){ | |||
let index = e.currentTarget.dataset.index | |||
let id = e.currentTarget.dataset.id | |||
this.setData({ | |||
activityFlag:index, | |||
id:id, | |||
pageNum:1, | |||
}) | |||
this.getLsit() | |||
}, | |||
setSearchValue(e){ | |||
let value = e.detail.value | |||
this.setData({ | |||
inputValue:value | |||
}) | |||
}, | |||
goDetails(e){ | |||
let id = e.currentTarget.dataset.id | |||
let title = e.currentTarget.dataset.title | |||
console.log(id); | |||
tt.navigateTo({ | |||
url: `/pages/classDetails/classDetails?id=${id}&title=${title}` // 指定页面的url | |||
}); | |||
}, | |||
getColumn(){ | |||
Http.get({ | |||
url:config.api.getColumn | |||
}).then(res=>{ | |||
let tempData = res.data | |||
tempData.unshift({ | |||
id:"", | |||
title:"推荐" | |||
}) | |||
this.setData({ | |||
column:tempData | |||
}) | |||
}).catch(err=>{ | |||
tt.showToast({ | |||
title: err.data, // 内容 | |||
}); | |||
}) | |||
}, | |||
getLsit(){ | |||
console.log(666); | |||
Http.get({ | |||
url:config.api.columnLsit, | |||
data:{ | |||
businessId:this.data.id, | |||
pageNum:this.data.pageNum, | |||
pageSize:10, | |||
title:this.data.inputValue | |||
} | |||
}).then(res=>{ | |||
console.log(res); | |||
let list = this.data.dataLsit | |||
if(this.data.pageNum>1){ | |||
list.push(...res.data.list) | |||
}else{ | |||
list = res.data.list | |||
} | |||
this.setData({ | |||
dataLsit:list | |||
}) | |||
}).catch(err=>{ | |||
tt.showToast({ | |||
title: err.data, // 内容 | |||
}); | |||
}) | |||
}, | |||
onLoad(options){ | |||
console.log(options); | |||
this.setData({ | |||
activityFlag:options.itemId, | |||
id:options.itemId | |||
}) | |||
this.getColumn() | |||
this.getLsit() | |||
}, | |||
onReachBottom: function() { | |||
this.setData({ | |||
pageNum:this.data.pageNum+1 | |||
}) | |||
console.log("我到底了"); | |||
this.getLsit() | |||
} | |||
}) |
@@ -0,0 +1,6 @@ | |||
{ | |||
"navigationBarTitleText": "分类", | |||
"usingComponents": { | |||
"navbar": "../../components/navbar/navbar" | |||
} | |||
} |
@@ -0,0 +1,67 @@ | |||
<view id="BoxBg"> | |||
<view class="Box"> | |||
<navbar back text="分类" background="#0E1119" color="#fff"></navbar> | |||
<view style="height:{{navigationBarHeight}} "></view> | |||
<view class="searchBox"> | |||
<view class="searchF"> | |||
<input type="text" class="searchText" placeholder-style="color: #666666;" placeholder="搜索" | |||
bindconfirm="getLsit" bindinput="setSearchValue" confirm-type="search" /> | |||
</view> | |||
</view> | |||
<view class="categoryBox oh"> | |||
<view class="columnBox" style="top:{{navigationBarHeight2+200}}rpx"> | |||
<view class=" {{activityFlag==index?'itemBox_a':'itemBox'}} oh" tt:for="{{column}}" bindtap="setActiviy" | |||
data-index="{{index}}" data-id="{{item.id}}"> | |||
<view class="{{activityFlag==index?'Text_a':'Text'}}"> | |||
{{item.title}} | |||
</view> | |||
</view> | |||
</view> | |||
<view class="courseBox"> | |||
<view class="courseItemBox oh" tt:for="{{dataLsit}}" bindtap="goDetails" data-id="{{item.id}}" data-title="{{item.title}}"> | |||
<image class="Img" src="{{item.coverImg}}" mode="" /> | |||
<view class="TextBox"> | |||
<view class="Name"> | |||
{{item.title}} | |||
</view> | |||
<view class="chargeBox oh"> | |||
<view class="tiem"> | |||
{{item.countClass?item.countClass+'课时':'单课程'}} | |||
</view> | |||
<view class="money" tt:if="{{item.salePriceStr!=0}}"> | |||
{{item.salePriceStr}} | |||
</view> | |||
<view class="py" tt:if="{{item.salePriceStr!=0}}"> | |||
¥ | |||
</view> | |||
<view class="money" tt:if="{{item.salePriceStr==0}}"> | |||
{{"免费"}} | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
</view> |
@@ -0,0 +1,111 @@ | |||
.BoxBg{ | |||
min-height: 1400rpx; | |||
} | |||
.searchBox{ | |||
height: 80rpx; | |||
} | |||
.searchF{ | |||
/* width: 80%; */ | |||
height: 80rpx; | |||
background-color: rgba(51, 51, 51, 0.5); | |||
border-radius: 60rpx; | |||
margin: 20rpx; | |||
} | |||
.searchText{ | |||
width: 80%; | |||
margin: 0 auto; | |||
height: 100%; | |||
color: #ffffff; | |||
} | |||
.categoryBox{ | |||
overflow: scroll; | |||
margin-top: 40rpx; | |||
} | |||
.columnBox{ | |||
width: 18%; | |||
/* float: left; */ | |||
position: fixed; | |||
top: 270rpx; | |||
/* height: 600rpx; */ | |||
} | |||
.courseBox{ | |||
float: left; | |||
width: 78%; | |||
/* height: 1066rpx; */ | |||
margin-left: 20%; | |||
overflow: scroll; | |||
} | |||
.itemBox_a{ | |||
height: 120rpx; | |||
background-image: -webkit-linear-gradient(left, #103930, #121620) | |||
} | |||
.itemBox{ | |||
height: 120rpx; | |||
} | |||
.Text{ | |||
height: 60rpx; | |||
text-align:center; | |||
line-height: 60rpx; | |||
color: #ffffff; | |||
margin-top: 30rpx; | |||
} | |||
.Text_a{ | |||
height: 60rpx; | |||
text-align:center; | |||
line-height: 60rpx; | |||
color: #ffffff; | |||
margin-top: 30rpx; | |||
font-size: 30rpx; | |||
border-left: 2rpx solid #00ff99; | |||
color:#00ff99 ; | |||
} | |||
.courseItemBox { | |||
margin-bottom: 20rpx; | |||
} | |||
.Img{ | |||
width: 200rpx; | |||
height: 120rpx; | |||
border-radius: 10rpx; | |||
/* background-color: chocolate; */ | |||
float: left; | |||
margin-right: 30rpx; | |||
} | |||
.TextBox{ | |||
width: 320rpx; | |||
height: 120rpx; | |||
float: left; | |||
} | |||
.Name{ | |||
height: 50rpx; | |||
line-height: 50rpx; | |||
font-size: 32rpx; | |||
overflow:hidden; | |||
text-overflow:ellipsis; | |||
display:-webkit-box; | |||
-webkit-box-orient:vertical; | |||
-webkit-line-clamp:1; | |||
color: #ffffff; | |||
} | |||
.chargeBox{ | |||
margin-top: 30rpx; | |||
} | |||
.tiem{ | |||
float: left; | |||
color: #999999; | |||
} | |||
.money{ | |||
float: right; | |||
color: #ff3366; | |||
font-size: 34rpx; | |||
} | |||
.py{ | |||
font-size: 26rpx; | |||
float: right; | |||
color: #ff3366; | |||
line-height: 46rpx; | |||
} |
@@ -0,0 +1,358 @@ | |||
const app = getApp() | |||
const navigationBarHeight = (getApp().statusBarHeight + 44) + "px" | |||
const config = require("../../config/config") | |||
const Http = require("../../utils/HttpBasics.js") | |||
Page({ | |||
data: { | |||
ifPay:app.globalData.platform, | |||
classTitle:"",//课程标题 | |||
showIos:false,//ios字符提示 | |||
showHie: false,//提示框 | |||
anthology: 0,//选集 | |||
classNumber: "",//有多少集 | |||
imgHttps: app.globalData.imgHttps, | |||
extraClasses: 'addBox-transition ', | |||
navigationBarHeight, | |||
videoContext: "", | |||
ifpay: 0,//是否支付 0免费 1付费 | |||
goPayFlag: false,//支付按钮显隐 | |||
btnSuspend: true,//控制播放按钮 | |||
columnIndex: 0, | |||
addFlag: true, | |||
thenIndex: 0,//播放选合集 | |||
popupNum: 0,//弹出选集 | |||
popupIndex: 0,////播放选集 | |||
showPopup: false,//选集弹框 | |||
id: "",//课程id | |||
data: {},//数据源 | |||
iscollect: false,//是否收藏 | |||
mp4Url: "", | |||
tiemLsit: [{//试看时间 | |||
value: 1, | |||
name: 60 | |||
}, { | |||
value: 2, | |||
name: 180, | |||
}, { | |||
value: 3, | |||
name: 300, | |||
}], | |||
}, | |||
// goIndent(e){ | |||
// console.log(e.dataset.url); | |||
// }, | |||
showIos(){ | |||
this.setData({ | |||
showIos:true | |||
}) | |||
}, | |||
cancel(e) { | |||
this.setData({ | |||
showHie: e.detail.data | |||
}) | |||
}, | |||
cancelIos(e) { | |||
this.setData({ | |||
showIos: e.detail.data | |||
}) | |||
}, | |||
hiePopup() { | |||
this.setData({ | |||
showPopup: false | |||
}) | |||
}, | |||
setShowPopup() { | |||
this.setData({ | |||
showPopup: true | |||
}) | |||
}, | |||
setPopupIndex(e) { | |||
let index = e.currentTarget.dataset.index | |||
this.setData({ | |||
popupIndex: index | |||
}) | |||
}, | |||
setPopupNum(e) { | |||
let index = e.currentTarget.dataset.index | |||
this.setData({ | |||
popupNum: index | |||
}) | |||
}, | |||
setThenIndex(e) { | |||
let index = e.currentTarget.dataset.index | |||
let id = e.currentTarget.dataset.id | |||
console.log(id); | |||
this.getVideoUrl(id) | |||
this.setData({ | |||
anthology: index | |||
}) | |||
}, | |||
siteVid(e) {//切换视频 | |||
let index = e.currentTarget.dataset.index | |||
let id = e.currentTarget.dataset.id | |||
this.getVideoUrl(id) | |||
this.setData({ | |||
anthology: index, | |||
goPayFlag: false, | |||
btnSuspend: true, | |||
}) | |||
}, | |||
hieaddCheck() { | |||
this.setData({ | |||
extraClasses: 'addBox-transition', | |||
addFlag: true | |||
}) | |||
}, | |||
addCheck() {//动画 | |||
this.setData({ | |||
addFlag: false | |||
}) | |||
if (this.data.extraClasses == 'addBox-transition addBox-moved') { | |||
this.setData({ | |||
extraClasses: 'addBox-transition', | |||
}) | |||
} else { | |||
this.setData({ | |||
extraClasses: 'addBox-transition addBox-moved' | |||
}) | |||
} | |||
}, | |||
setColumnIndex(e) { | |||
let index = e.currentTarget.dataset.index | |||
this.setData({ | |||
columnIndex: index | |||
}) | |||
}, | |||
order() {//支付 | |||
Http.post({//下订单 | |||
url: config.api.order, | |||
data: { | |||
couponId: this.data.id | |||
} | |||
}).then(res => { | |||
console.log(res.data, "订单成功"); | |||
let id = res.data.id | |||
console.log(id); | |||
Http.post({//拿orderInfo | |||
url: config.api.pay, | |||
data: { | |||
orderId: res.data.id | |||
} | |||
}).then(item => { | |||
console.log(item, "orderId"); | |||
tt.pay({ | |||
service: 5, | |||
orderInfo: { | |||
order_id: item.data.orderId, | |||
order_token: item.data.token, | |||
}, | |||
success(res) { | |||
if (res.code === 0) { | |||
this.getData() | |||
tt.showToast({ | |||
title: '支付成功!', // 内容 | |||
}); | |||
// 支付成功处理逻辑,只有res.code=0时,才表示支付成功 | |||
// 但是最终状态要以商户后端结果为准 | |||
} else if (res.code === 1) { | |||
tt.showToast({ | |||
title: '支付超时', // 内容 | |||
icon: "none" | |||
}); | |||
Http.post({ | |||
url: config.api.ifPayOk, | |||
data: { | |||
code: 1, | |||
orderId: res.data.id | |||
} | |||
}) | |||
} else if (res.code === 2) { | |||
tt.showToast({ | |||
title: '支付失败', // 内容 | |||
icon: "none" | |||
}); | |||
} else if (res.code === 3) { | |||
tt.showToast({ | |||
title: '支付关闭', // 内容 | |||
icon: "none" | |||
}); | |||
} else if (res.code === 4) { | |||
tt.showToast({ | |||
title: '支付取消', // 内容 | |||
icon: "none" | |||
}); | |||
} else if (res.code === 9) { | |||
tt.showToast({ | |||
title: '订单状态开发者自行获取', // 内容 | |||
icon: "none" | |||
}); | |||
} | |||
}, | |||
fail(res) { | |||
// handle fail | |||
}, | |||
}) | |||
}).catch(err => { | |||
tt.showToast({ | |||
title: '唤起支付失败', // 内容 | |||
icon: "none" | |||
}); | |||
}) | |||
}).catch(err => { | |||
if (err.code === 3013) { | |||
this.setData({ | |||
showHie: true | |||
}) | |||
} else { | |||
tt.showToast({ | |||
title: err.message, // 内容 | |||
icon: "none" | |||
}); | |||
} | |||
}) | |||
}, | |||
goPay() { | |||
this.order() | |||
console.log("我支付了"); | |||
this.setData({ | |||
goPayFlag: false, | |||
btnSuspend: true, | |||
}) | |||
}, | |||
time(e) { | |||
let time = e.detail.currentTime.toFixed(0); | |||
if (!this.data.ifpay || this.data.data.view) {//已经支付过或免费 | |||
if(this.data.data.columnCoupons){ | |||
this.setData({ | |||
classNumber: this.data.data.columnCoupons.length | |||
}) | |||
} | |||
return | |||
} else {//需要付费或已支付 | |||
let tempTime = "" //预览时间 | |||
if (this.data.data.columnCoupons) {//是不是集合 | |||
this.setData({ | |||
classNumber: this.data.data.columnCoupons.length | |||
}) | |||
tempTime = this.data.tiemLsit.filter(item => { | |||
return this.data.data.columnCoupons[this.data.anthology].previewDuration == item.value | |||
})[0].name | |||
} else { | |||
tempTime = this.data.tiemLsit.filter(item => { | |||
return this.data.data.previewDuration == item.value | |||
})[0].name | |||
} | |||
if (time >= tempTime) { | |||
this.data.videoContext.pause()//暂停 | |||
this.data.videoContext.exitFullScreen()//退出全屏 | |||
this.setData({ | |||
goPayFlag: true, | |||
btnSuspend: false,//禁止播放 | |||
}) | |||
} | |||
} | |||
}, | |||
setCollect() {//设置收藏 | |||
if (this.data.iscollect) {//已收藏 | |||
Http.get({ | |||
url: config.api.Fcollect, | |||
data: { id: this.data.id } | |||
}).then(res => { | |||
this.ifCollect() | |||
}).catch(err => { | |||
tt.showToast({ | |||
title: err.data, // 内容 | |||
icon: "none" | |||
}); | |||
}) | |||
} else {//未收藏 | |||
Http.get({ | |||
url: config.api.Tcollect, | |||
data: { id: this.data.id } | |||
}).then(res => { | |||
this.ifCollect() | |||
}).catch(err => { | |||
tt.showToast({ | |||
title: err.data, // 内容 | |||
icon: "none" | |||
}); | |||
}) | |||
} | |||
}, | |||
ifCollect() {//是否收藏课程 | |||
Http.get({ | |||
url: config.api.iscollect, | |||
data: { | |||
id: this.data.id | |||
} | |||
}).then(res => { | |||
this.setData({ | |||
iscollect: res.data | |||
}) | |||
}) | |||
}, | |||
getData() {//订单详情 | |||
Http.get({ | |||
url: config.api.classDetails, | |||
data: { id: this.data.id } | |||
}).then(res => { | |||
this.setData({ | |||
data: res.data, | |||
ifpay: res.data.isPayment | |||
}) | |||
if (res.data.columnCoupons) { | |||
this.getVideoUrl(res.data.columnCoupons[0].videoId) | |||
} else { | |||
this.getVideoUrl(res.data.videoId) | |||
} | |||
}).catch(err => { | |||
tt.showToast({ | |||
title: err.data, // 内容 | |||
icon: "none" | |||
}); | |||
}) | |||
}, | |||
getVideoUrl(id) {//获取视频url | |||
Http.get({ | |||
url: config.api.getViodUrl, | |||
data: { | |||
videoId: id | |||
} | |||
}).then(res => { | |||
console.log(res); | |||
this.setData({ | |||
mp4Url: res.data.videoUrl | |||
}) | |||
}) | |||
}, | |||
onReady() { | |||
this.setData({ | |||
videoContext: wx.createVideoContext('myVideo') | |||
}) | |||
}, | |||
onLoad(options) { | |||
if (options.id) { | |||
this.setData({ | |||
id: options.id, | |||
classTitle:options.title | |||
}) | |||
this.ifCollect() | |||
// this.getData() | |||
} | |||
}, | |||
onShow(){ | |||
this.getData() | |||
}, | |||
onShareAppMessage: function () { | |||
// return custom share data when user share. | |||
}, | |||
}) |
@@ -0,0 +1,6 @@ | |||
{ | |||
"usingComponents": { | |||
"navbar": "../../components/navbar/navbar", | |||
"prompt": "../../components/prompt/prompt" | |||
} | |||
} |
@@ -0,0 +1,159 @@ | |||
<view id="BoxBg" bindtap="hieaddCheck" > | |||
<view class="Box"> | |||
<navbar back text="{{classTitle}}" background="#0E1119" color="#fff"></navbar> | |||
<prompt bind:hie="cancel" url="/pages/order/order" tt:if="{{showHie}}" titil="提示" text="您有已存在的订单" assistant="取消" advocate="去查看"></prompt> | |||
<view style="height:{{navigationBarHeight}} "></view> | |||
<video id="myVideo" bindtimeupdate="time" controls="{{btnSuspend}}" src="{{mp4Url}}"></video> | |||
<cover-view class="coverPay" tt:if="{{goPayFlag&&ifPay!='ios'}}" bindtap="goPay">¥ {{data.salePriceStr}} 购买</cover-view> | |||
<cover-view class="noCoverPay" tt:if="{{goPayFlag&&ifPay=='ios'}}" >暂不支持购买</cover-view> | |||
<view class="showContBox oh"> | |||
<view class="titleBox"> | |||
<view class="title">{{data.title}}</view> | |||
<view class="classBox oh"> | |||
<!-- <image class="courseLogo" src="{{imgHttps+'upzy_icon_ks.png'}}" mode="" /> | |||
<view class="classNum">56课时</view> --> | |||
<image class="heatLogo" src="{{imgHttps+'home_ic_renq.png'}}" mode="" /> | |||
<view class="heatNum">人气{{data.popularity}}</view> | |||
</view> | |||
</view> | |||
<view class="collectBox" bindtap="setCollect"> | |||
<image class="collect" src="{{imgHttps+'details_tab_sc.png'}}" mode="" tt:if="{{!iscollect}}"/> | |||
<image class="collect" src="{{imgHttps+'details_xx_huang.png'}}" mode="" tt:if="{{iscollect}}"/> | |||
<!-- details_xx_huang.png --> | |||
<view style="color: #fff;">收藏</view> | |||
</view> | |||
</view> | |||
<!-- 未购买出现 --> | |||
<view class="payBox oh" tt:if="{{data.salePriceStr!=0}}"> | |||
<view class="payF"> | |||
¥ | |||
</view> | |||
<view class="payNum"> | |||
{{data.salePriceStr}} | |||
</view> | |||
</view> | |||
<!-- 未购买出现 --> | |||
<!-- 购买出现 --> | |||
<view class="oh" tt:if="{{data.columnCoupons}}"> | |||
<view class="purchaseBox oh" > | |||
<view bindtap="siteVid" data-id="{{item.videoId}}" data-index="{{index}}" class="{{anthology==index?'anthology_a':'anthology'}} anthology" tt:for="{{data.columnCoupons}}"> | |||
<view class="anthologyItem">{{(index+1)+'.'+item.title}}</view> | |||
</view> | |||
</view> | |||
<!-- <image class="more" bindtap="setShowPopup" src="{{imgHttps+'me_icon_jiantou.png'}}" mode="" /> --> | |||
</view> | |||
<!-- 选集弹框 --> | |||
<!-- <view class="compilationsBox oh" tt:if="{{showPopup}}"> | |||
<view class="oh"> | |||
<view class="aaClassBox"> | |||
<view class="anthologyBox oh"> | |||
<view class="anthologyText">课程分集</view> | |||
<view class="xiao">共</view> | |||
<view class="Num">{{classNumber}}</view> | |||
<view class="xiao">集</view> | |||
</view> | |||
</view> | |||
<image class="pack" src="{{imgHttps+'details_icon_fenji.png'}}" mode="" bindtap="hiePopup"/> | |||
</view> | |||
<view class="numberBox oh"> | |||
<view class="{{popupNum==index?'number_a':'number'}}" tt:for="{{3}}" bindtap="setPopupNum" data-index="{{index}}">1-20</view> | |||
</view> | |||
<view class="curriculumBox oh" tt:for="{{6}}" bindtap="setPopupIndex" data-index="{{index}}"> | |||
<image class="bfLogo" src="{{imgHttps+'details_ml_bf.png'}}" mode="" /> | |||
<view class="classnameBox"> | |||
<view class="{{popupIndex==index?'classname_a':'classname'}}">1.健身私教体验课-常规课程训练</view> | |||
<view class="classTiemBox oh"> | |||
<image class="time" src="{{imgHttps+'details_ml_sj.png'}}" mode="" /> | |||
<view class="timeText">20:58</view> | |||
<image class="yuan" src="{{imgHttps+'details_ml_zzbf.png'}}" mode="" tt:if="{{popupIndex==index}}"/> | |||
<view class="then" tt:if="{{popupIndex==index}}">正在播放</view> | |||
</view> | |||
</view> | |||
</view> | |||
</view> --> | |||
<!-- 选集弹框 --> | |||
<!-- 购买出现 --> | |||
<view class="columnBox oh"> | |||
<view class=" {{columnIndex==0?'introduce columnB_a':'introduce'}}" bindtap="setColumnIndex" data-index="{{0}}"> | |||
介绍 | |||
</view> | |||
<view class=" {{columnIndex==1?'catalogue columnB_a':'catalogue'}}" bindtap="setColumnIndex" data-index="{{1}}" tt:if="{{data.type==1}}"> | |||
<!-- 目录({{classNumber}}) --> | |||
目录 | |||
</view> | |||
</view> | |||
<navigator url="/pages/UpHome/UpHome?id={{data.merchantId}}&name={{data.merchantName}}" open-type="" hover-class="className" class="userParticularsBox oh" tt:if="{{columnIndex==0}}"> | |||
<view class="userBox oh" > | |||
<image class="userLogo" src="{{data.merchantPic}}" mode="" /> | |||
<view class="userNameBox oh"> | |||
<view class="oh"> | |||
<view class="userName">{{data.merchantName}}</view> | |||
<!-- <view class="attention">+ 关注</view> --> | |||
</view> | |||
<view class="classifyBoc oh" tt:if="{{data.businessName}}"> | |||
<view class="classifyItem">{{data.businessName}}</view> | |||
<!-- <view class="classifyItem">健身</view> --> | |||
</view> | |||
</view> | |||
<image class="extend" src="{{imgHttps+'me_icon_jiantou.png'}}" mode="" /> | |||
</view> | |||
<view class="userDescribe">{{data.author.introduction}}</view> | |||
</navigator> | |||
<view class="richtextBox" tt:if="{{columnIndex==0}}"> | |||
<rich-text class="rich_text" nodes="{{data.html}}"></rich-text> | |||
</view> | |||
<view tt:if="{{columnIndex==1}}" class="catalogueBox"> | |||
<view class="titleImgBox oh"> | |||
<image src="{{imgHttps+'details_icon_kcfj.png'}}" mode="" class="h3Img"/> | |||
<view class="h3">课程分集</view> | |||
</view> | |||
<view class="playLsitBox oh" tt:for="{{data.columnCoupons}}" bindtap="setThenIndex" data-index="{{index}}" data-id="{{item.videoId}}"> | |||
<image class="transmitImg" src="{{imgHttps+'details_ml_bf.png'}}" mode="" /> | |||
<view class="timeBox oh"> | |||
<view class="{{anthology==index?'timeBoxTitle_a':'timeBoxTitle'}} ">{{(index+1+'.')+item.title}}</view> | |||
<view class="tiemBoxImg oh"> | |||
<!-- <image class="time" src="{{imgHttps+'details_ml_sj.png'}}" mode="" /> --> | |||
<!-- <view class="timeText">20:58</view> --> | |||
<image class="yuan" src="{{imgHttps+'details_ml_zzbf.png'}}" mode="" tt:if="{{anthology==index}}"/> | |||
<view class="then" tt:if="{{anthology==index}}">正在播放</view> | |||
</view> | |||
</view> | |||
<image class="try" src="{{imgHttps+'details_ml_sk.png'}}" mode="" tt:if="{{anthology==index}}"/> | |||
<image class="shuo" src="{{imgHttps+'details_ml_wgm.png'}}" mode="" tt:if="{{anthology==!index}}"/> | |||
</view> | |||
</view> | |||
<view class="hit"></view> | |||
<image catchtap="addCheck" class="add" src="{{imgHttps+'details_bat_xf_zk.png'}}" mode="" tt:if="{{addFlag}}"/> | |||
<view class="addBox {{extraClasses}} oh"> | |||
<!-- <navigator url="" class="goruzu oh"> | |||
<image src="{{imgHttps+'details_xf_ic_fbsp.png'}}" mode="" class="video"/> | |||
<view class="issue">发布视频</view> | |||
</navigator> --> | |||
<!-- <view class="xian"></view> --> | |||
<navigator url="/pages/upEnter/upEnter" class="goruzu oh"> | |||
<image src="{{imgHttps+'details_xf_ic_sqrz.png'}}" mode="" class="checkImg"/> | |||
<view class="issue" url="/pages/upEnter/upEnter">申请入驻</view> | |||
</navigator> | |||
</view> | |||
<view class="shareBox oh"> | |||
<image class="shareImg" src="{{imgHttps+'details_bat_fx.png'}}" mode=""/> | |||
<button class="service" open-type="share"> 分享 </button> | |||
<view class="xuxian"></view> | |||
<image class="consult" src="{{imgHttps+'details_bat_zx.png'}}" mode=""/> | |||
<button class="service" open-type="contact" > 咨询 </button> | |||
<view class="shopping" bindtap="goPay" tt:if="{{ifPay!='ios'&&!data.view}}">¥{{data.salePriceStr}}</view> | |||
<view class="nOshopping" bindtap="showIos" tt:if="{{ifPay=='ios'&&!data.view}}">¥{{data.salePriceStr}}</view> | |||
</view> | |||
</view> | |||
<prompt bind:hie="cancelIos" tt:if="{{showIos}}" titil="提示" text="Ios当前暂不支持购买" hidText="确定" ></prompt> | |||
</view> |
@@ -0,0 +1,609 @@ | |||
.Box{ | |||
min-height: 100vh; | |||
} | |||
#myVideo{ | |||
width: 100%; | |||
height: 420rpx; | |||
position: relative; | |||
} | |||
.rich_text{ | |||
width: 100%; | |||
height: 100%; | |||
} | |||
.rich_text p{ | |||
width: 100%; | |||
} | |||
.coverPay{ | |||
/* width: 200rpx; */ | |||
padding: 0 20rpx; | |||
height: 90rpx; | |||
line-height: 90rpx; | |||
text-align: center; | |||
border-radius: 40rpx; | |||
background-color: #07E881; | |||
color: #ffffff; | |||
position: absolute; | |||
left: 40%; top: 293rpx; | |||
z-index: 1000000; | |||
} | |||
.noCoverPay{ | |||
/* width: 200rpx; */ | |||
padding: 0 20rpx; | |||
height: 90rpx; | |||
line-height: 90rpx; | |||
text-align: center; | |||
border-radius: 40rpx; | |||
background-color: rgba(255, 255, 255, 0.3); | |||
color: #ffffff; | |||
position: absolute; | |||
left: 40%; top: 293rpx; | |||
z-index: 1000000; | |||
} | |||
.showContBox { | |||
margin: 20rpx ; | |||
} | |||
.titleBox{ | |||
float: left; | |||
width: 80%; | |||
} | |||
.title{ | |||
color: #ffffff; | |||
font-size: 36rpx; | |||
font-family: PingFang SC; | |||
font-weight: bold; | |||
height: 40rpx; | |||
line-height: 40rpx; | |||
overflow:hidden; | |||
text-overflow:ellipsis; | |||
display:-webkit-box; | |||
-webkit-box-orient:vertical; | |||
-webkit-line-clamp:1; | |||
} | |||
.classBox{ | |||
margin: 20rpx 0; | |||
color: #ffffff; | |||
} | |||
.courseLogo{ | |||
float: left; | |||
width: 40rpx; | |||
height: 40rpx; | |||
} | |||
.classNum{ | |||
margin: 0 20rpx; | |||
float: left; | |||
} | |||
.heatLogo{ | |||
width: 35rpx; | |||
height: 40rpx; | |||
margin-left: 50rpx; | |||
float: left; | |||
} | |||
.heatNum{ | |||
margin-left: 20rpx; | |||
float: left; | |||
} | |||
.collectBox{ | |||
float: left; | |||
width: 20%; | |||
height: 120rpx; | |||
text-align: center; | |||
} | |||
.collect{ | |||
width: 50rpx; | |||
height: 50rpx; | |||
} | |||
.payBox{ | |||
width: 95%; | |||
margin: auto; | |||
background-image: -webkit-linear-gradient(left, #103930, #121620); | |||
} | |||
.payNum{ | |||
font-size: 36rpx; | |||
color: #FC4758; | |||
font-family: OPPOSans; | |||
font-weight: 400; | |||
height: 80rpx; | |||
float: left; | |||
line-height: 80rpx; | |||
} | |||
.payF{ | |||
height: 80rpx; | |||
float: left; | |||
line-height: 80rpx; | |||
margin-left: 20rpx; | |||
color: #FC4758; | |||
} | |||
.columnBox{ | |||
margin: 20rpx 0; | |||
} | |||
.columnB_a{ | |||
font-family: OPPOSans; | |||
font-weight: 800; | |||
color: #FFFFFF; | |||
font-size: 32rpx; | |||
margin-left: 20rpx; | |||
border-bottom: 4rpx solid #07E881; | |||
padding-bottom: 6rpx; | |||
} | |||
.introduce{ | |||
float: left; | |||
font-family: OPPOSans; | |||
margin: 20rpx 40px; | |||
} | |||
.catalogue{ | |||
font-family: OPPOSans; | |||
float: left; | |||
margin: 20rpx 40rpx; | |||
} | |||
.userParticularsBox{ | |||
border-radius: 20rpx; | |||
background-color: #293145; | |||
} | |||
.userBox{ | |||
/* float: left; */ | |||
margin: 40rpx 20rpx 20rpx 20rpx; | |||
} | |||
.userDescribe{ | |||
float: left; | |||
margin: 20rpx; | |||
color: #9DA8C4; | |||
font-family: OPPOSans; | |||
font-weight: 400; | |||
} | |||
.userLogo{ | |||
height: 120rpx; | |||
width: 120rpx; | |||
float: left; | |||
border-radius: 50%; | |||
} | |||
.userNameBox{ | |||
margin-left: 40rpx; | |||
float: left; | |||
} | |||
.userName{ | |||
float: left; | |||
color: #FFFFFF; | |||
font-family: OPPOSans; | |||
font-weight: 500; | |||
font-size: 30rpx; | |||
padding: 0 20rpx; | |||
} | |||
.attention{ | |||
float: left; | |||
border-radius: 20rpx; | |||
line-height: 40rpx; | |||
height: 40rpx; | |||
border: 1rpx solid #07E881; | |||
background: rgba(7, 232, 129, 0.12); | |||
color: #07E881; | |||
padding: 2rpx 20rpx; | |||
} | |||
.classifyItem{ | |||
text-align: center; | |||
background: #141825; | |||
border: 1rpx solid #666D80; | |||
border-radius: 18rpx; | |||
float: left; | |||
padding: 6rpx 10rpx; | |||
margin: 10rpx; | |||
} | |||
.extend{ | |||
width: 20rpx; | |||
height: 40rpx; | |||
float: right; | |||
margin: 20rpx 40rpx 0 0; | |||
} | |||
.richtextBox{ | |||
margin-top: 40rpx; | |||
min-height: 120rpx; | |||
} | |||
.add{ | |||
width: 140rpx; | |||
height: 140rpx; | |||
position: fixed; | |||
right: 0; | |||
bottom: 274rpx; | |||
} | |||
.addBox{ | |||
padding: 0 40rpx; | |||
/* width: 90%; */ | |||
height: 100rpx; | |||
background: linear-gradient(0deg, #2A3042, #464D61); | |||
box-shadow: 0px 6px 20px 0px rgba(0, 0, 0, 0.93); | |||
border-radius: 49rpx; | |||
position: fixed; | |||
left: 100%; | |||
bottom: 300rpx; | |||
} | |||
.addBox-transition { | |||
transition: all 0.5s; | |||
} | |||
.addBox-moved { | |||
left: 50%; | |||
} | |||
@keyframes addBox-ani { | |||
from { | |||
left: 100%; | |||
} | |||
to { | |||
left: 5%; | |||
} | |||
} | |||
.addBox-animation { | |||
animation: addBox-ani 1s alternate infinite; | |||
} | |||
.goruzu{ | |||
float: left; | |||
} | |||
.video{ | |||
width: 70rpx; | |||
height: 70rpx; | |||
float: left; | |||
margin-left: 40rpx; | |||
margin-top: 15rpx; | |||
} | |||
.checkImg{ | |||
width: 70rpx; | |||
height: 70rpx; | |||
float: left; | |||
/* margin-left: 80rpx; */ | |||
margin-left: 10rpx; | |||
margin-top: 10rpx; | |||
} | |||
.issue{ | |||
float: left; | |||
font-size: 30rpx; | |||
font-family: OPPOSans; | |||
font-weight: bold; | |||
color: #FFFFFF; | |||
line-height: 100rpx; | |||
margin-left: 10rpx; | |||
} | |||
.xian{ | |||
height: 70rpx; | |||
width: 2rpx; | |||
background-color: rgba(255, 255, 255, 0.3); | |||
border-radius: 1px; | |||
float: left; | |||
margin-left: 80rpx; | |||
margin-top: 15rpx; | |||
} | |||
.shareBox{ | |||
width: 100%; | |||
position: fixed; | |||
left: 0; | |||
bottom: 0; | |||
height: 120rpx; | |||
background: #141928; | |||
} | |||
.shareImg{ | |||
margin-top: 5rpx; | |||
float: left; | |||
width: 40rpx; | |||
height: 40rpx; | |||
margin-top: 20rpx; | |||
margin-left: 40rpx; | |||
} | |||
.shareText{ | |||
float: left; | |||
margin-top: 20rpx; | |||
margin-left: 20rpx; | |||
color: #ffffff; | |||
width: 70rpx; | |||
height: 50rpx; | |||
font-size: 28rpx; | |||
} | |||
.xuxian{ | |||
width: 1rpx; | |||
height: 28rpx; | |||
background: #8790A8; | |||
opacity: 0.4; | |||
float: left; | |||
margin-top: 30rpx; | |||
margin-left: 60rpx; | |||
} | |||
.consult{ | |||
float: left; | |||
width: 40rpx; | |||
height: 40rpx; | |||
margin-top: 20rpx; | |||
margin-left: 40rpx; | |||
line-height: 40rpx; | |||
} | |||
.service{ | |||
float: left; | |||
margin-top: 10rpx; | |||
margin-left: 10rpx; | |||
color: #ffffff; | |||
width: 100rpx; | |||
padding: 0; | |||
height: 50rpx; | |||
background-color: #141928; | |||
font-size: 28rpx; | |||
} | |||
.service span{ | |||
display: block; | |||
width: 100%; | |||
height: 100%; | |||
} | |||
.shopping{ | |||
height: 90rpx; | |||
line-height: 90rpx; | |||
text-align: center; | |||
float: left; | |||
padding: 0 60rpx; | |||
background: linear-gradient(-4deg, #4EE09D, #02C96E); | |||
border-radius: 50rpx; | |||
margin-left: 30rpx; | |||
color: #FFFFFF; | |||
font-size: 36rpx; | |||
font-family: OPPOSans; | |||
} | |||
.nOshopping{ | |||
height: 90rpx; | |||
line-height: 90rpx; | |||
text-align: center; | |||
float: left; | |||
padding: 0 60rpx; | |||
background-color: rgba(255, 255, 255, 0.1); | |||
border-radius: 50rpx; | |||
margin-left: 10rpx; | |||
color: #FFFFFF; | |||
font-size: 32rpx; | |||
font-family: OPPOSans; | |||
} | |||
.h3Img{ | |||
width: 40rpx; | |||
height: 40rpx; | |||
float: left; | |||
margin-left: 20rpx; | |||
} | |||
.h3{ | |||
float: left; | |||
margin-left: 20rpx; | |||
font-family: OPPOSans; | |||
font-weight: 500; | |||
color: #FFFFFF; | |||
} | |||
.playLsitBox{ | |||
margin: 40rpx 20rpx; | |||
} | |||
.transmitImg{ | |||
width: 100rpx; | |||
height: 100rpx; | |||
float: left; | |||
} | |||
.timeBox{ | |||
float: left; | |||
width: 400rpx; | |||
margin-left: 20rpx; | |||
color: #FFFFFF; | |||
} | |||
.curriculumBox{ | |||
margin-top: 20rpx; | |||
} | |||
.time{ | |||
float: left; | |||
width: 30rpx; | |||
height: 30rpx; | |||
margin-top: 20rpx; | |||
} | |||
.timeText{ | |||
font-family: OPPOSans; | |||
font-weight: 500; | |||
color: #6E768A; | |||
margin-top: 15rpx; | |||
margin-left: 10rpx; | |||
float: left; | |||
} | |||
.yuan{ | |||
float: left; | |||
width: 30rpx; | |||
height: 30rpx; | |||
margin-top: 20rpx; | |||
margin-left: 100rpx; | |||
} | |||
.then{ | |||
font-family: OPPOSans; | |||
font-weight: 500; | |||
color: #07E881; | |||
margin-top: 15rpx; | |||
margin-left: 10rpx; | |||
float: left; | |||
} | |||
.timeBoxTitle_a{ | |||
color: #07E881; | |||
} | |||
.timeBoxTitle{ | |||
color: #ffffff; | |||
} | |||
.try{ | |||
float: left; | |||
width: 60rpx; | |||
height: 40rpx; | |||
margin-left: 80rpx; | |||
margin-top: 20rpx; | |||
} | |||
.shuo{ | |||
float: left; | |||
width: 30rpx; | |||
height: 30rpx; | |||
margin-left: 80rpx; | |||
margin-top: 15rpx; | |||
} | |||
.hit{ | |||
height: 120rpx; | |||
} | |||
.purchaseBox{ | |||
float: left; | |||
width: 90%; | |||
overflow: hidden; | |||
overflow-y: hidden; | |||
overflow-x: auto; | |||
white-space: nowrap; | |||
margin-top: 20rpx; | |||
height: 70rpx; | |||
} | |||
.purchaseBox::-webkit-scrollbar { | |||
display: none; | |||
} | |||
.anthology_a{ | |||
width: 220rpx; | |||
padding: 10rpx 20rpx; | |||
border-radius: 50rpx; | |||
text-align: center; | |||
border: 1rpx solid #ffffff; | |||
color: #FFFFFF; | |||
display: inline-block; | |||
text-align: center; | |||
margin-left: 20rpx; | |||
} | |||
.anthology{ | |||
width: 220rpx; | |||
padding: 10rpx 20rpx; | |||
border-radius: 50rpx; | |||
text-align: center; | |||
display: inline-block; | |||
border: 1rpx solid #7A8399; | |||
color: #7A8399;; | |||
margin-left: 20rpx; | |||
margin-top: 20rpx 0; | |||
} | |||
.anthology_a{ | |||
width: 220rpx; | |||
padding: 10rpx 20rpx; | |||
border-radius: 50rpx; | |||
text-align: center; | |||
display: inline-block; | |||
border: 1rpx solid #7A8399; | |||
color: #ffffff;; | |||
margin-left: 20rpx; | |||
margin-top: 20rpx 0; | |||
} | |||
.anthologyItem{ | |||
width: 220rpx; | |||
overflow:hidden; | |||
text-overflow:ellipsis; | |||
display:-webkit-box; | |||
-webkit-box-orient:vertical; | |||
-webkit-line-clamp:1; | |||
} | |||
.more{ | |||
width: 20rpx; | |||
height: 40rpx; | |||
float: left; | |||
margin-top: 30rpx; | |||
margin-left: 40rpx; | |||
} | |||
.compilationsBox{ | |||
width: 100%; | |||
height: 60vh; | |||
position: fixed; | |||
background-color: #0E1119; | |||
z-index: 100000; | |||
bottom: 0; | |||
left: 0; | |||
} | |||
.aaClassBox{ | |||
width: 88%; | |||
float: left; | |||
} | |||
.pack{ | |||
width: 5%; | |||
height: 20rpx; | |||
float: right; | |||
margin-top: 30rpx; | |||
margin-right: 40rpx; | |||
} | |||
.anthologyText{ | |||
float: left; | |||
font-family: OPPOSans; | |||
font-weight: 500; | |||
color: #FFFFFF; | |||
font-size: 32rpx; | |||
margin: 20rpx; | |||
} | |||
.xiao{ | |||
font-size: 28rpx; | |||
float: left; | |||
margin-top: 20rpx; | |||
} | |||
.Num{ | |||
float: 20rpx; | |||
float: left; | |||
font-size: 34rpx; | |||
color: #ffffff; | |||
margin-top: 20rpx; | |||
margin-left: 10rpx; | |||
margin-right: 10rpx; | |||
} | |||
.number_a{ | |||
width: 90rpx; | |||
float: left; | |||
padding: 10rpx 20rpx; | |||
border: 1px solid #07E881;; | |||
margin: 0 30rpx; | |||
border-radius: 50rpx; | |||
text-align: center; | |||
color: #07E881; | |||
} | |||
.numberBox{ | |||
margin: 30rpx 0; | |||
} | |||
.number{ | |||
width: 90rpx; | |||
float: left; | |||
padding: 10rpx 20rpx; | |||
border: 1px solid #7A8399; | |||
margin: 0 30rpx; | |||
border-radius: 50rpx; | |||
text-align: center; | |||
} | |||
.bfLogo{ | |||
width: 100rpx; | |||
height: 100rpx; | |||
float: left; | |||
margin: 10rpx 20rpx; | |||
} | |||
.classnameBox{ | |||
float: left; | |||
} | |||
.classname{ | |||
width: 560rpx; | |||
font-size: 30rpx; | |||
color: #ffffff; | |||
overflow:hidden; | |||
text-overflow:ellipsis; | |||
display:-webkit-box; | |||
-webkit-box-orient:vertical; | |||
-webkit-line-clamp:1; | |||
margin-top: 10rpx; | |||
} | |||
.classname_a{ | |||
width: 560rpx; | |||
font-size: 30rpx; | |||
color: #07E881; | |||
overflow:hidden; | |||
text-overflow:ellipsis; | |||
display:-webkit-box; | |||
-webkit-box-orient:vertical; | |||
-webkit-line-clamp:1; | |||
margin-top: 10rpx; | |||
} |
@@ -0,0 +1,100 @@ | |||
// const app = getApp() | |||
// const navigationBarHeight = (getApp().statusBarHeight + 44)+"px" | |||
// Page({ | |||
// data:{ | |||
// navigationBarHeight, | |||
// } | |||
// }) | |||
const app = getApp() | |||
const config = require("../../config/config") | |||
const Http = require("../../utils/HttpBasics.js") | |||
const navigationBarHeight = (getApp().statusBarHeight + 44) + "px" | |||
Page({ | |||
data: { | |||
imgHttps: app.globalData.imgHttps, | |||
navigationBarHeight, | |||
inputValue: '', | |||
pageNum: 1, | |||
list: [], | |||
showFlog:false, | |||
id:"",//选中id | |||
}, | |||
setSearchValue(e) { | |||
let value = e.detail.value | |||
this.setData({ | |||
inputValue: value | |||
}) | |||
}, | |||
searchBtn() { | |||
this.setData({ | |||
list: [], | |||
pageNum: 1 | |||
}) | |||
this.search() | |||
}, | |||
cancel(){ | |||
Http.get({ | |||
url:config.api.Fcollect, | |||
data:{ | |||
id:this.data.id | |||
} | |||
}).then(res=>{{ | |||
tt.showToast({ | |||
title: '已取消收藏', // 内容 | |||
icon: "none" | |||
}); | |||
}}).catch(err=>{ | |||
tt.showToast({ | |||
title: err.message, // 内容 | |||
icon:"none" | |||
}); | |||
}) | |||
}, | |||
hie(){ | |||
this.setData({ | |||
showFlog:false | |||
}) | |||
}, | |||
showHie(e){ | |||
let id = e.currentTarget.dataset.id | |||
this.setData({ | |||
showFlog:true, | |||
id:id | |||
}) | |||
}, | |||
search() { | |||
Http.get({ | |||
url: config.api.getOrderLsit, | |||
data: { | |||
productTitle: this.data.inputValue, | |||
pageNum: this.data.pageNum, | |||
pageSize: 8, | |||
orderStatus: 2 | |||
} | |||
}).then(res => { | |||
console.log(res); | |||
let temp = this.data.list | |||
if (this.data.pageNum > 1) { | |||
temp.push(res.data.list) | |||
this.setData({ | |||
list: temp | |||
}) | |||
} else { | |||
this.setData({ | |||
list: res.data.list | |||
}) | |||
} | |||
}) | |||
}, | |||
onLoad() { | |||
this.search() | |||
}, | |||
onReachBottom: function() { | |||
this.setData({ | |||
pageNum:this.data.pageNum+1 | |||
}) | |||
this.search() | |||
} | |||
}) |
@@ -0,0 +1,6 @@ | |||
{ | |||
"navigationBarTitleText": "课程", | |||
"usingComponents": { | |||
"navbar": "../../components/navbar/navbar" | |||
} | |||
} |
@@ -0,0 +1,138 @@ | |||
<!-- <view id="BoxBg"> | |||
<view class="Box"> | |||
<navbar text="课程" background="#0E1119" color="#fff"></navbar> | |||
<view style="height:{{navigationBarHeight}} "></view> | |||
<view class="headBox oh"> | |||
<view class="classHourBox oh"> | |||
<view class="classNumBox oh"> | |||
<view class="numBox oh"> | |||
<view class="num"> | |||
686 | |||
</view> | |||
<view class="text"> | |||
节 | |||
</view> | |||
</view> | |||
<view class="study"> | |||
累计学习 | |||
</view> | |||
</view> | |||
<view class="xian"> | |||
</view> | |||
<view class="deyClassBox"> | |||
<view class="numBox oh"> | |||
<view class="num"> | |||
686 | |||
</view> | |||
<view class="text"> | |||
节 | |||
</view> | |||
</view> | |||
<view class="study"> | |||
今日学习 | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
<view class="learnBox"> | |||
<view class="learnTitle"> | |||
我的已学 | |||
</view> | |||
<view class="classBox oh" tt:for="{{6}}"> | |||
<view class="logo"> | |||
</view> | |||
<view class="particularsBox"> | |||
<view class="h3"> | |||
高级私教PT体验课-燃脂增肌 | |||
</view> | |||
<view class="overall"> | |||
共 56 课时 | |||
</view> | |||
<view class="overall" style="color: #07E881;margin-top: 20rpx;"> | |||
已学习:32/56 | |||
</view> | |||
<view class="scheduleHie"> | |||
<view class="scheduleA"> | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
</view> --> | |||
<view id="BoxBg"> | |||
<view class="Box"> | |||
<navbar back text="课程" background="#0E1119" color="#fff"></navbar> | |||
<view style="height:{{navigationBarHeight}} "></view> | |||
<view class="Hierecommend"> | |||
<view class="searchBox oh"> | |||
<view class="searchF"> | |||
<input type="text" class="searchText" placeholder-style="color: #666666;" placeholder="搜索" | |||
bindconfirm="search" bindinput="setSearchValue" confirm-type="search" /> | |||
</view> | |||
<view class="searchBtn" bindtap="searchBtn"> | |||
搜索 | |||
</view> | |||
</view> | |||
</view> | |||
<view class="classBoxAll"> | |||
<navigator url="/pages/classDetails/classDetails?id={{item.productId}}&title={{item.productTitle}}" open-type="" hover-class="className" tt:for="{{list}}" class="classBox oh"> | |||
<image class="logo" src="{{item.productPic}}" mode="" /> | |||
<view class="textBox"> | |||
<view class="titile">{{item.productTitle}}</view> | |||
<!-- <view class="cont">{{item.}}</view> --> | |||
<view class="moreBox oh"> | |||
<image class="user" src="{{item.authorPic}}" mode="" /> | |||
<view class="userText">{{item.author}}</view> | |||
<!-- <view class="show" catchtap="showHie" data-id="{{item.id}}"> | |||
<image class="go" src="{{imgHttps+'mesc_gd.png'}}" mode="" /> | |||
</view> --> | |||
</view> | |||
</view> | |||
</navigator> | |||
<view class="noDataBox" tt:if="{{list.length==0}}" > | |||
<image class="noDataImg" src="{{imgHttps+'no_favorite.png'}}" mode="" /> | |||
</view> | |||
</view> | |||
</view> | |||
<!-- <view class="instrumentBox" tt:if="{{showFlog}}"> | |||
<view class="cancel" bindtap="cancel">取消收藏</view> | |||
<view class="hie" bindtap="hie">取消</view> | |||
</view> --> | |||
</view> | |||
@@ -0,0 +1,273 @@ | |||
/* .headBox{ | |||
width: 100%; | |||
height: 320rpx; | |||
background-image: url("https://formall.oss-accelerate.aliyuncs.com/douyin/drawable-xhdpi/course_bnt.png"); | |||
background-size: 100% 320rpx; | |||
} | |||
.classHourBox{ | |||
width: 80%; | |||
height: 222rpx; | |||
background-image: url("https://formall.oss-accelerate.aliyuncs.com/douyin/drawable-xhdpi/course_bnt_xuexi.png"); | |||
background-size: 100% 222rpx; | |||
margin-top:60rpx ; | |||
margin-left: auto; | |||
margin-right: auto; | |||
} | |||
.classNumBox{ | |||
width: 46%; | |||
height: 100%; | |||
float: left; | |||
margin-left: 2%; | |||
} | |||
.xian{ | |||
width: 0rpx; | |||
height: 60%; | |||
float: left; | |||
margin-top: 8%; | |||
border: 2rpx #8D95B9 solid; | |||
opacity: 0.3; | |||
} | |||
.deyClassBox{ | |||
width: 46%; | |||
height: 100%; | |||
float: left; | |||
} | |||
.numBox{ | |||
color: #ffffff; | |||
margin-top: 50rpx; | |||
} | |||
.num{ | |||
float: left; | |||
margin-left: 70rpx; | |||
font-size: 64rpx; | |||
} | |||
.text{ | |||
float: left; | |||
margin-top: 26rpx; | |||
margin-left: 10rpx; | |||
color: #8B94AD; | |||
} | |||
.study{ | |||
color: #8B94AD; | |||
text-align: center; | |||
line-height: 40rpx; | |||
} | |||
.learnTitle{ | |||
height: 60rpx; | |||
line-height: 60rpx; | |||
font-family: OPPOSans; | |||
font-weight: 500; | |||
color: #FFFFFF; | |||
font-size: 32rpx; | |||
margin-bottom: 20rpx; | |||
text-indent: 20rpx; | |||
} | |||
.logo{ | |||
float: left; | |||
width: 43%; | |||
height: 180rpx; | |||
background-color: coral; | |||
border-radius: 10rpx; | |||
} | |||
.particularsBox{ | |||
margin-left: 2%; | |||
width: 55%; | |||
float: left; | |||
} | |||
.h3{ | |||
font-family: PingFang SC; | |||
font-weight: 500; | |||
color: #FEFEFE; | |||
font-size: 32rpx; | |||
height: 40rpx; | |||
line-height: 40rpx; | |||
overflow:hidden; | |||
text-overflow:ellipsis; | |||
display:-webkit-box; | |||
-webkit-box-orient:vertical; | |||
-webkit-line-clamp:1; | |||
} | |||
.overall{ | |||
font-size: 24rpx; | |||
font-family: PingFang SC; | |||
font-weight: 500; | |||
color: #8790A8; | |||
margin: 10rpx 0; | |||
} | |||
.scheduleHie{ | |||
width: 100%; | |||
height: 10rpx; | |||
background-color: #242A3A; | |||
border-radius: 10rpx; | |||
position: relative; | |||
} | |||
.scheduleA{ | |||
position: absolute; | |||
top: 0; | |||
left: 0; | |||
width: 12%; | |||
height: 10rpx; | |||
border-radius: 10rpx; | |||
background-color: #07E881; | |||
} | |||
.classBox{ | |||
padding: 10rpx 0; | |||
margin: 20rpx 0; | |||
} */ | |||
.Box{ | |||
height: 100vh; | |||
overflow: scroll; | |||
min-height: 100vh; | |||
} | |||
.searchF{ | |||
width: 80%; | |||
height: 80rpx; | |||
background-color: rgba(51, 51, 51, 0.5); | |||
border-radius: 60rpx; | |||
margin: 20rpx; | |||
float: left; | |||
} | |||
.searchText{ | |||
width: 80%; | |||
margin: 0 auto; | |||
height: 100%; | |||
color: #ffffff; | |||
} | |||
.searchBtn{ | |||
width: 10%; | |||
line-height: 100rpx; | |||
color: #00ff99; | |||
float: left; | |||
height: 100rpx; | |||
margin-top: 10rpx; | |||
font-size: 30rpx; | |||
} | |||
.classBoxAll{ | |||
margin: 0 20rpx; | |||
} | |||
.classBox{ | |||
margin: 20rpx 0; | |||
} | |||
.logo{ | |||
float: left; | |||
width: 300rpx; | |||
height: 200rpx; | |||
background-color: aquamarine; | |||
border-radius: 12rpx; | |||
} | |||
.textBox{ | |||
float: left; | |||
margin-left: 10px; | |||
} | |||
.titile{ | |||
width: 350rpx; | |||
height: 40rpx; | |||
line-height: 40rpx; | |||
font-size: 36rpx; | |||
font-family: PingFang SC; | |||
font-weight: 500; | |||
color: #FEFEFE; | |||
margin-bottom: 19rpx; | |||
overflow:hidden; | |||
text-overflow:ellipsis; | |||
display:-webkit-box; | |||
-webkit-box-orient:vertical; | |||
-webkit-line-clamp:1 | |||
} | |||
.cont{ | |||
width: 360rpx; | |||
height: 30rpx; | |||
line-height: 30rpx; | |||
font-size: 26rpx; | |||
font-family: PingFang SC; | |||
font-weight: 400; | |||
color: #6E768A; | |||
font-weight: 560; | |||
overflow:hidden; | |||
text-overflow:ellipsis; | |||
display:-webkit-box; | |||
-webkit-box-orient:vertical; | |||
-webkit-line-clamp:1; | |||
} | |||
.moreBox{ | |||
margin-top: 30rpx; | |||
position: relative; | |||
} | |||
.user{ | |||
float: left; | |||
width: 60rpx; | |||
height: 60rpx; | |||
border-radius: 50%; | |||
background-color: beige; | |||
} | |||
.userText{ | |||
width: 200rpx; | |||
text-align: center; | |||
height: 60rpx; | |||
line-height: 60rpx; | |||
background: #222735; | |||
border-radius: 50rpx; | |||
font-family: PingFang SC; | |||
font-weight: 500; | |||
font-size: 26rpx; | |||
color: #8790A8; | |||
} | |||
.show{ | |||
position: absolute; | |||
width: 60rpx; | |||
height: 60rpx; | |||
top:5rpx; | |||
right: 20rpx; | |||
text-align: center; | |||
} | |||
.go{ | |||
width: 40rpx; | |||
height: 10rpx; | |||
} | |||
.noDataBox{ | |||
width: 100%; | |||
height: 600rpx; | |||
top: 300rpx; | |||
left: 0; | |||
background-color: #0E1119; | |||
text-align: center; | |||
} | |||
.noDataImg{ | |||
width: 500rpx; | |||
height: 400rpx; | |||
} | |||
.instrumentBox{ | |||
width: 100%; | |||
background: #1F232E; | |||
border-radius: 30rpx 30rpx 0rpx 0rpx; | |||
height: 200rpx; | |||
position: fixed; | |||
bottom:0; | |||
left: 0; | |||
} | |||
.cancel{ | |||
width: 100%; | |||
line-height: 90rpx; | |||
height: 90rpx; | |||
font-size: 32rpx; | |||
font-family: PingFang SC; | |||
font-weight: 500; | |||
color: #FFFFFF; | |||
border-bottom: 1rpx rgba(255, 255, 255, 0.1) solid; | |||
text-align: center; | |||
} | |||
.hie{ | |||
width: 100%; | |||
line-height: 90rpx; | |||
height: 90rpx; | |||
font-size: 32rpx; | |||
font-family: PingFang SC; | |||
font-weight: 500; | |||
color: #FFFFFF; | |||
text-align: center; | |||
} |
@@ -0,0 +1,231 @@ | |||
const app = getApp() | |||
const config = require("../../config/config") | |||
const Http = require("../../utils/HttpBasics.js") | |||
const navigationBarHeight = (getApp().statusBarHeight + 44)+"px" | |||
Page({ | |||
data: { | |||
imgHttps:app.globalData.imgHttps, | |||
column:[], | |||
topFlag:0, | |||
swiperLsit:[], | |||
inputValue:'', | |||
navigationBarHeight, | |||
deyList:[],//今天推荐 | |||
deyPageNum:1, | |||
classLsit:[],//精选类容 | |||
classpageNum:1, | |||
autho:[],//推荐作者 | |||
authoPageNum:1, | |||
rankingList:[],//热门排行 | |||
rankingPageNum:1, | |||
}, | |||
goXq(e){//跳转详情 | |||
let id = e.currentTarget.dataset.id | |||
let title = e.currentTarget.dataset.title | |||
tt.navigateTo({ | |||
url: `/pages/classDetails/classDetails?id=${id}&title=${title}` // 指定页面的url | |||
}); | |||
}, | |||
goPublicity(e){ | |||
let id = e.currentTarget.dataset.id | |||
let type = e.currentTarget.dataset.type | |||
tt.navigateTo({ | |||
url: `/pages/publicity/publicity?id=${id}&type=${type}` // 指定页面的url | |||
}); | |||
}, | |||
getNweDataLsit(){//今天推荐 | |||
Http.get({ | |||
url:config.api.columnLsit, | |||
data:{ | |||
pageNum:this.data.deyPageNum, | |||
pageSize:4, | |||
sortOrder:"desc" | |||
} | |||
}).then(res=>{ | |||
let temp = this.data.list | |||
if(this.data.pageNum>1){ | |||
temp.push(...res.data.list) | |||
}else{ | |||
temp = res.data.list | |||
} | |||
this.setData({ | |||
deyList:temp | |||
}) | |||
}).catch(err=>{ | |||
tt.showToast({ | |||
title: err.message, // 内容 | |||
icon: "none" | |||
}); | |||
}) | |||
}, | |||
getSwiperLsit(){//获取轮播图 | |||
Http.get({ | |||
url:config.api.getPublicity, | |||
data:{ | |||
pageSize:7, | |||
pageNum:1 | |||
} | |||
}).then(res=>{ | |||
console.log(res.data,"轮播图"); | |||
this.setData({ | |||
swiperLsit:res.data.list | |||
}) | |||
}).catch(err=>{ | |||
tt.showToast({ | |||
title: err.message, // 内容 | |||
icon: "none" | |||
}); | |||
}) | |||
}, | |||
getClassLsit(){//精选课程 | |||
Http.get({ | |||
url:config.api.columnLsit, | |||
data:{ | |||
pageNum:this.data.classpageNum, | |||
pageSize:3, | |||
mark:1, | |||
sortColumn: "markTime", | |||
sortOrder: "desc" | |||
} | |||
}).then(res=>{ | |||
let temp = this.data.list | |||
if(this.data.pageNum>1){ | |||
temp.push(...res.data.list) | |||
}else{ | |||
temp = res.data.list | |||
} | |||
this.setData({ | |||
classLsit:temp | |||
}) | |||
}).catch(err=>{ | |||
tt.showToast({ | |||
title: err.message, // 内容 | |||
icon: "none" | |||
}); | |||
}) | |||
}, | |||
getRanking(){//排行榜 | |||
Http.get({ | |||
url:config.api.columnLsit, | |||
data:{ | |||
pageNum:this.data.rankingPageNum, | |||
pageSize:6, | |||
sortColumn:"popularity", | |||
sortOrder:"desc" | |||
} | |||
}).then(res=>{ | |||
let temp = this.data.list | |||
if(this.data.pageNum>1){ | |||
temp.push(...res.data.list) | |||
}else{ | |||
temp = res.data.list | |||
} | |||
this.setData({ | |||
rankingList:temp | |||
}) | |||
}).catch(err=>{ | |||
tt.showToast({ | |||
title: err.message, // 内容 | |||
icon: "none" | |||
}); | |||
}) | |||
}, | |||
getAuthor(){//推荐作者 | |||
Http.get({ | |||
url:config.api.getAuthor, | |||
data:{ | |||
pageNum:this.data.authoPageNum, | |||
pageSize:4, | |||
mark:1, | |||
sortColumn: "markTime", | |||
sortOrder: "desc" | |||
} | |||
}).then(res=>{ | |||
let text ="" | |||
let arr=res.data.list | |||
if(res.data.list[0].businessTypes){ | |||
arr.map(item1=>{ | |||
JSON.parse(item1.businessTypes).map(item2=>{ | |||
text += " "+item2.title | |||
}) | |||
item1.authoRemark = text | |||
}) | |||
} | |||
console.log(arr); | |||
this.setData({ | |||
autho:arr, | |||
}) | |||
}) | |||
}, | |||
search(){ | |||
console.log(this.data.inputValue); | |||
}, | |||
setTopFlag(e){ | |||
let index = e.currentTarget.dataset.index | |||
let itemId = e.currentTarget.dataset.itemid | |||
console.log(itemId); | |||
this.setData({ | |||
topFlag:index | |||
}) | |||
tt.navigateTo({ | |||
url: `/pages/category/category?itemId=${itemId}` // 指定页面的url | |||
}); | |||
}, | |||
getColumn(){ | |||
Http.get({ | |||
url:config.api.getColumn | |||
}).then(res=>{ | |||
let tempData = res.data | |||
tempData.unshift({ | |||
id:"", | |||
title:"推荐" | |||
}) | |||
this.setData({ | |||
column:tempData | |||
}) | |||
}).catch(err=>{ | |||
tt.showToast({ | |||
title: err.data, // 内容 | |||
}); | |||
}) | |||
}, | |||
getWeapNote(){//初始化 | |||
if (app.globalData.token){//登录 | |||
this.getColumn() | |||
this.getNweDataLsit() | |||
this.getClassLsit() | |||
this.getRanking() | |||
this.getAuthor() | |||
this.getSwiperLsit() | |||
}else{//未登录 | |||
app.tokenCallback = token => { | |||
this.getColumn() | |||
this.getNweDataLsit() | |||
this.getClassLsit() | |||
this.getRanking() | |||
this.getAuthor() | |||
this.getSwiperLsit() | |||
} | |||
} | |||
}, | |||
onLoad: function () { | |||
this.getWeapNote() | |||
}, | |||
onPullDownRefresh() { | |||
this.getColumn() | |||
this.getNweDataLsit() | |||
this.getClassLsit() | |||
this.getRanking() | |||
this.getAuthor() | |||
this.getSwiperLsit() | |||
tt.stopPullDownRefresh(); | |||
}, | |||
}) |
@@ -0,0 +1,8 @@ | |||
{ | |||
"navigationBarTitleText": "首页", | |||
"usingComponents": { | |||
"navbar": "../../components/navbar/navbar" | |||
}, | |||
"enablePullDownRefresh": true | |||
} |
@@ -0,0 +1,353 @@ | |||
<view id="BoxBg"> | |||
<view class="Box"> | |||
<navbar text="首页" background="#0E1119" color="#fff"></navbar> | |||
<view style="height:{{navigationBarHeight}} "></view> | |||
<view class="searchBox"> | |||
<navigator class="searchF" url="/pages/search/search" open-type="" hover-class="className"> | |||
<image class="searchLogo" src="{{imgHttps+'home_ic_ss.png'}}" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload="" /> | |||
<view class="searchText" style="color: #666666;">搜索</view> | |||
</navigator> | |||
</view> | |||
<view class="topBox"> | |||
<view class="TopNavigationBox"> | |||
<view class="item" tt:for="{{column}}" bindtap="setTopFlag" data-index="{{index}}" data-itemid="{{item.id}}"> | |||
<view class=" {{index==topFlag?'title_a':'title'}}">{{item.title}}</view> | |||
<view class="wire" tt:if="{{index==topFlag}}"></view> | |||
</view> | |||
</view> | |||
<image class="logo" src="{{imgHttps+'home_ic_saixuan.png'}}" bindtap="setTopFlag" data-itemid=" "></image> | |||
</view> | |||
<view class="swiperBox" tt:if="{{swiperLsit.length!=0}}"> | |||
<swiper class="swiper" indicator-dots="ture" indicator-color="rgba(255,255,255,.3)" | |||
indicator-active-color="rgba(255,255,255,1)" autoplay="ture" current="0" interval="5000" | |||
duration="{{1000}}" circular="false" previous-margin="false" display-multiple-items="1" | |||
skip-hidden-item-layout="false" vertical="{{false}}"> | |||
<swiper-item class="swiper-item" item-id="" tt:for="{{swiperLsit}}" bindtap="goPublicity" data-type="{{item.type}}" data-id="{{item.id}}"> | |||
<image class="swiperImg" src="{{item.coverImg}}" mode="" /> | |||
</swiper-item> | |||
</swiper> | |||
</view> | |||
<view class="columnBox"> | |||
<navigator class="columnItem" target="" url="/pages/ranking/ranking?type=1&titilText=最新上架" hover-class="navigator-hover" open-type="navigate"> | |||
<image src="{{imgHttps+'home_nav_ic_zxsj.png'}}" class="columnImg" style="width: 90%; height: 70%; margin: 0 5%;"> | |||
</image> | |||
<view class="columnText"> | |||
最新上架 | |||
</view> | |||
</navigator> | |||
<navigator class="columnItem" target="" url="/pages/ranking/ranking?type=2&titilText=精选课程" hover-class="navigator-hover" open-type="navigate"> | |||
<image src="{{imgHttps+'home_nav_ic_jxkc.png'}}" class="columnImg" style="width: 90%; height: 70%; margin: 0 5%;"> | |||
</image> | |||
<view class="columnText"> | |||
精选课程 | |||
</view> | |||
</navigator> | |||
<navigator class="columnItem" target="" url="/pages/ranking/ranking?type=3&titilText=排行榜" hover-class="navigator-hover" | |||
open-type="navigate"> | |||
<image src="{{imgHttps+'home_nav_ic_phb.png'}}" class="columnImg" style="width: 90%; height: 70%; margin: 0 5%;"> | |||
</image> | |||
<view class="columnText"> | |||
排行榜 | |||
</view> | |||
</navigator> | |||
<navigator class="columnItem" target="" url="/pages/category/category" hover-class="navigator-hover" | |||
open-type="navigate"> | |||
<image src="{{imgHttps+'home_nav_ic_qbfl.png'}}" class="columnImg" style="width: 90%; height: 70%; margin: 0 5%;"> | |||
</image> | |||
<view class="columnText"> | |||
全部分类 | |||
</view> | |||
</navigator> | |||
</view> | |||
<!-- 今日推荐--> | |||
<view class="deyBox" tt:if="{{deyList.length!=0}}"> | |||
<view class="deyTitleBox"> | |||
<image class="deyTitleImg" src="{{imgHttps+'home_tab_ic_jrtj.png'}}" | |||
mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload="" /> | |||
<view class="deyTitle"> | |||
今日推荐 | |||
</view> | |||
</view> | |||
<view class="deyImgBox"> | |||
<view class="imgBox" tt:for="{{deyList}}" bindtap="goXq" data-id="{{item.id}}" data-title="{{item.title}}"> | |||
<view class="imgitem"> | |||
<image class="img" src="{{item.coverImg}}" mode="" /> | |||
<view class="posClass"> | |||
{{item.businessName}} | |||
</view> | |||
</view> | |||
<view class="itemTitle"> | |||
投资者-周期 | |||
</view> | |||
</view> | |||
</view> | |||
<!-- <view class="exchangeBox"> | |||
<image class="exchangeImg" src="{{imgHttps+'home_ic_hyh.png'}}" mode="aspectFit|aspectFill|widthFix" | |||
lazy-load="false" binderror="" bindload="" /> | |||
<view class="exchangeText"> | |||
换一换 | |||
</view> | |||
</view> --> | |||
</view> | |||
<!-- 精选内容--> | |||
<view class="handpickBox" tt:if="{{classLsit.length!=0}}"> | |||
<view class="handpickTop"> | |||
<image class="handpickImg" src="{{imgHttps+'home_tab_ic_jxnr.png'}}" | |||
mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload="" /> | |||
<view class="handpickText"> | |||
精选内容 | |||
</view> | |||
</view> | |||
<view class="commodityBox" tt:for="{{classLsit}}" bindtap="goXq" data-id="{{item.id}}" data-title="{{item.title}}"> | |||
<view class="commodityImg"> | |||
<image class="classBoxImg" src="{{item.coverImg}}" mode="" /> | |||
<view class="newPopularity oh"> | |||
<image class="popularityImg" style="margin-left: 50rpx;" src="{{imgHttps+'home_ic_renq.png'}}" | |||
mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload="" /> | |||
<view class="popularityText"> | |||
最近人气 | |||
</view> | |||
<view class="popularityNum"> | |||
{{item.popularity}} | |||
</view> | |||
</view> | |||
</view> | |||
<view class="describeBox"> | |||
<view class="describeBame"> | |||
{{item.title}} | |||
</view> | |||
<view class="authorBox1"> | |||
<image class="headImg" src="{{item.merchantPic}}" mode="" /> | |||
<view class="annotation"> | |||
{{item.merchantName}} | |||
</view> | |||
<view class="priceBox"> | |||
<view class="priceF" tt:if="{{item.salePriceStr!=0}}"> | |||
¥ | |||
</view> | |||
<view class="price" tt:if="{{item.salePriceStr!=0}}"> | |||
{{item.salePriceStr}} | |||
</view> | |||
<view class="price" tt:if="{{item.salePriceStr==0}}"> | |||
免费 | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
<view class="extendBox"> | |||
<navigator class="extendMoreBox oh" target="" url="/pages/ranking/ranking?type=2&titilText=精选课程" hover-class="navigator-hover" | |||
open-type="navigate"> | |||
<image | |||
style="width: 40rpx;height: 40rpx;margin-top: 15rpx;margin-left: 80rpx;float: left; color: #8790A8;font-size: 30rpx;" | |||
src="{{imgHttps+'home_ic_ckgd.png'}}" mode="aspectFit|aspectFill|widthFix" lazy-load="false" | |||
binderror="" bindload="" /> | |||
<view style="line-height: 70rpx;margin-left: 20rpx;float: left;"> | |||
查看更多 | |||
</view> | |||
</navigator> | |||
<!-- <view class="changeBox"> | |||
<image | |||
style="width: 40rpx;height: 40rpx;margin-top: 15rpx;margin-left: 80rpx;float: left; color: #8790A8;font-size: 30rpx;" | |||
src="{{imgHttps+'home_ic_hyh.png'}}" mode="aspectFit|aspectFill|widthFix" lazy-load="false" | |||
binderror="" bindload="" /> | |||
<view style="line-height: 70rpx;margin-left: 20rpx;float: left;"> | |||
换一换 | |||
</view> | |||
</view> --> | |||
</view> | |||
</view> | |||
<!--推荐作者 --> | |||
<view class="deyBox author" tt:if="{{autho.length!=0}}"> | |||
<view class="deyTitleBox"> | |||
<image class="deyTitleImg" src="{{imgHttps+'home_tab_tjzz.png'}}" mode="aspectFit|aspectFill|widthFix" | |||
lazy-load="false" binderror="" bindload="" /> | |||
<view class="deyTitle"> | |||
推荐作者 | |||
</view> | |||
</view> | |||
<view class="authorBox"> | |||
<navigator class="authorItem" tt:for="{{autho}}" url="/pages/UpHome/UpHome?id={{item.id}}&name={{item.name}}" open-type="" hover-class="className"> | |||
<image class="authorImgTop" src="{{item.imgUrl}}" mode="" /> | |||
<view class="nameBox"> | |||
<view class="authorName"> | |||
{{item.name}} | |||
</view> | |||
<view class="authorText"> | |||
{{item.authoRemark}} | |||
</view> | |||
</view> | |||
</navigator> | |||
</view> | |||
</view> | |||
<view class="rankingBox" tt:if="{{rankingList.length!=0}}"> | |||
<view class="handpickTop"> | |||
<image class="handpickImg" src="{{imgHttps+'home_tab_ic_rmph.png'}}" | |||
mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload="" /> | |||
<view class="handpickText"> | |||
热门排行 | |||
</view> | |||
</view> | |||
<view class="sortBox"> | |||
<view class="sortItemBox" tt:for="{{rankingList}}" bindtap="goXq" data-id="{{item.id}}" data-title="{{item.title}}"> | |||
<view class="sortItemImg"> | |||
<image class="" src="{{item.coverImg}}" mode="" /> | |||
<view class="{{index <=3?'sortNumBj_'+index:'sortNumBj_3'}}"> | |||
{{index+1}} | |||
</view> | |||
</view> | |||
<view class="sortTitle"> | |||
{{item.title}} | |||
</view> | |||
<view class="popularityBox oh"> | |||
<image class="popularityImg" src="{{imgHttps+'home_ic_renq.png'}}" | |||
mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload="" /> | |||
<view class="popularityText"> | |||
人 气 | |||
</view> | |||
<view class="popularityNum"> | |||
{{item.popularity}} | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
<!-- <view class="exchangeBox"> | |||
<image class="exchangeImg" src="{{imgHttps+'home_ic_ckgd.png'}}" mode="aspectFit|aspectFill|widthFix" | |||
lazy-load="false" binderror="" bindload="" /> | |||
<view class="exchangeText"> | |||
换一换 | |||
</view> | |||
</view> --> | |||
</view> | |||
<view class="handpickBox" tt:if="{{deyList.length!=0}}"> | |||
<view class="handpickTop"> | |||
<image class="handpickImg" src="{{imgHttps+'home_tab_ic_new.png'}}" mode="aspectFit|aspectFill|widthFix" | |||
lazy-load="false" binderror="" bindload="" /> | |||
<view class="handpickText"> | |||
最新内容 | |||
</view> | |||
</view> | |||
<view class="commodityBox" tt:for="{{deyList}}" bindtap="goXq" data-id="{{item.id}}" data-title="{{item.title}}"> | |||
<view class="commodityImg"> | |||
<image class="commodityImage" src="{{item.coverImg}}" mode="" /> | |||
<view class="newPopularity oh"> | |||
<image class="popularityImg" style="margin-left: 50rpx;" src="{{imgHttps+'home_ic_renq.png'}}" | |||
mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload="" /> | |||
<view class="popularityText"> | |||
最近人气 | |||
</view> | |||
<view class="popularityNum"> | |||
{{item.popularity}} | |||
</view> | |||
</view> | |||
</view> | |||
<view class="describeBox"> | |||
<view class="describeBame"> | |||
{{item.title}} | |||
</view> | |||
<view class="authorBox1"> | |||
<image class="headImg" src="{{item.merchantPic}}" mode="" /> | |||
<view class="annotation"> | |||
{{item.merchantName}} | |||
</view> | |||
<view class="priceBox"> | |||
<view class="priceF" tt:if="{{item.salePriceStr!=0}}"> | |||
¥ | |||
</view> | |||
<view class="price" tt:if="{{item.salePriceStr!=0}}"> | |||
{{item.salePriceStr}} | |||
</view> | |||
<view class="price" tt:if="{{item.salePriceStr==0}}"> | |||
免费 | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
<view class="extendBox"> | |||
<navigator class="extendMoreBox oh" target="" url="/pages/ranking/ranking?type=1&titilText=最新上架" hover-class="navigator-hover" | |||
open-type="navigate"> | |||
<image | |||
style="width: 40rpx;height: 40rpx;margin-top: 15rpx;margin-left: 80rpx;float: left; color: #8790A8;font-size: 30rpx;" | |||
src="{{imgHttps+'home_ic_ckgd.png'}}" mode="aspectFit|aspectFill|widthFix" lazy-load="false" | |||
binderror="" bindload="" /> | |||
<view style="line-height: 70rpx;margin-left: 20rpx;float: left;"> | |||
查看更多 | |||
</view> | |||
</navigator> | |||
<!-- <view class="changeBox"> | |||
<image | |||
style="width: 40rpx;height: 40rpx;margin-top: 15rpx;margin-left: 80rpx;float: left; color: #8790A8;font-size: 30rpx;" | |||
src="{{imgHttps+'home_ic_hyh.png'}}" mode="aspectFit|aspectFill|widthFix" lazy-load="false" | |||
binderror="" bindload="" /> | |||
<view style="line-height: 70rpx;margin-left: 20rpx;float: left;"> | |||
换一换 | |||
</view> | |||
</view> --> | |||
</view> | |||
</view> | |||
</view> | |||
</view> |
@@ -0,0 +1,594 @@ | |||
.BoxBg{ | |||
background-color: #000033; | |||
overflow: hidden; | |||
font-size: 28rpx; | |||
min-height: 100vh; | |||
} | |||
.Box{ | |||
width: 96%; | |||
margin: 0 2%; | |||
} | |||
.topBox{ | |||
height: 70rpx; | |||
color: #666666; | |||
margin-top: 10rpx; | |||
} | |||
.TopNavigationBox{ | |||
width: 90%; | |||
height: 100%; | |||
overflow: hidden; | |||
overflow-y: hidden; | |||
overflow-x: auto; | |||
white-space: nowrap; | |||
float: left; | |||
} | |||
.TopNavigationBox::-webkit-scrollbar { | |||
display: none; | |||
} | |||
.logo{ | |||
width: 32rpx; | |||
float: right; | |||
height: 36rpx; | |||
float: left; | |||
margin-top: 10rpx; | |||
margin-left: 12rpx; | |||
} | |||
.item{ | |||
width: 80rpx; | |||
margin: 0 20rpx; | |||
position: relative; | |||
display: inline-block; | |||
text-align: center; | |||
} | |||
.title_a{ | |||
font-size: 34rpx; | |||
color: #00cc99; | |||
} | |||
.title{ | |||
color: #666666; | |||
} | |||
.wire{ | |||
width: 70%; | |||
margin: 10rpx auto; | |||
height: 2rpx; | |||
background-color: #00cc99; | |||
} | |||
.searchBox{ | |||
overflow: hidden; | |||
} | |||
.searchText{ | |||
color: #666666; | |||
line-height: 80rpx; | |||
} | |||
.searchF{ | |||
width: 90%; | |||
height: 80rpx; | |||
background-color: rgba(51, 51, 51, 0.5); | |||
border-radius: 60rpx; | |||
margin: 20rpx auto; | |||
} | |||
.searchLogo{ | |||
width: 40rpx; | |||
height: 40rpx; | |||
float: left; | |||
margin: 20rpx 10rpx 15rpx 60rpx; | |||
} | |||
.searchText{ | |||
float: left; | |||
width: 80%; | |||
margin: 0 auto; | |||
height: 100%; | |||
color: #ffffff; | |||
} | |||
.swiperBox{ | |||
margin: 30rpx 0; | |||
border-radius: 10rpx; | |||
} | |||
.swiper{ | |||
height: 320rpx; | |||
} | |||
.swiperImg{ | |||
width: 100%; | |||
height: 100%; | |||
background-color: chocolate; | |||
border-radius: 10rpx; | |||
} | |||
.columnBox{ | |||
height: 180rpx; | |||
padding: 40rpx 0 ; | |||
display: flex; | |||
justify-content: center; | |||
} | |||
.columnItem{ | |||
width: 20%; | |||
margin: 0 auto; | |||
} | |||
.columnText{ | |||
color: #ffffff; | |||
text-align: center; | |||
line-height: 40rpx; | |||
} | |||
.deyBox{ | |||
overflow: hidden; | |||
} | |||
.deyTitleBox{ | |||
/* overflow: hidden; */margin: 20rpx 0; | |||
} | |||
.deyTitleImg{ | |||
width: 60rpx; | |||
height: 70rpx; | |||
float: left; | |||
margin: 0 10rpx; | |||
} | |||
.deyTitle{ | |||
font-size: 36rpx; | |||
color:#ffffff; | |||
font-weight: 700; | |||
padding: 10rpx 0 30rpx 0 ; | |||
margin-left: 10rpx; | |||
letter-spacing:4rpx; | |||
} | |||
.authorBox1{ | |||
margin-top: 20rpx; | |||
} | |||
.authorImgTop{ | |||
width: 150rpx; | |||
height: 150rpx; | |||
background-color: #00cc99; | |||
border-radius: 50%; | |||
margin: 40rpx auto; | |||
} | |||
.deyImgBox{ | |||
display: flex; | |||
/* justify-content: space-around; */ | |||
flex-wrap :wrap; | |||
} | |||
/* .authorOutsideBox{ | |||
width: 100%; | |||
height: 400rpx; | |||
} */ | |||
.authorBox{ | |||
height: 380rpx; | |||
overflow: hidden; | |||
display: -webkit-box; | |||
overflow-x: scroll; | |||
-webkit-overflow-scrolling: touch; | |||
} | |||
.authorBox::-webkit-scrollbar { | |||
display: none; | |||
} | |||
.authorItem{ | |||
width: 32%; | |||
/* height: 400rpx; */ | |||
margin: 0 2%; | |||
border-radius: 10rpx 10rpx 10rpx 40rpx; | |||
text-align: center; | |||
background-image: -webkit-linear-gradient(top, #103930, #121620); | |||
} | |||
.imgBox{ | |||
width: 46%; | |||
overflow: hidden; | |||
display: inline-block; | |||
text-align: center; | |||
margin: 0 2%; | |||
/* height: 400rpx; */ | |||
} | |||
.imgitem{ | |||
position: relative; | |||
} | |||
.imgitem .img{ | |||
width: 100%; | |||
/* background-color: chartreuse; */ | |||
height: 200rpx; | |||
border-radius: 10rpx; | |||
} | |||
.posClass{ | |||
position: absolute; | |||
right: 0; | |||
top: 0; | |||
width: 70rpx; | |||
height: 40rpx; | |||
background-image: url('https://formall.oss-accelerate.aliyuncs.com/douyin/drawable-xhdpi/home_bnt_bq.png'); | |||
background-size:70rpx 40rpx; | |||
color: #ffffff; | |||
font-size: 24rpx; | |||
z-index: 100000; | |||
} | |||
.imgBox .itemTitle{ | |||
height: 60rpx; | |||
line-height: 60rpx; | |||
text-align: center; | |||
color: #ffffff; | |||
font-size: 30rpx; | |||
} | |||
.handpickBox{ | |||
overflow: hidden; | |||
} | |||
.handpickTop{ | |||
overflow: hidden; | |||
margin: 40rpx 0 ; | |||
} | |||
.handpickImg{ | |||
width: 60rpx; | |||
height: 70rpx; | |||
float: left; | |||
margin: 0 10rpx; | |||
} | |||
.handpickText{ | |||
font-size: 36rpx; | |||
color:#ffffff; | |||
font-weight: 700; | |||
height: 36rpx; | |||
padding: 10rpx 0 30rpx 0 ; | |||
margin-left: 10rpx; | |||
float: left; | |||
letter-spacing:4rpx | |||
} | |||
.handpickadd{ | |||
float: right; | |||
color: #00cc99; | |||
font-size: 30rrpx; | |||
margin: 10rpx 20rpx; | |||
} | |||
.handpickLogo{ | |||
width: 50rpx; | |||
height: 50rpx; | |||
float: right; | |||
background-color: #00cc99; | |||
margin-top: 10rpx; | |||
margin-right: 20rpx; | |||
border-radius: 50%; | |||
color: #ffffff; | |||
text-align: center; | |||
line-height: 50rpx; | |||
font-size: 36rpx; | |||
} | |||
.commodityBox{ | |||
overflow: hidden; | |||
margin-bottom: 30rpx; | |||
} | |||
.extendBox{ | |||
overflow: hidden; | |||
margin: 40rpx 0; | |||
} | |||
.extendMoreBox{ | |||
float: left; | |||
width: 45%; | |||
height: 70rpx; | |||
margin-right: 5%; | |||
background-color: #1A1D26; | |||
border-radius: 30rpx; | |||
} | |||
.changeBox { | |||
margin-left: 5%; | |||
float: left; | |||
background-color: #1A1D26; | |||
border-radius: 30rpx; | |||
width: 45%; | |||
height: 70rpx; | |||
} | |||
.commodityImg{ | |||
position: relative; | |||
width: 320rpx; | |||
background-color: chocolate; | |||
border-radius: 10rpx; | |||
height: 200rpx; | |||
float: left; | |||
margin-left: 10rpx; | |||
} | |||
.commodityImage{ | |||
width: 100%; | |||
height: 100%; | |||
border-radius: 10rpx; | |||
} | |||
.classBoxImg{ | |||
width: 100%; | |||
height: 100%; | |||
border-radius: 10rpx; | |||
} | |||
.describeBox{ | |||
width: 360rpx; | |||
margin-left: 30rpx; | |||
float: left; | |||
} | |||
.describeBame{ | |||
width: 80%; | |||
height: 50rpx; | |||
line-height: 50rpx; | |||
font-size: 34rpx; | |||
color: #ffffff; | |||
font-weight: 560; | |||
overflow:hidden; | |||
text-overflow:ellipsis; | |||
display:-webkit-box; | |||
-webkit-box-orient:vertical; | |||
-webkit-line-clamp:1; | |||
} | |||
.headImgBox{ | |||
float: left; | |||
} | |||
.headImg{ | |||
float: left; | |||
width: 60rpx; | |||
height: 60rpx; | |||
border-radius: 50%; | |||
background-color: #00cc99; | |||
} | |||
.annotation{ | |||
width: 240rpx; | |||
border-radius: 50rpx; | |||
height: 60rpx; | |||
background-color: #333; | |||
text-align: center; | |||
line-height: 60rpx; | |||
color: #9999cc; | |||
} | |||
.introduce{ | |||
width: 96%; | |||
margin-top: 20rpx; | |||
color: #9999cc; | |||
height: 86rpx; | |||
line-height: 40rpx; | |||
overflow:hidden; | |||
text-overflow:ellipsis; | |||
display:-webkit-box; | |||
-webkit-box-orient:vertical; | |||
-webkit-line-clamp:2; | |||
} | |||
.priceBox{ | |||
margin-top: 20rpx; | |||
overflow: hidden; | |||
} | |||
.priceF{ | |||
float: left; | |||
color: #ff3366; | |||
line-height: 60rpx; | |||
} | |||
.price{ | |||
font-size: 34rpx; | |||
color: #ff3366; | |||
float: left; | |||
line-height: 60rpx; | |||
} | |||
.popularity{ | |||
width: 180rpx; | |||
height: 60rpx; | |||
float: right; | |||
margin-right: 60rpx; | |||
margin-top: 10rpx; | |||
background-color: chocolate; | |||
} | |||
.exchangeText{ | |||
float: left; | |||
color: #8790A8; | |||
line-height: 70rpx; | |||
margin-left: 20rpx; | |||
font-size: 30rpx; | |||
} | |||
.exchangeBox{ | |||
width: 90%; | |||
margin: 20rpx auto; | |||
height: 70rpx; | |||
line-height: 70rpx; | |||
border-radius: 50rpx; | |||
text-align: center; | |||
background: #1A1D26; | |||
} | |||
.exchangeImg{ | |||
width: 40rpx; | |||
height: 40rpx; | |||
margin-top: 15rpx ; | |||
margin-left: 260rpx; | |||
float: left; | |||
} | |||
.exchangeBtn{ | |||
float: left; | |||
width: 50rpx; | |||
height: 50rpx; | |||
margin: 5rpx 0 0 20rpx; | |||
background-color: cornflowerblue; | |||
} | |||
.authorImgBox{ | |||
background-color: rgba(51, 51, 51, 0.5); | |||
height: 360rpx; | |||
border-radius: 40rpx; | |||
overflow: hidden; | |||
} | |||
.nameBox{ | |||
height: 140rpx; | |||
background-color: rgba(51, 51, 51,0.6); | |||
border-radius: 0rpx 40rpx 0rpx 40rpx; | |||
} | |||
.authorName{ | |||
height: 60rpx; | |||
line-height: 60rpx; | |||
text-align: center; | |||
color: #ffffff; | |||
font-size: 36rpx; | |||
font-weight: 600; | |||
} | |||
.authorText{ | |||
width: 90%; | |||
margin: 0 auto; | |||
color: #9999cc; | |||
height: 60rpx; | |||
line-height: 60rpx; | |||
text-align: center; | |||
overflow:hidden; | |||
text-overflow:ellipsis; | |||
display:-webkit-box; | |||
-webkit-box-orient:vertical; | |||
-webkit-line-clamp:1; | |||
} | |||
.rankingBox{ | |||
margin: 20rpx 0; | |||
} | |||
.sortBox{ | |||
overflow: hidden; | |||
} | |||
.sortNmu{ | |||
width: 18%; | |||
background-color: aqua; | |||
height: 360rpx; | |||
float: left; | |||
} | |||
.articleBox{ | |||
width: 82%; | |||
height: 360rpx; | |||
float: left; | |||
} | |||
.articleImg{ | |||
width: 40%; | |||
height: 100%; | |||
background-color: blueviolet; | |||
border-radius: 10rpx; | |||
float: left; | |||
} | |||
.articleTextBox{ | |||
float: left; | |||
width: 58%; | |||
margin-left: 2%; | |||
height: 100%; | |||
border-radius: 10rpx; | |||
} | |||
.articleTitle{ | |||
font-size: 34rpx; | |||
color: #ffffff; | |||
font-weight: 560; | |||
} | |||
.articlePopularity{ | |||
width: 180rpx; | |||
height: 60rpx; | |||
float: right; | |||
margin-right: 20rpx; | |||
margin-top: 10rpx; | |||
background-color: chocolate; | |||
} | |||
.sortItemBox{ | |||
width: 31%; | |||
margin: 20rpx 1%; | |||
float: left; | |||
} | |||
.sortItemImg{ | |||
position: relative; | |||
width: 100%; | |||
height: 160rpx; | |||
border-radius: 10rpx; | |||
} | |||
.sortItemImg image{ | |||
width: 100%; | |||
height: 100%; | |||
border-radius: 10rpx; | |||
} | |||
.sortNumBj_0{ | |||
position: absolute; | |||
width: 52rpx; | |||
height: 65rpx; | |||
background-image: url('https://formall.oss-accelerate.aliyuncs.com/douyin/drawable-xhdpi/home_rmph_ic_1.png'); | |||
background-size:52rpx 65rpx; | |||
color: #ffffff; | |||
text-align: center; | |||
line-height: 46rpx; | |||
top: 0; | |||
left: 0; | |||
} | |||
.sortNumBj_1{ | |||
position: absolute; | |||
width: 52rpx; | |||
height: 65rpx; | |||
background-image: url('https://formall.oss-accelerate.aliyuncs.com/douyin/drawable-xhdpi/home_rmph_ic_2.png'); | |||
background-size:52rpx 65rpx; | |||
color: #ffffff; | |||
text-align: center; | |||
line-height: 46rpx; | |||
top: 0; | |||
left: 0; | |||
} | |||
.sortNumBj_2{ | |||
position: absolute; | |||
width: 52rpx; | |||
height: 65rpx; | |||
background-image: url('https://formall.oss-accelerate.aliyuncs.com/douyin/drawable-xhdpi/home_rmph_ic_3.png'); | |||
background-size:52rpx 65rpx; | |||
color: #ffffff; | |||
text-align: center; | |||
line-height: 46rpx; | |||
top: 0; | |||
left: 0; | |||
} | |||
.sortNumBj_3{ | |||
position: absolute; | |||
width: 52rpx; | |||
height: 65rpx; | |||
background-image: url('https://formall.oss-accelerate.aliyuncs.com/douyin/drawable-xhdpi/home_rmph_ic_4.png'); | |||
background-size:52rpx 65rpx; | |||
color: #ffffff; | |||
text-align: center; | |||
line-height: 46rpx; | |||
top: 0; | |||
left: 0; | |||
} | |||
.sortTitle{ | |||
height: 40rpx; | |||
line-height: 40rpx; | |||
font-size: 32rpx; | |||
color: #FEFEFE; | |||
overflow:hidden; | |||
text-overflow:ellipsis; | |||
display:-webkit-box; | |||
-webkit-box-orient:vertical; | |||
-webkit-line-clamp:1; | |||
margin: 10rpx 0; | |||
} | |||
.popularityBox { | |||
padding: 10rpx 0; | |||
} | |||
.popularityImg{ | |||
float: left; | |||
width: 23rpx; | |||
height: 26rpx; | |||
margin-top: 8rpx; | |||
margin-left: 5rpx; | |||
} | |||
.popularityText{ | |||
float: left; | |||
font-size: 26rpx; | |||
margin: 0 10rpx; | |||
} | |||
.popularityNum{ | |||
float: left; | |||
color: #07E881; | |||
font-size: 26rpx; | |||
} | |||
.newPopularity{ | |||
width: 100%; | |||
position: absolute; | |||
bottom: 0; | |||
left: 10; | |||
background-color: #222735; | |||
height: 40rpx; | |||
border-radius: 0 0 10rpx 10rpx ; | |||
} |
@@ -0,0 +1,10 @@ | |||
const app = getApp() | |||
const config = require("../../config/config") | |||
const Http = require("../../utils/HttpBasics.js") | |||
const navigationBarHeight = (getApp().statusBarHeight + 44)+"px" | |||
Page({ | |||
data:{ | |||
imgHttps:app.globalData.imgHttps, | |||
navigationBarHeight, | |||
} | |||
}) |
@@ -0,0 +1,6 @@ | |||
{ | |||
"navigationBarTitleText": "我的关注", | |||
"usingComponents": { | |||
"navbar": "../../components/navbar/navbar" | |||
} | |||
} |
@@ -0,0 +1,91 @@ | |||
const app = getApp() | |||
const config = require("../../config/config") | |||
const Http = require("../../utils/HttpBasics.js") | |||
const navigationBarHeight = (getApp().statusBarHeight + 44) + "px" | |||
Page({ | |||
data: { | |||
imgHttps: app.globalData.imgHttps, | |||
navigationBarHeight, | |||
inputValue: '', | |||
pageNum: 1, | |||
list: [], | |||
showFlog:false, | |||
id:"",//选中id | |||
}, | |||
setSearchValue(e) { | |||
let value = e.detail.value | |||
this.setData({ | |||
inputValue: value | |||
}) | |||
}, | |||
searchBtn() { | |||
this.setData({ | |||
list: [], | |||
pageNum: 1 | |||
}) | |||
this.search() | |||
}, | |||
cancel(){ | |||
Http.get({ | |||
url:config.api.Fcollect, | |||
data:{ | |||
id:this.data.id | |||
} | |||
}).then(res=>{{ | |||
tt.showToast({ | |||
title: '已取消收藏', // 内容 | |||
icon: "none" | |||
}); | |||
}}).catch(err=>{ | |||
tt.showToast({ | |||
title: err.message, // 内容 | |||
icon:"none" | |||
}); | |||
}) | |||
}, | |||
hie(){ | |||
this.setData({ | |||
showFlog:false | |||
}) | |||
}, | |||
showHie(e){ | |||
let id = e.currentTarget.dataset.id | |||
this.setData({ | |||
showFlog:true, | |||
id:id | |||
}) | |||
}, | |||
search() { | |||
Http.get({ | |||
url: config.api.mainCollet, | |||
data: { | |||
title: this.data.inputValue, | |||
pageNum: this.data.pageNum, | |||
pageSize: 8 | |||
} | |||
}).then(res => { | |||
console.log(res); | |||
let temp = this.data.list | |||
if (this.data.pageNum > 1) { | |||
temp.push(res.data.list) | |||
this.setData({ | |||
list: temp | |||
}) | |||
} else { | |||
this.setData({ | |||
list: res.data.list | |||
}) | |||
} | |||
}) | |||
}, | |||
onLoad() { | |||
this.search() | |||
}, | |||
onReachBottom: function() { | |||
this.setData({ | |||
pageNum:this.data.pageNum+1 | |||
}) | |||
this.search() | |||
} | |||
}) |
@@ -0,0 +1,6 @@ | |||
{ | |||
"navigationBarTitleText": "我的收藏", | |||
"usingComponents": { | |||
"navbar": "../../components/navbar/navbar" | |||
} | |||
} |
@@ -0,0 +1,49 @@ | |||
<view id="BoxBg"> | |||
<view class="Box"> | |||
<navbar back text="我的收藏" background="#0E1119" color="#fff"></navbar> | |||
<view style="height:{{navigationBarHeight}} "></view> | |||
<view class="Hierecommend"> | |||
<view class="searchBox oh"> | |||
<view class="searchF"> | |||
<input type="text" class="searchText" placeholder-style="color: #666666;" placeholder="搜索" | |||
bindconfirm="search" bindinput="setSearchValue" confirm-type="search" /> | |||
</view> | |||
<view class="searchBtn" bindtap="searchBtn"> | |||
搜索 | |||
</view> | |||
</view> | |||
</view> | |||
<view class="classBoxAll"> | |||
<navigator url="/pages/classDetails/classDetails?id={{item.id}}&title={{item.title}}" open-type="" hover-class="className" tt:for="{{list}}" class="classBox oh"> | |||
<image class="logo" src="{{item.coverImg}}" mode="" /> | |||
<view class="textBox"> | |||
<view class="titile">{{item.title}}</view> | |||
<!-- <view class="cont">{{item.}}</view> --> | |||
<view class="moreBox oh"> | |||
<image class="user" src="{{item.merchantPic}}" mode="" /> | |||
<view class="userText">{{item.merchantName}}</view> | |||
<view class="show" catchtap="showHie" data-id="{{item.id}}"> | |||
<image class="go" src="{{imgHttps+'mesc_gd.png'}}" mode="" /> | |||
</view> | |||
</view> | |||
</view> | |||
</navigator> | |||
<view class="noDataBox" tt:if="{{list.length==0}}" > | |||
<image class="noDataImg" src="{{imgHttps+'no_favorite.png'}}" mode="" /> | |||
</view> | |||
</view> | |||
</view> | |||
<view class="instrumentBox" tt:if="{{showFlog}}"> | |||
<view class="cancel" bindtap="cancel">取消收藏</view> | |||
<view class="hie" bindtap="hie">取消</view> | |||
</view> | |||
</view> |
@@ -0,0 +1,151 @@ | |||
.Box{ | |||
height: 100vh; | |||
overflow: scroll; | |||
min-height: 100vh; | |||
} | |||
.searchF{ | |||
width: 80%; | |||
height: 80rpx; | |||
background-color: rgba(51, 51, 51, 0.5); | |||
border-radius: 60rpx; | |||
margin: 20rpx; | |||
float: left; | |||
} | |||
.searchText{ | |||
width: 80%; | |||
margin: 0 auto; | |||
height: 100%; | |||
color: #ffffff; | |||
} | |||
.searchBtn{ | |||
width: 10%; | |||
line-height: 100rpx; | |||
color: #00ff99; | |||
float: left; | |||
height: 100rpx; | |||
margin-top: 10rpx; | |||
font-size: 30rpx; | |||
} | |||
.classBoxAll{ | |||
margin: 0 20rpx; | |||
} | |||
.classBox{ | |||
margin: 20rpx 0; | |||
} | |||
.logo{ | |||
float: left; | |||
width: 300rpx; | |||
height: 200rpx; | |||
border-radius: 12rpx; | |||
} | |||
.textBox{ | |||
float: left; | |||
margin-left: 10px; | |||
} | |||
.titile{ | |||
width: 350rpx; | |||
height: 40rpx; | |||
line-height: 40rpx; | |||
font-size: 36rpx; | |||
font-family: PingFang SC; | |||
font-weight: 500; | |||
color: #FEFEFE; | |||
margin-bottom: 19rpx; | |||
overflow:hidden; | |||
text-overflow:ellipsis; | |||
display:-webkit-box; | |||
-webkit-box-orient:vertical; | |||
-webkit-line-clamp:1 | |||
} | |||
.cont{ | |||
width: 360rpx; | |||
height: 30rpx; | |||
line-height: 30rpx; | |||
font-size: 26rpx; | |||
font-family: PingFang SC; | |||
font-weight: 400; | |||
color: #6E768A; | |||
font-weight: 560; | |||
overflow:hidden; | |||
text-overflow:ellipsis; | |||
display:-webkit-box; | |||
-webkit-box-orient:vertical; | |||
-webkit-line-clamp:1; | |||
} | |||
.moreBox{ | |||
margin-top: 30rpx; | |||
position: relative; | |||
} | |||
.user{ | |||
float: left; | |||
width: 60rpx; | |||
height: 60rpx; | |||
border-radius: 50%; | |||
background-color: beige; | |||
} | |||
.userText{ | |||
width: 200rpx; | |||
text-align: center; | |||
height: 60rpx; | |||
line-height: 60rpx; | |||
background: #222735; | |||
border-radius: 50rpx; | |||
font-family: PingFang SC; | |||
font-weight: 500; | |||
font-size: 26rpx; | |||
color: #8790A8; | |||
} | |||
.show{ | |||
position: absolute; | |||
width: 60rpx; | |||
height: 60rpx; | |||
top:5rpx; | |||
right: 20rpx; | |||
text-align: center; | |||
} | |||
.go{ | |||
width: 40rpx; | |||
height: 10rpx; | |||
} | |||
.noDataBox{ | |||
width: 100%; | |||
height: 600rpx; | |||
top: 300rpx; | |||
left: 0; | |||
background-color: #0E1119; | |||
text-align: center; | |||
} | |||
.noDataImg{ | |||
width: 500rpx; | |||
height: 400rpx; | |||
} | |||
.instrumentBox{ | |||
width: 100%; | |||
background: #1F232E; | |||
border-radius: 30rpx 30rpx 0rpx 0rpx; | |||
height: 200rpx; | |||
position: fixed; | |||
bottom:0; | |||
left: 0; | |||
} | |||
.cancel{ | |||
width: 100%; | |||
line-height: 90rpx; | |||
height: 90rpx; | |||
font-size: 32rpx; | |||
font-family: PingFang SC; | |||
font-weight: 500; | |||
color: #FFFFFF; | |||
border-bottom: 1rpx rgba(255, 255, 255, 0.1) solid; | |||
text-align: center; | |||
} | |||
.hie{ | |||
width: 100%; | |||
line-height: 90rpx; | |||
height: 90rpx; | |||
font-size: 32rpx; | |||
font-family: PingFang SC; | |||
font-weight: 500; | |||
color: #FFFFFF; | |||
text-align: center; | |||
} |
@@ -0,0 +1,168 @@ | |||
const app = getApp() | |||
const navigationBarHeight = (getApp().statusBarHeight + 44) + "px" | |||
const config = require("../../config/config") | |||
const util = require("../../utils/util"); | |||
const Http = require("../../utils/HttpBasics.js") | |||
Page({ | |||
data: { | |||
navigationBarHeight, | |||
imgHttps: app.globalData.imgHttps, | |||
pitch: 0,//选中支付类型 | |||
orderLsit: [],//订单列表 | |||
pageNum: 1, | |||
statusLsit: [ | |||
{ | |||
value: 0, | |||
name: "待支付" | |||
}, | |||
{ | |||
value: 1, | |||
name: "已支付" | |||
} | |||
], | |||
}, | |||
goClass(e){ | |||
let id = e.currentTarget.dataset.id | |||
let title = e.currentTarget.dataset.title | |||
tt.navigateTo({ | |||
url: `/pages/classDetails/classDetails?id=${id}&title=${title}` // 指定页面的url | |||
}); | |||
}, | |||
setPitch(e) { | |||
let index = e.currentTarget.dataset.index | |||
this.setData({ | |||
pitch: index, | |||
pageNum:1 | |||
}) | |||
this.getOrder() | |||
}, | |||
goPay(e){ | |||
let id = e.currentTarget.dataset.id | |||
Http.post({//拿orderInfo | |||
url: config.api.pay, | |||
data: { | |||
orderId: id | |||
} | |||
}).then(item => { | |||
console.log(item, "orderId"); | |||
tt.pay({ | |||
service: 5, | |||
orderInfo: { | |||
order_id: item.data.orderId, | |||
order_token: item.data.token, | |||
}, | |||
success(res) { | |||
if (res.code === 0) { | |||
tt.showToast({ | |||
title: '支付成功!', // 内容 | |||
}); | |||
// 支付成功处理逻辑,只有res.code=0时,才表示支付成功 | |||
// 但是最终状态要以商户后端结果为准 | |||
} else if (res.code === 1) { | |||
tt.showToast({ | |||
title: '支付超时', // 内容 | |||
icon: "none" | |||
}); | |||
Http.post({ | |||
url: config.api.ifPayOk, | |||
data: { | |||
code: 1, | |||
orderId: res.data.id | |||
} | |||
}) | |||
} else if (res.code === 2) { | |||
tt.showToast({ | |||
title: '支付失败', // 内容 | |||
icon: "none" | |||
}); | |||
} else if (res.code === 3) { | |||
tt.showToast({ | |||
title: '支付关闭', // 内容 | |||
icon: "none" | |||
}); | |||
} else if (res.code === 4) { | |||
tt.showToast({ | |||
title: '支付取消', // 内容 | |||
icon: "none" | |||
}); | |||
} else if (res.code === 9) { | |||
tt.showToast({ | |||
title: '订单状态开发者自行获取', // 内容 | |||
icon: "none" | |||
}); | |||
} | |||
}, | |||
fail(res) { | |||
// handle fail | |||
}, | |||
}) | |||
}).catch(err => { | |||
tt.showToast({ | |||
title: '唤起支付失败', // 内容 | |||
icon: "none" | |||
}); | |||
}) | |||
}, | |||
getOrder() {//查询订单 | |||
//ORDER_STATUS_PENDING_PAYMENT(0, "待付款"), | |||
// ORDER_STATUS_PAYMENT_ING(1,"支付中"), | |||
// ORDER_STATUS_PAYMENT_SUCCESS(2, "已支付"), | |||
// ORDER_STATUS_OVERTIME_CANCEL(3, "已取消"), | |||
// ORDER_STATUS_PENDING_REFUND(4, "待退款"), | |||
// ORDER_STATUS_REFUND_SUCCESS(5,"已退款"), | |||
// ORDER_STATUS_REFUND_FAILD(6, "退款失败"), | |||
let tempArr = [] | |||
if (this.data.pitch == 0) {//待付款 | |||
tempArr.push(...[0, 1, 3]) | |||
} else {//已支付 | |||
tempArr.push(...[2, 4, 5, 6]) | |||
} | |||
console.log(tempArr); | |||
Http.get({ | |||
url: config.api.getOrderLsit, | |||
data: { | |||
pageNum: this.data.pageNum, | |||
pageSize: 3, | |||
statusS: tempArr | |||
} | |||
}).then(res => { | |||
let arr = res.data.list | |||
arr.map(item=>{ | |||
item.createDate = util.formatTime(item.createDate, "yyyy-MM-dd hh:mm:ss") | |||
}) | |||
if(this.data.pageNum>1){ | |||
let tempLsit = this.data.orderLsit | |||
tempLsit.push(...arr) | |||
this.setData({ | |||
orderLsit:tempLsit | |||
}) | |||
}else{ | |||
this.setData({ | |||
orderLsit:arr | |||
}) | |||
} | |||
}).catch(err=>{ | |||
tt.showToast({ | |||
title: err.message, // 内容 | |||
icon: "none" | |||
}); | |||
}) | |||
}, | |||
onLoad() { | |||
this.getOrder() | |||
}, | |||
onSshow(){ | |||
this.getOrder() | |||
}, | |||
onReachBottom(){ | |||
console.log("到底了"); | |||
this.setData({ | |||
pageNum:this.data.pageNum +1 | |||
}) | |||
this.getOrder() | |||
} | |||
}) |
@@ -0,0 +1,6 @@ | |||
{ | |||
"navigationBarTitleText": "我的订单", | |||
"usingComponents": { | |||
"navbar": "../../components/navbar/navbar" | |||
} | |||
} |
@@ -0,0 +1,73 @@ | |||
<view id="BoxBg"> | |||
<view class="Box"> | |||
<navbar back text="我的订单" background="#0E1119" color="#fff"></navbar> | |||
<view style="height:{{navigationBarHeight}} "></view> | |||
<view class="navigation oh"> | |||
<view class="fPay" tt:for="{{statusLsit}}"> | |||
<view class="{{pitch==item.value?'aText':'Text'}} " bindtap="setPitch" data-index="{{item.value}}" > | |||
{{item.name}} | |||
</view> | |||
<view class="Axian" tt:if="{{pitch==item.value}}"> | |||
</view> | |||
</view> | |||
</view> | |||
<view class="orderBox oh" tt:for="{{orderLsit}}" bindtap="goClass" data-title="{{item.title}}" data-id="{{item.productId}}"> | |||
<view class="orderNum"> | |||
订单编号:{{item.id}} | |||
</view> | |||
<view class="classBox oh" > | |||
<image src="{{item.productPic}}" class="img" mode="" /> | |||
<view class="courseBox oh"> | |||
<view class="h3"> | |||
{{item.productTitle}} | |||
</view> | |||
<image class="headImg" src="{{item.authorPic}}" mode="" /> | |||
<view class="name"> | |||
{{item.author}} | |||
</view> | |||
<view class="priceBox"> | |||
<view class="priceF"> | |||
¥ | |||
</view> | |||
<view class="price"> | |||
{{item.paymentStr}} | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
<view class="timeBox oh"> | |||
<view class="timeTitile "> | |||
<view class="time">订单时间:{{item.createDate}}</view> | |||
<view class="payTiem"> | |||
{{item.paymentTime?item.paymentTime:'请您在30分支之内支付'}} | |||
</view> | |||
</view> | |||
<view class="payBtn" catchtap="goPay" data-id="{{item.id}}" tt:if="{{item.orderStatus==0}}"> | |||
付款 | |||
</view> | |||
<view class="payOk" tt:if="{{item.orderStatus==2}}"> | |||
已完成 | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
@@ -0,0 +1,149 @@ | |||
.BoxBg{ | |||
min-height: 100vh; | |||
} | |||
.navigation{ | |||
height: 120rpx; | |||
border-bottom: 1rpx #232835 solid; | |||
} | |||
.fPay{ | |||
width: 50%; | |||
float: left; | |||
} | |||
.tPay{ | |||
width: 50%; | |||
float: left; | |||
} | |||
.aText{ | |||
margin-top: 20rpx; | |||
font-size: 36rpx; | |||
font-family: PingFang SC; | |||
font-weight: 800; | |||
color: #07E881; | |||
text-align: center; | |||
} | |||
.Axian{ | |||
width: 70rpx; | |||
height: 4rpx; | |||
background-color: #07E881; | |||
margin: 10rpx auto; | |||
} | |||
.classBox{ | |||
width: 90%; | |||
margin: 20rpx auto; | |||
padding-bottom: 20rpx; | |||
border-bottom: 1rpx #232835 solid; | |||
} | |||
.Text{ | |||
margin-top: 20rpx; | |||
font-size: 32rpx; | |||
font-family: PingFang SC; | |||
font-weight: 500; | |||
color: #FFFFFF; | |||
text-align: center; | |||
} | |||
.orderBox{ | |||
border-radius: 20rpx; | |||
background-color: #181C28; | |||
margin: 40rpx 0 0 0; | |||
} | |||
.orderNum{ | |||
clear: #8790A8; | |||
line-height: 70rpx; | |||
width: 90%; | |||
margin: 20rpx auto; | |||
border-bottom: 1rpx #232835 solid; | |||
} | |||
.img{ | |||
float: left; | |||
width: 250rpx; | |||
height: 160rpx; | |||
border-radius: 10rpx; | |||
background-color: coral; | |||
} | |||
.courseBox { | |||
margin-left: 30rpx; | |||
float: left; | |||
} | |||
.h3{ | |||
width: 300rpx; | |||
line-height: 60rpx; | |||
font-size: 34rpx; | |||
color: #ffffff; | |||
font-weight: 560; | |||
overflow:hidden; | |||
text-overflow:ellipsis; | |||
display:-webkit-box; | |||
-webkit-box-orient:vertical; | |||
-webkit-line-clamp:1; | |||
} | |||
.headImg{ | |||
width: 60rpx; | |||
height: 60rpx; | |||
border-radius: 50%; | |||
background-color: coral; | |||
float: left; | |||
} | |||
.name{ | |||
width: 220rpx; | |||
line-height: 60rpx; | |||
height: 60rpx; | |||
border-radius: 50rpx; | |||
color: #8790A8; | |||
text-align: center; | |||
background-color: #222735; | |||
} | |||
.priceBox{ | |||
/* margin-top: 20rpx; */ | |||
overflow: hidden; | |||
} | |||
.priceF{ | |||
float: left; | |||
color: #ff3366; | |||
line-height: 60rpx; | |||
} | |||
.price{ | |||
font-size: 34rpx; | |||
color: #ff3366; | |||
float: left; | |||
line-height: 60rpx; | |||
} | |||
.timeBox{ | |||
width: 90%; | |||
margin: 20rpx auto; | |||
} | |||
.timeTitile{ | |||
float: left; | |||
} | |||
.payTiem{ | |||
line-height: 80rpx; | |||
font-size: 32rpx; | |||
font-family: PingFang SC; | |||
font-weight: 500; | |||
color: #FC4758; | |||
} | |||
.payBtn{ | |||
float: right; | |||
width: 180rpx; | |||
line-height: 80rpx; | |||
text-align: center; | |||
border: 2rpx solid #06D176; | |||
border-radius: 50rpx; | |||
color: #06D176; | |||
} | |||
.payOk{ | |||
float: right; | |||
width: 180rpx; | |||
line-height: 80rpx; | |||
text-align: center; | |||
border: 2rpx solid #666D80; | |||
border-radius: 50rpx; | |||
color: #666D80; | |||
background-color: rgba(135, 144, 168, 0.1);; | |||
} |
@@ -0,0 +1,70 @@ | |||
const app = getApp() | |||
const config = require("../../config/config") | |||
const Http = require("../../utils/HttpBasics.js") | |||
const navigationBarHeight = (getApp().statusBarHeight + 44)+"px" | |||
var WxParse = require('../../wxParse/wxParse.js'); | |||
Page({ | |||
data:{ | |||
imgHttps:app.globalData.imgHttps, | |||
navigationBarHeight, | |||
allLsit:"", | |||
id:"", | |||
type:"", | |||
}, | |||
getData(){ | |||
Http.get({ | |||
url:config.api.getPublicityDetail, | |||
data:{id:this.data.id} | |||
}).then(res=>{ | |||
this.setData({ | |||
allLsit:res.data | |||
}) | |||
}).catch(err=>{ | |||
tt.showToast({ | |||
title: err.message, // 内容 | |||
icon: "none" | |||
}); | |||
}) | |||
}, | |||
getHtml(id ,that){ | |||
tt.request({ | |||
url: 'https://ttctest.malls.iformall.com/tt/api/wxCampaign/printHtmlById', // 目标服务器url | |||
data:{ | |||
token: app.globalData.token, | |||
id:id, | |||
date: new Date() | |||
}, | |||
header: { | |||
'content-type': 'application/html' | |||
}, | |||
success: (res) => { | |||
var temp = WxParse.wxParse('article', 'html', res.data, that, 5); | |||
} | |||
}); | |||
}, | |||
goXq(e){//跳转详情 | |||
let id = e.currentTarget.dataset.id | |||
let title = e.currentTarget.dataset.title | |||
tt.navigateTo({ | |||
url: `/pages/classDetails/classDetails?id=${id}&title=${title}` // 指定页面的url | |||
}); | |||
}, | |||
onLoad:function (params) { | |||
const that = this; | |||
console.log(params.id); | |||
if(params.id &¶ms.type==1){//宣传页 | |||
that.setData({ | |||
id:params.id, | |||
type:params.type | |||
}) | |||
that.getData() | |||
}else if(params.id &¶ms.type==2){//图文 | |||
that.setData({ | |||
id:params.id, | |||
type:params.type | |||
}) | |||
that.getHtml(params.id,that) | |||
} | |||
}, | |||
}) |
@@ -0,0 +1,6 @@ | |||
{ | |||
"navigationBarTitleText": "我的关注", | |||
"usingComponents": { | |||
"navbar": "../../components/navbar/navbar" | |||
} | |||
} |
@@ -0,0 +1,50 @@ | |||
<view id="BoxBg"> | |||
<view class="Box"> | |||
<navbar back text="详情" background="#0E1119" color="#fff"></navbar> | |||
<view style="height:{{navigationBarHeight}} "></view> | |||
<image class="logoBox" src="{{allLsit.coverImg}}" mode="" tt:if="{{type==1}}"/> | |||
<view class="explainBox" tt:if="{{type==1}}"> | |||
<view class="zText">{{allLsit.title}}</view> | |||
<view class="fText">{{allLsit.subTitle}}</view> | |||
<view class="aivi">活动说明</view> | |||
<view class="fText">{{allLsit.detail}}</view> | |||
</view> | |||
<view class="courseBoxAll" tt:if="{{type==1}}"> | |||
<view class="courseBox oh" tt:for="{{allLsit.ttCoupons}}" bindtap="goXq" data-id="{{item.id}}" data-title="{{item.title}}"> | |||
<image class="cover" src="{{item.coverImg}}" mode="" /> | |||
<view class="courseItem"> | |||
<view class="courseName"> | |||
{{item.title}} | |||
</view> | |||
<view class="oh" style="margin-top: 20rpx;"> | |||
<image class="headImg" src="{{item.merchantPic}}" mode="" /> | |||
<view class="annotation"> | |||
{{item.merchantName}} | |||
</view> | |||
</view> | |||
<view class="incomeBox oh"> | |||
<view class="py" tt:if="{{item.salePriceStr!=0}}"> | |||
¥ | |||
</view> | |||
<view class="money" tt:if="{{item.salePriceStr!=0}}">{{item.salePriceStr}}</view> | |||
<view class="money" tt:if="{{item.salePriceStr==0}}"> | |||
{{"免费"}} | |||
</view> | |||
<view class="moodsNum">{{item.popularity}}</view> | |||
<view class="moodsText">人气</view> | |||
<image class="moodsImg" src="{{imgHttps+'home_ic_renq.png'}}" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload="" /> | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
<import src="../../wxParse/wxParse.wxml" tt:if="{{type==2}}"/> | |||
<view class="content" tt:if="{{type==2}}"> | |||
<template is="wxParse" data="{{wxParseData:article.nodes}}" /> | |||
</view> | |||
</view> | |||
</view> |
@@ -0,0 +1,170 @@ | |||
#BoxBg{ | |||
background-color: #0E1119; | |||
overflow: hidden; | |||
font-size: 28rpx; | |||
min-height: 100vh; | |||
} | |||
.logoBox{ | |||
width: 100%; | |||
height: 280rpx; | |||
border-radius: 20rpx; | |||
margin-top: 10rpx; | |||
} | |||
.courseBoxAll{ | |||
width: 100%; | |||
overflow: hidden; | |||
background-color: #0E1119; | |||
z-index: 1000000; | |||
} | |||
.explainBox{ | |||
overflow: hidden; | |||
border-radius: 20rpx; | |||
background-color: rgba(255, 255, 255, 0.1); | |||
margin: 50rpx 0; | |||
} | |||
.zText{ | |||
font-size: 34rpx; | |||
width: 90%; | |||
line-height: 40rpx; | |||
line-height: 40rpx; | |||
color: #ffffff; | |||
margin: 10rpx auto; | |||
} | |||
.fText{ | |||
width: 90%; | |||
line-height: 40rpx; | |||
line-height: 40rpx; | |||
margin: 10rpx auto; | |||
} | |||
.aivi{ | |||
font-size: 34rpx; | |||
width: 90%; | |||
line-height: 40rpx; | |||
line-height: 40rpx; | |||
color: #ffffff; | |||
margin: 10rpx auto; | |||
} | |||
.courseBox{ | |||
margin: 20rpx 0; | |||
} | |||
.cover{ | |||
width: 300rpx; | |||
height: 200rpx; | |||
float: left; | |||
border-radius: 10rpx; | |||
/* background-color: cornflowerblue; */ | |||
margin-right: 20rpx; | |||
margin-left: 20rpx; | |||
} | |||
.courseItem{ | |||
width: 380rpx; | |||
float: left; | |||
} | |||
.courseName{ | |||
height: 50rpx; | |||
line-height: 50rpx; | |||
font-size: 32rpx; | |||
overflow:hidden; | |||
text-overflow:ellipsis; | |||
display:-webkit-box; | |||
-webkit-box-orient:vertical; | |||
-webkit-line-clamp:1; | |||
color: #ffffff; | |||
} | |||
.headImg{ | |||
float: left; | |||
width: 60rpx; | |||
height: 60rpx; | |||
border-radius: 50%; | |||
background-color: #00cc99; | |||
} | |||
.annotation{ | |||
width: 240rpx; | |||
border-radius: 50rpx; | |||
height: 60rpx; | |||
background-color: #333; | |||
text-align: center; | |||
line-height: 60rpx; | |||
color: #9999cc; | |||
} | |||
.incomeBox{ | |||
margin-top: 10rpx; | |||
} | |||
.money{ | |||
float: left; | |||
color: #ff3366; | |||
font-size: 34rpx; | |||
} | |||
.py{ | |||
font-size: 26rpx; | |||
float: left; | |||
color: #ff3366; | |||
line-height: 46rpx; | |||
} | |||
.moodsImg{ | |||
float: right; | |||
width: 30rpx; | |||
height: 30rpx; | |||
margin-top: 8rpx; | |||
/* background-color: cornflowerblue; */ | |||
} | |||
.moodsText{ | |||
float: right; | |||
color: #ffffff; | |||
margin: 0 10rpx; | |||
} | |||
.moodsNum{ | |||
float: right; | |||
color: #00cc99; | |||
} | |||
.sortNumBj_0{ | |||
position: absolute; | |||
width: 52rpx; | |||
height: 65rpx; | |||
background-image: url('https://formall.oss-accelerate.aliyuncs.com/douyin/drawable-xhdpi/home_rmph_ic_1.png'); | |||
background-size:52rpx 65rpx; | |||
color: #ffffff; | |||
text-align: center; | |||
line-height: 46rpx; | |||
top: 0rpx; | |||
left: 20rpx; | |||
} | |||
.sortNumBj_1{ | |||
position: absolute; | |||
width: 52rpx; | |||
height: 65rpx; | |||
background-image: url('https://formall.oss-accelerate.aliyuncs.com/douyin/drawable-xhdpi/home_rmph_ic_2.png'); | |||
background-size:52rpx 65rpx; | |||
color: #ffffff; | |||
text-align: center; | |||
line-height: 46rpx; | |||
top: 0rpx; | |||
left: 20rpx; | |||
} | |||
.sortNumBj_2{ | |||
position: absolute; | |||
width: 52rpx; | |||
height: 65rpx; | |||
background-image: url('https://formall.oss-accelerate.aliyuncs.com/douyin/drawable-xhdpi/home_rmph_ic_3.png'); | |||
background-size:52rpx 65rpx; | |||
color: #ffffff; | |||
text-align: center; | |||
line-height: 46rpx; | |||
top: 0rpx; | |||
left: 20rpx; | |||
} | |||
.sortNumBj_3{ | |||
position: absolute; | |||
width: 52rpx; | |||
height: 65rpx; | |||
background-image: url('https://formall.oss-accelerate.aliyuncs.com/douyin/drawable-xhdpi/home_rmph_ic_4.png'); | |||
background-size:52rpx 65rpx; | |||
color: #ffffff; | |||
text-align: center; | |||
line-height: 46rpx; | |||
top: 0rpx; | |||
left: 20rpx; | |||
} |
@@ -0,0 +1,130 @@ | |||
const app = getApp() | |||
const navigationBarHeight = (getApp().statusBarHeight + 44)+"px" | |||
const config = require("../../config/config") | |||
const Http = require("../../utils/HttpBasics.js") | |||
Page({ | |||
data:{ | |||
navigationBarHeight, | |||
imgHttps:app.globalData.imgHttps, | |||
titilText:"",//顶部标题 | |||
type:"",//标题类型 | |||
pageNum:1, | |||
list:[], | |||
}, | |||
goXq(e){//跳转详情 | |||
let id = e.currentTarget.dataset.id | |||
let title = e.currentTarget.dataset.title | |||
tt.navigateTo({ | |||
url: `/pages/classDetails/classDetails?id=${id}&title=${title}` // 指定页面的url | |||
}); | |||
}, | |||
getNweDataLsit(){//最新上架 | |||
Http.get({ | |||
url:config.api.columnLsit, | |||
data:{ | |||
pageNum:this.data.pageNum, | |||
pageSize:10, | |||
sortOrder:"desc" | |||
} | |||
}).then(res=>{ | |||
let temp = this.data.list | |||
if(this.data.pageNum>1){ | |||
temp.push(...res.data.list) | |||
}else{ | |||
temp = res.data.list | |||
} | |||
this.setData({ | |||
list:temp | |||
}) | |||
}).catch(err=>{ | |||
tt.showToast({ | |||
title: err.message, // 内容 | |||
icon: "none" | |||
}); | |||
}) | |||
}, | |||
getClassLsit(){//精选课程 | |||
Http.get({ | |||
url:config.api.columnLsit, | |||
data:{ | |||
pageNum:this.data.pageNum, | |||
pageSize:10, | |||
mark:1, | |||
sortColumn: "markTime", | |||
sortOrder: "desc" | |||
} | |||
}).then(res=>{ | |||
let temp = this.data.list | |||
if(this.data.pageNum>1){ | |||
temp.push(...res.data.list) | |||
}else{ | |||
temp = res.data.list | |||
} | |||
this.setData({ | |||
list:temp | |||
}) | |||
}).catch(err=>{ | |||
tt.showToast({ | |||
title: err.message, // 内容 | |||
icon: "none" | |||
}); | |||
}) | |||
}, | |||
getRanking(){//排行榜 | |||
Http.get({ | |||
url:config.api.columnLsit, | |||
data:{ | |||
pageNum:this.data.pageNum, | |||
pageSize:10, | |||
sortColumn:"popularity", | |||
sortOrder:"desc" | |||
} | |||
}).then(res=>{ | |||
let temp = this.data.list | |||
if(this.data.pageNum>1){ | |||
temp.push(...res.data.list) | |||
}else{ | |||
temp = res.data.list | |||
} | |||
this.setData({ | |||
list:temp | |||
}) | |||
}).catch(err=>{ | |||
tt.showToast({ | |||
title: err.message, // 内容 | |||
icon: "none" | |||
}); | |||
}) | |||
}, | |||
onLoad:function (params) { | |||
// console.log(params.titilText,params.type); | |||
this.setData({ | |||
titilText:params.titilText, | |||
type:params.type | |||
}) | |||
if(this.data.type==1){ | |||
this.getNweDataLsit() | |||
}else if(this.data.type==2){ | |||
this.getClassLsit() | |||
}else{ | |||
this.getRanking() | |||
} | |||
}, | |||
onReachBottom: function() { | |||
this.setData({ | |||
pageNum:this.data.pageNum+1 | |||
}) | |||
if(this.data.type==1){ | |||
this.getNweDataLsit() | |||
}else if(this.data.type==2){ | |||
this.getClassLsit() | |||
}else{ | |||
this.getRanking() | |||
} | |||
} | |||
}) |
@@ -0,0 +1,6 @@ | |||
{ | |||
"navigationBarTitleText": "排行榜", | |||
"usingComponents": { | |||
"navbar": "../../components/navbar/navbar" | |||
} | |||
} |
@@ -0,0 +1,53 @@ | |||
<view id="BoxBg"> | |||
<view class="BoxA"> | |||
<navbar back text="{{titilText}}" background="#0E1119" color="#fff"></navbar> | |||
<view style="height:{{navigationBarHeight}} "></view> | |||
<view class="logoBox"> | |||
<view class="logo"></view> | |||
<view class="logoText">{{titilText}} </view> | |||
</view> | |||
<view class="courseBoxAll"> | |||
<view class="courseBox oh" tt:for="{{list}}" bindtap="goXq" data-id="{{item.id}}" data-title="{{item.title}}"> | |||
<image class="cover" src="{{item.coverImg}}" mode="" /> | |||
<view class="{{index <=3?'sortNumBj_'+index:'sortNumBj_3'}}"> | |||
{{index+1}} | |||
</view> | |||
<view class="courseItem"> | |||
<view class="courseName"> | |||
{{item.title}} | |||
</view> | |||
<view class="oh" style="margin-top: 20rpx;"> | |||
<image class="headImg" src="{{item.merchantPic}}" mode="" /> | |||
<view class="annotation"> | |||
{{item.merchantName}} | |||
</view> | |||
</view> | |||
<view class="incomeBox oh"> | |||
<view class="py" tt:if="{{item.salePriceStr!=0}}"> | |||
¥ | |||
</view> | |||
<view class="money" tt:if="{{item.salePriceStr!=0}}">{{item.salePriceStr}}</view> | |||
<view class="money" tt:if="{{item.salePriceStr==0}}"> | |||
{{"免费"}} | |||
</view> | |||
<view class="moodsNum">{{item.popularity}}</view> | |||
<view class="moodsText">人气</view> | |||
<image class="moodsImg" src="{{imgHttps+'home_ic_renq.png'}}" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload="" /> | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
@@ -0,0 +1,166 @@ | |||
.BoxBg{ | |||
min-height: 100vh; | |||
} | |||
.logoBox{ | |||
position: relative; | |||
width: 100%; | |||
} | |||
.logo{ | |||
width: 100%; | |||
height: 480rpx; | |||
border-radius: 10rpx; | |||
background-image: url('https://formall.oss-accelerate.aliyuncs.com/douyin/drawable-xhdpi/leaderboard_bnt.png'); | |||
background-size: 100% 480rpx; | |||
background-position: 0 -1500rpx; | |||
} | |||
.logoText{ | |||
position: absolute; | |||
width: 187rpx; | |||
height: 58rpx; | |||
border-radius: 29rpx; | |||
background: #07E881; | |||
border-radius: 29rpx; | |||
color: #ffffff; | |||
text-align: center; | |||
top: 200rpx; | |||
left: 30rpx; | |||
z-index: 100000; | |||
font-size: 30rpx; | |||
font-family: PingFang SC; | |||
font-weight: 500; | |||
line-height: 58rpx; | |||
} | |||
.courseBoxAll{ | |||
width: 100%; | |||
position: absolute; | |||
overflow: hidden; | |||
margin-top: -160rpx; | |||
background-color: #0E1119; | |||
z-index: 1000000; | |||
} | |||
.courseBox{ | |||
margin: 20rpx 0; | |||
position: relative; | |||
} | |||
.cover{ | |||
width: 300rpx; | |||
height: 200rpx; | |||
float: left; | |||
border-radius: 10rpx; | |||
/* background-color: cornflowerblue; */ | |||
margin-right: 20rpx; | |||
margin-left: 20rpx; | |||
} | |||
.courseItem{ | |||
width: 380rpx; | |||
float: left; | |||
} | |||
.courseName{ | |||
height: 50rpx; | |||
line-height: 50rpx; | |||
font-size: 32rpx; | |||
overflow:hidden; | |||
text-overflow:ellipsis; | |||
display:-webkit-box; | |||
-webkit-box-orient:vertical; | |||
-webkit-line-clamp:1; | |||
color: #ffffff; | |||
} | |||
.headImg{ | |||
float: left; | |||
width: 60rpx; | |||
height: 60rpx; | |||
border-radius: 50%; | |||
background-color: #00cc99; | |||
} | |||
.annotation{ | |||
width: 240rpx; | |||
border-radius: 50rpx; | |||
height: 60rpx; | |||
background-color: #333; | |||
text-align: center; | |||
line-height: 60rpx; | |||
color: #9999cc; | |||
} | |||
.incomeBox{ | |||
margin-top: 10rpx; | |||
} | |||
.money{ | |||
float: left; | |||
color: #ff3366; | |||
font-size: 34rpx; | |||
} | |||
.py{ | |||
font-size: 26rpx; | |||
float: left; | |||
color: #ff3366; | |||
line-height: 46rpx; | |||
} | |||
.moodsImg{ | |||
float: right; | |||
width: 30rpx; | |||
height: 30rpx; | |||
margin-top: 8rpx; | |||
/* background-color: cornflowerblue; */ | |||
} | |||
.moodsText{ | |||
float: right; | |||
color: #ffffff; | |||
margin: 0 10rpx; | |||
} | |||
.moodsNum{ | |||
float: right; | |||
color: #00cc99; | |||
} | |||
.sortNumBj_0{ | |||
position: absolute; | |||
width: 52rpx; | |||
height: 65rpx; | |||
background-image: url('https://formall.oss-accelerate.aliyuncs.com/douyin/drawable-xhdpi/home_rmph_ic_1.png'); | |||
background-size:52rpx 65rpx; | |||
color: #ffffff; | |||
text-align: center; | |||
line-height: 46rpx; | |||
top: 0rpx; | |||
left: 20rpx; | |||
} | |||
.sortNumBj_1{ | |||
position: absolute; | |||
width: 52rpx; | |||
height: 65rpx; | |||
background-image: url('https://formall.oss-accelerate.aliyuncs.com/douyin/drawable-xhdpi/home_rmph_ic_2.png'); | |||
background-size:52rpx 65rpx; | |||
color: #ffffff; | |||
text-align: center; | |||
line-height: 46rpx; | |||
top: 0rpx; | |||
left: 20rpx; | |||
} | |||
.sortNumBj_2{ | |||
position: absolute; | |||
width: 52rpx; | |||
height: 65rpx; | |||
background-image: url('https://formall.oss-accelerate.aliyuncs.com/douyin/drawable-xhdpi/home_rmph_ic_3.png'); | |||
background-size:52rpx 65rpx; | |||
color: #ffffff; | |||
text-align: center; | |||
line-height: 46rpx; | |||
top: 0rpx; | |||
left: 20rpx; | |||
} | |||
.sortNumBj_3{ | |||
position: absolute; | |||
width: 52rpx; | |||
height: 65rpx; | |||
background-image: url('https://formall.oss-accelerate.aliyuncs.com/douyin/drawable-xhdpi/home_rmph_ic_4.png'); | |||
background-size:52rpx 65rpx; | |||
color: #ffffff; | |||
text-align: center; | |||
line-height: 46rpx; | |||
top: 0rpx; | |||
left: 20rpx; | |||
} |
@@ -0,0 +1,111 @@ | |||
const app = getApp() | |||
const config = require("../../config/config") | |||
const Http = require("../../utils/HttpBasics.js") | |||
const navigationBarHeight = (getApp().statusBarHeight + 44)+"px" | |||
Page({ | |||
data:{ | |||
imgHttps:app.globalData.imgHttps, | |||
navigationBarHeight, | |||
activityFlag:0, | |||
pageNum:1, | |||
inputValue:"", | |||
list:[], | |||
}, | |||
setSearchValue(e){ | |||
let value = e.detail.value | |||
this.setData({ | |||
inputValue:value | |||
}) | |||
}, | |||
setActiviy(e){ | |||
let index = e.currentTarget.dataset.index | |||
this.setData({ | |||
activityFlag:index, | |||
pageNum:1, | |||
inputValue:"", | |||
}) | |||
this.search() | |||
}, | |||
goXq(e){//跳转详情 | |||
let id = e.currentTarget.dataset.id | |||
let title = e.currentTarget.dataset.title | |||
tt.navigateTo({ | |||
url: `/pages/classDetails/classDetails?id=${id}&title=${title}` // 指定页面的url | |||
}); | |||
}, | |||
searchBtn(){ | |||
this.setData({ | |||
pageNum:1, | |||
list:[], | |||
}) | |||
this.search() | |||
}, | |||
search(){//查询 | |||
let url = "" | |||
let data="" | |||
if(this.data.activityFlag==0){//课程 | |||
url = config.api.columnLsit | |||
data = { | |||
title:this.data.inputValue, | |||
pageNum:this.data.pageNum, | |||
pageSize:8 | |||
} | |||
}else{//作者 | |||
url = config.api.getAuthor | |||
data = { | |||
name:this.data.inputValue, | |||
pageNum:this.data.pageNum, | |||
pageSize:8 | |||
} | |||
} | |||
Http.get({ | |||
url:url, | |||
data:data | |||
}).then(res=>{ | |||
let arr = [] | |||
if(res.data.list[0].businessTypes){ | |||
arr = res.data.list | |||
let sting = "" | |||
arr.map(item=>{ | |||
if(item.businessTypes){ | |||
item.authoRemark = JSON.parse(item.businessTypes)[0].title | |||
} | |||
}) | |||
let tempArr = this.data.list | |||
if(this.data.pageNum>1){ | |||
tempArr.push(...arr) | |||
this.setData({ | |||
list:tempArr | |||
}) | |||
}else{ | |||
this.setData({ | |||
list:arr | |||
}) | |||
} | |||
}else{ | |||
if(this.pageNum>1){ | |||
let tempArr = this.data.list | |||
tempArr.push(...res.data.list) | |||
this.setData({ | |||
list:tempArr | |||
}) | |||
}else{ | |||
this.setData({ | |||
list:res.data.list | |||
}) | |||
} | |||
} | |||
}) | |||
}, | |||
onLoad(){ | |||
this.search() | |||
}, | |||
onReachBottom:function(){ | |||
this.setData({ | |||
pageNum:this.data.pageNum+1 | |||
}) | |||
} | |||
}) |
@@ -0,0 +1,6 @@ | |||
{ | |||
"navigationBarTitleText": "搜索", | |||
"usingComponents": { | |||
"navbar": "../../components/navbar/navbar" | |||
} | |||
} |
@@ -0,0 +1,144 @@ | |||
<view id="BoxBg"> | |||
<view class="Box"> | |||
<navbar back text="搜索" background="#0E1119" color="#fff"></navbar> | |||
<view style="height:{{navigationBarHeight}} "></view> | |||
<view class="Hierecommend" > | |||
<view class="searchBox oh"> | |||
<view class="searchF"> | |||
<input type="text" class="searchText" placeholder-style="color: #666666;" placeholder="搜索" | |||
bindconfirm="search" bindinput="setSearchValue" confirm-type="search" /> | |||
</view> | |||
<view class="searchBtn" bindtap="searchBtn"> | |||
搜索 | |||
</view> | |||
</view> | |||
<view class="recommendBox oh" tt:if="{{false}}"> | |||
<view class="recommendTitleBox oh"> | |||
<view class="recommendLogo"></view> | |||
<view class="recommendText">推荐搜索</view> | |||
</view> | |||
<view class="recommend oh" > | |||
<view class="recommendItem" tt:for="{{6}}"> | |||
锻炼的协调,炼的协调炼的协调炼的协调 | |||
</view> | |||
</view> | |||
</view> | |||
<view class="author oh" tt:if="{{false}}"> | |||
<view class="recommendTitleBox oh"> | |||
<view class="recommendLogo"></view> | |||
<view class="recommendText">推荐搜索</view> | |||
</view> | |||
<view class="authorItemBox"> | |||
<view class="authorItem" tt:for="{{6}}"> | |||
<view class="portrait"> | |||
</view> | |||
<view class="name"> | |||
张三 | |||
</view> | |||
<view class="categoryBox oh"> | |||
<view class="categoryTtem" tt:for="{{2}}"> | |||
金融 | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
<view class="contentBox oh"> | |||
<view class="navigationBox oh"> | |||
<view class=" course"> | |||
<view class="{{activityFlag==0?'titleA':'title'}} " bindtap="setActiviy" data-index="{{0}}"> | |||
课程 | |||
</view> | |||
<view class="xian" tt:if="{{activityFlag==0}}"> | |||
</view> | |||
</view> | |||
<view class="cAuthor"> | |||
<view class="{{activityFlag==1?'titleA':'title'}} " bindtap="setActiviy"data-index="{{1}}"> | |||
作者 | |||
</view> | |||
<view class="xian" tt:if="{{activityFlag==1}}"> | |||
</view> | |||
</view> | |||
</view> | |||
<view class="orderBidBox oh"> | |||
<view class="orderBox oh" tt:for="{{list}}" tt:if="{{activityFlag==0}}" bindtap="goXq" data-id="{{item.id}}" data-title="{{item.title}}"> | |||
<view class="classBox oh" > | |||
<image class="img" src="{{item.coverImg}}" mode="" /> | |||
<view class="courseBox oh"> | |||
<view class="h3"> | |||
{{item.title}} | |||
</view> | |||
<image src="{{item.merchantPic}}" mode="" class="headImg" /> | |||
<view class="name"> | |||
{{item.merchantName}} | |||
</view> | |||
<view class="priceBox"> | |||
<view class="priceF"> | |||
¥ | |||
</view> | |||
<view class="price"> | |||
{{item.salePriceStr}} | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
<navigator url="/pages/UpHome/UpHome?id={{item.id}}&name={{item.name}}" class="authorBox oh" tt:if="{{activityFlag==1}}" tt:for="{{list}}"> | |||
<image class="userHead" src="{{item.imgUrl}}" mode="" /> | |||
<view class="userNameBox"> | |||
<view class="userName"> | |||
{{item.name}} | |||
</view> | |||
<view class="typeBox oh"> | |||
<view class="type"> | |||
{{item.authoRemark}} | |||
</view> | |||
<!-- <view class="shuXian"> | |||
</view> | |||
<view class="bean"> | |||
1058万粉丝 | |||
</view> --> | |||
</view> | |||
</view> | |||
<!-- <view class="attentionBox"> | |||
+ 关注 | |||
</view> --> | |||
<!-- <view class="attentionBoxHie"> | |||
已关注 | |||
</view> --> | |||
</navigator> | |||
<view class="noDataBox" tt:if="{{list.length==0}}"> | |||
<image class="noDataImg" src="{{imgHttps+'no_result.png'}}" mode="" /> | |||
</view> | |||
</view> | |||
</view> | |||
<view> | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
@@ -0,0 +1,311 @@ | |||
.Box{ | |||
height: 100vh; | |||
overflow: scroll; | |||
min-height: 100vh; | |||
} | |||
.searchF{ | |||
width: 80%; | |||
height: 80rpx; | |||
background-color: rgba(51, 51, 51, 0.5); | |||
border-radius: 60rpx; | |||
margin: 20rpx; | |||
float: left; | |||
} | |||
.searchText{ | |||
width: 80%; | |||
margin: 0 auto; | |||
height: 100%; | |||
color: #ffffff; | |||
} | |||
.searchBtn{ | |||
width: 10%; | |||
line-height: 100rpx; | |||
color: #00ff99; | |||
float: left; | |||
height: 100rpx; | |||
margin-top: 10rpx; | |||
font-size: 30rpx; | |||
} | |||
.recommendBox{ | |||
margin: 40rpx 0; | |||
} | |||
.recommendLogo{ | |||
float: left; | |||
width: 60rpx; | |||
height: 60rpx; | |||
background-color: #00ff99; | |||
} | |||
.recommendText{ | |||
color: #ffffff; | |||
font-size: 32rpx; | |||
line-height: 60rpx; | |||
margin-left: 20rpx; | |||
float: left; | |||
} | |||
.recommend{ | |||
display: flex; | |||
justify-content: space-between; | |||
flex-wrap:wrap; | |||
} | |||
.recommendItem{ | |||
width: 40%; | |||
margin: 20rpx 5%; | |||
background-color: rgba(51, 51, 51, 0.5); | |||
border-radius: 50rpx; | |||
text-align: center; | |||
line-height: 80rpx; | |||
height: 80rpx; | |||
overflow:hidden; | |||
text-overflow:ellipsis; | |||
display:-webkit-box; | |||
-webkit-box-orient:vertical; | |||
-webkit-line-clamp:1; | |||
color: #ffffff; | |||
text-indent:10rpx | |||
} | |||
.authorItemBox{ | |||
margin: 20rpx 0; | |||
overflow: hidden; | |||
overflow-y: hidden; | |||
overflow-x: auto; | |||
white-space: nowrap; | |||
} | |||
.authorItemBox::-webkit-scrollbar { | |||
display: none; | |||
} | |||
.authorItem{ | |||
width: 30%; | |||
height: 340rpx; | |||
border-radius: 10rpx; | |||
background-color: #333; | |||
overflow: hidden; | |||
display: inline-block; | |||
margin-right:20rpx; | |||
} | |||
.portrait{ | |||
width: 150rpx; | |||
height: 150rpx; | |||
background-color: azure; | |||
border-radius: 50%; | |||
margin: 20rpx auto; | |||
} | |||
.name{ | |||
line-height: 72rpx; | |||
text-align: center; | |||
color: #ffffff; | |||
font-size: 36rpx; | |||
text-align: center; | |||
} | |||
.categoryBox{ | |||
display: flex; | |||
justify-content: center; | |||
} | |||
.categoryTtem{ | |||
width: 40%; | |||
margin: 0 5%; | |||
border-radius: 30rpx; | |||
border: 2rpx solid #00ff99; | |||
text-align: center; | |||
color: #00ff99; | |||
height: 50rpx; | |||
line-height: 50rpx; | |||
} | |||
/* 暂时填充 */ | |||
.author { | |||
height: 600rpx; | |||
} | |||
.course{ | |||
width: 20%; | |||
float: left; | |||
text-align: center; | |||
padding-bottom:20rpx; | |||
} | |||
.titleA{ | |||
font-size: 36rpx; | |||
line-height: 70rpx; | |||
color: #07E881; | |||
font-family: PingFang SC; | |||
font-weight: 800; | |||
} | |||
.title{ | |||
line-height: 70rpx; | |||
color: #ffffff; | |||
} | |||
.xian{ | |||
width: 40%; | |||
margin: 0 auto; | |||
height: 2rpx; | |||
background-color: #07E881; | |||
} | |||
.cAuthor{ | |||
width: 20%; | |||
float: left; | |||
text-align: center; | |||
} | |||
.classBox { | |||
width: 90%; | |||
margin:20rpx auto; | |||
border-bottom: #666666 1rpx dotted; | |||
} | |||
.orderBidBox{ | |||
border-radius: 20rpx; | |||
background-color: #181C28; | |||
margin: 40rpx 0; | |||
} | |||
.img{ | |||
float: left; | |||
width: 250rpx; | |||
height: 160rpx; | |||
border-radius: 10rpx; | |||
} | |||
.courseBox { | |||
width: 360rpx; | |||
margin-left: 30rpx; | |||
float: left; | |||
} | |||
.h3{ | |||
width: 360rpx; | |||
line-height: 60rpx; | |||
font-size: 34rpx; | |||
color: #ffffff; | |||
font-weight: 560; | |||
overflow:hidden; | |||
text-overflow:ellipsis; | |||
display:-webkit-box; | |||
-webkit-box-orient:vertical; | |||
-webkit-line-clamp:1; | |||
} | |||
.headImg{ | |||
width: 60rpx; | |||
height: 60rpx; | |||
border-radius: 50%; | |||
background-color: coral; | |||
float: left; | |||
} | |||
.name{ | |||
width: 220rpx; | |||
line-height: 60rpx; | |||
height: 60rpx; | |||
border-radius: 50rpx; | |||
color: #8790A8; | |||
text-align: center; | |||
background-color: #222735; | |||
} | |||
.priceBox{ | |||
/* margin-top: 20rpx; */ | |||
overflow: hidden; | |||
} | |||
.priceF{ | |||
float: left; | |||
color: #ff3366; | |||
line-height: 60rpx; | |||
} | |||
.price{ | |||
font-size: 34rpx; | |||
color: #ff3366; | |||
float: left; | |||
line-height: 60rpx; | |||
} | |||
.timeBox{ | |||
width: 90%; | |||
margin: 20rpx auto; | |||
} | |||
.payTiem{ | |||
float: left; | |||
line-height: 80rpx; | |||
font-size: 32rpx; | |||
font-family: PingFang SC; | |||
font-weight: 500; | |||
color: #FC4758; | |||
} | |||
.payBtn{ | |||
float: right; | |||
width: 180rpx; | |||
line-height: 80rpx; | |||
text-align: center; | |||
border: 2rpx solid #06D176; | |||
border-radius: 50rpx; | |||
color: #06D176; | |||
} | |||
.userHead{ | |||
float: left; | |||
width: 120rpx; | |||
height: 120rpx; | |||
background-color: aqua; | |||
border-radius: 50%; | |||
margin: 20rpx; | |||
} | |||
.userNameBox{ | |||
float: left; | |||
margin: 20rpx; | |||
} | |||
.userName{ | |||
width: 300rpx; | |||
line-height: 60rpx; | |||
margin: 10rpx; | |||
color: #fff; | |||
font-size: 30rpx; | |||
} | |||
.typeBox{ | |||
margin: 0 10rpx; | |||
} | |||
.shuXian{ | |||
float: left; | |||
width: 1rpx; | |||
margin: 0 20rpx; | |||
background-color: #31335C; | |||
height: 40rpx; | |||
} | |||
.type{ | |||
float: left; | |||
} | |||
.bean{ | |||
float: left; | |||
} | |||
.attentionBox{ | |||
float: left; | |||
margin: 40rpx 20rpx; | |||
border: 1rpx solid #07E881; | |||
width: 130rpx; | |||
height: 70rpx; | |||
line-height: 70rpx; | |||
border-radius: 40rpx; | |||
background: rgba(7, 232, 129, 0.12); | |||
text-align: center; | |||
color: #07E881; | |||
} | |||
.attentionBoxHie{ | |||
float: left; | |||
margin: 40rpx 20rpx; | |||
border: 1rpx solid #666666; | |||
width: 130rpx; | |||
height: 70rpx; | |||
line-height: 70rpx; | |||
border-radius: 40rpx; | |||
text-align: center; | |||
color: #666666; | |||
} | |||
.noDataBox{ | |||
width: 100%; | |||
height: 600rpx; | |||
top: 300rpx; | |||
left: 0; | |||
background-color: #0E1119; | |||
} | |||
.noDataImg{ | |||
width: 500rpx; | |||
height: 400rpx; | |||
} |
@@ -0,0 +1,8 @@ | |||
const app = getApp() | |||
const navigationBarHeight = (getApp().statusBarHeight + 44)+"px" | |||
Page({ | |||
data:{ | |||
navigationBarHeight, | |||
imgHttps:app.globalData.imgHttps, | |||
} | |||
}) |
@@ -0,0 +1,6 @@ | |||
{ | |||
"navigationBarTitleText": "关于我们", | |||
"usingComponents": { | |||
"navbar": "../../components/navbar/navbar" | |||
} | |||
} |
@@ -0,0 +1,31 @@ | |||
<view id="BoxBg"> | |||
<view class="Box"> | |||
<navbar back text="关于我们" background="#0E1119" color="#fff"></navbar> | |||
<view style="height:{{navigationBarHeight}} "></view> | |||
<view class="versionsBox oh"> | |||
<view class="logoText"> | |||
LOGO | |||
</view> | |||
<view class="versions"> | |||
版本 1.0.0 | |||
</view> | |||
</view> | |||
<view class="describeBox oh"> | |||
<view class="describe"> | |||
dddddddddasd阿德飒飒啊啊啊啊啊啊啊啊啊打算大苏打顶顶 | |||
顶顶顶顶顶顶大师水水水水水水水水水水水水水水大飒飒飒飒 | |||
飒飒飒飒飒飒飒飒飒飒飒飒飒飒d阿三水水水水水水水水水水 | |||
</view> | |||
</view> | |||
<view class="consult"> | |||
咨询我们 | |||
</view> | |||
</view> | |||
</view> | |||
@@ -0,0 +1,54 @@ | |||
.versionsBox{ | |||
height: 360rpx; | |||
background-image: url('https://formall.oss-accelerate.aliyuncs.com/douyin/drawable-xhdpi/aboutUs_bnt.png'); | |||
background-size: 100% 360rpx; | |||
} | |||
.Box{ | |||
width: 100%; | |||
margin: 0 0; | |||
height: 100vh; | |||
} | |||
.logoText{ | |||
height: 90rpx; | |||
text-align: center; | |||
font-size: 36px; | |||
font-family: Tensentype JinZhuanHeiJ; | |||
font-weight: 500; | |||
color: #FFFFFF; | |||
margin-top: 100rpx; | |||
} | |||
.versions{ | |||
height: 40rpx; | |||
text-align: center; | |||
height: 40rpx; | |||
font-size: 30rpx; | |||
font-family: PingFang SC; | |||
font-weight: 500; | |||
color: #FFFFFF; | |||
margin-top: 40rpx; | |||
} | |||
.describeBox{ | |||
width: 96%; | |||
margin: -70rpx auto 0 auto; | |||
background-color: #212838; | |||
border-radius: 30rpx; | |||
text-align: center; | |||
} | |||
.describe{ | |||
width: 90%; | |||
height: 400rpx; | |||
margin: 20rpx auto; | |||
padding: 20rpx; | |||
} | |||
.consult{ | |||
width: 80%; | |||
margin: 60rpx auto; | |||
height: 80rpx; | |||
border-radius: 60rpx; | |||
line-height: 80rpx; | |||
text-align: center; | |||
color: #FFFFFF; | |||
background: linear-gradient(-4deg, #4EE09D, #02C96E); | |||
} |
@@ -0,0 +1,93 @@ | |||
const app = getApp() | |||
const config = require("../../config/config") | |||
const Http = require("../../utils/HttpBasics.js") | |||
const navigationBarHeight = (getApp().statusBarHeight + 44)+"px" | |||
Page({ | |||
data:{ | |||
imgHttps:app.globalData.imgHttps, | |||
navigationBarHeight, | |||
ttNum:"",//抖音号 | |||
ttBean:"",//抖音粉丝数量 | |||
userName:"",//姓名 | |||
userPhone:"",//手机号 | |||
}, | |||
setTtNum(e){ | |||
let value = e.detail.value | |||
this.setData({ | |||
ttNum: value | |||
}) | |||
}, | |||
setTtBean(e){ | |||
let value = e.detail.value | |||
this.setData({ | |||
ttBean: value | |||
}) | |||
}, | |||
setUserName(e){ | |||
let value = e.detail.value | |||
this.setData({ | |||
userName: value | |||
}) | |||
}, | |||
setUserPhone(e){ | |||
let value = e.detail.value | |||
this.setData({ | |||
userPhone: value | |||
}) | |||
}, | |||
submit(){ | |||
let myreg = /^[1][3,4,5,7,8,9][0-9]{9}$/; | |||
if(this.data.ttNum==""){ | |||
tt.showToast({ | |||
title: '请填写抖音号', // 抖音号 | |||
icon: "none" | |||
}); | |||
return | |||
} | |||
if(this.data.ttBean==""){ | |||
tt.showToast({ | |||
title: '请填写抖音粉丝数量', // 粉丝数量 | |||
icon: "none" | |||
}); | |||
return | |||
} | |||
if(this.data.userName==""){ | |||
tt.showToast({ | |||
title: '请填写姓名', // 姓名 | |||
icon: "none" | |||
}); | |||
return | |||
} | |||
if(!myreg.test(this.data.userPhone)){ | |||
tt.showToast({ | |||
title: '请输入正确的手机号', | |||
icon: "none" | |||
}); | |||
return | |||
} | |||
Http.post({ | |||
url:config.api.apply, | |||
data:{ | |||
ttUserName:this.data.ttNum, | |||
ttCountFans:this.data.ttBean, | |||
liaisonMan:this.data.userName, | |||
liaisonPhone:this.data.userPhone | |||
} | |||
}).then(res=>{ | |||
tt.showToast({ | |||
title: '提交成功!', // 内容 | |||
success: (res) => { | |||
} | |||
}); | |||
}).catch(err=>{ | |||
tt.showToast({ | |||
title: err.message, | |||
icon: "none" | |||
}); | |||
}) | |||
} | |||
}) |
@@ -0,0 +1,6 @@ | |||
{ | |||
"navigationBarTitleText": "入驻申请", | |||
"usingComponents": { | |||
"navbar": "../../components/navbar/navbar" | |||
} | |||
} |
@@ -0,0 +1,37 @@ | |||
<view id="BoxBg"> | |||
<view class="Box"> | |||
<navbar back text="申请入驻" background="#0E1119" color="#fff"></navbar> | |||
<view style="height:{{navigationBarHeight}} "></view> | |||
<view class="backImg" ></view> | |||
<view class="messageBox oh"> | |||
<view class="textBox oh"> | |||
<view class="xian"></view> | |||
<view class="h3">基本信息</view> | |||
</view> | |||
<view class="ttTitle">抖音号</view> | |||
<view class="inputBox"> | |||
<input type="text" bindinput="setTtNum" placeholder="请输入当前账号的抖音号" placeholder-style="color: #8790A8;font-family: PingFang SC;" class="input"/> | |||
</view> | |||
<view class="ttTitle">粉丝数</view> | |||
<view class="inputBox"> | |||
<input type="text" bindinput="setTtBean" placeholder="请输入当前抖音号的粉丝数量" placeholder-style="color: #8790A8;font-family: PingFang SC;" class="input"/> | |||
</view> | |||
<view class="textBox oh"> | |||
<view class="xian"></view> | |||
<view class="h3">联系方式</view> | |||
</view> | |||
<view class="inputBox1"> | |||
<input type="text" bindinput="setUserName" placeholder="请输入您的真实姓名" placeholder-style="color: #8790A8;font-family: PingFang SC;" class="input"/> | |||
</view> | |||
<view class="inputBox1"> | |||
<input type="text" bindinput="setUserPhone" placeholder="请输入您的手机号码" placeholder-style="color: #8790A8;font-family: PingFang SC;" class="input"/> | |||
</view> | |||
<!-- <view class="inputBox1"> | |||
<input type="text" bindinput="setUserPhone" placeholder="请输入验证码" placeholder-style="color: #8790A8;font-family: PingFang SC;" class="input2"/> | |||
<view class="code">获取验证码</view> | |||
</view> --> | |||
<view class="submit" bindtap="submit">提交申请</view> | |||
</view> | |||
</view> | |||
</view> |
@@ -0,0 +1,79 @@ | |||
.backImg{ | |||
width: 100%; | |||
height: 750rpx; | |||
background-image: url('https://formall.oss-accelerate.aliyuncs.com/douyin/drawable-xhdpi/apply_bnt.png'); | |||
background-size: 100% 750rpx; | |||
} | |||
.messageBox{ | |||
width: 96%; | |||
margin: auto; | |||
margin-top: -60rpx; | |||
z-index: 10000; | |||
overflow: hidden; | |||
} | |||
.xian{ | |||
float: left; | |||
width: 10rpx; | |||
height: 28rpx; | |||
background: #07E881; | |||
margin-top: 10rpx; | |||
} | |||
.h3{ | |||
margin-left: 10rpx; | |||
float: left; | |||
font-size: 32rpx; | |||
font-family: PingFang SC; | |||
font-weight: 500; | |||
color: #FFFFFF; | |||
} | |||
.ttTitle{ | |||
font-size: 28rpx; | |||
font-family: PingFang SC; | |||
font-weight: 500; | |||
color: #FFFFFF; | |||
margin: 20rpx 0; | |||
} | |||
.inputBox{ | |||
height: 88rpx; | |||
border-radius: 10rpx; | |||
background: #1B2130; | |||
margin-bottom: 20rpx; | |||
} | |||
.input{ | |||
width: 80%; | |||
height: 80rpx; | |||
margin: 0 auto; | |||
} | |||
.inputBox1{ | |||
height: 88rpx; | |||
border-radius: 10rpx; | |||
background: #1B2130; | |||
margin-bottom: 40rpx; | |||
margin-top: 20rpx; | |||
} | |||
.input2{ | |||
width: 50%; | |||
height: 80rpx; | |||
float: left; | |||
margin-left: 70rpx; | |||
} | |||
.code{ | |||
height: 80rpx; | |||
line-height: 80rpx; | |||
font-family: PingFang SC; | |||
font-weight: 500; | |||
color: #07E881; | |||
font-size: 30rpx; | |||
float: left; | |||
margin-left: 20rpx; | |||
} | |||
.submit{ | |||
width: 90%; | |||
height: 80rpx; | |||
background: linear-gradient(-4deg, #4EE09D, #02C96E); | |||
border-radius: 44rpx; | |||
color: #FFFFFF; | |||
text-align: center; | |||
line-height: 80rpx; | |||
margin: 20rpx auto; | |||
} |
@@ -0,0 +1,56 @@ | |||
const app = getApp() | |||
const config = require("../../config/config") | |||
const Http = require("../../utils/HttpBasics.js") | |||
const navigationBarHeight = (getApp().statusBarHeight + 44) + "px" | |||
Page({ | |||
data: { | |||
navigationBarHeight, | |||
imgHttps: app.globalData.imgHttps, | |||
userData: "", | |||
}, | |||
onLoad: function () { | |||
console.log(123); | |||
let _this = this | |||
tt.login({ | |||
success(_res) { | |||
// 获取用户信息 | |||
tt.getUserInfo({ | |||
withCredentials: true, | |||
// withRealNameAuthenticationInfo: true, | |||
success(res) { | |||
console.log(res); | |||
_this.setData({ | |||
userData: res.userInfo | |||
}) | |||
Http.get({ | |||
url: config.api.checkUserInfo | |||
}).then(res => { | |||
}).catch(err=>{ | |||
console.log("我没提交授权",err.code); | |||
if(err.code == 11004){ | |||
Http.post({ | |||
url:config.api.userInfo, | |||
data:{ | |||
iv:res.iv, | |||
encryptedData:res.encryptedData | |||
} | |||
}).then(res=>{ | |||
console.log(res); | |||
}) | |||
} | |||
}) | |||
}, | |||
fail(res) { | |||
tt.navigateTo({ | |||
url: 'pages/index/index' // 指定页面的url | |||
}); | |||
}, | |||
}); | |||
}, | |||
}); | |||
} | |||
}) |
@@ -0,0 +1,6 @@ | |||
{ | |||
"navigationBarTitleText": "我的", | |||
"usingComponents": { | |||
"navbar": "../../components/navbar/navbar" | |||
} | |||
} |
@@ -0,0 +1,109 @@ | |||
<view id="BoxBg"> | |||
<view class="Box"> | |||
<navbar text="我的" background="#0E1119" color="#fff"></navbar> | |||
<view style="height:{{navigationBarHeight}} "></view> | |||
<view class="userInif oh"> | |||
<!-- <view class="LogoBox"> | |||
</view> --> | |||
<image src="{{userData.avatarUrl}}" mode="" class="LogoBoxImg"/> | |||
<view class="userNameBox "> | |||
<view class="nameGoBox oh"> | |||
<view class="name"> | |||
{{userData.nickName}} | |||
</view> | |||
<image class="go" src="../../assets/images/arrow-right-bold.png" mode="aspectFit|aspectFill|widthFix" | |||
lazy-load="false" binderror="" bindload="" /> | |||
</view> | |||
<!-- <view class="phone"> | |||
13028584842 | |||
</view> --> | |||
</view> | |||
</view> | |||
<!-- <view class="functionBox oh"> | |||
<view class="attentionBox"> | |||
<view class="num"> | |||
508 | |||
</view> | |||
<view class="text"> | |||
我的关注 | |||
</view> | |||
</view> | |||
<navigator class="collectBox" url="/pages/mianCollect/mianCollect" open-type="" hover-class="className"> | |||
<view class="num"> | |||
506 | |||
</view> | |||
<view class="text"> | |||
我的收藏 | |||
</view> | |||
</navigator> | |||
<view class="commentBox"> | |||
<view class="num"> | |||
480 | |||
</view> | |||
<view class="text"> | |||
我的评价 | |||
</view> | |||
</view> | |||
</view> --> | |||
<view class="elseBox"> | |||
<view class="elseTitle"> | |||
其他服务 | |||
</view> | |||
<navigator class="orderBox oh" target="" url="/pages/order/order" hover-class="navigator-hover" open-type="navigate"> | |||
<image class="logo" src="{{imgHttps+'me_icon_wddd.png'}}" mode="aspectFit|aspectFill|widthFix" | |||
lazy-load="false" binderror="" bindload="" /> | |||
<view class="orderTitle"> | |||
我的订单 | |||
</view> | |||
<image class="go" src="../../assets/images/arrow-right-bold.png" mode="aspectFit|aspectFill|widthFix" | |||
lazy-load="false" binderror="" bindload="" /> | |||
</navigator> | |||
<navigator class="orderBox oh" target="" url="" hover-class="navigator-hover" open-type="navigate"> | |||
<image class="logo" src="{{imgHttps+'me_icon_zxkf.png'}}" mode="aspectFit|aspectFill|widthFix" | |||
lazy-load="false" binderror="" bindload="" /> | |||
<view class="orderTitle"> | |||
在线客服 | |||
</view> | |||
<image class="go" src="../../assets/images/arrow-right-bold.png" mode="aspectFit|aspectFill|widthFix" | |||
lazy-load="false" binderror="" bindload="" /> | |||
</navigator> | |||
<navigator class="orderBox oh" target="" url="/pages/mianCollect/mianCollect" hover-class="navigator-hover" open-type="navigate"> | |||
<image class="logo" src="{{imgHttps+'details_tab_sc.png'}}" mode="aspectFit|aspectFill|widthFix" | |||
lazy-load="false" binderror="" bindload="" /> | |||
<view class="orderTitle"> | |||
我的收藏 | |||
</view> | |||
<image class="go" src="../../assets/images/arrow-right-bold.png" mode="aspectFit|aspectFill|widthFix" | |||
lazy-load="false" binderror="" bindload="" /> | |||
</navigator> | |||
<navigator class="orderBox oh" target="" url="/pages/sponsor/sponsor" hover-class="navigator-hover" open-type="navigate"> | |||
<image class="logo" src="{{imgHttps+'me_icon_gywm.png'}}" mode="aspectFit|aspectFill|widthFix" | |||
lazy-load="false" binderror="" bindload="" /> | |||
<view class="orderTitle"> | |||
关于我们 | |||
</view> | |||
<image class="go" src="../../assets/images/arrow-right-bold.png" mode="aspectFit|aspectFill|widthFix" | |||
lazy-load="false" binderror="" bindload="" /> | |||
</navigator> | |||
</view> | |||
</view> | |||
</view> |
@@ -0,0 +1,117 @@ | |||
.userInif{ | |||
} | |||
.LogoBox{ | |||
margin: 20rpx; | |||
width: 162rpx; | |||
height: 162rpx; | |||
float: left; | |||
background-image: url("https://formall.oss-accelerate.aliyuncs.com/douyin/drawable-xhdpi/me_bnt_touxiang.png"); | |||
background-size: 156rpx 162rpx; | |||
overflow: hidden; | |||
} | |||
.LogoBoxImg{ | |||
width: 130rpx; | |||
height: 130rpx; | |||
border-radius: 50%; | |||
margin-top: 10rpx; | |||
margin-left: 20rpx; | |||
float: left; | |||
} | |||
.userNameBox{ | |||
width: 500rpx; | |||
float: left; | |||
margin-left: 20rpx; | |||
} | |||
.nameGoBox{ | |||
margin-top: 50rpx; | |||
} | |||
.name{ | |||
font-size: 36rpx; | |||
font-family: OPPOSans; | |||
font-weight: bold; | |||
color: #FFFFFF; | |||
float: left; | |||
} | |||
.go{ | |||
margin-top: 15rpx; | |||
width: 30rpx; | |||
height: 30rpx; | |||
float: right; | |||
} | |||
.phone{ | |||
font-family: OPPOSans; | |||
font-weight: 400; | |||
color: #8790A8; | |||
} | |||
.functionBox{ | |||
margin-top: 30rpx ; | |||
} | |||
.attentionBox{ | |||
float: left; | |||
width: 30%; | |||
height: 160rpx; | |||
} | |||
.collectBox{ | |||
float: left; | |||
width: 30%; | |||
height: 160rpx; | |||
margin: 0 1%; | |||
} | |||
.commentBox{ | |||
height: 160rpx; | |||
width: 30%; | |||
float: left; | |||
} | |||
.num{ | |||
font-family: OPPOSans; | |||
font-weight: 400; | |||
text-align: center; | |||
line-height: 60rpx; | |||
font-size: 42rpx; | |||
color: #FFFFFF; | |||
} | |||
.text{ | |||
text-align: center; | |||
margin: 10rpx 0; | |||
} | |||
.elseBox{ | |||
border-radius: 20rpx; | |||
background-color: #191F2E; | |||
} | |||
.elseTitle{ | |||
text-indent: 20rpx; | |||
font-size: 32rpx; | |||
color: #FFFFFF; | |||
font-family: OPPOSans; | |||
font-weight: bold; | |||
padding: 20rpx; | |||
} | |||
.orderBox{ | |||
padding: 20rpx; | |||
} | |||
.serviceBox{ | |||
padding: 20rpx; | |||
} | |||
.weBox{ | |||
padding: 20rpx; | |||
} | |||
.logo{ | |||
width: 58rpx; | |||
height: 61rpx; | |||
float: left; | |||
margin-left: 20rpx; | |||
} | |||
.orderTitle{ | |||
float: left; | |||
margin: 0 20rpx; | |||
color: #FFFFFF; | |||
font-family: OPPOSans; | |||
font-weight: 500; | |||
line-height: 60rpx; | |||
} | |||
.Box{ | |||
height: 100vh; | |||
} |
@@ -0,0 +1,33 @@ | |||
{ | |||
"setting": { | |||
"urlCheck": true, | |||
"es6": true, | |||
"newFeature": false, | |||
"postcss": false, | |||
"autoCompile": true, | |||
"mockUpdate": true, | |||
"minified": false, | |||
"scripts": false | |||
}, | |||
"appid": "tt9da4eb19029c2bb301", | |||
"projectname": "知播堂", | |||
"condition": { | |||
"miniprogram": { | |||
"current": -1, | |||
"list": [ | |||
{ | |||
"id": 1623739186577, | |||
"name": "classDetails", | |||
"pathName": "pages/classDetails/classDetails", | |||
"query": "", | |||
"scene": "990001", | |||
"launchFrom": "scan", | |||
"location": "qr_code" | |||
} | |||
] | |||
} | |||
}, | |||
"scripts": { | |||
"afterOpen": "" | |||
} | |||
} |
@@ -0,0 +1,117 @@ | |||
const config = require("../config/config.js"); | |||
class HttpBasics { | |||
constructor(address) { | |||
if (address) { | |||
this.address = address; | |||
} | |||
} | |||
/** | |||
* 配置 | |||
*/ | |||
config = config; | |||
/** | |||
* 请求路径前缀 | |||
*/ | |||
address ='https://ttctest.malls.iformall.com/tt/api'; | |||
/** | |||
* 请求头 | |||
*/ | |||
headers = { | |||
"Content-Type": "application/json;charset=UTF-8", | |||
token: "" | |||
}; | |||
/** | |||
* 设置token | |||
* @param {*} token | |||
*/ | |||
setToken(token) { | |||
this.headers.token = token; | |||
} | |||
/** | |||
* 获取数据 | |||
* @param {url,data,headers} param0 | |||
*/ | |||
get({ url, data, headers }) { | |||
headers = { ...this.headers, ...headers }; | |||
url = `${this.address}${url}`; | |||
return new Promise((resolve, reject) => { | |||
tt.request({ | |||
url: url, | |||
header: headers, | |||
data: data, | |||
method: "get", | |||
success: res => { | |||
this.responseMap(res, resolve, reject); | |||
}, | |||
fail: err => { | |||
console.log(err) | |||
if (err.errMsg == 'request:fail timeout') { | |||
err.errMsg = '请求超时,请检查您的网络设置!' | |||
} else if (err.errMsg == 'request:fail'){ | |||
err.errMsg = '未检查到您的网络,请检查您的网络设置!' | |||
} else if (err.errMsg == 'request:fail request connect error') { | |||
err.errMsg = '连接失败' | |||
} | |||
reject(err); | |||
} | |||
}); | |||
}); | |||
} | |||
/** | |||
* 提交数据 | |||
* @param {url,data,headers} param0 | |||
*/ | |||
post({ url, data, headers }) { | |||
headers = { ...this.headers, ...headers }; | |||
url = `${this.address}${url}`; | |||
return new Promise((resolve, reject) => { | |||
tt.request({ | |||
url: url, | |||
header: headers, | |||
data: data, | |||
method: "post", | |||
success: res => { | |||
this.responseMap(res, resolve, reject); | |||
}, | |||
fail: err => { | |||
if (err.errMsg == 'request:fail timeout') { | |||
err.errMsg = '请求超时,请检查您的网络设置!' | |||
} else if (err.errMsg == 'request:fail') { | |||
err.errMsg = '未检查到您的网络,请检查您的网络设置!' | |||
} else if (err.errMsg == 'request:fail request connect error') { | |||
err.errMsg = '连接失败' | |||
} | |||
reject(err); | |||
}, | |||
complete: res => {} | |||
}); | |||
}); | |||
} | |||
/** | |||
* 过滤 请求信息 | |||
* @param {*} res | |||
* @param {*} resolve | |||
* @param {*} reject | |||
*/ | |||
responseMap = (res, resolve, reject) => { | |||
// 网络状态码200 | |||
if (res.statusCode == 200) { | |||
// 服务器code 200 成功 | |||
if (res.data.code == 200) { | |||
resolve(res.data); | |||
} else if (res.data.code == 1052) { | |||
tt.reLaunch({ | |||
url: '/pages/index/index' | |||
}) | |||
} else { | |||
reject(res.data); | |||
} | |||
} else { | |||
console.log("请求出错:", res); | |||
reject(res.data); | |||
} | |||
}; | |||
/** 日志 */ | |||
log(url, body, headers) {} | |||
} | |||
module.exports = new HttpBasics(); |
@@ -0,0 +1,392 @@ | |||
var CHAR_TILDE = 126; | |||
var CODE_FNC1 = 102; | |||
var SET_STARTA = 103; | |||
var SET_STARTB = 104; | |||
var SET_STARTC = 105; | |||
var SET_SHIFT = 98; | |||
var SET_CODEA = 101; | |||
var SET_CODEB = 100; | |||
var SET_STOP = 106; | |||
var REPLACE_CODES = { | |||
CHAR_TILDE: CODE_FNC1 //~ corresponds to FNC1 in GS1-128 standard | |||
} | |||
var CODESET = { | |||
ANY: 1, | |||
AB: 2, | |||
A: 3, | |||
B: 4, | |||
C: 5 | |||
}; | |||
function getBytes(str) { | |||
var bytes = []; | |||
for (var i = 0; i < str.length; i++) { | |||
bytes.push(str.charCodeAt(i)); | |||
} | |||
return bytes; | |||
} | |||
exports.code128 = function(ctx, text, width, height) { | |||
width = parseInt(width); | |||
height = parseInt(height); | |||
var codes = stringToCode128(text); | |||
var g = new Graphics(ctx, width, height); | |||
var barWeight = g.area.width / ((codes.length - 3) * 11 + 35); | |||
var x = g.area.left; | |||
var y = g.area.top; | |||
for (var i = 0; i < codes.length; i++) { | |||
var c = codes[i]; | |||
//two bars at a time: 1 black and 1 white | |||
for (var bar = 0; bar < 8; bar += 2) { | |||
var barW = PATTERNS[c][bar] * barWeight; | |||
// var barH = height - y - this.border; | |||
var barH = height - y; | |||
var spcW = PATTERNS[c][bar + 1] * barWeight; | |||
//no need to draw if 0 width | |||
if (barW > 0) { | |||
g.fillFgRect(x, y, barW, barH); | |||
} | |||
x += barW + spcW; | |||
} | |||
} | |||
ctx.draw(); | |||
} | |||
function stringToCode128(text) { | |||
var barc = { | |||
currcs: CODESET.C | |||
}; | |||
var bytes = getBytes(text); | |||
//decide starting codeset | |||
var index = bytes[0] == CHAR_TILDE ? 1 : 0; | |||
var csa1 = bytes.length > 0 ? codeSetAllowedFor(bytes[index++]) : CODESET.AB; | |||
var csa2 = bytes.length > 0 ? codeSetAllowedFor(bytes[index++]) : CODESET.AB; | |||
barc.currcs = getBestStartSet(csa1, csa2); | |||
barc.currcs = perhapsCodeC(bytes, barc.currcs); | |||
//if no codeset changes this will end up with bytes.length+3 | |||
//start, checksum and stop | |||
var codes = new Array(); | |||
switch (barc.currcs) { | |||
case CODESET.A: | |||
codes.push(SET_STARTA); | |||
break; | |||
case CODESET.B: | |||
codes.push(SET_STARTB); | |||
break; | |||
default: | |||
codes.push(SET_STARTC); | |||
break; | |||
} | |||
for (var i = 0; i < bytes.length; i++) { | |||
var b1 = bytes[i]; //get the first of a pair | |||
//should we translate/replace | |||
if (b1 in REPLACE_CODES) { | |||
codes.push(REPLACE_CODES[b1]); | |||
i++ //jump to next | |||
b1 = bytes[i]; | |||
} | |||
//get the next in the pair if possible | |||
var b2 = bytes.length > (i + 1) ? bytes[i + 1] : -1; | |||
codes = codes.concat(codesForChar(b1, b2, barc.currcs)); | |||
//code C takes 2 chars each time | |||
if (barc.currcs == CODESET.C) i++; | |||
} | |||
//calculate checksum according to Code 128 standards | |||
var checksum = codes[0]; | |||
for (var weight = 1; weight < codes.length; weight++) { | |||
checksum += (weight * codes[weight]); | |||
} | |||
codes.push(checksum % 103); | |||
codes.push(SET_STOP); | |||
//encoding should now be complete | |||
return codes; | |||
function getBestStartSet(csa1, csa2) { | |||
//tries to figure out the best codeset | |||
//to start with to get the most compact code | |||
var vote = 0; | |||
vote += csa1 == CODESET.A ? 1 : 0; | |||
vote += csa1 == CODESET.B ? -1 : 0; | |||
vote += csa2 == CODESET.A ? 1 : 0; | |||
vote += csa2 == CODESET.B ? -1 : 0; | |||
//tie goes to B due to my own predudices | |||
return vote > 0 ? CODESET.A : CODESET.B; | |||
} | |||
function perhapsCodeC(bytes, codeset) { | |||
for (var i = 0; i < bytes.length; i++) { | |||
var b = bytes[i] | |||
if ((b < 48 || b > 57) && b != CHAR_TILDE) | |||
return codeset; | |||
} | |||
return CODESET.C; | |||
} | |||
//chr1 is current byte | |||
//chr2 is the next byte to process. looks ahead. | |||
function codesForChar(chr1, chr2, currcs) { | |||
var result = []; | |||
var shifter = -1; | |||
if (charCompatible(chr1, currcs)) { | |||
if (currcs == CODESET.C) { | |||
if (chr2 == -1) { | |||
shifter = SET_CODEB; | |||
currcs = CODESET.B; | |||
} else if ((chr2 != -1) && !charCompatible(chr2, currcs)) { | |||
//need to check ahead as well | |||
if (charCompatible(chr2, CODESET.A)) { | |||
shifter = SET_CODEA; | |||
currcs = CODESET.A; | |||
} else { | |||
shifter = SET_CODEB; | |||
currcs = CODESET.B; | |||
} | |||
} | |||
} | |||
} else { | |||
//if there is a next char AND that next char is also not compatible | |||
if ((chr2 != -1) && !charCompatible(chr2, currcs)) { | |||
//need to switch code sets | |||
switch (currcs) { | |||
case CODESET.A: | |||
shifter = SET_CODEB; | |||
currcs = CODESET.B; | |||
break; | |||
case CODESET.B: | |||
shifter = SET_CODEA; | |||
currcs = CODESET.A; | |||
break; | |||
} | |||
} else { | |||
//no need to shift code sets, a temporary SHIFT will suffice | |||
shifter = SET_SHIFT; | |||
} | |||
} | |||
//ok some type of shift is nessecary | |||
if (shifter != -1) { | |||
result.push(shifter); | |||
result.push(codeValue(chr2)); | |||
} else { | |||
if (currcs == CODESET.C) { | |||
//include next as well | |||
result.push(codeValue(chr1, chr2)); | |||
} else { | |||
result.push(codeValue(chr1)); | |||
} | |||
} | |||
barc.currcs = currcs; | |||
return result; | |||
} | |||
} | |||
//reduce the ascii code to fit into the Code128 char table | |||
function codeValue(chr1, chr2) { | |||
if (typeof chr2 == "undefined") { | |||
return chr1 >= 32 ? chr1 - 32 : chr1 + 64; | |||
} else { | |||
return parseInt(String.fromCharCode(chr1) + String.fromCharCode(chr2)); | |||
} | |||
} | |||
function charCompatible(chr, codeset) { | |||
var csa = codeSetAllowedFor(chr); | |||
if (csa == CODESET.ANY) return true; | |||
//if we need to change from current | |||
if (csa == CODESET.AB) return true; | |||
if (csa == CODESET.A && codeset == CODESET.A) return true; | |||
if (csa == CODESET.B && codeset == CODESET.B) return true; | |||
return false; | |||
} | |||
function codeSetAllowedFor(chr) { | |||
if (chr >= 48 && chr <= 57) { | |||
//0-9 | |||
return CODESET.ANY; | |||
} else if (chr >= 32 && chr <= 95) { | |||
//0-9 A-Z | |||
return CODESET.AB; | |||
} else { | |||
//if non printable | |||
return chr < 32 ? CODESET.A : CODESET.B; | |||
} | |||
} | |||
var Graphics = function(ctx, width, height) { | |||
this.width = width; | |||
this.height = height; | |||
this.quiet = Math.round(this.width / 40); | |||
this.border_size = 0; | |||
this.padding_width = 0; | |||
this.area = { | |||
width: width - this.padding_width * 2 - this.quiet * 2, | |||
height: height - this.border_size * 2, | |||
top: this.border_size - 4, | |||
left: this.padding_width + this.quiet | |||
}; | |||
this.ctx = ctx; | |||
this.fg = "#000000"; | |||
this.bg = "#ffffff"; | |||
// fill background | |||
this.fillBgRect(0, 0, width, height); | |||
// fill center to create border | |||
this.fillBgRect(0, this.border_size, width, height - this.border_size * 2); | |||
} | |||
//use native color | |||
Graphics.prototype._fillRect = function(x, y, width, height, color) { | |||
this.ctx.setFillStyle(color) | |||
this.ctx.fillRect(x, y, width, height) | |||
} | |||
Graphics.prototype.fillFgRect = function(x, y, width, height) { | |||
this._fillRect(x, y, width, height, this.fg); | |||
} | |||
Graphics.prototype.fillBgRect = function(x, y, width, height) { | |||
this._fillRect(x, y, width, height, this.bg); | |||
} | |||
var PATTERNS = [ | |||
[2, 1, 2, 2, 2, 2, 0, 0], // 0 | |||
[2, 2, 2, 1, 2, 2, 0, 0], // 1 | |||
[2, 2, 2, 2, 2, 1, 0, 0], // 2 | |||
[1, 2, 1, 2, 2, 3, 0, 0], // 3 | |||
[1, 2, 1, 3, 2, 2, 0, 0], // 4 | |||
[1, 3, 1, 2, 2, 2, 0, 0], // 5 | |||
[1, 2, 2, 2, 1, 3, 0, 0], // 6 | |||
[1, 2, 2, 3, 1, 2, 0, 0], // 7 | |||
[1, 3, 2, 2, 1, 2, 0, 0], // 8 | |||
[2, 2, 1, 2, 1, 3, 0, 0], // 9 | |||
[2, 2, 1, 3, 1, 2, 0, 0], // 10 | |||
[2, 3, 1, 2, 1, 2, 0, 0], // 11 | |||
[1, 1, 2, 2, 3, 2, 0, 0], // 12 | |||
[1, 2, 2, 1, 3, 2, 0, 0], // 13 | |||
[1, 2, 2, 2, 3, 1, 0, 0], // 14 | |||
[1, 1, 3, 2, 2, 2, 0, 0], // 15 | |||
[1, 2, 3, 1, 2, 2, 0, 0], // 16 | |||
[1, 2, 3, 2, 2, 1, 0, 0], // 17 | |||
[2, 2, 3, 2, 1, 1, 0, 0], // 18 | |||
[2, 2, 1, 1, 3, 2, 0, 0], // 19 | |||
[2, 2, 1, 2, 3, 1, 0, 0], // 20 | |||
[2, 1, 3, 2, 1, 2, 0, 0], // 21 | |||
[2, 2, 3, 1, 1, 2, 0, 0], // 22 | |||
[3, 1, 2, 1, 3, 1, 0, 0], // 23 | |||
[3, 1, 1, 2, 2, 2, 0, 0], // 24 | |||
[3, 2, 1, 1, 2, 2, 0, 0], // 25 | |||
[3, 2, 1, 2, 2, 1, 0, 0], // 26 | |||
[3, 1, 2, 2, 1, 2, 0, 0], // 27 | |||
[3, 2, 2, 1, 1, 2, 0, 0], // 28 | |||
[3, 2, 2, 2, 1, 1, 0, 0], // 29 | |||
[2, 1, 2, 1, 2, 3, 0, 0], // 30 | |||
[2, 1, 2, 3, 2, 1, 0, 0], // 31 | |||
[2, 3, 2, 1, 2, 1, 0, 0], // 32 | |||
[1, 1, 1, 3, 2, 3, 0, 0], // 33 | |||
[1, 3, 1, 1, 2, 3, 0, 0], // 34 | |||
[1, 3, 1, 3, 2, 1, 0, 0], // 35 | |||
[1, 1, 2, 3, 1, 3, 0, 0], // 36 | |||
[1, 3, 2, 1, 1, 3, 0, 0], // 37 | |||
[1, 3, 2, 3, 1, 1, 0, 0], // 38 | |||
[2, 1, 1, 3, 1, 3, 0, 0], // 39 | |||
[2, 3, 1, 1, 1, 3, 0, 0], // 40 | |||
[2, 3, 1, 3, 1, 1, 0, 0], // 41 | |||
[1, 1, 2, 1, 3, 3, 0, 0], // 42 | |||
[1, 1, 2, 3, 3, 1, 0, 0], // 43 | |||
[1, 3, 2, 1, 3, 1, 0, 0], // 44 | |||
[1, 1, 3, 1, 2, 3, 0, 0], // 45 | |||
[1, 1, 3, 3, 2, 1, 0, 0], // 46 | |||
[1, 3, 3, 1, 2, 1, 0, 0], // 47 | |||
[3, 1, 3, 1, 2, 1, 0, 0], // 48 | |||
[2, 1, 1, 3, 3, 1, 0, 0], // 49 | |||
[2, 3, 1, 1, 3, 1, 0, 0], // 50 | |||
[2, 1, 3, 1, 1, 3, 0, 0], // 51 | |||
[2, 1, 3, 3, 1, 1, 0, 0], // 52 | |||
[2, 1, 3, 1, 3, 1, 0, 0], // 53 | |||
[3, 1, 1, 1, 2, 3, 0, 0], // 54 | |||
[3, 1, 1, 3, 2, 1, 0, 0], // 55 | |||
[3, 3, 1, 1, 2, 1, 0, 0], // 56 | |||
[3, 1, 2, 1, 1, 3, 0, 0], // 57 | |||
[3, 1, 2, 3, 1, 1, 0, 0], // 58 | |||
[3, 3, 2, 1, 1, 1, 0, 0], // 59 | |||
[3, 1, 4, 1, 1, 1, 0, 0], // 60 | |||
[2, 2, 1, 4, 1, 1, 0, 0], // 61 | |||
[4, 3, 1, 1, 1, 1, 0, 0], // 62 | |||
[1, 1, 1, 2, 2, 4, 0, 0], // 63 | |||
[1, 1, 1, 4, 2, 2, 0, 0], // 64 | |||
[1, 2, 1, 1, 2, 4, 0, 0], // 65 | |||
[1, 2, 1, 4, 2, 1, 0, 0], // 66 | |||
[1, 4, 1, 1, 2, 2, 0, 0], // 67 | |||
[1, 4, 1, 2, 2, 1, 0, 0], // 68 | |||
[1, 1, 2, 2, 1, 4, 0, 0], // 69 | |||
[1, 1, 2, 4, 1, 2, 0, 0], // 70 | |||
[1, 2, 2, 1, 1, 4, 0, 0], // 71 | |||
[1, 2, 2, 4, 1, 1, 0, 0], // 72 | |||
[1, 4, 2, 1, 1, 2, 0, 0], // 73 | |||
[1, 4, 2, 2, 1, 1, 0, 0], // 74 | |||
[2, 4, 1, 2, 1, 1, 0, 0], // 75 | |||
[2, 2, 1, 1, 1, 4, 0, 0], // 76 | |||
[4, 1, 3, 1, 1, 1, 0, 0], // 77 | |||
[2, 4, 1, 1, 1, 2, 0, 0], // 78 | |||
[1, 3, 4, 1, 1, 1, 0, 0], // 79 | |||
[1, 1, 1, 2, 4, 2, 0, 0], // 80 | |||
[1, 2, 1, 1, 4, 2, 0, 0], // 81 | |||
[1, 2, 1, 2, 4, 1, 0, 0], // 82 | |||
[1, 1, 4, 2, 1, 2, 0, 0], // 83 | |||
[1, 2, 4, 1, 1, 2, 0, 0], // 84 | |||
[1, 2, 4, 2, 1, 1, 0, 0], // 85 | |||
[4, 1, 1, 2, 1, 2, 0, 0], // 86 | |||
[4, 2, 1, 1, 1, 2, 0, 0], // 87 | |||
[4, 2, 1, 2, 1, 1, 0, 0], // 88 | |||
[2, 1, 2, 1, 4, 1, 0, 0], // 89 | |||
[2, 1, 4, 1, 2, 1, 0, 0], // 90 | |||
[4, 1, 2, 1, 2, 1, 0, 0], // 91 | |||
[1, 1, 1, 1, 4, 3, 0, 0], // 92 | |||
[1, 1, 1, 3, 4, 1, 0, 0], // 93 | |||
[1, 3, 1, 1, 4, 1, 0, 0], // 94 | |||
[1, 1, 4, 1, 1, 3, 0, 0], // 95 | |||
[1, 1, 4, 3, 1, 1, 0, 0], // 96 | |||
[4, 1, 1, 1, 1, 3, 0, 0], // 97 | |||
[4, 1, 1, 3, 1, 1, 0, 0], // 98 | |||
[1, 1, 3, 1, 4, 1, 0, 0], // 99 | |||
[1, 1, 4, 1, 3, 1, 0, 0], // 100 | |||
[3, 1, 1, 1, 4, 1, 0, 0], // 101 | |||
[4, 1, 1, 1, 3, 1, 0, 0], // 102 | |||
[2, 1, 1, 4, 1, 2, 0, 0], // 103 | |||
[2, 1, 1, 2, 1, 4, 0, 0], // 104 | |||
[2, 1, 1, 2, 3, 2, 0, 0], // 105 | |||
[2, 3, 3, 1, 1, 1, 2, 0] // 106 | |||
] |
@@ -0,0 +1,87 @@ | |||
const config = require("../config/config.js") | |||
const Http = require("./HttpBasics.js") | |||
function order(id) {//支付 | |||
Http.post({//下订单 | |||
url:config.api.order, | |||
data:{ | |||
couponId:this.data.id | |||
} | |||
}).then(res=>{ | |||
console.log(res.data,"订单成功"); | |||
let id = res.data.id | |||
console.log(id); | |||
Http.post({//拿orderInfo | |||
url:config.api.pay, | |||
data:{ | |||
orderId:res.data.id | |||
} | |||
}).then(item=>{ | |||
console.log(item,"orderId"); | |||
tt.pay({ | |||
service: 5, | |||
orderInfo:{ | |||
order_id:item.data.orderId, | |||
order_token:item.data.token, | |||
}, | |||
success(res) { | |||
if (res.code === 0) { | |||
tt.showToast({ | |||
title: '支付成功!', // 内容 | |||
}); | |||
// 支付成功处理逻辑,只有res.code=0时,才表示支付成功 | |||
// 但是最终状态要以商户后端结果为准 | |||
}else if(res.code === 1){ | |||
tt.showToast({ | |||
title: '支付超时', // 内容 | |||
icon:"none" | |||
}); | |||
Http.post({ | |||
url:config.api.ifPayOk, | |||
data:{ | |||
code:1, | |||
orderId:res.data.id | |||
} | |||
}) | |||
}else if(res.code === 2){ | |||
tt.showToast({ | |||
title: '支付失败', // 内容 | |||
icon:"none" | |||
}); | |||
}else if(res.code === 3){ | |||
tt.showToast({ | |||
title: '支付关闭', // 内容 | |||
icon:"none" | |||
}); | |||
}else if(res.code === 4){ | |||
tt.showToast({ | |||
title: '支付取消', // 内容 | |||
icon:"none" | |||
}); | |||
}else if(res.code === 9){ | |||
tt.showToast({ | |||
title: '订单状态开发者自行获取', // 内容 | |||
icon:"none" | |||
}); | |||
} | |||
}, | |||
fail(res) { | |||
// handle fail | |||
}, | |||
}) | |||
}).catch(err=>{ | |||
tt.showToast({ | |||
title: '唤起支付失败', // 内容 | |||
icon:"none" | |||
}); | |||
}) | |||
}).catch(err=>{ | |||
tt.showToast({ | |||
title: err.message, // 内容 | |||
icon:"none" | |||
}); | |||
}) | |||
} | |||
module.exports={ | |||
order | |||
} |
@@ -0,0 +1,778 @@ | |||
var QR = (function () { | |||
// alignment pattern | |||
var adelta = [ | |||
0, 11, 15, 19, 23, 27, 31, // force 1 pat | |||
16, 18, 20, 22, 24, 26, 28, 20, 22, 24, 24, 26, 28, 28, 22, 24, 24, | |||
26, 26, 28, 28, 24, 24, 26, 26, 26, 28, 28, 24, 26, 26, 26, 28, 28 | |||
]; | |||
// version block | |||
var vpat = [ | |||
0xc94, 0x5bc, 0xa99, 0x4d3, 0xbf6, 0x762, 0x847, 0x60d, | |||
0x928, 0xb78, 0x45d, 0xa17, 0x532, 0x9a6, 0x683, 0x8c9, | |||
0x7ec, 0xec4, 0x1e1, 0xfab, 0x08e, 0xc1a, 0x33f, 0xd75, | |||
0x250, 0x9d5, 0x6f0, 0x8ba, 0x79f, 0xb0b, 0x42e, 0xa64, | |||
0x541, 0xc69 | |||
]; | |||
// final format bits with mask: level << 3 | mask | |||
var fmtword = [ | |||
0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976, //L | |||
0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0, //M | |||
0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed, //Q | |||
0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b //H | |||
]; | |||
// 4 per version: number of blocks 1,2; data width; ecc width | |||
var eccblocks = [ | |||
1, 0, 19, 7, 1, 0, 16, 10, 1, 0, 13, 13, 1, 0, 9, 17, | |||
1, 0, 34, 10, 1, 0, 28, 16, 1, 0, 22, 22, 1, 0, 16, 28, | |||
1, 0, 55, 15, 1, 0, 44, 26, 2, 0, 17, 18, 2, 0, 13, 22, | |||
1, 0, 80, 20, 2, 0, 32, 18, 2, 0, 24, 26, 4, 0, 9, 16, | |||
1, 0, 108, 26, 2, 0, 43, 24, 2, 2, 15, 18, 2, 2, 11, 22, | |||
2, 0, 68, 18, 4, 0, 27, 16, 4, 0, 19, 24, 4, 0, 15, 28, | |||
2, 0, 78, 20, 4, 0, 31, 18, 2, 4, 14, 18, 4, 1, 13, 26, | |||
2, 0, 97, 24, 2, 2, 38, 22, 4, 2, 18, 22, 4, 2, 14, 26, | |||
2, 0, 116, 30, 3, 2, 36, 22, 4, 4, 16, 20, 4, 4, 12, 24, | |||
2, 2, 68, 18, 4, 1, 43, 26, 6, 2, 19, 24, 6, 2, 15, 28, | |||
4, 0, 81, 20, 1, 4, 50, 30, 4, 4, 22, 28, 3, 8, 12, 24, | |||
2, 2, 92, 24, 6, 2, 36, 22, 4, 6, 20, 26, 7, 4, 14, 28, | |||
4, 0, 107, 26, 8, 1, 37, 22, 8, 4, 20, 24, 12, 4, 11, 22, | |||
3, 1, 115, 30, 4, 5, 40, 24, 11, 5, 16, 20, 11, 5, 12, 24, | |||
5, 1, 87, 22, 5, 5, 41, 24, 5, 7, 24, 30, 11, 7, 12, 24, | |||
5, 1, 98, 24, 7, 3, 45, 28, 15, 2, 19, 24, 3, 13, 15, 30, | |||
1, 5, 107, 28, 10, 1, 46, 28, 1, 15, 22, 28, 2, 17, 14, 28, | |||
5, 1, 120, 30, 9, 4, 43, 26, 17, 1, 22, 28, 2, 19, 14, 28, | |||
3, 4, 113, 28, 3, 11, 44, 26, 17, 4, 21, 26, 9, 16, 13, 26, | |||
3, 5, 107, 28, 3, 13, 41, 26, 15, 5, 24, 30, 15, 10, 15, 28, | |||
4, 4, 116, 28, 17, 0, 42, 26, 17, 6, 22, 28, 19, 6, 16, 30, | |||
2, 7, 111, 28, 17, 0, 46, 28, 7, 16, 24, 30, 34, 0, 13, 24, | |||
4, 5, 121, 30, 4, 14, 47, 28, 11, 14, 24, 30, 16, 14, 15, 30, | |||
6, 4, 117, 30, 6, 14, 45, 28, 11, 16, 24, 30, 30, 2, 16, 30, | |||
8, 4, 106, 26, 8, 13, 47, 28, 7, 22, 24, 30, 22, 13, 15, 30, | |||
10, 2, 114, 28, 19, 4, 46, 28, 28, 6, 22, 28, 33, 4, 16, 30, | |||
8, 4, 122, 30, 22, 3, 45, 28, 8, 26, 23, 30, 12, 28, 15, 30, | |||
3, 10, 117, 30, 3, 23, 45, 28, 4, 31, 24, 30, 11, 31, 15, 30, | |||
7, 7, 116, 30, 21, 7, 45, 28, 1, 37, 23, 30, 19, 26, 15, 30, | |||
5, 10, 115, 30, 19, 10, 47, 28, 15, 25, 24, 30, 23, 25, 15, 30, | |||
13, 3, 115, 30, 2, 29, 46, 28, 42, 1, 24, 30, 23, 28, 15, 30, | |||
17, 0, 115, 30, 10, 23, 46, 28, 10, 35, 24, 30, 19, 35, 15, 30, | |||
17, 1, 115, 30, 14, 21, 46, 28, 29, 19, 24, 30, 11, 46, 15, 30, | |||
13, 6, 115, 30, 14, 23, 46, 28, 44, 7, 24, 30, 59, 1, 16, 30, | |||
12, 7, 121, 30, 12, 26, 47, 28, 39, 14, 24, 30, 22, 41, 15, 30, | |||
6, 14, 121, 30, 6, 34, 47, 28, 46, 10, 24, 30, 2, 64, 15, 30, | |||
17, 4, 122, 30, 29, 14, 46, 28, 49, 10, 24, 30, 24, 46, 15, 30, | |||
4, 18, 122, 30, 13, 32, 46, 28, 48, 14, 24, 30, 42, 32, 15, 30, | |||
20, 4, 117, 30, 40, 7, 47, 28, 43, 22, 24, 30, 10, 67, 15, 30, | |||
19, 6, 118, 30, 18, 31, 47, 28, 34, 34, 24, 30, 20, 61, 15, 30 | |||
]; | |||
// Galois field log table | |||
var glog = [ | |||
0xff, 0x00, 0x01, 0x19, 0x02, 0x32, 0x1a, 0xc6, 0x03, 0xdf, 0x33, 0xee, 0x1b, 0x68, 0xc7, 0x4b, | |||
0x04, 0x64, 0xe0, 0x0e, 0x34, 0x8d, 0xef, 0x81, 0x1c, 0xc1, 0x69, 0xf8, 0xc8, 0x08, 0x4c, 0x71, | |||
0x05, 0x8a, 0x65, 0x2f, 0xe1, 0x24, 0x0f, 0x21, 0x35, 0x93, 0x8e, 0xda, 0xf0, 0x12, 0x82, 0x45, | |||
0x1d, 0xb5, 0xc2, 0x7d, 0x6a, 0x27, 0xf9, 0xb9, 0xc9, 0x9a, 0x09, 0x78, 0x4d, 0xe4, 0x72, 0xa6, | |||
0x06, 0xbf, 0x8b, 0x62, 0x66, 0xdd, 0x30, 0xfd, 0xe2, 0x98, 0x25, 0xb3, 0x10, 0x91, 0x22, 0x88, | |||
0x36, 0xd0, 0x94, 0xce, 0x8f, 0x96, 0xdb, 0xbd, 0xf1, 0xd2, 0x13, 0x5c, 0x83, 0x38, 0x46, 0x40, | |||
0x1e, 0x42, 0xb6, 0xa3, 0xc3, 0x48, 0x7e, 0x6e, 0x6b, 0x3a, 0x28, 0x54, 0xfa, 0x85, 0xba, 0x3d, | |||
0xca, 0x5e, 0x9b, 0x9f, 0x0a, 0x15, 0x79, 0x2b, 0x4e, 0xd4, 0xe5, 0xac, 0x73, 0xf3, 0xa7, 0x57, | |||
0x07, 0x70, 0xc0, 0xf7, 0x8c, 0x80, 0x63, 0x0d, 0x67, 0x4a, 0xde, 0xed, 0x31, 0xc5, 0xfe, 0x18, | |||
0xe3, 0xa5, 0x99, 0x77, 0x26, 0xb8, 0xb4, 0x7c, 0x11, 0x44, 0x92, 0xd9, 0x23, 0x20, 0x89, 0x2e, | |||
0x37, 0x3f, 0xd1, 0x5b, 0x95, 0xbc, 0xcf, 0xcd, 0x90, 0x87, 0x97, 0xb2, 0xdc, 0xfc, 0xbe, 0x61, | |||
0xf2, 0x56, 0xd3, 0xab, 0x14, 0x2a, 0x5d, 0x9e, 0x84, 0x3c, 0x39, 0x53, 0x47, 0x6d, 0x41, 0xa2, | |||
0x1f, 0x2d, 0x43, 0xd8, 0xb7, 0x7b, 0xa4, 0x76, 0xc4, 0x17, 0x49, 0xec, 0x7f, 0x0c, 0x6f, 0xf6, | |||
0x6c, 0xa1, 0x3b, 0x52, 0x29, 0x9d, 0x55, 0xaa, 0xfb, 0x60, 0x86, 0xb1, 0xbb, 0xcc, 0x3e, 0x5a, | |||
0xcb, 0x59, 0x5f, 0xb0, 0x9c, 0xa9, 0xa0, 0x51, 0x0b, 0xf5, 0x16, 0xeb, 0x7a, 0x75, 0x2c, 0xd7, | |||
0x4f, 0xae, 0xd5, 0xe9, 0xe6, 0xe7, 0xad, 0xe8, 0x74, 0xd6, 0xf4, 0xea, 0xa8, 0x50, 0x58, 0xaf | |||
]; | |||
// Galios field exponent table | |||
var gexp = [ | |||
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1d, 0x3a, 0x74, 0xe8, 0xcd, 0x87, 0x13, 0x26, | |||
0x4c, 0x98, 0x2d, 0x5a, 0xb4, 0x75, 0xea, 0xc9, 0x8f, 0x03, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, | |||
0x9d, 0x27, 0x4e, 0x9c, 0x25, 0x4a, 0x94, 0x35, 0x6a, 0xd4, 0xb5, 0x77, 0xee, 0xc1, 0x9f, 0x23, | |||
0x46, 0x8c, 0x05, 0x0a, 0x14, 0x28, 0x50, 0xa0, 0x5d, 0xba, 0x69, 0xd2, 0xb9, 0x6f, 0xde, 0xa1, | |||
0x5f, 0xbe, 0x61, 0xc2, 0x99, 0x2f, 0x5e, 0xbc, 0x65, 0xca, 0x89, 0x0f, 0x1e, 0x3c, 0x78, 0xf0, | |||
0xfd, 0xe7, 0xd3, 0xbb, 0x6b, 0xd6, 0xb1, 0x7f, 0xfe, 0xe1, 0xdf, 0xa3, 0x5b, 0xb6, 0x71, 0xe2, | |||
0xd9, 0xaf, 0x43, 0x86, 0x11, 0x22, 0x44, 0x88, 0x0d, 0x1a, 0x34, 0x68, 0xd0, 0xbd, 0x67, 0xce, | |||
0x81, 0x1f, 0x3e, 0x7c, 0xf8, 0xed, 0xc7, 0x93, 0x3b, 0x76, 0xec, 0xc5, 0x97, 0x33, 0x66, 0xcc, | |||
0x85, 0x17, 0x2e, 0x5c, 0xb8, 0x6d, 0xda, 0xa9, 0x4f, 0x9e, 0x21, 0x42, 0x84, 0x15, 0x2a, 0x54, | |||
0xa8, 0x4d, 0x9a, 0x29, 0x52, 0xa4, 0x55, 0xaa, 0x49, 0x92, 0x39, 0x72, 0xe4, 0xd5, 0xb7, 0x73, | |||
0xe6, 0xd1, 0xbf, 0x63, 0xc6, 0x91, 0x3f, 0x7e, 0xfc, 0xe5, 0xd7, 0xb3, 0x7b, 0xf6, 0xf1, 0xff, | |||
0xe3, 0xdb, 0xab, 0x4b, 0x96, 0x31, 0x62, 0xc4, 0x95, 0x37, 0x6e, 0xdc, 0xa5, 0x57, 0xae, 0x41, | |||
0x82, 0x19, 0x32, 0x64, 0xc8, 0x8d, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0, 0xdd, 0xa7, 0x53, 0xa6, | |||
0x51, 0xa2, 0x59, 0xb2, 0x79, 0xf2, 0xf9, 0xef, 0xc3, 0x9b, 0x2b, 0x56, 0xac, 0x45, 0x8a, 0x09, | |||
0x12, 0x24, 0x48, 0x90, 0x3d, 0x7a, 0xf4, 0xf5, 0xf7, 0xf3, 0xfb, 0xeb, 0xcb, 0x8b, 0x0b, 0x16, | |||
0x2c, 0x58, 0xb0, 0x7d, 0xfa, 0xe9, 0xcf, 0x83, 0x1b, 0x36, 0x6c, 0xd8, 0xad, 0x47, 0x8e, 0x00 | |||
]; | |||
// Working buffers: | |||
// data input and ecc append, image working buffer, fixed part of image, run lengths for badness | |||
var strinbuf=[], eccbuf=[], qrframe=[], framask=[], rlens=[]; | |||
// Control values - width is based on version, last 4 are from table. | |||
var version, width, neccblk1, neccblk2, datablkw, eccblkwid; | |||
var ecclevel = 2; | |||
// set bit to indicate cell in qrframe is immutable. symmetric around diagonal | |||
function setmask(x, y) | |||
{ | |||
var bt; | |||
if (x > y) { | |||
bt = x; | |||
x = y; | |||
y = bt; | |||
} | |||
// y*y = 1+3+5... | |||
bt = y; | |||
bt *= y; | |||
bt += y; | |||
bt >>= 1; | |||
bt += x; | |||
framask[bt] = 1; | |||
} | |||
// enter alignment pattern - black to qrframe, white to mask (later black frame merged to mask) | |||
function putalign(x, y) | |||
{ | |||
var j; | |||
qrframe[x + width * y] = 1; | |||
for (j = -2; j < 2; j++) { | |||
qrframe[(x + j) + width * (y - 2)] = 1; | |||
qrframe[(x - 2) + width * (y + j + 1)] = 1; | |||
qrframe[(x + 2) + width * (y + j)] = 1; | |||
qrframe[(x + j + 1) + width * (y + 2)] = 1; | |||
} | |||
for (j = 0; j < 2; j++) { | |||
setmask(x - 1, y + j); | |||
setmask(x + 1, y - j); | |||
setmask(x - j, y - 1); | |||
setmask(x + j, y + 1); | |||
} | |||
} | |||
//======================================================================== | |||
// Reed Solomon error correction | |||
// exponentiation mod N | |||
function modnn(x) | |||
{ | |||
while (x >= 255) { | |||
x -= 255; | |||
x = (x >> 8) + (x & 255); | |||
} | |||
return x; | |||
} | |||
var genpoly = []; | |||
// Calculate and append ECC data to data block. Block is in strinbuf, indexes to buffers given. | |||
function appendrs(data, dlen, ecbuf, eclen) | |||
{ | |||
var i, j, fb; | |||
for (i = 0; i < eclen; i++) | |||
strinbuf[ecbuf + i] = 0; | |||
for (i = 0; i < dlen; i++) { | |||
fb = glog[strinbuf[data + i] ^ strinbuf[ecbuf]]; | |||
if (fb != 255) /* fb term is non-zero */ | |||
for (j = 1; j < eclen; j++) | |||
strinbuf[ecbuf + j - 1] = strinbuf[ecbuf + j] ^ gexp[modnn(fb + genpoly[eclen - j])]; | |||
else | |||
for( j = ecbuf ; j < ecbuf + eclen; j++ ) | |||
strinbuf[j] = strinbuf[j + 1]; | |||
strinbuf[ ecbuf + eclen - 1] = fb == 255 ? 0 : gexp[modnn(fb + genpoly[0])]; | |||
} | |||
} | |||
//======================================================================== | |||
// Frame data insert following the path rules | |||
// check mask - since symmetrical use half. | |||
function ismasked(x, y) | |||
{ | |||
var bt; | |||
if (x > y) { | |||
bt = x; | |||
x = y; | |||
y = bt; | |||
} | |||
bt = y; | |||
bt += y * y; | |||
bt >>= 1; | |||
bt += x; | |||
return framask[bt]; | |||
} | |||
//======================================================================== | |||
// Apply the selected mask out of the 8. | |||
function applymask(m) | |||
{ | |||
var x, y, r3x, r3y; | |||
switch (m) { | |||
case 0: | |||
for (y = 0; y < width; y++) | |||
for (x = 0; x < width; x++) | |||
if (!((x + y) & 1) && !ismasked(x, y)) | |||
qrframe[x + y * width] ^= 1; | |||
break; | |||
case 1: | |||
for (y = 0; y < width; y++) | |||
for (x = 0; x < width; x++) | |||
if (!(y & 1) && !ismasked(x, y)) | |||
qrframe[x + y * width] ^= 1; | |||
break; | |||
case 2: | |||
for (y = 0; y < width; y++) | |||
for (r3x = 0, x = 0; x < width; x++, r3x++) { | |||
if (r3x == 3) | |||
r3x = 0; | |||
if (!r3x && !ismasked(x, y)) | |||
qrframe[x + y * width] ^= 1; | |||
} | |||
break; | |||
case 3: | |||
for (r3y = 0, y = 0; y < width; y++, r3y++) { | |||
if (r3y == 3) | |||
r3y = 0; | |||
for (r3x = r3y, x = 0; x < width; x++, r3x++) { | |||
if (r3x == 3) | |||
r3x = 0; | |||
if (!r3x && !ismasked(x, y)) | |||
qrframe[x + y * width] ^= 1; | |||
} | |||
} | |||
break; | |||
case 4: | |||
for (y = 0; y < width; y++) | |||
for (r3x = 0, r3y = ((y >> 1) & 1), x = 0; x < width; x++, r3x++) { | |||
if (r3x == 3) { | |||
r3x = 0; | |||
r3y = !r3y; | |||
} | |||
if (!r3y && !ismasked(x, y)) | |||
qrframe[x + y * width] ^= 1; | |||
} | |||
break; | |||
case 5: | |||
for (r3y = 0, y = 0; y < width; y++, r3y++) { | |||
if (r3y == 3) | |||
r3y = 0; | |||
for (r3x = 0, x = 0; x < width; x++, r3x++) { | |||
if (r3x == 3) | |||
r3x = 0; | |||
if (!((x & y & 1) + !(!r3x | !r3y)) && !ismasked(x, y)) | |||
qrframe[x + y * width] ^= 1; | |||
} | |||
} | |||
break; | |||
case 6: | |||
for (r3y = 0, y = 0; y < width; y++, r3y++) { | |||
if (r3y == 3) | |||
r3y = 0; | |||
for (r3x = 0, x = 0; x < width; x++, r3x++) { | |||
if (r3x == 3) | |||
r3x = 0; | |||
if (!(((x & y & 1) + (r3x && (r3x == r3y))) & 1) && !ismasked(x, y)) | |||
qrframe[x + y * width] ^= 1; | |||
} | |||
} | |||
break; | |||
case 7: | |||
for (r3y = 0, y = 0; y < width; y++, r3y++) { | |||
if (r3y == 3) | |||
r3y = 0; | |||
for (r3x = 0, x = 0; x < width; x++, r3x++) { | |||
if (r3x == 3) | |||
r3x = 0; | |||
if (!(((r3x && (r3x == r3y)) + ((x + y) & 1)) & 1) && !ismasked(x, y)) | |||
qrframe[x + y * width] ^= 1; | |||
} | |||
} | |||
break; | |||
} | |||
return; | |||
} | |||
// Badness coefficients. | |||
var N1 = 3, N2 = 3, N3 = 40, N4 = 10; | |||
// Using the table of the length of each run, calculate the amount of bad image | |||
// - long runs or those that look like finders; called twice, once each for X and Y | |||
function badruns(length) | |||
{ | |||
var i; | |||
var runsbad = 0; | |||
for (i = 0; i <= length; i++) | |||
if (rlens[i] >= 5) | |||
runsbad += N1 + rlens[i] - 5; | |||
// BwBBBwB as in finder | |||
for (i = 3; i < length - 1; i += 2) | |||
if (rlens[i - 2] == rlens[i + 2] | |||
&& rlens[i + 2] == rlens[i - 1] | |||
&& rlens[i - 1] == rlens[i + 1] | |||
&& rlens[i - 1] * 3 == rlens[i] | |||
// white around the black pattern? Not part of spec | |||
&& (rlens[i - 3] == 0 // beginning | |||
|| i + 3 > length // end | |||
|| rlens[i - 3] * 3 >= rlens[i] * 4 || rlens[i + 3] * 3 >= rlens[i] * 4) | |||
) | |||
runsbad += N3; | |||
return runsbad; | |||
} | |||
// Calculate how bad the masked image is - blocks, imbalance, runs, or finders. | |||
function badcheck() | |||
{ | |||
var x, y, h, b, b1; | |||
var thisbad = 0; | |||
var bw = 0; | |||
// blocks of same color. | |||
for (y = 0; y < width - 1; y++) | |||
for (x = 0; x < width - 1; x++) | |||
if ((qrframe[x + width * y] && qrframe[(x + 1) + width * y] | |||
&& qrframe[x + width * (y + 1)] && qrframe[(x + 1) + width * (y + 1)]) // all black | |||
|| !(qrframe[x + width * y] || qrframe[(x + 1) + width * y] | |||
|| qrframe[x + width * (y + 1)] || qrframe[(x + 1) + width * (y + 1)])) // all white | |||
thisbad += N2; | |||
// X runs | |||
for (y = 0; y < width; y++) { | |||
rlens[0] = 0; | |||
for (h = b = x = 0; x < width; x++) { | |||
if ((b1 = qrframe[x + width * y]) == b) | |||
rlens[h]++; | |||
else | |||
rlens[++h] = 1; | |||
b = b1; | |||
bw += b ? 1 : -1; | |||
} | |||
thisbad += badruns(h); | |||
} | |||
// black/white imbalance | |||
if (bw < 0) | |||
bw = -bw; | |||
var big = bw; | |||
var count = 0; | |||
big += big << 2; | |||
big <<= 1; | |||
while (big > width * width) | |||
big -= width * width, count++; | |||
thisbad += count * N4; | |||
// Y runs | |||
for (x = 0; x < width; x++) { | |||
rlens[0] = 0; | |||
for (h = b = y = 0; y < width; y++) { | |||
if ((b1 = qrframe[x + width * y]) == b) | |||
rlens[h]++; | |||
else | |||
rlens[++h] = 1; | |||
b = b1; | |||
} | |||
thisbad += badruns(h); | |||
} | |||
return thisbad; | |||
} | |||
function genframe(instring) | |||
{ | |||
var x, y, k, t, v, i, j, m; | |||
// find the smallest version that fits the string | |||
t = instring.length; | |||
version = 0; | |||
do { | |||
version++; | |||
k = (ecclevel - 1) * 4 + (version - 1) * 16; | |||
neccblk1 = eccblocks[k++]; | |||
neccblk2 = eccblocks[k++]; | |||
datablkw = eccblocks[k++]; | |||
eccblkwid = eccblocks[k]; | |||
k = datablkw * (neccblk1 + neccblk2) + neccblk2 - 3 + (version <= 9); | |||
if (t <= k) | |||
break; | |||
} while (version < 40); | |||
// FIXME - insure that it fits insted of being truncated | |||
width = 17 + 4 * version; | |||
// allocate, clear and setup data structures | |||
v = datablkw + (datablkw + eccblkwid) * (neccblk1 + neccblk2) + neccblk2; | |||
for( t = 0; t < v; t++ ) | |||
eccbuf[t] = 0; | |||
strinbuf = instring.slice(0); | |||
for( t = 0; t < width * width; t++ ) | |||
qrframe[t] = 0; | |||
for( t = 0 ; t < (width * (width + 1) + 1) / 2; t++) | |||
framask[t] = 0; | |||
// insert finders - black to frame, white to mask | |||
for (t = 0; t < 3; t++) { | |||
k = 0; | |||
y = 0; | |||
if (t == 1) | |||
k = (width - 7); | |||
if (t == 2) | |||
y = (width - 7); | |||
qrframe[(y + 3) + width * (k + 3)] = 1; | |||
for (x = 0; x < 6; x++) { | |||
qrframe[(y + x) + width * k] = 1; | |||
qrframe[y + width * (k + x + 1)] = 1; | |||
qrframe[(y + 6) + width * (k + x)] = 1; | |||
qrframe[(y + x + 1) + width * (k + 6)] = 1; | |||
} | |||
for (x = 1; x < 5; x++) { | |||
setmask(y + x, k + 1); | |||
setmask(y + 1, k + x + 1); | |||
setmask(y + 5, k + x); | |||
setmask(y + x + 1, k + 5); | |||
} | |||
for (x = 2; x < 4; x++) { | |||
qrframe[(y + x) + width * (k + 2)] = 1; | |||
qrframe[(y + 2) + width * (k + x + 1)] = 1; | |||
qrframe[(y + 4) + width * (k + x)] = 1; | |||
qrframe[(y + x + 1) + width * (k + 4)] = 1; | |||
} | |||
} | |||
// alignment blocks | |||
if (version > 1) { | |||
t = adelta[version]; | |||
y = width - 7; | |||
for (;;) { | |||
x = width - 7; | |||
while (x > t - 3) { | |||
putalign(x, y); | |||
if (x < t) | |||
break; | |||
x -= t; | |||
} | |||
if (y <= t + 9) | |||
break; | |||
y -= t; | |||
putalign(6, y); | |||
putalign(y, 6); | |||
} | |||
} | |||
// single black | |||
qrframe[8 + width * (width - 8)] = 1; | |||
// timing gap - mask only | |||
for (y = 0; y < 7; y++) { | |||
setmask(7, y); | |||
setmask(width - 8, y); | |||
setmask(7, y + width - 7); | |||
} | |||
for (x = 0; x < 8; x++) { | |||
setmask(x, 7); | |||
setmask(x + width - 8, 7); | |||
setmask(x, width - 8); | |||
} | |||
// reserve mask-format area | |||
for (x = 0; x < 9; x++) | |||
setmask(x, 8); | |||
for (x = 0; x < 8; x++) { | |||
setmask(x + width - 8, 8); | |||
setmask(8, x); | |||
} | |||
for (y = 0; y < 7; y++) | |||
setmask(8, y + width - 7); | |||
// timing row/col | |||
for (x = 0; x < width - 14; x++) | |||
if (x & 1) { | |||
setmask(8 + x, 6); | |||
setmask(6, 8 + x); | |||
} | |||
else { | |||
qrframe[(8 + x) + width * 6] = 1; | |||
qrframe[6 + width * (8 + x)] = 1; | |||
} | |||
// version block | |||
if (version > 6) { | |||
t = vpat[version - 7]; | |||
k = 17; | |||
for (x = 0; x < 6; x++) | |||
for (y = 0; y < 3; y++, k--) | |||
if (1 & (k > 11 ? version >> (k - 12) : t >> k)) { | |||
qrframe[(5 - x) + width * (2 - y + width - 11)] = 1; | |||
qrframe[(2 - y + width - 11) + width * (5 - x)] = 1; | |||
} | |||
else { | |||
setmask(5 - x, 2 - y + width - 11); | |||
setmask(2 - y + width - 11, 5 - x); | |||
} | |||
} | |||
// sync mask bits - only set above for white spaces, so add in black bits | |||
for (y = 0; y < width; y++) | |||
for (x = 0; x <= y; x++) | |||
if (qrframe[x + width * y]) | |||
setmask(x, y); | |||
// convert string to bitstream | |||
// 8 bit data to QR-coded 8 bit data (numeric or alphanum, or kanji not supported) | |||
v = strinbuf.length; | |||
// string to array | |||
for( i = 0 ; i < v; i++ ) | |||
eccbuf[i] = strinbuf.charCodeAt(i); | |||
strinbuf = eccbuf.slice(0); | |||
// calculate max string length | |||
x = datablkw * (neccblk1 + neccblk2) + neccblk2; | |||
if (v >= x - 2) { | |||
v = x - 2; | |||
if (version > 9) | |||
v--; | |||
} | |||
// shift and repack to insert length prefix | |||
i = v; | |||
if (version > 9) { | |||
strinbuf[i + 2] = 0; | |||
strinbuf[i + 3] = 0; | |||
while (i--) { | |||
t = strinbuf[i]; | |||
strinbuf[i + 3] |= 255 & (t << 4); | |||
strinbuf[i + 2] = t >> 4; | |||
} | |||
strinbuf[2] |= 255 & (v << 4); | |||
strinbuf[1] = v >> 4; | |||
strinbuf[0] = 0x40 | (v >> 12); | |||
} | |||
else { | |||
strinbuf[i + 1] = 0; | |||
strinbuf[i + 2] = 0; | |||
while (i--) { | |||
t = strinbuf[i]; | |||
strinbuf[i + 2] |= 255 & (t << 4); | |||
strinbuf[i + 1] = t >> 4; | |||
} | |||
strinbuf[1] |= 255 & (v << 4); | |||
strinbuf[0] = 0x40 | (v >> 4); | |||
} | |||
// fill to end with pad pattern | |||
i = v + 3 - (version < 10); | |||
while (i < x) { | |||
strinbuf[i++] = 0xec; | |||
// buffer has room if (i == x) break; | |||
strinbuf[i++] = 0x11; | |||
} | |||
// calculate and append ECC | |||
// calculate generator polynomial | |||
genpoly[0] = 1; | |||
for (i = 0; i < eccblkwid; i++) { | |||
genpoly[i + 1] = 1; | |||
for (j = i; j > 0; j--) | |||
genpoly[j] = genpoly[j] | |||
? genpoly[j - 1] ^ gexp[modnn(glog[genpoly[j]] + i)] : genpoly[j - 1]; | |||
genpoly[0] = gexp[modnn(glog[genpoly[0]] + i)]; | |||
} | |||
for (i = 0; i <= eccblkwid; i++) | |||
genpoly[i] = glog[genpoly[i]]; // use logs for genpoly[] to save calc step | |||
// append ecc to data buffer | |||
k = x; | |||
y = 0; | |||
for (i = 0; i < neccblk1; i++) { | |||
appendrs(y, datablkw, k, eccblkwid); | |||
y += datablkw; | |||
k += eccblkwid; | |||
} | |||
for (i = 0; i < neccblk2; i++) { | |||
appendrs(y, datablkw + 1, k, eccblkwid); | |||
y += datablkw + 1; | |||
k += eccblkwid; | |||
} | |||
// interleave blocks | |||
y = 0; | |||
for (i = 0; i < datablkw; i++) { | |||
for (j = 0; j < neccblk1; j++) | |||
eccbuf[y++] = strinbuf[i + j * datablkw]; | |||
for (j = 0; j < neccblk2; j++) | |||
eccbuf[y++] = strinbuf[(neccblk1 * datablkw) + i + (j * (datablkw + 1))]; | |||
} | |||
for (j = 0; j < neccblk2; j++) | |||
eccbuf[y++] = strinbuf[(neccblk1 * datablkw) + i + (j * (datablkw + 1))]; | |||
for (i = 0; i < eccblkwid; i++) | |||
for (j = 0; j < neccblk1 + neccblk2; j++) | |||
eccbuf[y++] = strinbuf[x + i + j * eccblkwid]; | |||
strinbuf = eccbuf; | |||
// pack bits into frame avoiding masked area. | |||
x = y = width - 1; | |||
k = v = 1; // up, minus | |||
/* inteleaved data and ecc codes */ | |||
m = (datablkw + eccblkwid) * (neccblk1 + neccblk2) + neccblk2; | |||
for (i = 0; i < m; i++) { | |||
t = strinbuf[i]; | |||
for (j = 0; j < 8; j++, t <<= 1) { | |||
if (0x80 & t) | |||
qrframe[x + width * y] = 1; | |||
do { // find next fill position | |||
if (v) | |||
x--; | |||
else { | |||
x++; | |||
if (k) { | |||
if (y != 0) | |||
y--; | |||
else { | |||
x -= 2; | |||
k = !k; | |||
if (x == 6) { | |||
x--; | |||
y = 9; | |||
} | |||
} | |||
} | |||
else { | |||
if (y != width - 1) | |||
y++; | |||
else { | |||
x -= 2; | |||
k = !k; | |||
if (x == 6) { | |||
x--; | |||
y -= 8; | |||
} | |||
} | |||
} | |||
} | |||
v = !v; | |||
} while (ismasked(x, y)); | |||
} | |||
} | |||
// save pre-mask copy of frame | |||
strinbuf = qrframe.slice(0); | |||
t = 0; // best | |||
y = 30000; // demerit | |||
// for instead of while since in original arduino code | |||
// if an early mask was "good enough" it wouldn't try for a better one | |||
// since they get more complex and take longer. | |||
for (k = 0; k < 8; k++) { | |||
applymask(k); // returns black-white imbalance | |||
x = badcheck(); | |||
if (x < y) { // current mask better than previous best? | |||
y = x; | |||
t = k; | |||
} | |||
if (t == 7) | |||
break; // don't increment i to a void redoing mask | |||
qrframe = strinbuf.slice(0); // reset for next pass | |||
} | |||
if (t != k) // redo best mask - none good enough, last wasn't t | |||
applymask(t); | |||
// add in final mask/ecclevel bytes | |||
y = fmtword[t + ((ecclevel - 1) << 3)]; | |||
// low byte | |||
for (k = 0; k < 8; k++, y >>= 1) | |||
if (y & 1) { | |||
qrframe[(width - 1 - k) + width * 8] = 1; | |||
if (k < 6) | |||
qrframe[8 + width * k] = 1; | |||
else | |||
qrframe[8 + width * (k + 1)] = 1; | |||
} | |||
// high byte | |||
for (k = 0; k < 7; k++, y >>= 1) | |||
if (y & 1) { | |||
qrframe[8 + width * (width - 7 + k)] = 1; | |||
if (k) | |||
qrframe[(6 - k) + width * 8] = 1; | |||
else | |||
qrframe[7 + width * 8] = 1; | |||
} | |||
// return image | |||
return qrframe; | |||
} | |||
var _canvas = null, | |||
_size = null; | |||
var api = { | |||
get ecclevel () { | |||
return ecclevel; | |||
}, | |||
set ecclevel (val) { | |||
ecclevel = val; | |||
}, | |||
get size () { | |||
return _size; | |||
}, | |||
set size (val) { | |||
_size = val | |||
}, | |||
get canvas () { | |||
return _canvas; | |||
}, | |||
set canvas (el) { | |||
_canvas = el; | |||
}, | |||
getFrame: function (string) { | |||
return genframe(string); | |||
}, | |||
draw: function (string, canvas, size, ecc) { | |||
ecclevel = ecc || ecclevel; | |||
canvas = canvas || _canvas; | |||
if (!canvas) { | |||
console.warn('No canvas provided to draw QR code in!') | |||
return; | |||
} | |||
size = size || _size || Math.min(canvas.width, canvas.height); | |||
var frame = genframe(string), | |||
ctx = canvas.ctx, | |||
px = Math.round(size / (width + 8)); | |||
var roundedSize = px * (width + 8), | |||
offset = Math.floor((size - roundedSize) / 2); | |||
size = roundedSize; | |||
ctx.clearRect(0, 0, canvas.width, canvas.height); | |||
ctx.setFillStyle('#000000'); | |||
for (var i = 0; i < width; i++) { | |||
for (var j = 0; j < width; j++) { | |||
if (frame[j * width + i]) { | |||
ctx.fillRect(px * (4 + i) + offset, px * (4 + j) + offset, px, px); | |||
} | |||
} | |||
} | |||
ctx.draw(); | |||
} | |||
} | |||
module.exports = { | |||
api: api | |||
} | |||
})() |
@@ -0,0 +1,197 @@ | |||
var barcode = require("./barcode"); | |||
var qrcode = require("./qrcode"); | |||
const extConfig = tt.getExtConfigSync ? tt.getExtConfigSync() : {} | |||
function convertUTCTimeToLocalTime(UTCDateString) { | |||
if (!UTCDateString) { | |||
return '-'; | |||
} | |||
function formatFunc(str) { //格式化显示 | |||
return str > 9 ? str : '0' + str | |||
} | |||
var date2 = new Date(UTCDateString); //这步是关键 | |||
var year = date2.getFullYear(); | |||
var mon = formatFunc(date2.getMonth() + 1); | |||
var day = formatFunc(date2.getDate()); | |||
var hour = date2.getHours(); | |||
var noon = hour >= 12 ? 'PM' : 'AM'; | |||
hour = hour >= 24 ? hour - 24 : hour; | |||
hour = formatFunc(hour); | |||
var min = formatFunc(date2.getMinutes()); | |||
var dateStr = ' ' + hour + ':' + min ; | |||
return dateStr; | |||
} | |||
function fmtDate(date) { | |||
var dateee = new Date(date).toJSON(); | |||
return new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, ''); | |||
} | |||
const formatTime = (date, fmt) => { | |||
try { | |||
if (!date) { | |||
return date; | |||
} | |||
if (typeof date === 'string' && date.length === 13) { | |||
date = Number(date); | |||
} | |||
if (typeof date == "number") { | |||
date = new Date(date); | |||
} | |||
var o = { | |||
"M+": date.getMonth() + 1, //月份 | |||
"d+": date.getDate(), //日 | |||
"h+": date.getHours(), //小时 | |||
"m+": date.getMinutes(), //分 | |||
"s+": date.getSeconds(), //秒 | |||
"q+": Math.floor((date.getMonth() + 3) / 3), //季度 | |||
S: date.getMilliseconds() //毫秒 | |||
}; | |||
if (/(y+)/.test(fmt)) | |||
fmt = fmt.replace( | |||
RegExp.$1, | |||
(date.getFullYear() + "").substr(4 - RegExp.$1.length) | |||
); | |||
for (var k in o) | |||
if (new RegExp("(" + k + ")").test(fmt)) | |||
fmt = fmt.replace( | |||
RegExp.$1, | |||
RegExp.$1.length == 1 | |||
? o[k] | |||
: ("00" + o[k]).substr(("" + o[k]).length) | |||
); | |||
return fmt; | |||
} catch (error) { | |||
return date; | |||
} | |||
}; | |||
const formatNumber = n => { | |||
n = n.toString(); | |||
return n[1] ? n : "0" + n; | |||
}; | |||
function convert_length(length) { | |||
return Math.round((tt.getSystemInfoSync().windowWidth * length) / 750); | |||
} | |||
function barc(id, code, width, height) { | |||
barcode.code128( | |||
tt.createCanvasContext(id), | |||
code, | |||
convert_length(width), | |||
convert_length(height) | |||
); | |||
} | |||
function qrc(id, code, width, height) { | |||
qrcode.api.draw(code, { | |||
ctx: tt.createCanvasContext(id), | |||
width: convert_length(width), | |||
height: convert_length(height) | |||
}); | |||
} | |||
function fmtDate(obj) { | |||
if (typeof obj === 'string' && obj.length === 13) { | |||
obj = Number(obj); | |||
} | |||
var date = new Date(obj); | |||
var y = 1900 + date.getYear(); | |||
var m = "0" + (date.getMonth() + 1); | |||
var d = "0" + date.getDate(); | |||
return ( | |||
y + | |||
"-" + | |||
m.substring(m.length - 2, m.length) + | |||
"-" + | |||
d.substring(d.length - 2, d.length) | |||
); | |||
} | |||
//计算下单的时间与现在的时间的 | |||
function timechuo(startTime) { | |||
var s1 = new Date(startTime.replace(/-/g, "/")); | |||
var s2 = new Date(); | |||
var runTime = parseInt((s1.getTime() - s2.getTime()) / 1000); | |||
var year = Math.floor(runTime / 86400 / 365); | |||
var runTime = runTime % (86400 * 365); | |||
var month = Math.floor(runTime / 86400 / 30); | |||
var runTime = runTime % (86400 * 30); | |||
var day = Math.floor(runTime / 86400); | |||
var runTime = runTime % 86400; | |||
var hour = Math.floor(runTime / 3600); | |||
var runTime = runTime % 3600; | |||
var minute = Math.floor(runTime / 60); | |||
var runTime = runTime % 60; | |||
var second = runTime; | |||
if (day && !year && !month){ | |||
return (day + '天' + hour + "小时" + minute + "分钟") | |||
} else if (month && !year){ | |||
return ((month*30+day) +'天' + hour + "小时" + minute + "分钟") | |||
} else if (year) { | |||
return ((year*365 + month*30+ day) + '天' + hour + "小时" + minute + "分钟") | |||
}else{ | |||
return (hour + "小时" + minute + "分钟") | |||
} | |||
} | |||
//计算时间差 | |||
function timecha(endTime,startTime) { | |||
var s1 = new Date(endTime.replace(/-/g, "/")); | |||
var s2 = new Date(startTime.replace(/-/g, "/")); | |||
var runTime = parseInt((s1.getTime() - s2.getTime()) / 1000); | |||
var year = Math.floor(runTime / 86400 / 365); | |||
var runTime = runTime % (86400 * 365); | |||
var month = Math.floor(runTime / 86400 / 30); | |||
var runTime = runTime % (86400 * 30); | |||
var day = Math.floor(runTime / 86400); | |||
var runTime = runTime % 86400; | |||
var hour = Math.floor(runTime / 3600); | |||
var runTime = runTime % 3600; | |||
var minute = Math.floor(runTime / 60); | |||
var runTime = runTime % 60; | |||
var second = runTime; | |||
return (month+"月"+day+"天"+hour+"小时"+minute+"分钟") | |||
} | |||
function isJSON(str) { | |||
if (typeof str == 'string') { | |||
console.log("string") | |||
try { | |||
var obj = JSON.parse(str); | |||
if (typeof obj == 'object' && obj) { | |||
return true; | |||
} else { | |||
return false; | |||
} | |||
} catch (e) { | |||
console.log(e); | |||
tt.showToast({ | |||
title: '请扫描正确的二维码', | |||
icon: 'none', | |||
duration: 1300 | |||
}) | |||
} | |||
} else { | |||
tt.showToast({ | |||
title: '请扫描正确的二维码', | |||
icon: 'none', | |||
duration: 1300 | |||
}) | |||
} | |||
} | |||
module.exports = { | |||
formatTime: formatTime, | |||
barcode: barc, | |||
qrcode: qrc, | |||
isJSON: isJSON, | |||
fmtDate: fmtDate, | |||
timechuo: timechuo, | |||
timecha: timecha, | |||
convertUTCTimeToLocalTime: convertUTCTimeToLocalTime | |||
}; |
@@ -0,0 +1,318 @@ | |||
/** | |||
* 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, | |||
attr:{} | |||
}; | |||
if (node.tag =="embed"){ | |||
console.log(node,attrs,unary,666) | |||
var embUrl = ''; | |||
attrs.map((item,index)=>{ | |||
if(item.name == 'src'){ | |||
embUrl = item.value | |||
} | |||
}) | |||
// if (node.attr.src.indexOf('http:')==-1){ | |||
// embUrl = "http://xxxx.com" + node.attr.src; | |||
// } | |||
node.attr.src = embUrl; | |||
node.tag='video'; | |||
} | |||
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 | |||
}; | |||
@@ -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; |
@@ -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 | |||
} |
@@ -0,0 +1,157 @@ | |||
/** | |||
* 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; | |||
tt.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); | |||
} else if (type == 'md' || type == 'markdown') { | |||
var converter = new showdown.Converter(); | |||
var html = converter.makeHtml(data); | |||
transData = HtmlToJson.html2json(html, bindName); | |||
} | |||
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) { | |||
tt.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 | |||
} | |||
@@ -0,0 +1,963 @@ | |||
<!--** | |||
* 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}}" bindload="wxParseImgLoad" bindtap="wxParseImgTap" mode="widthFix" style="width:{{item.width}}px;" | |||
/> | |||
</template> | |||
<template name="WxEmojiView"> | |||
<view class="WxEmojiView wxParse-inline" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.textArray}}" tt:key=""> | |||
<block class="{{item.text == '\\n' ? 'wxParse-hide':''}}" tt:if="{{item.node == 'text'}}">{{item.text}}</block> | |||
<block tt: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 tt:for="{{wxParseData}}" tt:key=""> | |||
<template is="wxParse0" tt:if="{{item.tag !='style'}}" data="{{item}}" /> | |||
</block> | |||
</template> | |||
<!--循环模版--> | |||
<template name="wxParse0"> | |||
<!--<template is="wxParse1" data="{{item}}" />--> | |||
<!--判断是否是标签节点--> | |||
<block tt:if="{{item.node == 'element'}}"> | |||
<block tt:if="{{item.tag == 'button'}}"> | |||
<button type="default" size="mini"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse1" data="{{item}}" /> | |||
</block> | |||
</button> | |||
</block> | |||
<!--li类型--> | |||
<block tt: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 tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse1" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</view> | |||
</view> | |||
</block> | |||
<!--video类型--> | |||
<block tt:elif="{{item.tag == 'video'}}"> | |||
<template is="wxParseVideo" data="{{item}}" /> | |||
</block> | |||
<!--img类型--> | |||
<block tt:elif="{{item.tag == 'img'}}"> | |||
<template is="wxParseImg" data="{{item}}" /> | |||
</block> | |||
<!--a类型--> | |||
<block tt:elif="{{item.tag == 'a'}}"> | |||
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse1" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<block tt:elif="{{item.tag == 'table'}}"> | |||
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse1" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<block tt:elif="{{item.tag == 'br'}}"> | |||
<template is="WxParseBr"></template> | |||
</block> | |||
<!--其他块级标签--> | |||
<block tt:elif="{{item.tagType == 'block'}}"> | |||
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse1" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<!--内联标签--> | |||
<view tt:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse1" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<!--判断是否是文本节点--> | |||
<block tt:elif="{{item.node == 'text'}}"> | |||
<!--如果是,直接进行--> | |||
<template is="WxEmojiView" data="{{item}}" /> | |||
</block> | |||
</template> | |||
<!--循环模版--> | |||
<template name="wxParse1"> | |||
<!--判断是否是标签节点--> | |||
<block tt:if="{{item.node == 'element'&&item.tag !='style'}}"> | |||
<block tt:if="{{item.tag == 'button'}}"> | |||
<button type="default" size="mini"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse2" data="{{item}}" /> | |||
</block> | |||
</button> | |||
</block> | |||
<!--li类型--> | |||
<block tt: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 tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse2" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</view> | |||
</view> | |||
</block> | |||
<!--video类型--> | |||
<block tt:elif="{{item.tag == 'video'}}"> | |||
<template is="wxParseVideo" data="{{item}}" /> | |||
</block> | |||
<!--img类型--> | |||
<block tt:elif="{{item.tag == 'img'}}"> | |||
<template is="wxParseImg" data="{{item}}" /> | |||
</block> | |||
<!--a类型--> | |||
<block tt:elif="{{item.tag == 'a'}}"> | |||
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse2" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<block tt:elif="{{item.tag == 'br'}}"> | |||
<template is="WxParseBr"></template> | |||
</block> | |||
<!--其他块级标签--> | |||
<block tt:elif="{{item.tagType == 'block'}}"> | |||
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse2" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<!--内联标签--> | |||
<view tt:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse2" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<!--判断是否是文本节点--> | |||
<block tt:elif="{{item.node == 'text'}}"> | |||
<!--如果是,直接进行--> | |||
<template is="WxEmojiView" data="{{item}}" /> | |||
</block> | |||
</template> | |||
<!--循环模版--> | |||
<template name="wxParse2"> | |||
<!--<template is="wxParse3" data="{{item}}" />--> | |||
<!--判断是否是标签节点--> | |||
<block tt:if="{{item.node == 'element'}}"> | |||
<block tt:if="{{item.tag == 'button'}}"> | |||
<button type="default" size="mini"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse3" data="{{item}}" /> | |||
</block> | |||
</button> | |||
</block> | |||
<!--li类型--> | |||
<block tt: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 tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse3" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</view> | |||
</view> | |||
</block> | |||
<!--video类型--> | |||
<block tt:elif="{{item.tag == 'video'}}"> | |||
<template is="wxParseVideo" data="{{item}}" /> | |||
</block> | |||
<!--img类型--> | |||
<block tt:elif="{{item.tag == 'img'}}"> | |||
<template is="wxParseImg" data="{{item}}" /> | |||
</block> | |||
<!--a类型--> | |||
<block tt:elif="{{item.tag == 'a'}}"> | |||
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse3" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<block tt:elif="{{item.tag == 'br'}}"> | |||
<template is="WxParseBr"></template> | |||
</block> | |||
<!--其他块级标签--> | |||
<block tt:elif="{{item.tagType == 'block'}}"> | |||
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse3" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<!--内联标签--> | |||
<view tt:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse3" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<!--判断是否是文本节点--> | |||
<block tt:elif="{{item.node == 'text'&&item.tag !='style'}}"> | |||
<!--如果是,直接进行--> | |||
<template is="WxEmojiView" data="{{item}}" /> | |||
</block> | |||
</template> | |||
<!--循环模版--> | |||
<template name="wxParse3"> | |||
<!--<template is="wxParse4" data="{{item}}" />--> | |||
<!--判断是否是标签节点--> | |||
<block tt:if="{{item.node == 'element'}}"> | |||
<block tt:if="{{item.tag == 'button'}}"> | |||
<button type="default" size="mini"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse4" data="{{item}}" /> | |||
</block> | |||
</button> | |||
</block> | |||
<!--li类型--> | |||
<block tt: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 tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse4" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</view> | |||
</view> | |||
</block> | |||
<!--video类型--> | |||
<block tt:elif="{{item.tag == 'video'}}"> | |||
<template is="wxParseVideo" data="{{item}}" /> | |||
</block> | |||
<!--img类型--> | |||
<block tt:elif="{{item.tag == 'img'}}"> | |||
<template is="wxParseImg" data="{{item}}" /> | |||
</block> | |||
<!--a类型--> | |||
<block tt:elif="{{item.tag == 'a'}}"> | |||
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse4" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<block tt:elif="{{item.tag == 'br'}}"> | |||
<template is="WxParseBr"></template> | |||
</block> | |||
<!--其他块级标签--> | |||
<block tt:elif="{{item.tagType == 'block'}}"> | |||
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse4" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<!--内联标签--> | |||
<view tt:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse4" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<!--判断是否是文本节点--> | |||
<block tt:elif="{{item.node == 'text'}}"> | |||
<!--如果是,直接进行--> | |||
<template is="WxEmojiView" data="{{item}}" /> | |||
</block> | |||
</template> | |||
<!--循环模版--> | |||
<template name="wxParse4"> | |||
<!--<template is="wxParse5" data="{{item}}" />--> | |||
<!--判断是否是标签节点--> | |||
<block tt:if="{{item.node == 'element'}}"> | |||
<block tt:if="{{item.tag == 'button'}}"> | |||
<button type="default" size="mini"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse5" data="{{item}}" /> | |||
</block> | |||
</button> | |||
</block> | |||
<!--li类型--> | |||
<block tt: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 tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse5" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</view> | |||
</view> | |||
</block> | |||
<!--video类型--> | |||
<block tt:elif="{{item.tag == 'video'}}"> | |||
<template is="wxParseVideo" data="{{item}}" /> | |||
</block> | |||
<!--img类型--> | |||
<block tt:elif="{{item.tag == 'img'}}"> | |||
<template is="wxParseImg" data="{{item}}" /> | |||
</block> | |||
<!--a类型--> | |||
<block tt:elif="{{item.tag == 'a'}}"> | |||
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse5" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<block tt:elif="{{item.tag == 'br'}}"> | |||
<template is="WxParseBr"></template> | |||
</block> | |||
<!--其他块级标签--> | |||
<block tt:elif="{{item.tagType == 'block'}}"> | |||
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse5" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<!--内联标签--> | |||
<view tt:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse5" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<!--判断是否是文本节点--> | |||
<block tt:elif="{{item.node == 'text'}}"> | |||
<!--如果是,直接进行--> | |||
<template is="WxEmojiView" data="{{item}}" /> | |||
</block> | |||
</template> | |||
<!--循环模版--> | |||
<template name="wxParse5"> | |||
<!--<template is="wxParse6" data="{{item}}" />--> | |||
<!--判断是否是标签节点--> | |||
<block tt:if="{{item.node == 'element'}}"> | |||
<block tt:if="{{item.tag == 'button'}}"> | |||
<button type="default" size="mini"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse6" data="{{item}}" /> | |||
</block> | |||
</button> | |||
</block> | |||
<!--li类型--> | |||
<block tt: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 tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse6" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</view> | |||
</view> | |||
</block> | |||
<!--video类型--> | |||
<block tt:elif="{{item.tag == 'video'}}"> | |||
<template is="wxParseVideo" data="{{item}}" /> | |||
</block> | |||
<!--img类型--> | |||
<block tt:elif="{{item.tag == 'img'}}"> | |||
<template is="wxParseImg" data="{{item}}" /> | |||
</block> | |||
<!--a类型--> | |||
<block tt:elif="{{item.tag == 'a'}}"> | |||
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse6" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<block tt:elif="{{item.tag == 'br'}}"> | |||
<template is="WxParseBr"></template> | |||
</block> | |||
<!--其他块级标签--> | |||
<block tt:elif="{{item.tagType == 'block'}}"> | |||
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse6" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<!--内联标签--> | |||
<view tt:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse6" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<!--判断是否是文本节点--> | |||
<block tt:elif="{{item.node == 'text'}}"> | |||
<!--如果是,直接进行--> | |||
<template is="WxEmojiView" data="{{item}}" /> | |||
</block> | |||
</template> | |||
<!--循环模版--> | |||
<template name="wxParse6"> | |||
<!--<template is="wxParse7" data="{{item}}" />--> | |||
<!--判断是否是标签节点--> | |||
<block tt:if="{{item.node == 'element'}}"> | |||
<block tt:if="{{item.tag == 'button'}}"> | |||
<button type="default" size="mini"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse7" data="{{item}}" /> | |||
</block> | |||
</button> | |||
</block> | |||
<!--li类型--> | |||
<block tt: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 tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse7" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</view> | |||
</view> | |||
</block> | |||
<!--video类型--> | |||
<block tt:elif="{{item.tag == 'video'}}"> | |||
<template is="wxParseVideo" data="{{item}}" /> | |||
</block> | |||
<!--img类型--> | |||
<block tt:elif="{{item.tag == 'img'}}"> | |||
<template is="wxParseImg" data="{{item}}" /> | |||
</block> | |||
<!--a类型--> | |||
<block tt:elif="{{item.tag == 'a'}}"> | |||
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse7" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<block tt:elif="{{item.tag == 'br'}}"> | |||
<template is="WxParseBr"></template> | |||
</block> | |||
<!--其他块级标签--> | |||
<block tt:elif="{{item.tagType == 'block'}}"> | |||
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse7" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<!--内联标签--> | |||
<view tt:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse7" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<!--判断是否是文本节点--> | |||
<block tt:elif="{{item.node == 'text'}}"> | |||
<!--如果是,直接进行--> | |||
<template is="WxEmojiView" data="{{item}}" /> | |||
</block> | |||
</template> | |||
<!--循环模版--> | |||
<template name="wxParse7"> | |||
<!--<template is="wxParse8" data="{{item}}" />--> | |||
<!--判断是否是标签节点--> | |||
<block tt:if="{{item.node == 'element'}}"> | |||
<block tt:if="{{item.tag == 'button'}}"> | |||
<button type="default" size="mini"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse8" data="{{item}}" /> | |||
</block> | |||
</button> | |||
</block> | |||
<!--li类型--> | |||
<block tt: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 tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse8" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</view> | |||
</view> | |||
</block> | |||
<!--video类型--> | |||
<block tt:elif="{{item.tag == 'video'}}"> | |||
<template is="wxParseVideo" data="{{item}}" /> | |||
</block> | |||
<!--img类型--> | |||
<block tt:elif="{{item.tag == 'img'}}"> | |||
<template is="wxParseImg" data="{{item}}" /> | |||
</block> | |||
<!--a类型--> | |||
<block tt:elif="{{item.tag == 'a'}}"> | |||
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse8" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<block tt:elif="{{item.tag == 'br'}}"> | |||
<template is="WxParseBr"></template> | |||
</block> | |||
<!--其他块级标签--> | |||
<block tt:elif="{{item.tagType == 'block'}}"> | |||
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse8" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<!--内联标签--> | |||
<view tt:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse8" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<!--判断是否是文本节点--> | |||
<block tt:elif="{{item.node == 'text'}}"> | |||
<!--如果是,直接进行--> | |||
<template is="WxEmojiView" data="{{item}}" /> | |||
</block> | |||
</template> | |||
<!--循环模版--> | |||
<template name="wxParse8"> | |||
<!--<template is="wxParse9" data="{{item}}" />--> | |||
<!--判断是否是标签节点--> | |||
<block tt:if="{{item.node == 'element'}}"> | |||
<block tt:if="{{item.tag == 'button'}}"> | |||
<button type="default" size="mini"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse9" data="{{item}}" /> | |||
</block> | |||
</button> | |||
</block> | |||
<!--li类型--> | |||
<block tt: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 tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse9" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</view> | |||
</view> | |||
</block> | |||
<!--video类型--> | |||
<block tt:elif="{{item.tag == 'video'}}"> | |||
<template is="wxParseVideo" data="{{item}}" /> | |||
</block> | |||
<!--img类型--> | |||
<block tt:elif="{{item.tag == 'img'}}"> | |||
<template is="wxParseImg" data="{{item}}" /> | |||
</block> | |||
<!--a类型--> | |||
<block tt:elif="{{item.tag == 'a'}}"> | |||
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse9" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<block tt:elif="{{item.tag == 'br'}}"> | |||
<template is="WxParseBr"></template> | |||
</block> | |||
<!--其他块级标签--> | |||
<block tt:elif="{{item.tagType == 'block'}}"> | |||
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse9" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<!--内联标签--> | |||
<view tt:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse9" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<!--判断是否是文本节点--> | |||
<block tt:elif="{{item.node == 'text'}}"> | |||
<!--如果是,直接进行--> | |||
<template is="WxEmojiView" data="{{item}}" /> | |||
</block> | |||
</template> | |||
<!--循环模版--> | |||
<template name="wxParse9"> | |||
<!--<template is="wxParse10" data="{{item}}" />--> | |||
<!--判断是否是标签节点--> | |||
<block tt:if="{{item.node == 'element'}}"> | |||
<block tt:if="{{item.tag == 'button'}}"> | |||
<button type="default" size="mini"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse10" data="{{item}}" /> | |||
</block> | |||
</button> | |||
</block> | |||
<!--li类型--> | |||
<block tt: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 tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse10" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</view> | |||
</view> | |||
</block> | |||
<!--video类型--> | |||
<block tt:elif="{{item.tag == 'video'}}"> | |||
<template is="wxParseVideo" data="{{item}}" /> | |||
</block> | |||
<!--img类型--> | |||
<block tt:elif="{{item.tag == 'img'}}"> | |||
<template is="wxParseImg" data="{{item}}" /> | |||
</block> | |||
<!--a类型--> | |||
<block tt:elif="{{item.tag == 'a'}}"> | |||
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse10" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<block tt:elif="{{item.tag == 'br'}}"> | |||
<template is="WxParseBr"></template> | |||
</block> | |||
<!--其他块级标签--> | |||
<block tt:elif="{{item.tagType == 'block'}}"> | |||
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse10" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<!--内联标签--> | |||
<view tt:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse10" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<!--判断是否是文本节点--> | |||
<block tt:elif="{{item.node == 'text'}}"> | |||
<!--如果是,直接进行--> | |||
<template is="WxEmojiView" data="{{item}}" /> | |||
</block> | |||
</template> | |||
<!--循环模版--> | |||
<template name="wxParse10"> | |||
<!--<template is="wxParse11" data="{{item}}" />--> | |||
<!--判断是否是标签节点--> | |||
<block tt:if="{{item.node == 'element'}}"> | |||
<block tt:if="{{item.tag == 'button'}}"> | |||
<button type="default" size="mini"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse11" data="{{item}}" /> | |||
</block> | |||
</button> | |||
</block> | |||
<!--li类型--> | |||
<block tt: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 tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse11" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</view> | |||
</view> | |||
</block> | |||
<!--video类型--> | |||
<block tt:elif="{{item.tag == 'video'}}"> | |||
<template is="wxParseVideo" data="{{item}}" /> | |||
</block> | |||
<!--img类型--> | |||
<block tt:elif="{{item.tag == 'img'}}"> | |||
<template is="wxParseImg" data="{{item}}" /> | |||
</block> | |||
<!--a类型--> | |||
<block tt:elif="{{item.tag == 'a'}}"> | |||
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse11" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<block tt:elif="{{item.tag == 'br'}}"> | |||
<template is="WxParseBr"></template> | |||
</block> | |||
<!--其他块级标签--> | |||
<block tt:elif="{{item.tagType == 'block'}}"> | |||
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse11" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<!--内联标签--> | |||
<view tt:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse11" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<!--判断是否是文本节点--> | |||
<block tt:elif="{{item.node == 'text'}}"> | |||
<!--如果是,直接进行--> | |||
<template is="WxEmojiView" data="{{item}}" /> | |||
</block> | |||
</template> | |||
<!--循环模版--> | |||
<template name="wxParse11"> | |||
<!--<template is="wxParse12" data="{{item}}" />--> | |||
<!--判断是否是标签节点--> | |||
<block tt:if="{{item.node == 'element'}}"> | |||
<block tt:if="{{item.tag == 'button'}}"> | |||
<button type="default" size="mini"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse12" data="{{item}}" /> | |||
</block> | |||
</button> | |||
</block> | |||
<!--li类型--> | |||
<block tt: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 tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse12" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</view> | |||
</view> | |||
</block> | |||
<!--video类型--> | |||
<block tt:elif="{{item.tag == 'video'}}"> | |||
<template is="wxParseVideo" data="{{item}}" /> | |||
</block> | |||
<!--img类型--> | |||
<block tt:elif="{{item.tag == 'img'}}"> | |||
<template is="wxParseImg" data="{{item}}" /> | |||
</block> | |||
<!--a类型--> | |||
<block tt:elif="{{item.tag == 'a'}}"> | |||
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse12" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<block tt:elif="{{item.tag == 'br'}}"> | |||
<template is="WxParseBr"></template> | |||
</block> | |||
<!--其他块级标签--> | |||
<block tt:elif="{{item.tagType == 'block'}}"> | |||
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse12" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<!--内联标签--> | |||
<view tt:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}"> | |||
<block tt:for="{{item.nodes}}" tt:for-item="item" tt:key=""> | |||
<template is="wxParse12" data="{{item}}" /> | |||
</block> | |||
</view> | |||
</block> | |||
<!--判断是否是文本节点--> | |||
<block tt:elif="{{item.node == 'text'}}"> | |||
<!--如果是,直接进行--> | |||
<template is="WxEmojiView" data="{{item}}" /> | |||
</block> | |||
</template> |
@@ -0,0 +1,208 @@ | |||
/** | |||
* 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; | |||
background: #FFF; | |||
} | |||
.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; | |||
} |