newsInfo.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <view class="content">
  3. <view class="newshead">{{ newsInfo.title }}</view>
  4. <text class="time textgrey">{{ newsInfo.create_time }}</text>
  5. <view v-if="type == 20" class="u-content">
  6. <view @click="down(item)" class="dffd" v-for="(item, ind) in newsInfo.files_url" :key="ind">{{ item }}</view>
  7. <image :src="newsInfo.img" mode="widthFix"></image>
  8. </view>
  9. <view class="newsCon"><u-parse :content="newsInfo.content"></u-parse></view>
  10. <view v-if="type == 10" class="u-content"><u-parse :content="newsInfo.hide"></u-parse></view>
  11. <view v-if="type == 11" class="u-content"><u-parse :content="newsInfo.service"></u-parse></view>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. data() {
  17. return {
  18. id: '',
  19. type: '', //
  20. newsInfo: {},
  21. talkList: [], //图文分享老师点评
  22. fbText: ''
  23. };
  24. },
  25. onLoad(opt) {
  26. this.id = opt.id;
  27. this.type = opt.type; // 10.隐私,11服务协议 1=新闻信息 2公告详情 20联盟课件 30图文分享
  28. if (this.type == 10) {
  29. uni.setNavigationBarTitle({
  30. title: '隐私协议'
  31. });
  32. } else if (this.type == 11) {
  33. uni.setNavigationBarTitle({
  34. title: '服务政策'
  35. });
  36. } else if (this.type == 2) {
  37. uni.setNavigationBarTitle({
  38. title: '公告详情'
  39. });
  40. } else if (this.type == 20) {
  41. uni.setNavigationBarTitle({
  42. title: '课件详情'
  43. });
  44. } else if (this.type == 30) {
  45. uni.setNavigationBarTitle({
  46. title: '图文分享详情'
  47. });
  48. }
  49. this.loading(this.id);
  50. },
  51. onShow() {},
  52. methods: {
  53. toFuba() {
  54. if (!this.fbText) return this.$api.toast('请输入发布内容');
  55. this.$api
  56. .request('study/evaluate', {
  57. login_token: this.token(),
  58. id: this.id,
  59. content: this.fbText
  60. })
  61. .then(data => {
  62. this.fbText = '';
  63. if (data.code == 200) {
  64. this.$api.toast(data.msg);
  65. setTimeout(res => {
  66. this.loading();
  67. }, 600);
  68. } else {
  69. this.$api.toast(data.msg);
  70. }
  71. })
  72. },
  73. loading() {
  74. let url = '';
  75. let data = {};
  76. if (this.type == 10 || this.type == 11) {
  77. url = 'common/getAgreement';
  78. } else if (this.type == 1) {
  79. url = 'news/getNewsInfo';
  80. data = {
  81. id: this.id
  82. };
  83. } else if (this.type == 2) {
  84. url = 'index/noticeInfo';
  85. data = {
  86. id: this.id
  87. };
  88. }
  89. this.$api
  90. .request(url, data )
  91. .then(data => {
  92. if (data.code == 200) {
  93. // if (this.type == 1||this.type == 2) {
  94. // let content = data.data.content.replace(/<img [^>]*src=['"]/g, '<img style="width:100%;height:auto;max-width:750rpx;border-radius: 6rpx" src="' + this.$api.imgurl());
  95. // data.data.content = content;
  96. // }
  97. this.newsInfo = data.data;
  98. } else {
  99. this.$api.toast(data.msg);
  100. }
  101. })
  102. }
  103. }
  104. };
  105. </script>
  106. <style lang="scss">
  107. .content {
  108. min-height: 100vh;
  109. padding: 32rpx 30rpx 120rpx;
  110. background-color: #fff;
  111. .newshead {
  112. font-size: 36rpx;
  113. font-family: PingFangSC-Medium, PingFang SC;
  114. font-weight: 600;
  115. line-height: 58rpx;
  116. margin-bottom: 8rpx;
  117. }
  118. .time {
  119. line-height: 40rpx;
  120. }
  121. .newsCon {
  122. margin-top: 30rpx;
  123. line-height: 42rpx;
  124. font-size: 30rpx;
  125. }
  126. .talkBox {
  127. border-top: 1rpx solid #ececec;
  128. margin-top: 30rpx;
  129. padding: 30rpx 0 0;
  130. .title {
  131. font-size: 28rpx;
  132. }
  133. .leRiBox {
  134. .left {
  135. width: 76rpx;
  136. height: 76rpx;
  137. margin-right: 24rpx;
  138. border-radius: 50%;
  139. }
  140. .right {
  141. padding: 30rpx 0;
  142. flex: 1;
  143. .tigTop {
  144. font-family: PingFangSC-Semibold, PingFang SC;
  145. font-weight: 600;
  146. line-height: 44rpx;
  147. text {
  148. font-size: 26rpx;
  149. color: #999999;
  150. line-height: 36rpx;
  151. flex: 1;
  152. font-weight: 400;
  153. margin: 0 20rpx;
  154. }
  155. image {
  156. width: 44rpx;
  157. height: 44rpx;
  158. }
  159. }
  160. .cont {
  161. margin-top: 12rpx;
  162. font-size: 28rpx;
  163. color: #333333;
  164. line-height: 40rpx;
  165. }
  166. }
  167. }
  168. }
  169. .fixBox {
  170. .editicon {
  171. position: absolute;
  172. left: 60rpx;
  173. width: 40rpx;
  174. height: 40rpx;
  175. padding: 3rpx;
  176. }
  177. input {
  178. flex: 1;
  179. font-size: 28rpx;
  180. height: 76rpx;
  181. background: #f6f6f6;
  182. border-radius: 38rpx;
  183. padding: 0 30rpx 0 78rpx;
  184. }
  185. .share {
  186. margin-left: 30rpx;
  187. width: 40rpx;
  188. height: 40rpx;
  189. }
  190. }
  191. }
  192. </style>