school-circle.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  1. <template>
  2. <view class="school-circle iPhone-bottom flex-common-css box-border-box ">
  3. <image class="circle-add" src="@/static/img/school/add.png" mode="" @click="openPop()"></image>
  4. <view class="bg-box"></view>
  5. <Nav :leftShow='false' :customNav='true' bgckgroundBox='transparent'>
  6. <template>
  7. <view slot="custom" class="align-items-center">
  8. <uni-icons type="left" size="20" @click="toBack()"></uni-icons>
  9. <view class="w-390 text-overflow-ellipsis-one fs-36 fw-400">{{schoolData.school_name}}</view>
  10. </view>
  11. </template>
  12. </Nav>
  13. <view class="ts-box mt-24 align-items-center box-border-box plr-12 mb-20">
  14. <image src="@/static/img/school/ts.png" mode=""></image>
  15. <view class="fs-26 fw-400 fc-FB3D03">警惕骗钱骗色,保护自身安全,不轻信陌生人</view>
  16. </view>
  17. <view class="nav-box display-flex box-border-box mb-20">
  18. <view class="nav-item view-nowrap" @click="selectTopicId(item.id)"
  19. :class="fromData.topic_id == item.id?'h130':''" v-for="(item,i) in classList" :key="i">
  20. <image v-if="item.id == 0" class="nav-icon" src="@/static/img/school/icon.png" mode=""></image>
  21. <image v-else class="nav-icon" :src="item.image" mode=""></image>
  22. <view class="fs-24 plr-24 " :class="fromData.topic_id==item.id?'fw-600 fc-41ABF5':''">{{item.name}}</view>
  23. <image v-if="fromData.topic_id == item.id" class="nav-bg" src="@/static/img/school/bg.png" mode=""></image>
  24. </view>
  25. </view>
  26. <view class="flex-justify-space type-box mb-24">
  27. <view class="display-flex">
  28. <view @click="selectOrderBuy(1)" class="box-1" :class="fromData.orderBy == 1?'box-s':''">最新</view>
  29. <view @click="selectOrderBuy(2)" class="box-1" :class="fromData.orderBy == 2?'box-s':''">最热</view>
  30. <view @click="selectOrderBuy(3)" class="box-1" :class="fromData.orderBy == 3?'box-s':''">评论最多</view>
  31. </view>
  32. <view class="box-2 fs-24 fc-41ABF5" @click="toSelectSchool()">逛其他学校</view>
  33. </view>
  34. <view v-if="list.length === 0" class="scroll-view-css">
  35. <EnBlank :customSrc='true'>
  36. <template v-slot:blankImg>
  37. <image class="black-custom-img" src="@/static/img/common/no-order.png" mode=""></image>
  38. </template>
  39. </EnBlank>
  40. </view>
  41. <scroll-view v-else scroll-y="true" class="scroll-view-css" @scrolltolower="scrolltolower">
  42. <view class="card-box box-border-box p-24 bgc-f flex-justify-space" v-for="(item,i) in list" :key="i" @click.stop="toDet()">
  43. <image class="card-head" :src="item.head_img" mode="scaleToFill"></image>
  44. <view class="flex-1">
  45. <view class="card-1 flex-justify-space mb-16">
  46. <view class="">
  47. <view class="w-400 fs-28 fw-600 mb-8">{{item.nickname}}</view>
  48. <view class="fs-24 fc-9">{{item.created_date}}</view>
  49. </view>
  50. <view class="">
  51. <image class="dian-img" src="@/static/img/school/dian.png" mode=""></image>
  52. <view class="align-items-center">
  53. <image class="hot-img" src="@/static/img/school/hot.png" mode=""></image>
  54. <view class="fs-26 fw-400 fc-9">{{item.heat}}</view>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="card-2 fs-30 fw-400 mb-16">
  59. {{item.content}}
  60. </view>
  61. <view class="card-3 flex-wrap-wrap mb-32">
  62. <image class="card-3-img" :src="item" v-for="(item,i) in item.image" mode="scaleToFill"></image>
  63. </view>
  64. <view class="card-4 flex-wrap-wrap mb-40">
  65. <view class="">{{item.school_name}}</view>
  66. <view class="">{{item.topic_name}}</view>
  67. </view>
  68. <view class="card-5 flex-justify-space">
  69. <view class="align-items-center">
  70. <image src="@/static/img/school/fx.png" mode=""></image>
  71. <view class="fs-24 fc-9">分享</view>
  72. </view>
  73. <view class="align-items-center" @click.stop="handUp(item)">
  74. <uni-icons type="hand-up" size="22" :color="item.is_like==1?'#FD5C02':'#999'"></uni-icons>
  75. <view class="fs-24 " :class="item.is_like==1?'fc-FD5C02':'fc-9'">{{item.like}}</view>
  76. </view>
  77. <view class="align-items-center" @click.stop="openMsg(item)">
  78. <image src="@/static/img/school/info.png" mode=""></image>
  79. <view class="fs-24 fc-9">{{item.remark}}</view>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. </scroll-view>
  85. <uni-popup ref="popup" type="bottom">
  86. <view class="pop-box box-border-box p-24">
  87. <view class="head-pop flex-justify-space align-items-center mb-24">
  88. <uni-icons @click.stop="closePop()" type="closeempty" size="24"></uni-icons>
  89. <view class="fs-36 fc-0 fw-600">选发布类型</view>
  90. <view class="fs-28 fw-600 fc-41ABF5" @click.stop="add()">确定</view>
  91. </view>
  92. <view class="scroll-view-css">
  93. <view class="item-box fs-32 " :class="id==i?'fc-41ABF5 bgc-D5EDFB':'bgc-F3F4F6'" v-for="(item,i) in classListPop" :key="i">{{item.name}}</view>
  94. </view>
  95. </view>
  96. </uni-popup>
  97. <uni-popup ref="popmsg" type="bottom">
  98. <view class="pop-box pop-msg box-border-box p-24">
  99. <!-- 输入框 -->
  100. <view class="pop-input" v-if="isShowIpnut">
  101. <view class="head-pop flex-justify-space align-items-center mb-24 box-border-box p-24">
  102. <uni-icons @click.stop="closeInput()" type="closeempty" size="24"></uni-icons>
  103. <view class="fs-36 fc-0 fw-600">评论</view>
  104. <view class="fs-28 fw-600 fc-41ABF5" @click.stop="save">确定</view>
  105. </view>
  106. <view class="scroll-view-css">
  107. <view class="bgc-f box-border-box p-32">
  108. <view class="fs-34 fw-600 mb-20">评论</view>
  109. <textarea class=" fs-24" placeholder='友善评论,文明发言'></textarea>
  110. </view>
  111. </view>
  112. </view>
  113. <view class="head-pop flex-justify-space align-items-center mb-24">
  114. <view class=""></view>
  115. <view class="fs-36 fc-0 fw-600">评论(4)</view>
  116. <uni-icons @click.stop="closeMsg()" type="closeempty" size="24"></uni-icons>
  117. </view>
  118. <view class="scroll-view-css box-border-box plr-24">
  119. <view class="list-box flex-justify-space" v-for="(item,i) in remarkData.list" :key="i">
  120. <image class="list-box-img" :src="item.head_img" mode="scaleToFill"></image>
  121. <view class="flex-1">
  122. <view class=" flex-justify-space">
  123. <view class="p-b-20 b-b-F9F9F9 mr-20">
  124. <view class="fs-28 fw-400 fc-9 mb-8">
  125. {{item.nickname}} <span v-if="is_author == 1" class='only-box text-align-center fs-24 fc-41ABF5 ml-10'>作者</span>
  126. </view>
  127. <view class="fs-30 fw-400 mb-8" @click.stop="openInput()">
  128. {{item.content}}
  129. </view>
  130. <view class="fs-24 fw-400 fc-9 mb-8">{{item.created_date}}</view>
  131. </view>
  132. <view class="display-flex">
  133. <uni-icons type="hand-up" size="20" :color="item.is_like==1?'#FD5C02':'#999'"></uni-icons>
  134. <view class="fs-24 fw-400 mt-5" :class="item.is_like==1?'fc-FD5C02':'fc-9'">{{item.like}}</view>
  135. </view>
  136. </view>
  137. <view class="list-box flex-justify-space" v-for="(info,index) in 1" :key="index">
  138. <image class="list-box-img" src="@/static/img/my/bg.png" mode="scaleToFill"></image>
  139. <view class="flex-1">
  140. <view class=" flex-justify-space">
  141. <view class="p-b-20 b-b-F9F9F9 mr-20">
  142. <view class="fs-28 fw-400 fc-9 mb-8">
  143. 最佳损友最佳损友 <span class='only-box text-align-center fs-24 fc-41ABF5 ml-10'>作者</span>
  144. </view>
  145. <view class="fs-30 fw-400 mb-8" @click.stop="openInput()">
  146. 回关一下啊,这么近这么近这么近这么近这么近这么近
  147. </view>
  148. <view class="fs-24 fw-400 fc-9 mb-8">2021-04-17 15:53</view>
  149. </view>
  150. <view class="display-flex">
  151. <uni-icons type="hand-up" size="20" color="#999"></uni-icons>
  152. <view class="fs-24 fw-400 fc-9 mt-5">11</view>
  153. </view>
  154. </view>
  155. </view>
  156. </view>
  157. </view>
  158. </view>
  159. </view>
  160. </view>
  161. </uni-popup>
  162. </view>
  163. </template>
  164. <script>
  165. import EnBlank from "@/components/en-utils/en-blank/en-blank";
  166. import {getAlumniList,setAlumniLike,getRemarkList} from '@/api/alumni.js';
  167. import {getTopic} from '@/api/category.js';
  168. import tools from '@/service/tools';
  169. export default {
  170. components:{EnBlank},
  171. data(){
  172. return{
  173. id:0,
  174. isShowIpnut:false,
  175. classList:[],
  176. classListPop:[],
  177. total:0,
  178. list:[],
  179. fromData:{
  180. topic_id:0,
  181. orderBy:1,//1最新 2最热 3最多评论
  182. school_id:'',
  183. page:1,
  184. },
  185. isAJAX:false,
  186. remarkData:{
  187. total:0,
  188. list:[],
  189. page:1,
  190. },
  191. schoolData:{
  192. school_name:'',
  193. },
  194. }
  195. },
  196. onShow(){
  197. let circleSchoolId = uni.getStorageSync('circleSchoolId');
  198. let schoolName = uni.getStorageSync('school_name');
  199. let circleSchoolName = uni.getStorageSync('circleSchoolName');
  200. this.schoolData.school_name = circleSchoolId?circleSchoolName:schoolName;
  201. this.classList = [];
  202. this.getTopic();
  203. this.list = [];
  204. this.fromData.page = 1;
  205. this.getList();
  206. },
  207. methods:{
  208. toBack(){
  209. tools.leftClick()
  210. },
  211. toSelectSchool(){
  212. uni.navigateTo({
  213. url:'/pages-address/select-school?type=2'
  214. })
  215. },
  216. getTopic(){
  217. getTopic().then((res)=>{
  218. if(res.code === 1){
  219. this.classListPop = JSON.parse(JSON.stringify(res.data));
  220. this.classList = res.data;
  221. this.classList.unshift({name:'全部贴子',id:0});
  222. }
  223. })
  224. },
  225. selectOrderBuy(type){
  226. if(this.fromData.orderBy != type){
  227. this.fromData.orderBy = type;
  228. this.list = [];
  229. this.fromData.page = 1;
  230. this.getList();
  231. }
  232. },
  233. selectTopicId(id){
  234. if(this.fromData.topic_id != id){
  235. this.fromData.topic_id = id;
  236. this.list = [];
  237. this.fromData.page = 1;
  238. this.getList();
  239. }
  240. },
  241. getList(){
  242. this.fromData.school_id = uni.getStorageSync('school_id');
  243. getAlumniList(this.fromData).then((res)=>{
  244. if(res.code === 1){
  245. this.list = [...this.list,...res.data.items];
  246. this.total = res.data.total;
  247. }
  248. })
  249. },
  250. scrolltolower(){
  251. if(this.list.length < this.total){
  252. this.fromData.page += 1;
  253. this.getList();
  254. }
  255. },
  256. handUp(item){
  257. if(this.isAJAX){
  258. return
  259. }
  260. this.isAJAX = true;
  261. let is_like = item.is_like == 1?0:1;
  262. setAlumniLike({news_id:item.news_id,is_like:is_like}).then((res)=>{
  263. if(res.code === 1){
  264. item.is_like = is_like;
  265. this.isAJAX = false;
  266. tools.success(res.msg);
  267. }else{
  268. this.isAJAX = false;
  269. tools.error(res.msg);
  270. }
  271. })
  272. },
  273. openMsg(item){
  274. if(this.isAJAX){
  275. return
  276. }
  277. this.isAJAX = true;
  278. getRemarkList({news_id:item.news_id,remark_id:0,page:this.remarkData.page}).then((res)=>{
  279. if(res.code === 1){
  280. this.remarkData.list = [...this.remarkData.list,...res.data.items];
  281. this.remarkData.total = res.data.total;
  282. this.remarkData.list.forEach((v)=>{
  283. v.isOpne = false;
  284. })
  285. this.$refs.popmsg.open();
  286. }
  287. })
  288. },
  289. toDet(){
  290. uni.navigateTo({
  291. url:"/pages-school/circle-info"
  292. })
  293. },
  294. openPop(){
  295. this.$refs.popup.open();
  296. },
  297. closePop(){
  298. this.$refs.popup.close();
  299. },
  300. add(item){
  301. uni.navigateTo({
  302. url:"/pages-school/add-circle?topic_id=" + this.fromData.topic_id + '&news_id=' + item.news_id
  303. })
  304. },
  305. closeMsg(){
  306. this.$refs.popmsg.close();
  307. },
  308. openInput(){
  309. this.isShowIpnut = true;
  310. },
  311. closeInput(){
  312. this.isShowIpnut = false;
  313. },
  314. save(){
  315. this.isShowIpnut = false;
  316. },
  317. },
  318. }
  319. </script>
  320. <style scoped lang="scss">
  321. .school-circle{
  322. padding-left: 24rpx;
  323. padding-right: 24rpx;
  324. position: relative;
  325. .pop-box{
  326. width: 100%;
  327. height: 50vh;
  328. background-color: #fff;
  329. border-radius: 24rpx 24rpx 0rpx 0rpx;
  330. display: flex;
  331. flex-direction: column;
  332. .item-box{
  333. width: 100%;
  334. height: 92rpx;
  335. border-radius: 200rpx;
  336. line-height: 92rpx;
  337. text-align: center;
  338. margin-bottom: 24rpx;
  339. }
  340. }
  341. .pop-msg{
  342. height: 70vh;
  343. position: relative;
  344. .pop-input{
  345. position: absolute;
  346. width: 100%;
  347. height: 70vh;
  348. background-color: #fff;
  349. bottom: 0;
  350. left: 0;
  351. border-top: 1rpx solid #ccc;
  352. border-radius: 20rpx 20rpx 0 0;
  353. display: flex;
  354. flex-direction: column;
  355. }
  356. .head-pop{
  357. padding-bottom: 34rpx !important;
  358. border-bottom: 1rpx solid #F2F2F2;
  359. }
  360. .list-box{
  361. .list-box-img{
  362. width: 80rpx;
  363. height: 80rpx;
  364. border-radius: 50%;
  365. margin-right: 16rpx;
  366. }
  367. .only-box{
  368. padding: 4rpx 16rpx;
  369. background: rgba(65,171,245,0.1);
  370. border-radius: 8rpx 8rpx 8rpx 8rpx;
  371. }
  372. .msg-img{
  373. width: 144rpx;
  374. height: 144rpx;
  375. border-radius: 12rpx;
  376. margin-right:5rpx;
  377. margin-bottom: 5rpx;
  378. }
  379. .msg-img:nth-child(3n){
  380. margin-right: 0rpx;
  381. }
  382. .msg-img-1{
  383. width: 100rpx !important;
  384. height: 100rpx !important;
  385. }
  386. }
  387. }
  388. .circle-add{
  389. width: 88rpx;
  390. height: 88rpx;
  391. position: absolute;
  392. right: 0;
  393. bottom: 20vh;
  394. z-index: 2;
  395. }
  396. .w-400{
  397. width: 400rpx;
  398. }
  399. .bg-box{
  400. width: 100%;
  401. height: 260rpx;
  402. filter: blur(80rpx);
  403. background: linear-gradient(to right,#E1F2FD,#E0F3FA,#DBF8EF);
  404. position: absolute;
  405. top: 0;
  406. left: 0;
  407. z-index: -1;
  408. }
  409. .ts-box{
  410. width: 100%;
  411. height: 72rpx;
  412. background: linear-gradient( 180deg, #FFDBD0 0%, #FFFFFF 100%);
  413. border-radius: 16rpx;
  414. image{
  415. width: 44rpx;
  416. height: 44rpx;
  417. margin-right: 8rpx;
  418. }
  419. }
  420. .nav-box{
  421. width: 100%;
  422. overflow-x: scroll;
  423. .h130{
  424. height: 130rpx !important;
  425. }
  426. .nav-item{
  427. margin-right: 12rpx;
  428. width: 144rpx;
  429. height: 114rpx;
  430. text-align: center;
  431. border-radius: 20rpx;
  432. position: relative;
  433. .nav-icon{
  434. width: 64rpx;
  435. height: 64rpx;
  436. margin: 12rpx auto 0 auto;
  437. }
  438. .nav-bg{
  439. width: 144rpx;
  440. height: 130rpx;
  441. position: absolute;
  442. top: 0;
  443. left: 0;
  444. z-index: -1;
  445. }
  446. }
  447. }
  448. .type-box{
  449. .box-s{
  450. font-weight: 600 !important;
  451. color: #41ABF5;
  452. background: #E0F1FF !important;
  453. box-sizing: border-box;
  454. border: 1rpx solid #70C0F8;
  455. }
  456. .box-1{
  457. padding: 8rpx 32rpx;
  458. margin-right: 20rpx;
  459. background-color: #fff;
  460. border-radius: 12rpx;
  461. font-size: 24rpx;
  462. font-weight: 400;
  463. }
  464. .box-2{
  465. width: 168rpx;
  466. height: 50rpx;
  467. line-height: 50rpx;
  468. text-align: center;
  469. border-radius: 12rpx 12rpx 12rpx 12rpx;
  470. border: 1rpx solid #41ABF5;
  471. }
  472. }
  473. .card-box{
  474. width: 100%;
  475. min-height: 100rpx;
  476. border-radius: 20rpx;
  477. margin-bottom: 20rpx;
  478. .card-head{
  479. width: 80rpx;
  480. height: 80rpx;
  481. border-radius: 50%;
  482. margin-right: 16rpx;
  483. }
  484. .dian-img{
  485. width: 30rpx;
  486. height: 6rpx;
  487. margin-bottom: 24rpx;
  488. margin-left: auto;
  489. }
  490. .hot-img{
  491. width: 40rpx;
  492. height: 40rpx;
  493. margin-left: auto;
  494. }
  495. .card-3{
  496. .card-3-img{
  497. width: 182rpx;
  498. height: 182rpx;
  499. border-radius: 12rpx;
  500. margin-right: 6rpx;
  501. margin-bottom: 6rpx;
  502. }
  503. .card-3-img:nth-child(3n){
  504. margin-right: 0rpx;
  505. }
  506. }
  507. .card-4{
  508. view{
  509. padding: 4rpx 16rpx;
  510. background: #F2F2F2;
  511. border-radius: 200rpx;
  512. font-size: 24rpx;
  513. color: #999;
  514. margin-right: 20rpx;
  515. margin-bottom: 10rpx;
  516. }
  517. }
  518. .card-5{
  519. image{
  520. width: 40rpx;
  521. height: 40rpx;
  522. margin-right: 8rpx;
  523. }
  524. }
  525. }
  526. }
  527. </style>