1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <template>
- <view class="contents">
- <view class="title"><text>{{item.title}}</text></view>
- <view class="ly">
- <text>{{item.author}}</text>
- <text class="day">4天前</text>
- </view>
- <view>
- <view class="fwb">
- <u-parse :html="item.content"></u-parse>
- </view>
- <view class="mt10">
- <view class="">来源:作者名称</view>
- <view class="">编辑丨编辑名称</view>
- <view class="">责编丨初审名称</view>
- <view class="">审核丨终审名称</view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- ip: this.$http.urls.ip,
- item: {}
- };
- },
- onLoad(e) {
- this.$http.request({
- url: this.$http.urls.getContentInfo+ e.id,
- success: res => {
- console.log("asd:"+JSON.stringify(res));
- this.item = res.data.data.info;
- //this.item.contents = res.data.data.contents.replace(/\<img/gi, '<img style=width:100%;height:auto');
- }
- });
- },
- methods: {
- //购物车
- car() {
- uni.switchTab({
- url: 'shopcar'
- });
- },
- //添加购物车
- add() {
- this.$http.request({
- url: this.$http.urls.cart_add,
- method: 'POST',
- data: { goodsId: this.item.id, userId: this.$getUser().id },
- success: res => {
- uni.showToast({ title: '已加入购物车', icon: 'none' });
- }
- });
- },
- //直接购买服务
- buy() {
- let list = [{ goodsId: this.item.id, goods: { title: this.item.title, price: this.item.price, pic: this.item.pic } }];
- uni.navigateTo({ url: 'pay?list=' + JSON.stringify(list) });
- }
- }
- };
- </script>
- <style lang="scss">
- .contents {
- padding: 20px;
- .ly {
- font-size: 14px;
- margin-bottom: 15px;
- color: #2196f3;
- .day {
- color: #818184;
- padding-left: 10px;
- }
- }
- .title {
- padding-top: 20px;
- font-size: 23px;
- font-weight: 400;
- margin-bottom: 20px;
- }
- .pic {
- width: 100%;
- border-radius: 3px;
- margin-top: 3px;
- }
- .fwb {
- margin-top: 15px;
- color: #909090;
- }
- }
- </style>
|