Prechádzať zdrojové kódy

1 增加 pdf 和富文本显示

wangguoyu 2 mesiacov pred
rodič
commit
cd57b9ecce
5 zmenil súbory, kde vykonal 101 pridanie a 1 odobranie
  1. 11 0
      api/login.js
  2. 1 1
      config.js
  3. 1 0
      package.json
  4. 6 0
      pages.json
  5. 82 0
      pages/demo/richDemo.vue

+ 11 - 0
api/login.js

@@ -43,4 +43,15 @@ export function queryCert(data = {}) {
     data,
     timeout: 20000
   })
+}
+export function zhaoshengZhaopinInfo(data = {}) {
+  return request({
+    'url': '/common/zhaosheng/zhaopin/info',
+    headers: {
+      isToken: true
+    },
+    method: 'post',
+    data,
+    timeout: 20000
+  })
 }

+ 1 - 1
config.js

@@ -1,7 +1,7 @@
 // 应用全局配置
 export default   {
   baseUrl: 'https://kf3.mtavip.com/api',
-  // baseUrl: 'http://localhost:8080',
+  // baseUrl: 'https://jtxy.mtavip.com/api',
   // 应用信息
   appInfo: {
     // 应用名称

+ 1 - 0
package.json

@@ -7,6 +7,7 @@
     "axios": "^1.7.2",
     "crypto-js": "^4.2.0",
     "jsencrypt": "^3.3.2",
+    "mp-html": "^2.5.1",
     "pinia": "^2.1.7",
     "ts-md5": "^1.3.1"
   },

+ 6 - 0
pages.json

@@ -12,6 +12,12 @@
 				"navigationStyle": "custom"
 			}
 		},	
+			{
+			"path": "pages/demo/richDemo",
+			"style": {
+				"navigationStyle": "custom"
+			}
+		},	
 		{
 			"path": "pages/showZhengshu",
 			"style": {

+ 82 - 0
pages/demo/richDemo.vue

@@ -0,0 +1,82 @@
+<template>
+	<view >
+		<view class="pdf-container">
+			  <web-view 
+			        v-if="pdfUrl" 
+			        :src="pdfUrl" 
+			        class="web-view"
+			      ></web-view>
+		</view>
+		<view>
+			<mp-html :content="content" />
+		</view>
+	</view>
+</template>
+<script setup>
+	import CryptoJS from 'crypto-js';
+	import {
+		toast
+	} from "@/utils/common";
+	import {
+		onLoad
+	} from "@dcloudio/uni-app";
+	import {
+		zhaoshengZhaopinInfo
+	} from '@/api/login.js'
+	import cacheManager from '@/utils/cacheManager.js'
+	import mpHtml from 'mp-html/dist/uni-app/components/mp-html/mp-html'
+	import {
+		ref
+	} from 'vue';
+	const content = ref('')
+	const pdfUrl = ref('')
+	onLoad(() => {
+		getZhaopinInfo()
+	})
+
+	function getZhaopinInfo() {
+		zhaoshengZhaopinInfo({}).then(res => {
+			console.log('res', res);
+			content.value = res.data.content
+			pdfUrl.value = res.data.pdfUrl
+
+		})
+	}
+</script>
+<style lang="scss">
+	.lli-demo-page {
+		display: flex;
+		flex-direction: column;
+		height: 100vh;
+		padding-bottom: 60rpx;
+		box-sizing: border-box;
+
+		.demo-scroll-view {
+			overflow-y: auto;
+			flex: 1;
+		}
+
+		.content-view {
+			padding: 24px;
+			box-sizing: border-box;
+		}
+
+		.demo-title {
+			margin: 24px 0 10px;
+		}
+	}
+	.pdf-container {
+	    width: 100%;
+	    height: 500px; // 固定高度
+	    position: relative;
+	    overflow: hidden;
+	    border: 1px solid #eee;
+	    margin-top: 20px;
+	    
+	    .web-view {
+	      width: 100%;
+	      height: 100%;
+	      display: block;
+	    }
+	  }
+</style>