Commit 8c9a5063 authored by 李智书's avatar 李智书

1.新增pdf预览;

parent ede6adf2
......@@ -312,6 +312,16 @@
}
}
,{
"path" : "pages/UserAgreement/UserAgreement",
"style" :
{
"navigationStyle": "custom",
"navigationBarTitleText": "用户协议",
"enablePullDownRefresh": false
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
......
<template>
<view class="UserAgreement">
<view class="AgreementItem" @click="ToAgreement(1)">
<van-icon name="question" />《服务协议》
</view>
<view class="AgreementItem" @click="ToAgreement(2)">
<van-icon name="question" />《隐私权政策》
</view>
<view class="AgreementItem" @click="ToAgreement(3)">
<van-icon name="question" />《未成年人个人信息保护规则》
</view>
</view>
</template>
<script>
export default {
name: "UserAgreement",
data() {
return {
externalInfo: {
seesionID: '',
userID: '',
AppID: ''
}
}
},
onLoad: function(options) {
console.warn(options);
this.externalInfo = options
},
methods: {
// 跳转协议
async ToAgreement(type) {
try {
uni.navigateTo({
url: "../pdfPreview/pdfPreview?pdfName=" + this.externalInfo.AppID + '_' + type
})
} catch (e) {
//TODO handle the exception
}
}
}
}
</script>
<style lang="scss">
.UserAgreement {
margin-top: 300rpx;
margin-left: 150rpx;
.AgreementItem {
font-family: PingFang SC;
font-size: 35rpx;
letter-spacing: 1rpx;
font-weight: 600;
color: #34C98E;
line-height: 100rpx;
}
}
</style>
......@@ -9,22 +9,61 @@
name: 'App',
data() {
return {
pdfh5: null
pdfh5: null,
pdfName: "",
ImgUrl: this.$ImgUrl
};
},
mounted() {
//实例化
this.pdfh5 = new Pdfh5("#pdfh5", {
pdfurl: "../../static/test.pdf",
scale: 2,
zoomEnable: true,
renderType: 'svg'
onLoad: function(options) {
console.warn(options);
let type = options.pdfName.split("_")[1] * 1
switch (type) {
case 1:
uni.setNavigationBarTitle({
title: "服务协议"
})
break;
case 2:
uni.setNavigationBarTitle({
title: "隐私权政策"
})
break;
case 3:
uni.setNavigationBarTitle({
title: "未成年人个人信息保护规则"
})
break;
default:
break;
}
this.pdfName = options.pdfName
this.Init(this.ImgUrl + 'AgreementPdf/' + this.pdfName)
},
mounted() {},
methods: {
// 跳转协议
async Init(pdfName) {
let this_ = this
try {
this.$nextTick(function() {
//实例化
this_.pdfh5 = new Pdfh5("#pdfh5", {
pdfurl: pdfName + '.pdf',
scale: 2,
zoomEnable: true,
renderType: 'svg'
});
//监听完成事件
this.pdfh5.on("complete", function(status, msg, time) {
console.log("状态:" + status + ",信息:" + msg + ",耗时:" + time + "毫秒,总页数:" + this.totalNum)
})
});
//监听完成事件
this_.pdfh5.on("complete", function(status, msg, time) {
console.log("状态:" + status + ",信息:" + msg + ",耗时:" + time + "毫秒,总页数:" +
this.totalNum)
})
})
} catch (e) {
//TODO handle the exception
}
}
}
}
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment