filesonic.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. <template>
  2. <view>
  3. <u-navbar title="分享空间"></u-navbar>
  4. <!-- 图片 -->
  5. <view class="image" v-if="false">
  6. <u-image width="100%" height="200rpx" :src="src" border-radius="16"></u-image>
  7. </view>
  8. <!-- 分享内容 -->
  9. <view class="share-content">
  10. <view class="item" v-for="(item,i) in list" :key="i" @click="ckItem(item)">
  11. <view class="infos">
  12. <view class="person">
  13. <view class="photo">
  14. <img v-if="item.regUser&&item.regUser.headImg" :src="item.regUser.headImg" alt="">
  15. <u-avatar v-else size="64" ></u-avatar>
  16. </view>
  17. <view class="name">
  18. {{item.createName}}
  19. </view>
  20. </view>
  21. <view class="date">
  22. {{item.createTime}}
  23. </view>
  24. </view>
  25. <view class="share-text">
  26. <textarea placeholder="记录点滴生活..." disabled="disabled" :auto-height="true" style="width:auto"
  27. v-model="item.synopsis" readonly maxlength="200"
  28. name="" id="" ></textarea>
  29. </view>
  30. <view class="pictures" >
  31. <template v-for="(pic,i2) in item.listShareFiles" v-if="pic.url">
  32. <img v-if="pic.isPic" :key="i2"
  33. @click="previewImage(item.listShareFiles,i2)"
  34. :src="pic.url" alt="">
  35. <video v-else :key="i2" :src="pic.url" :class="{videoplay:playurl==pic.url}" @play="playurl=pic.url"
  36. enable-danmu danmu-btn controls></video>
  37. </template>
  38. </view>
  39. <view class="tagMain">
  40. <view class="tag"
  41. v-if="!item.activityId"
  42. :class="item.activityId" >
  43. <text class="status" style="color: red;" v-if="item.status!=1">[{{item.status==0?'审核中':''}}{{item.status==2?'审核不通过':''}}]</text>
  44. </view>
  45. <view class="tag" v-else
  46. :class="item.activityId" @click="issueMethod(item.activityId)" >
  47. <text class="status" style="color: red;" v-if="item.status!=1">[{{item.status==0?'审核中':''}}{{item.status==2?'审核不通过':''}}]</text>
  48. <template>
  49. <text class="symbol">#</text>
  50. <text class="text">{{item.activityName}}</text>
  51. <text class="icon" >
  52. <u-icon size="28" color="#cccccc" name="arrow-right"></u-icon>
  53. </text>
  54. </template>
  55. </view>
  56. <view class="tag status" style="color: #19be6b;" @click="delShare(item.id)" v-if="item.status!=1">
  57. <u>点击删除</u>
  58. </view>
  59. <view class="like" v-if="item.status==1" @click="changeLikes(item)" :class="{
  60. red:item.isLike
  61. }"
  62. ><view class="icon">
  63. <u-icon name="thumb-up" size="38"></u-icon>
  64. </view><view class="number">
  65. {{item.likesNum}}</view></view>
  66. </view>
  67. </view>
  68. </view>
  69. <u-divider :isnone="list.length==0" v-if="list.length==recordsTotal" nonetext="没有找到相关内容" border-color="#CFD2D5">已经到底了</u-divider>
  70. <view class="bottom" @click="issueMethod()" >
  71. <img src="../../assets/img/riFill-camera-fill@2x.png">
  72. </view>
  73. </view>
  74. </template>
  75. <script>
  76. import * as API from '@/apis/pagejs/share.js'
  77. import {
  78. isWeiXin
  79. } from '@/apis/utils'
  80. export default {
  81. data() {
  82. return {
  83. listForm:{
  84. pageIndex:1,
  85. pageSize:20,
  86. },
  87. playurl:"",
  88. list:[],
  89. recordsTotal:0,
  90. tabList: [],
  91. current: 0
  92. }
  93. },
  94. onLoad(op){
  95. this.carhelp.set("addShare",0);
  96. if((process.env.NODE_ENV === "development")||isWeiXin()){
  97. this.getList()
  98. }else{
  99. alert("请使用微信打开本页面")
  100. }
  101. //this.dataList()
  102. },
  103. onReachBottom() {
  104. if (this.list.length < this.recordsTotal) {
  105. this.myLoadmore();
  106. }
  107. },
  108. onShow(){
  109. console.log("onShow")
  110. if( this.carhelp.get("addShare")){
  111. this.listForm.pageIndex=1;
  112. this.getList()
  113. }
  114. },
  115. methods: {
  116. delShare(id){
  117. uni.showModal({
  118. title: '提示',
  119. content: '是否删除分享?',
  120. success: res=>{
  121. if (res.confirm) {
  122. this.delShareApi(id)
  123. } else if (res.cancel) {
  124. //('用户点击取消');
  125. }
  126. }
  127. });
  128. },
  129. delShareApi(id){
  130. uni.showLoading({
  131. title: "加载中",
  132. mask: true,
  133. })
  134. API.delShare({
  135. shareId:id
  136. }).then((res) => {
  137. uni.showToast({
  138. title: "删除成功",
  139. icon: "none"
  140. })
  141. this.listForm.pageIndex=1;
  142. this.getList()
  143. }).catch(error => {
  144. uni.showToast({
  145. title: error,
  146. icon: "none"
  147. })
  148. this.listForm.pageIndex=1;
  149. this.getList()
  150. })
  151. },
  152. changeLikes(info){
  153. var userInfo=this.carhelp.getPersonInfo()
  154. if(!userInfo){
  155. return
  156. }
  157. if(!info.isLike){
  158. uni.showLoading({
  159. title: "加载中",
  160. mask: true,
  161. })
  162. API.changeLikes({
  163. shareId:info.id
  164. }).then((res) => {
  165. info.isLike=true;
  166. info.likesNum++;
  167. uni.hideLoading();
  168. //this.getInfo(true)
  169. }).catch(error => {
  170. uni.showToast({
  171. title: error,
  172. icon: "none"
  173. })
  174. })
  175. }else{
  176. uni.showToast({
  177. title: "您已经点过赞了",
  178. icon: "none"
  179. })
  180. }
  181. },
  182. issueMethod(id){
  183. var userInfo=this.carhelp.getPersonInfo()
  184. if(!userInfo){
  185. uni.showModal({
  186. title:"提示",
  187. content:"未登录,登录后参与分享活动",
  188. confirmText:"前往登录",
  189. showCancel:true,
  190. success: function (res) {
  191. if(res.confirm){
  192. uni.navigateTo({
  193. url:'/pages/login/index'
  194. })
  195. }
  196. }
  197. })
  198. }else{
  199. if(id){
  200. this.gotoUrl('pages/mine/issue?id='+id)
  201. }else{
  202. this.gotoUrl('pages/mine/issue?nic=1')
  203. }
  204. }
  205. },
  206. previewImage(img,i) {
  207. let imgs = [];
  208. img.forEach(it=>{
  209. if(it.isPic){
  210. imgs.push(it.url)
  211. }
  212. })
  213. uni.previewImage({
  214. //indicator:"default",
  215. indicator:"number",
  216. loop:true,
  217. urls: imgs,
  218. current: i
  219. })
  220. },
  221. ckItem(item){
  222. },
  223. dataList(){
  224. API.dataList("活动类型").then((res) => {
  225. this.tabList=[
  226. {
  227. id:'',
  228. name:'全部'
  229. },
  230. ...res.data
  231. ]
  232. }).catch(error => {
  233. })
  234. },
  235. getList(){
  236. uni.showLoading({
  237. title: "加载中",
  238. mask: true,
  239. })
  240. API.pageList(this.listForm).then((res) => {
  241. this.carhelp.set("addShare",0);
  242. uni.hideLoading();
  243. var list=res.data.data;
  244. if(this.listForm.pageIndex==1){
  245. this.list = list;
  246. }else{
  247. this.list = [
  248. ...this.list,
  249. ...list
  250. ];
  251. }
  252. this.recordsTotal = res.data.recordsTotal;
  253. }).catch(error => {
  254. uni.showToast({
  255. title: error,
  256. icon: "none"
  257. })
  258. })
  259. },
  260. myLoadmore(){
  261. this.listForm.pageIndex += 1;
  262. this.getList();
  263. },
  264. change(index) {
  265. this.current = index;
  266. this.listForm.pageIndex = 1;
  267. this.listForm.type=this.tabList[index].id
  268. this.getList()
  269. }
  270. }
  271. }
  272. </script>
  273. <style lang="scss" scoped>
  274. .red{
  275. color: red !important;
  276. }
  277. .like{
  278. margin-top: 16rpx;
  279. line-height: 24px;
  280. display: flex;
  281. .number{
  282. margin-left: 16rpx;
  283. }
  284. }
  285. page {
  286. background-color: #fff;
  287. padding-bottom: 100px;
  288. }
  289. .image {
  290. padding: 0 32rpx;
  291. margin: 24rpx 0;
  292. }
  293. .tabs {
  294. background-color: rgba(255, 255, 255, 1);
  295. padding: 0 32rpx;
  296. /deep/.u-tab-item {
  297. flex: none !important;
  298. margin-right: 32rpx;
  299. }
  300. /deep/.u-tabs-scorll-flex {
  301. justify-content: start;
  302. }
  303. }
  304. // 分享内容
  305. .share-content {
  306. margin: 48rpx 32rpx 0 32rpx;
  307. .item {
  308. padding-bottom: 32rpx;
  309. border-bottom: 1px solid rgba(232, 232, 232, 1);
  310. margin-top: 48rpx;
  311. font-family: 'Regular';
  312. .infos {
  313. display: flex;
  314. justify-content: space-between;
  315. align-items: center;
  316. .person {
  317. display: flex;
  318. align-items: center;
  319. .photo {
  320. img {
  321. width: 64rpx;
  322. height: 64rpx;
  323. border-radius: 50px;
  324. }
  325. }
  326. .name {
  327. color: rgba(51, 51, 51, 1);
  328. font-size: 16px;
  329. margin-left: 24rpx;
  330. font-family: 'Medium';
  331. }
  332. }
  333. }
  334. .share-text {
  335. margin-top: 24rpx;
  336. color: #101010;
  337. font-size: 16px;
  338. line-height: 22px;
  339. }
  340. .pictures {
  341. display: flex;
  342. justify-content: start;
  343. flex-wrap: wrap;
  344. margin-top: 16rpx;
  345. .videoplay{
  346. height: 400rpx;
  347. }
  348. video {
  349. width: 100%;
  350. height: 200rpx;
  351. border-radius: 16rpx;
  352. margin-bottom: 16rpx;
  353. margin-left: 16rpx;
  354. }
  355. img {
  356. width: 31%;
  357. height: 216rpx;
  358. border-radius: 16rpx;
  359. margin-bottom: 16rpx;
  360. margin-left: 16rpx;
  361. }
  362. }
  363. .video{
  364. margin-top: 16rpx;
  365. uni-video{
  366. width: 100%;
  367. height: 380rpx;
  368. border-radius: 8px;
  369. }
  370. }
  371. .tagMain{
  372. display: flex;
  373. justify-content: space-between;
  374. .tag {
  375. margin-top: 16rpx;
  376. line-height: 24px;
  377. .symbol {
  378. color: rgba(31, 74, 153, 100);
  379. font-size: 16px
  380. }
  381. .text {
  382. color: rgba(31, 74, 153, 1);
  383. margin-left: 14rpx;
  384. }
  385. }
  386. }
  387. }
  388. }
  389. .item:last-of-type {
  390. border: none;
  391. margin-bottom: 26rpx;
  392. }
  393. .bottom{
  394. z-index: 999;
  395. background: linear-gradient(223.81deg, rgba(0,90,217,1) 14.24%,rgba(0,52,148,1) 86.67%);
  396. width: 104rpx;
  397. height: 104rpx;
  398. border-radius: 50px;
  399. display: flex;
  400. justify-content: center;
  401. align-items: center;
  402. position: fixed;
  403. right: 72rpx;
  404. bottom: 72rpx;
  405. img{
  406. width: 56rpx;
  407. height: 56rpx;
  408. }
  409. }
  410. </style>