You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

654 lines
12 KiB

  1. <template>
  2. <view class="main">
  3. <view class="tit">{{ messageObj.title }}</view>
  4. <u-parse class="ql-editor" :content="messageObj.content" @preview="preview" @navigate="navigate" />
  5. <web-view v-if="webviewShow" :webview-styles="webviewStyles" :src="webviewUrl"></web-view>
  6. <!-- <view v-html="content"></view> -->
  7. <!-- <rich-text :nodes="content"></rich-text> -->
  8. </view>
  9. </template>
  10. <script>
  11. var util = require("../../utils/util.js");
  12. var config = require("../../config");
  13. import uParse from '@/components/gaoyia-parse/parse.vue'
  14. export default {
  15. data() {
  16. return {
  17. webviewShow: false,
  18. webviewUrl: "",
  19. webviewStyles: {
  20. progress: {
  21. color: '#FF3333'
  22. }
  23. }
  24. };
  25. },
  26. components: {
  27. uParse
  28. },
  29. computed: {
  30. messageObj() {
  31. return this.$store.state.messageObj
  32. }
  33. },
  34. onLoad(e) {
  35. this.read()
  36. },
  37. methods: {
  38. navigate(href, e) {
  39. if (href != undefined && href != "") {
  40. this.webviewShow = true;
  41. this.webviewUrl = href
  42. }
  43. console.log(href, 111)
  44. //比如点击a标签,打开某个传输url
  45. uni.navigateTo({
  46. url: href,
  47. })
  48. },
  49. read() {
  50. uni.request({
  51. url: config.service.updateRead,
  52. method: "GET",
  53. data: {
  54. id: this.messageObj.id,
  55. accountId: uni.getStorageSync('weapp_session_userInfo_data').accountId
  56. },
  57. header: {
  58. 'content-type': 'application/json',
  59. 'Authorization': 'Bearer ' + uni.getStorageSync('weapp_session_login_data').token
  60. },
  61. success: (res) => {
  62. console.log(res)
  63. }
  64. })
  65. }
  66. }
  67. }
  68. </script>
  69. <style lang="scss">
  70. @import '../../static/css/quill/quill.core.css';
  71. @import '../../static/css/quill/quill.snow.css';
  72. @import '../../static/css/quill/quill.bubble.css';
  73. .main {
  74. padding: 20rpx;
  75. word-wrap: break-word;
  76. .tit {
  77. font-size: 46rpx;
  78. font-weight: 800;
  79. text-align: center;
  80. margin-bottom: 16rpx;
  81. }
  82. }
  83. .ql-editor {
  84. font-size: 32rpx;
  85. .strong {
  86. font-weight: bold;
  87. }
  88. .ol {
  89. padding-left: 16rpx;
  90. .li {
  91. font-size: 34rpx;
  92. &::before {
  93. content: "·";
  94. font-size: 34rpx;
  95. }
  96. }
  97. }
  98. .ql-indent-1 {
  99. text-indent: 10px;
  100. }
  101. .h1 {
  102. font-size: 5em;
  103. }
  104. .h2 {
  105. font-size: 4em;
  106. }
  107. .h3 {
  108. font-size: 3em;
  109. }
  110. .h4 {
  111. font-size: 2em;
  112. }
  113. .h4 {
  114. font-size: 1em;
  115. }
  116. .em {
  117. font-style: italic
  118. }
  119. .u {
  120. text-decoration: underline
  121. }
  122. .blockquote {
  123. text-decoration: line-through;
  124. }
  125. }
  126. .ql-container {
  127. box-sizing: border-box;
  128. font-family: Helvetica, Arial, sans-serif;
  129. font-size: 13px;
  130. height: 100%;
  131. margin: 0px;
  132. position: relative;
  133. }
  134. .ql-editor h1 {
  135. font-size: 2em;
  136. }
  137. .ql-container.ql-disabled .ql-tooltip {
  138. visibility: hidden;
  139. }
  140. .ql-container.ql-disabled .ql-editor ul[data-checked]>li::before {
  141. pointer-events: none;
  142. }
  143. .ql-clipboard {
  144. left: -100000px;
  145. height: 1px;
  146. overflow-y: hidden;
  147. position: absolute;
  148. top: 50%;
  149. }
  150. .ql-clipboard p {
  151. margin: 0;
  152. padding: 0;
  153. }
  154. .ql-editor {
  155. box-sizing: border-box;
  156. line-height: 1.42;
  157. height: 100%;
  158. outline: none;
  159. overflow-y: auto;
  160. padding: 12px 15px;
  161. tab-size: 4;
  162. -moz-tab-size: 4;
  163. text-align: left;
  164. white-space: pre-wrap;
  165. word-wrap: break-word;
  166. }
  167. .ql-editor>* {
  168. cursor: text;
  169. }
  170. .ql-editor p,
  171. .ql-editor ol,
  172. .ql-editor ul,
  173. .ql-editor pre,
  174. .ql-editor blockquote,
  175. .ql-editor h1,
  176. .ql-editor h2,
  177. .ql-editor h3,
  178. .ql-editor h4,
  179. .ql-editor h5,
  180. .ql-editor h6 {
  181. margin: 0;
  182. padding: 0;
  183. counter-reset: list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9;
  184. }
  185. .ql-editor ol,
  186. .ql-editor ul {
  187. padding-left: 1.5em;
  188. }
  189. .ql-editor ol>li,
  190. .ql-editor ul>li {
  191. list-style-type: none;
  192. }
  193. .ql-editor ul>li::before {
  194. content: '\2022';
  195. }
  196. .ql-editor ul[data-checked=true],
  197. .ql-editor ul[data-checked=false] {
  198. pointer-events: none;
  199. }
  200. .ql-editor ul[data-checked=true]>li *,
  201. .ql-editor ul[data-checked=false]>li * {
  202. pointer-events: all;
  203. }
  204. .ql-editor ul[data-checked=true]>li::before,
  205. .ql-editor ul[data-checked=false]>li::before {
  206. color: #777;
  207. cursor: pointer;
  208. pointer-events: all;
  209. }
  210. .ql-editor ul[data-checked=true]>li::before {
  211. content: '\2611';
  212. }
  213. .ql-editor ul[data-checked=false]>li::before {
  214. content: '\2610';
  215. }
  216. .ql-editor li::before {
  217. display: inline-block;
  218. white-space: nowrap;
  219. width: 1.2em;
  220. }
  221. .ql-editor li:not(.ql-direction-rtl)::before {
  222. margin-left: -1.5em;
  223. margin-right: 0.3em;
  224. text-align: right;
  225. }
  226. .ql-editor li.ql-direction-rtl::before {
  227. margin-left: 0.3em;
  228. margin-right: -1.5em;
  229. }
  230. .ql-editor ol li:not(.ql-direction-rtl),
  231. .ql-editor ul li:not(.ql-direction-rtl) {
  232. padding-left: 1.5em;
  233. }
  234. .ql-editor ol li.ql-direction-rtl,
  235. .ql-editor ul li.ql-direction-rtl {
  236. padding-right: 1.5em;
  237. }
  238. .ql-editor ol li {
  239. counter-reset: list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9;
  240. counter-increment: list-0;
  241. }
  242. .ql-editor ol li:before {
  243. content: counter(list-0, decimal) '. ';
  244. }
  245. .ql-editor ol li.ql-indent-1 {
  246. counter-increment: list-1;
  247. }
  248. .ql-editor ol li.ql-indent-1:before {
  249. content: counter(list-1, lower-alpha) '. ';
  250. }
  251. .ql-editor ol li.ql-indent-1 {
  252. counter-reset: list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9;
  253. }
  254. .ql-editor ol li.ql-indent-2 {
  255. counter-increment: list-2;
  256. }
  257. .ql-editor ol li.ql-indent-2:before {
  258. content: counter(list-2, lower-roman) '. ';
  259. }
  260. .ql-editor ol li.ql-indent-2 {
  261. counter-reset: list-3 list-4 list-5 list-6 list-7 list-8 list-9;
  262. }
  263. .ql-editor ol li.ql-indent-3 {
  264. counter-increment: list-3;
  265. }
  266. .ql-editor ol li.ql-indent-3:before {
  267. content: counter(list-3, decimal) '. ';
  268. }
  269. .ql-editor ol li.ql-indent-3 {
  270. counter-reset: list-4 list-5 list-6 list-7 list-8 list-9;
  271. }
  272. .ql-editor ol li.ql-indent-4 {
  273. counter-increment: list-4;
  274. }
  275. .ql-editor ol li.ql-indent-4:before {
  276. content: counter(list-4, lower-alpha) '. ';
  277. }
  278. .ql-editor ol li.ql-indent-4 {
  279. counter-reset: list-5 list-6 list-7 list-8 list-9;
  280. }
  281. .ql-editor ol li.ql-indent-5 {
  282. counter-increment: list-5;
  283. }
  284. .ql-editor ol li.ql-indent-5:before {
  285. content: counter(list-5, lower-roman) '. ';
  286. }
  287. .ql-editor ol li.ql-indent-5 {
  288. counter-reset: list-6 list-7 list-8 list-9;
  289. }
  290. .ql-editor ol li.ql-indent-6 {
  291. counter-increment: list-6;
  292. }
  293. .ql-editor ol li.ql-indent-6:before {
  294. content: counter(list-6, decimal) '. ';
  295. }
  296. .ql-editor ol li.ql-indent-6 {
  297. counter-reset: list-7 list-8 list-9;
  298. }
  299. .ql-editor ol li.ql-indent-7 {
  300. counter-increment: list-7;
  301. }
  302. .ql-editor ol li.ql-indent-7:before {
  303. content: counter(list-7, lower-alpha) '. ';
  304. }
  305. .ql-editor ol li.ql-indent-7 {
  306. counter-reset: list-8 list-9;
  307. }
  308. .ql-editor ol li.ql-indent-8 {
  309. counter-increment: list-8;
  310. }
  311. .ql-editor ol li.ql-indent-8:before {
  312. content: counter(list-8, lower-roman) '. ';
  313. }
  314. .ql-editor ol li.ql-indent-8 {
  315. counter-reset: list-9;
  316. }
  317. .ql-editor ol li.ql-indent-9 {
  318. counter-increment: list-9;
  319. }
  320. .ql-editor ol li.ql-indent-9:before {
  321. content: counter(list-9, decimal) '. ';
  322. }
  323. .ql-editor .ql-indent-1:not(.ql-direction-rtl) {
  324. padding-left: 3em;
  325. }
  326. .ql-editor li.ql-indent-1:not(.ql-direction-rtl) {
  327. padding-left: 4.5em;
  328. }
  329. .ql-editor .ql-indent-1.ql-direction-rtl.ql-align-right {
  330. padding-right: 3em;
  331. }
  332. .ql-editor li.ql-indent-1.ql-direction-rtl.ql-align-right {
  333. padding-right: 4.5em;
  334. }
  335. .ql-editor .ql-indent-2:not(.ql-direction-rtl) {
  336. padding-left: 6em;
  337. }
  338. .ql-editor li.ql-indent-2:not(.ql-direction-rtl) {
  339. padding-left: 7.5em;
  340. }
  341. .ql-editor .ql-indent-2.ql-direction-rtl.ql-align-right {
  342. padding-right: 6em;
  343. }
  344. .ql-editor li.ql-indent-2.ql-direction-rtl.ql-align-right {
  345. padding-right: 7.5em;
  346. }
  347. .ql-editor .ql-indent-3:not(.ql-direction-rtl) {
  348. padding-left: 9em;
  349. }
  350. .ql-editor li.ql-indent-3:not(.ql-direction-rtl) {
  351. padding-left: 10.5em;
  352. }
  353. .ql-editor .ql-indent-3.ql-direction-rtl.ql-align-right {
  354. padding-right: 9em;
  355. }
  356. .ql-editor li.ql-indent-3.ql-direction-rtl.ql-align-right {
  357. padding-right: 10.5em;
  358. }
  359. .ql-editor .ql-indent-4:not(.ql-direction-rtl) {
  360. padding-left: 12em;
  361. }
  362. .ql-editor li.ql-indent-4:not(.ql-direction-rtl) {
  363. padding-left: 13.5em;
  364. }
  365. .ql-editor .ql-indent-4.ql-direction-rtl.ql-align-right {
  366. padding-right: 12em;
  367. }
  368. .ql-editor li.ql-indent-4.ql-direction-rtl.ql-align-right {
  369. padding-right: 13.5em;
  370. }
  371. .ql-editor .ql-indent-5:not(.ql-direction-rtl) {
  372. padding-left: 15em;
  373. }
  374. .ql-editor li.ql-indent-5:not(.ql-direction-rtl) {
  375. padding-left: 16.5em;
  376. }
  377. .ql-editor .ql-indent-5.ql-direction-rtl.ql-align-right {
  378. padding-right: 15em;
  379. }
  380. .ql-editor li.ql-indent-5.ql-direction-rtl.ql-align-right {
  381. padding-right: 16.5em;
  382. }
  383. .ql-editor .ql-indent-6:not(.ql-direction-rtl) {
  384. padding-left: 18em;
  385. }
  386. .ql-editor li.ql-indent-6:not(.ql-direction-rtl) {
  387. padding-left: 19.5em;
  388. }
  389. .ql-editor .ql-indent-6.ql-direction-rtl.ql-align-right {
  390. padding-right: 18em;
  391. }
  392. .ql-editor li.ql-indent-6.ql-direction-rtl.ql-align-right {
  393. padding-right: 19.5em;
  394. }
  395. .ql-editor .ql-indent-7:not(.ql-direction-rtl) {
  396. padding-left: 21em;
  397. }
  398. .ql-editor li.ql-indent-7:not(.ql-direction-rtl) {
  399. padding-left: 22.5em;
  400. }
  401. .ql-editor .ql-indent-7.ql-direction-rtl.ql-align-right {
  402. padding-right: 21em;
  403. }
  404. .ql-editor li.ql-indent-7.ql-direction-rtl.ql-align-right {
  405. padding-right: 22.5em;
  406. }
  407. .ql-editor .ql-indent-8:not(.ql-direction-rtl) {
  408. padding-left: 24em;
  409. }
  410. .ql-editor li.ql-indent-8:not(.ql-direction-rtl) {
  411. padding-left: 25.5em;
  412. }
  413. .ql-editor .ql-indent-8.ql-direction-rtl.ql-align-right {
  414. padding-right: 24em;
  415. }
  416. .ql-editor li.ql-indent-8.ql-direction-rtl.ql-align-right {
  417. padding-right: 25.5em;
  418. }
  419. .ql-editor .ql-indent-9:not(.ql-direction-rtl) {
  420. padding-left: 27em;
  421. }
  422. .ql-editor li.ql-indent-9:not(.ql-direction-rtl) {
  423. padding-left: 28.5em;
  424. }
  425. .ql-editor .ql-indent-9.ql-direction-rtl.ql-align-right {
  426. padding-right: 27em;
  427. }
  428. .ql-editor li.ql-indent-9.ql-direction-rtl.ql-align-right {
  429. padding-right: 28.5em;
  430. }
  431. .ql-editor .ql-video {
  432. display: block;
  433. max-width: 100%;
  434. }
  435. .ql-editor .ql-video.ql-align-center {
  436. margin: 0 auto;
  437. }
  438. .ql-editor .ql-video.ql-align-right {
  439. margin: 0 0 0 auto;
  440. }
  441. .ql-editor .ql-bg-black {
  442. background-color: #000;
  443. }
  444. .ql-editor .ql-bg-red {
  445. background-color: #e60000;
  446. }
  447. .ql-editor .ql-bg-orange {
  448. background-color: #f90;
  449. }
  450. .ql-editor .ql-bg-yellow {
  451. background-color: #ff0;
  452. }
  453. .ql-editor .ql-bg-green {
  454. background-color: #008a00;
  455. }
  456. .ql-editor .ql-bg-blue {
  457. background-color: #06c;
  458. }
  459. .ql-editor .ql-bg-purple {
  460. background-color: #93f;
  461. }
  462. .ql-editor .ql-color-white {
  463. color: #fff;
  464. }
  465. .ql-editor .ql-color-red {
  466. color: #e60000;
  467. }
  468. .ql-editor .ql-color-orange {
  469. color: #f90;
  470. }
  471. .ql-editor .ql-color-yellow {
  472. color: #ff0;
  473. }
  474. .ql-editor .ql-color-green {
  475. color: #008a00;
  476. }
  477. .ql-editor .ql-color-blue {
  478. color: #06c;
  479. }
  480. .ql-editor .ql-color-purple {
  481. color: #93f;
  482. }
  483. .ql-editor .ql-font-serif {
  484. font-family: Georgia, Times New Roman, serif;
  485. }
  486. .ql-editor .ql-font-monospace {
  487. font-family: Monaco, Courier New, monospace;
  488. }
  489. .ql-editor .ql-size-small {
  490. font-size: 0.75em;
  491. }
  492. .ql-editor .ql-size-large {
  493. font-size: 1.5em;
  494. }
  495. .ql-editor .ql-size-huge {
  496. font-size: 2.5em;
  497. }
  498. .ql-editor .ql-direction-rtl {
  499. direction: rtl;
  500. text-align: inherit;
  501. }
  502. .ql-editor .ql-align-center {
  503. text-align: center;
  504. }
  505. .ql-editor .ql-align-justify {
  506. text-align: justify;
  507. }
  508. .ql-editor .ql-align-right {
  509. text-align: right;
  510. }
  511. .ql-editor.ql-blank::before {
  512. color: rgba(0, 0, 0, 0.6);
  513. content: attr(data-placeholder);
  514. font-style: italic;
  515. left: 15px;
  516. pointer-events: none;
  517. position: absolute;
  518. right: 15px;
  519. }
  520. </style>