community-detail.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. <!-- 文章详情 -->
  2. <template>
  3. <view class="detail">
  4. <view class="detail-head flex">
  5. <image class="detail-head-left" @click="$back()" src="/static/image/common/left.png" mode=""></image>
  6. <!-- <image class="detail-head-logo" :src="detail.info.avatar" mode=""></image> -->
  7. <view class="detail-head-name">{{info.classification_name}}</view>
  8. <!-- <image src="/static/image/news/topic3.png" mode="" @click="$navigateTo('../download')"></image> -->
  9. </view>
  10. <view class="detail-comtent">
  11. <view class="album flex">
  12. <view class="album_top flex-start" v-if="info">
  13. <image class="logo" :src="info.avatar" mode=""></image>
  14. <view class="">
  15. <u--text :text="info.user_nickname" bold size="32"></u--text>
  16. <u--text margin="6px 0 0 0" color="#999" size="26" :text="info.addtimeString"></u--text>
  17. </view>
  18. </view>
  19. <view class="detail-head-status" :class="{active:info.is_attention == 1}" @click="attention(info.is_attention)" v-if="infos.id != info.uid">
  20. <image src="/static/image/match/guanzhu.png" mode=""></image>
  21. {{info.is_attention == 1?$t('news.followed'):$t('news.follow')}}
  22. </view>
  23. </view>
  24. <view class="font28" style="width: 100%;overflow: hidden;color: #333;" v-if="detail.info" v-html="detail.info.title"></view>
  25. <view class="album__content" v-if="info.is_flie_type == 0">
  26. <u-album multipleSize="200" space="16" :urls="info.img"></u-album>
  27. </view>
  28. <view class="album__content" v-else >
  29. <video style="width: 100%;" v-if="info.video[0]" :src="info.video[0].video"></video>
  30. <!-- <image v-if="info.video[0]" :src="info.video[0].img+'?vframe/jpg/offset/0'" mode=""></image> -->
  31. <!-- <image class="play" src="/static/image/match/play.png" mode=""></image> -->
  32. </view>
  33. <view class="detail-link flex-start">
  34. <view class="flex-start type">
  35. <image :src="info.classification_icon" mode="aspectFill"></image>
  36. {{info.classification_name}}
  37. </view>
  38. <view class="flex-start">
  39. <image src="/static/image/news/eyes.png" mode=""></image>
  40. <text class="font24">{{info.click}}</text>
  41. </view>
  42. </view>
  43. </view>
  44. <comment-community ref="eg" :articleId="id" style="background-color: white;"></comment-community>
  45. <view class="detail-common flex">
  46. <view class="flex-start input" @click="setEg()">
  47. <image src="/static/image/news/topic9.png" mode=""></image>
  48. <text>{{$t('news.input')}}</text>
  49. </view>
  50. <!-- <image src="/static/image/news/topic7.png" mode="" @click="setEg()"></image> -->
  51. <view class="flex-start">
  52. <image :src="info.is_likes == 0?'/static/image/news/topic4.png' :'/static/image/news/zan.png'" mode="" @click="likes(info.is_likes)"></image>
  53. <text>{{info.likes}}</text>
  54. </view>
  55. <image :src="info.is_favorites == 0?'/static/image/news/topic1.png':'/static/image/news/fav.png'" mode="" @click="favorites(info.is_favorites)"></image>
  56. </view>
  57. </view>
  58. </template>
  59. <script>
  60. export default {
  61. data() {
  62. return {
  63. id:0,
  64. info:{
  65. },
  66. detail:{}
  67. }
  68. },
  69. mounted() {
  70. },
  71. computed:{
  72. infos() {
  73. return this.$store.state.info
  74. },
  75. },
  76. onLoad(optin) {
  77. this.id = optin.id;
  78. this.navigate(optin)
  79. // this.$u.get('/api/Headlines/getInfo', {id:optin.id}).then(res => {
  80. // this.detail = res
  81. // })
  82. },
  83. methods:{
  84. /* 关注 */
  85. attention(type) {
  86. if (this.$store.state.isLogin != 1) {
  87. this.$toUrl('/pages/login/login')
  88. return
  89. }
  90. uni.showLoading({
  91. title:this.$t('common.lab')
  92. })
  93. uni.$u.http.post('/api/Member/attention', {id:this.info.uid}).then(res => {
  94. uni.hideLoading()
  95. this.info.is_attention = type == 1?type = 0 : type = 1
  96. })
  97. },
  98. navigate(item){
  99. uni.showLoading({
  100. title:'loading'
  101. })
  102. // console.log(item);
  103. uni.$u.http.get('/api/circle/info', {params:{id:item.id}}).then(res => {
  104. this.detail = res;
  105. this.info = res.info;
  106. uni.hideLoading()
  107. uni.pageScrollTo({       
  108.     duration: 0,//过渡时间必须为0,否则运行到手机会报错
  109.     scrollTop: 0 //滚动到实际距离是元素距离顶部的距离减去最外层盒子的滚动距离(如res.top - data.top)
  110.   })
  111. })
  112. },
  113. /* 打开评论 */
  114. setEg() {
  115. this.$refs.eg.showCom()
  116. },
  117. /* 点赞 */
  118. likes(type) {
  119. if (this.$store.state.isLogin != 1) {
  120. this.$toUrl('/pages/login/login')
  121. return
  122. }
  123. uni.showLoading({
  124. title:this.$t('common.lab')
  125. })
  126. uni.$u.http.post('api/Circleuser/likes',{id:this.info.id}).then(res=>{
  127. this.info.is_likes = type==1?0:1;
  128. type == 1?this.info.likes -- : this.info.likes ++
  129. uni.hideLoading()
  130. }).catch(res=>{})
  131. },
  132. /* 收藏 */
  133. favorites(type) {
  134. if (this.$store.state.isLogin != 1) {
  135. this.$toUrl('/pages/login/login')
  136. return
  137. }
  138. uni.showLoading({
  139. title:this.$t('common.lab')
  140. })
  141. uni.$u.http.post('api/Circleuser/favorites',{id:this.info.id}).then(res=>{
  142. this.info.is_favorites = type==1?0:1;
  143. uni.hideLoading()
  144. }).catch(res=>{})
  145. }
  146. }
  147. }
  148. </script>
  149. <style>
  150. .detail-comtent>>>img {
  151. height: auto !important;
  152. width: 100% !important;
  153. }
  154. </style>
  155. <style lang="scss" scoped>
  156. page {
  157. background-color: #F3F3F7;
  158. }
  159. .detail {
  160. padding-bottom: 100rpx;
  161. }
  162. video {
  163. margin-top: 20rpx;
  164. z-index: 0;
  165. }
  166. .album {
  167. // margin-top: 20rpx;
  168. padding: 0 24rpx;
  169. margin-bottom: 64rpx;
  170. border-radius: 12rpx;
  171. background-color: white;
  172. .logo {
  173. width: 72rpx;
  174. height: 72rpx;
  175. border-radius: 50%;
  176. margin-right: 16rpx;
  177. }
  178. .nav {
  179. padding-top: 20rpx;
  180. }
  181. .album__content {
  182. position: relative;
  183. margin-top: 30rpx;
  184. image {
  185. border-radius: 10rpx;
  186. }
  187. .play {
  188. position: absolute;
  189. top: 40%;
  190. left: 50%;
  191. margin-left: -60rpx;
  192. width: 80rpx;
  193. height: 80rpx;
  194. }
  195. }
  196. .tabbar {
  197. margin-top: 22rpx;
  198. padding: 0 22rpx;
  199. image {
  200. width: 48rpx;
  201. height: 48rpx;
  202. }
  203. view {
  204. display: flex;
  205. align-items: center;
  206. justify-content: flex-start;
  207. }
  208. }
  209. .detail-head-status {
  210. display: flex;
  211. align-items: center;
  212. justify-content: center;
  213. color: #fff;
  214. font-size: 24rpx;
  215. border-radius: 6rpx;
  216. padding: 10rpx;
  217. border-radius: 10rpx;
  218. text-align: center;
  219. border: 2rpx solid #F1F1F1;
  220. background: url('/static/image/live/live-at.png')center top / 100% 100%;
  221. // background: linear-gradient(90deg, #DC3C23 0%, #DC3C23 100%);
  222. image {
  223. width: 28rpx;
  224. height: 26rpx;
  225. margin-right: 10rpx;
  226. }
  227. }
  228. .active {
  229. background:#ccc
  230. }
  231. }
  232. .detail-head {
  233. position: sticky;
  234. top: 0;
  235. z-index: 99;
  236. padding: 14rpx 24rpx;
  237. background-color: white;
  238. border-bottom: 2rpx solid #F0F0F0;
  239. image {
  240. width: 60rpx;
  241. height: 60rpx;
  242. margin-right: 20rpx;
  243. }
  244. .detail-head-left {
  245. width: 60rpx;
  246. height: 60rpx;
  247. margin-right: 32rpx;
  248. }
  249. .detail-head-logo {
  250. width: 72rpx;
  251. height: 72rpx;
  252. border-radius: 50%;
  253. margin-right: 16rpx;
  254. }
  255. .detail-head-name {
  256. flex: 1;
  257. font-size: 28rpx;
  258. }
  259. }
  260. .detail-comtent {
  261. margin-top: 20rpx;
  262. padding: 32rpx 24rpx;
  263. background-color: white;
  264. .detail-link {
  265. margin-top: 24rpx;
  266. view {
  267. color: #999;
  268. image {
  269. width: 32rpx;
  270. height: 24rpx;
  271. margin-right: 16rpx;
  272. border-radius: 6rpx;
  273. }
  274. }
  275. }
  276. .type {
  277. color: #fff !important;
  278. border-radius: 10rpx;
  279. margin-right: 20rpx;
  280. padding: 10rpx 20rpx;
  281. background: rgb(238, 192, 123);
  282. text {
  283. color: #fff;
  284. }
  285. image {
  286. height: 32rpx !important;
  287. }
  288. }
  289. }
  290. .detail-article {
  291. padding: 0 24rpx;
  292. margin-top: 20rpx;
  293. padding-bottom: 120rpx;
  294. background-color: white;
  295. .detail-article-title {
  296. color: #333;
  297. font-size: 32rpx;
  298. font-weight: bold;
  299. padding-top: 32rpx;
  300. }
  301. .detail-article-li {
  302. padding: 30rpx 0;
  303. border-bottom: 2rpx solid #F0F0F0;
  304. view {
  305. flex: 1;
  306. color: #333;
  307. font-size: 32rpx;
  308. margin-right: 90rpx;
  309. }
  310. image {
  311. width: 242rpx;
  312. height: 136rpx;
  313. border-radius: 12rpx;
  314. }
  315. }
  316. }
  317. .detail-common {
  318. position: fixed;
  319. bottom: 0;
  320. right: 0;
  321. left: 0;
  322. background-color: white;
  323. padding: 18rpx 28rpx;
  324. image {
  325. width: 60rpx;
  326. height: 60rpx;
  327. margin-left: 16rpx;
  328. }
  329. text {
  330. color: #999;
  331. }
  332. .input {
  333. flex: 1;
  334. color: #999;
  335. font-size: 28rpx;
  336. border-radius: 12rpx;
  337. padding: 22rpx 32rpx;
  338. background-color: #F5F5F5;
  339. image {
  340. width: 28rpx;
  341. height: 28rpx;
  342. margin-right: 32rpx;
  343. }
  344. }
  345. }
  346. </style>