You've already forked guangan-mp
65 lines
1.3 KiB
Vue
65 lines
1.3 KiB
Vue
<template>
|
|
<view class="flex flex-column" style="width:100vw;height: 100vh;">
|
|
<i-loading v-if="loading" />
|
|
<view class="mt-2 font40 line15">{{newsInfo.title}}</view>
|
|
<scroll-view>
|
|
<view class="mt-2">
|
|
<u-parse :content="newsInfo.content" @preview="preview" @navigate="navigate"></u-parse>
|
|
</view>
|
|
</scroll-view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { friendlyDate } from '../../common/util';
|
|
import {
|
|
TaAjax
|
|
} from '@/common/ajax'
|
|
export default {
|
|
data() {
|
|
return {
|
|
id: 0,
|
|
newsInfo: {
|
|
title: "",
|
|
content: "",
|
|
material: "",
|
|
method: "",
|
|
view_count: 0,
|
|
},
|
|
loading: true
|
|
}
|
|
},
|
|
onLoad(params) {
|
|
this.id = params.id
|
|
this.loading = true;
|
|
TaAjax.get('/cms/api.tutorial/info', {
|
|
id: this.id
|
|
}).then((response) => {
|
|
if (response.code == 0) {
|
|
uni.showToast({
|
|
title: response.info
|
|
})
|
|
return uni.navigateBack()
|
|
}
|
|
const data = response.data;
|
|
uni.setNavigationBarTitle({
|
|
title: data.title
|
|
});
|
|
data.create_at = friendlyDate((new Date(data.create_at.replace(/\-/g, '/')).getTime()))
|
|
this.newsInfo = data;
|
|
}).catch((e) => {
|
|
console.warn(e)
|
|
}).finally(() => {
|
|
this.loading = false;
|
|
})
|
|
},
|
|
methods: {
|
|
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
|
|
</style>
|