123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321 |
- <template>
- <view class="container">
- <view class="pay-wall">
- <view class="title">
- {{ report.title }}
- </view>
- <!-- <text>需要付款才能看</text> -->
- </view>
- <!-- <web-view id="webview" :src="report.sourceFile">
- <cover-view class="close-view">
- <button>22222</button>
- </cover-view>
- </web-view> -->
- <view class="bottom-box">
- <view class="menu-box">
- <button class="menu-item" @click="changeApplaud">
- <i class="iconfont icon-dianzan" :class="report.hasApplaud?'active':''"></i>
- </button>
- <button class="menu-item" @click="changeFavi">
- <i class="iconfont icon-shoucang1" :class="report.hasFavi?'active':''"></i>
- </button>
- <button class="menu-item" open-type="share">
- <i class="iconfont icon-zhuanfa"></i>
- </button>
- <button class="menu-item">
- <i class="iconfont icon-pengyouquan"></i>
- </button>
- <button class="menu-item">
- <i class="iconfont icon-xiaoxi"></i>
- </button>
- </view>
- </view>
- </view>
- </template>
- <script setup>
- import {
- ref,
- computed,
- onMounted
- } from 'vue'
- import {
- onLoad,
- onShareAppMessage,
- onShareTimeline
- } from '@dcloudio/uni-app'
- import {
- getToken
- } from '@/utils/auth.js'
- import {
- getReportDetail,
- reportFavi,
- cancelReportFavi,
- reportApplaud,
- cancelReportApplaud
- } from '@/api/report.js'
- // import VueOfficePdf from '@vue-office/pdf'
- // const modelValue = ref('http://www.gzrea.org.cn/upload/news/2025/03/4128b87c1b0535772f345cf82fa04084431c17f2561a6fb3.pdf')
- // let previewOtherUpload = ref(false);
- const webview = ref();
- const id = ref()
- const title = ref()
- const hasPermission = ref(false);
- const imgurl = '/static/images/avator-img/1.png'
- const report = ref({
- id: '01',
- title: '2025年2月从化区二手住宅市场交易简报',
- summary: "2025年2月从化区二手住宅市场交易简报",
- price: '9.9',
- memberFree: 1,
- free: 0,
- status: 0,
- markdown: ``
- })
- const compileMarkDown = computed(() => {
- if (!report.value.markdown) {
- return;
- }
- let htmlString = "";
- // 判断markdown中代码块标识符的数量是否为偶数
- if (report.value.markdown.split("```").length % 2) {
- let content = report.value.markdown;
- if (content[content.length - 1] != "\n") {
- content += "\n";
- }
- htmlString = content;
- } else {
- htmlString = report.value.markdown;
- }
- return htmlString;
- })
- // 是否登录
- const isLogin = computed(() => {
- return false
- // return getToken() ? true : false
- })
- // 是否购买/免费
- const free = computed(() => {
- return false
- })
- const showMask = computed(() => {
- // 是否登录
- // 是否已购买或者免费
- if (report.value.status || report.value.free) {
- return false
- }
- // 判断用户是否为会员免费
- if (report.value.memberFree) {
- //
- }
- return false
- })
- function changeFavi() {
- if(report.value.hasFavi){
- cancelReportFavi(id.value).then(res=>{
- if(res?.code==0){
- report.value.hasFavi = false
- }
- })
- }else{
- reportFavi(id.value).then(res => {
- if(res?.code==0){
- report.value.hasFavi = true
- }
- })
- }
- }
-
- function changeApplaud(){
- if(report.value.hasApplaud){
- cancelReportApplaud(id.value).then(res=>{
- if(res?.code==0){
- report.value.hasApplaud = false
- }
- })
- }else{
- reportApplaud(id.value).then(res => {
- if(res?.code==0){
- report.value.hasApplaud = true
- }
- })
- }
- }
- onLoad((load) => {
- if(load.id){
- console.log(load.id)
- id.value = load.id
- title.value = load.title
- }
- getReportDetail(66).then(res => {
- console.log(res, "报告详情")
- if (res.code === 0) {
- report.value = res.data
- }
- })
- uni.setNavigationBarTitle({
- title: title.value
- })
- })
- onMounted(()=>{
- console.log(uni.createSelectorQuery().select("#webview"))
- })
-
- onShareAppMessage((res) => {
- if (res.from === 'button') {
- console.log('来自按钮分享');
- }
- return {
- title: '研究报告',
- path: `/pages/reportDetail/reportDetail?id=${id.value}`,
- imageUrl: imgurl.value
- };
- })
- onShareTimeline(() => {
- return {
- title: '朋友圈标题-研究报告',
- query: `id=${id.value}`,
- imageUrl: imgurl.value
- };
- })
- </script>
- <style lang="scss" scoped>
- .container {
- height: 100vh;
- width: 100vw;
- background-color: $uni-bg-color;
- .title {
- font-size: 38rpx;
- text-align: center;
- width: 60%;
- margin: 0 auto;
- padding: 20rpx 0;
- }
- .content {
- padding: 0 20rpx;
- }
- .mask {
- height: 75vh;
- padding: 0 20rpx;
- background-color: $uni-bg-color-grey;
- -webkit-box-shadow: 0px -1rpx 5rpx 0px rgba(50, 50, 50, 0.25);
- -moz-box-shadow: 0px -1rpx 5rpx 0px rgba(50, 50, 50, 0.25);
- box-shadow: 0px -1rpx 5rpx 0px rgba(50, 50, 50, 0.25);
- border-radius: 20rpx 20rpx 0 0;
- @include bottomMagnet();
- .mask-box {
- height: 100%;
- width: 100%;
- position: relative;
- .button {
- margin: 0 auto;
- width: 45%;
- }
- }
- .member-box {
- padding-top: 210rpx;
- .remark {
- height: 90rpx;
- text-align: center;
- letter-spacing: 3rpx;
- font-size: 32rpx;
- color: $uni-text-color-grey;
- }
- .link {
- position: absolute;
- top: 70%;
- width: 100%;
- font-size: 32rpx;
- color: $uni-color-error;
- font-size: $uni-title-font-size-2;
- font-weight: bold;
- .text {
- text-align: center;
- letter-spacing: 5rpx;
- &:active {
- text-decoration: underline;
- }
- }
- }
- }
- .login-box {
- padding-top: 300rpx;
- }
- }
- .disable-scroll {
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- }
- .bottom-block {
- height: 110rpx;
- }
- .bottom-box {
- padding: 5rpx 25rpx;
- background-color: $uni-bg-color-grey;
- @include bottomMagnet();
- -webkit-box-shadow: 0px -1rpx 5rpx 0px rgba(50, 50, 50, 0.25);
- -moz-box-shadow: 0px -1rpx 5rpx 0px rgba(50, 50, 50, 0.25);
- box-shadow: 0px -1rpx 5rpx 0px rgba(50, 50, 50, 0.25);
- .menu-box {
- height: 100rpx;
- display: flex;
- align-items: center;
- justify-content: flex-end;
- gap: 50rpx;
- .menu-item{
- background-color: transparent;
- margin: 0;
- border: none;
- padding: 0;
- }
- .menu-item::after{
- border: none !important;
- }
- .iconfont {
- font-size: 42rpx;
- color: $uni-text-color-grey;
- }
- .active {
- color: yellow;
- }
- }
- }
- }
- </style>
|