| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <template>
- <view :class="[AppTheme]" class="message" v-if="info">
- <u-parse :content="info.contents"></u-parse>
- </view>
- </template>
- <script>
- import homeApi from '@/api/home/index.js';
- export default {
- data() {
- return {
- primary: this.$theme.primary,
- info: '',
- settingFile: getApp().globalData.siteinfo
- };
- },
- onLoad(options) {
- let that = this
- console.log('options', JSON.stringify(options))
- if (!options.type) {
- options.type = 1;
- }
- console.log('options', JSON.stringify(options))
- if (options.type == 1) {
- if (options.id !== null && options.id !== undefined) {
- let data = {
- id: options.id
- }
- homeApi.Notice(data).then((ret) => {
- if (ret.data.artical) {
- uni.setNavigationBarTitle({
- title: ret.data.artical.title
- })
- that.info = ret.data.artical
- that.info.contents = that.info.contents.replace(/\<img src="/gi,
- `<img style='width:100%;display:block' src="${that.settingFile.root_rich_img}`);
- }
- })
- }
- } else if (options.type == 2) {
- if (options.title !== null && options.title !== undefined) {
- let data = {
- title: options.title
- }
- homeApi.Artical(data).then((ret) => {
- if (ret.data.artical) {
- uni.setNavigationBarTitle({
- title: ret.data.artical.title
- })
- that.info = ret.data.artical
- that.info.contents = that.info.content.replace(/\<img src="/gi,
- `<img style='width:100%' src="${that.settingFile.root_rich_img}`);
- }
- })
- }
- }
- }
- }
- </script>
- <style lang="scss">
- page {
- background-color: #ffffff;
- }
- .message {
- padding: 30rpx 20rpx 70rpx 20rpx;
- background: #fff;
- .author {
- font-size: 30rpx;
- margin-bottom: 20rpx;
- text-align: center;
- }
- .content {
- font-size: 28rpx;
- line-height: 40rpx;
- margin-bottom: 40rpx;
- }
- .read {
- color: #cecece;
- font-size: 28rpx;
- }
- .ft-flex {
- display: flex;
- justify-content: flex-end;
- }
- }
- </style>
|