list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. <template>
  2. <view class="content">
  3. <!-- <view>
  4. </view> -->
  5. <uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" styleType="text" activeColor="#1c9bdc"></uni-segmented-control>
  6. <view v-show="current == 0">
  7. <view class="active-title-box">
  8. <view class="header-title">{{activeDesc.name}}</view>
  9. <view style="color: gray;">{{activeDesc.start_time}}</view>
  10. </view>
  11. <view class="active-box" v-for="(item,index) in activiList" :key="index" style="flex-direction: column;" :class="index===activiList.length-1?'marginB40':''">
  12. <view class="active-header">
  13. <!-- <view class="active-type">
  14. <text style="margin: 0 auto;">头像</text>
  15. </view> -->
  16. <view class="active-content-box">
  17. <view class="active-content margin-top-3">
  18. <view class="active-name">{{item.author}}</view>
  19. <!-- <view class="active-date">{{item.addtime}}</view> -->
  20. </view>
  21. <view class="active-content">
  22. <view class="active-date">{{item.addtime}}</view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="active-content-box">
  27. <view class="active-content">
  28. <view class="active-title">{{item.content}}</view>
  29. </view>
  30. </view>
  31. <view class="active-content-box-img margin-top-3">
  32. <view v-for="(img,indexImg) in item.pic_list" :key="indexImg" class="marginR5">
  33. <image :src="img.pic_url_resize" mode="aspectFill" @click="showLarge(item.pic_list,indexImg)"></image>
  34. </view>
  35. </view>
  36. <view class="margin-top-3" style="color: #007AFF;" @click="tonewurl(item.web_url)" v-if="item.web_url">
  37. {{item.web_url}}
  38. </view>
  39. <view v-if="item.web_url" style="font-size: 24rpx;color: #ccc;">
  40. 点击链接可进行复制,前往浏览器查看。
  41. </view>
  42. <view class="edit-icon-box">
  43. <image src="/static/edit-icon.png" mode="aspectFit" v-if="item.edit_auth" @click="goEditPage(item.id)"></image>
  44. <image src="/static/del-icon.png" mode="aspectFit" v-if="item.del_auth" @click="delProcess(item.id)"></image>
  45. </view>
  46. </view>
  47. <button class="footer-box-record" @click="goRecord()">上传记录</button>
  48. </view>
  49. <view v-if="current == 1">
  50. <view class="active-box" v-for="(item,index) in activiList" :key="index" style="flex-direction: column;" :class="index===activiList.length-1?'marginB40':''">
  51. <view class="active-content-box-img margin-top-3">
  52. <view v-for="(img,indexImg) in item.pic_list" :key="indexImg" class="marginR5">
  53. <image :src="img.pic_url_resize" mode="aspectFill" @click="showLarge(item.pic_list,indexImg)"></image>
  54. </view>
  55. </view>
  56. <view class="edit-icon-box">
  57. <image src="/static/edit-icon.png" mode="aspectFit" v-if="item.edit_auth" @click="goEditPage(item.id)"></image>
  58. <image src="/static/del-icon.png" mode="aspectFit" v-if="item.del_auth" @click="delProcess(item.id)"></image>
  59. </view>
  60. </view>
  61. <button class="footer-box-record" @click="goFiles()">上传文件</button>
  62. </view>
  63. <view v-if="current == 2">
  64. 评论
  65. </view>
  66. <share-modal @closeShare="closeShare" :isShowShare="isShowShareModal" :class="{ shareParent: isShowShareModal}"></share-modal>
  67. </view>
  68. </template>
  69. <script>
  70. import md5 from "@/common/md5.js";
  71. import shareModal from '@/components/share-modal/share-modal.vue'
  72. export default {
  73. components: {
  74. "share-modal": shareModal,
  75. },
  76. data() {
  77. return {
  78. isAuth:getApp().globalData.globalAuth,
  79. userHeadImg: getApp().globalData.user_headUrl,
  80. userNickName:getApp().globalData.user_name,
  81. globalUrl:getApp().globalData.shareUrl,
  82. activeId:'',
  83. branchId:'',
  84. recordId:'',
  85. activeDesc:{},
  86. activiList:[],
  87. fileObj:{},
  88. isShowShareModal:false,
  89. items:['记录','文件','评论'],
  90. current:0,
  91. };
  92. },
  93. onLoad(option) {
  94. this.recordId = option.id;
  95. this.readDesc(this.recordId);
  96. },
  97. onShow() {
  98. this.readActive(this.recordId);
  99. this.getFileList(this.recordId)
  100. },
  101. onShareAppMessage() {
  102. return {
  103. title: '农工笔记',
  104. path:'/pages/index/activity/activity'
  105. }
  106. },
  107. methods: {
  108. goEditPage(id){
  109. uni.navigateTo({
  110. url:'./record?id='+ id + '&bId=' + this.branchId + '&aId=' + this.activeId + '&types=edit'
  111. })
  112. },
  113. pageShowShare(obj){
  114. console.log(obj)
  115. this.isShowShareModal = true;
  116. },
  117. closeShare(e){
  118. this.isShowShareModal = false;
  119. },
  120. onClickItem(e){
  121. this.current = e.currentIndex
  122. },
  123. //打开文件
  124. openFile(files){
  125. console.log(files)
  126. uni.downloadFile({
  127. url: files,
  128. success: function(res) {
  129. var filePath = res.tempFilePath;
  130. //打开文件有效值 doc, xls, ppt, pdf, docx, xlsx, pptx
  131. uni.openDocument({
  132. filePath:filePath,
  133. success: function(res) {
  134. console.log(res)
  135. //that.downloadFile_onoff = true;
  136. },
  137. fail(res) {
  138. console.log(res)
  139. uni.showToast({
  140. title: '暂不支持此类型',
  141. icon:'none',
  142. duration: 2000
  143. });
  144. //uni.hideLoading();
  145. //that.downloadFile_onoff = true;
  146. }
  147. });
  148. }
  149. });
  150. },
  151. showLarge(urlList,index) {
  152. let imgList = urlList,imgArr = [];
  153. imgList.forEach((item,index)=>{
  154. imgArr.push(item.pic_url)
  155. })
  156. uni.previewImage({
  157. urls:imgArr,
  158. current:imgArr[index],
  159. longPressActions: {
  160. itemList: ["发送给朋友", "保存图片"],
  161. success: function (data) {},
  162. fail: function (err) {
  163. console.log(err.errMsg);
  164. },
  165. },
  166. });
  167. },
  168. delProcessRequeset(delId){
  169. let md5Sign = md5(
  170. "method=" +"activity" + "&timestamp=" + getApp().globalData.globalTimestamp +
  171. "&secret=" + getApp().globalData.secret
  172. );
  173. let url = getApp().globalData.shareUrl +"api/api.php" +
  174. "?method=activity&action=process_del&timestamp=" +
  175. getApp().globalData.globalTimestamp + "&sign=" + md5Sign;
  176. uni.request({
  177. url: url,
  178. method: "POST",
  179. header: {
  180. "content-type": "application/x-www-form-urlencoded",
  181. },
  182. data: {
  183. openid: getApp().globalData.open_id,
  184. id:delId
  185. },
  186. success: (res) => {
  187. if (res.data.code === 200) {
  188. uni.showToast({
  189. title: "删除成功",
  190. icon: "none",
  191. duration: 2500,
  192. success:()=>{
  193. this.readActive(this.activeId)
  194. }
  195. });
  196. }
  197. },
  198. fail: () => {
  199. console.log("连接失败");
  200. },
  201. });
  202. },
  203. delProcess(id){
  204. let that = this;
  205. uni.showModal({
  206. title: "确定删除此记录吗?",
  207. success(res) {
  208. if (res.confirm) {
  209. that.delProcessRequeset(id);
  210. } else if (res.cancel) {
  211. console.log("用户点击取消");
  212. }
  213. },
  214. });
  215. },
  216. readDesc(id){
  217. let md5Sign = md5(
  218. "method=" +"activity" + "&timestamp=" + getApp().globalData.globalTimestamp +
  219. "&secret=" + getApp().globalData.secret
  220. );
  221. let url = getApp().globalData.shareUrl +"api/api.php" +
  222. "?method=activity&action=info_by_id&timestamp=" +
  223. getApp().globalData.globalTimestamp + "&sign=" + md5Sign;
  224. uni.request({
  225. url: url,
  226. method: "POST",
  227. header: {
  228. "content-type": "application/x-www-form-urlencoded",
  229. },
  230. data: {
  231. openid:getApp().globalData.open_id,
  232. id:id
  233. },
  234. success: (res) => {
  235. if (res.data.code === 200) {
  236. this.activeDesc = res.data.data;
  237. this.branchId = res.data.data.branch_id;
  238. this.activeId = res.data.data.id;
  239. }
  240. },
  241. fail: () => {
  242. console.log("连接失败");
  243. },
  244. });
  245. },
  246. getFileList(id){
  247. let md5Sign = md5(
  248. "method=" +"activity" + "&timestamp=" + getApp().globalData.globalTimestamp +
  249. "&secret=" + getApp().globalData.secret
  250. );
  251. let url = getApp().globalData.shareUrl +"api/api.php" +
  252. "?method=activity&action=files_list&timestamp=" +
  253. getApp().globalData.globalTimestamp + "&sign=" + md5Sign;
  254. uni.request({
  255. url: url,
  256. method: "POST",
  257. header: {
  258. "content-type": "application/x-www-form-urlencoded",
  259. },
  260. data: {
  261. openid:getApp().globalData.open_id,
  262. activity_id : id
  263. },
  264. success: (res) => {
  265. if (res.data.code === 200) {
  266. console.log(res.data.data)
  267. }
  268. },
  269. fail: () => {
  270. console.log("连接失败");
  271. },
  272. });
  273. },
  274. readActive(id){
  275. let md5Sign = md5(
  276. "method=" +"activity" + "&timestamp=" + getApp().globalData.globalTimestamp +
  277. "&secret=" + getApp().globalData.secret
  278. );
  279. let url = getApp().globalData.shareUrl +"api/api.php" +
  280. "?method=activity&action=process_list&timestamp=" +
  281. getApp().globalData.globalTimestamp + "&sign=" + md5Sign;
  282. uni.request({
  283. url: url,
  284. method: "POST",
  285. header: {
  286. "content-type": "application/x-www-form-urlencoded",
  287. },
  288. data: {
  289. openid:getApp().globalData.open_id,
  290. activity_id:id
  291. },
  292. success: (res) => {
  293. if (res.data.code === 200) {
  294. let listArr = res.data.data.list;
  295. listArr.forEach((item)=>{
  296. item.pic_list.forEach((child)=>{
  297. child.pic_url = this.globalUrl + child.pic_url;
  298. child.pic_url_resize = this.globalUrl + child.pic_url_resize;
  299. })
  300. })
  301. this.activiList = listArr;
  302. }
  303. },
  304. fail: () => {
  305. console.log("连接失败");
  306. },
  307. });
  308. },
  309. tonewurl(urls) {
  310. uni.setClipboardData({
  311. data: urls,
  312. success: function (res) {
  313. uni.showToast({
  314. title: '复制成功,请在手机浏览器中打开',
  315. icon:"none"
  316. });
  317. }
  318. })
  319. // uni.navigateTo({
  320. // url:'/pages/index/webview/web-view?url=' + urls
  321. // });
  322. },
  323. goRecord(){
  324. uni.navigateTo({
  325. url:'./record?bId=' + this.branchId + '&aId=' + this.activeId + '&types=add'
  326. })
  327. },
  328. goFiles(){
  329. uni.navigateTo({
  330. url:'./files?bId=' + this.branchId + '&aId=' + this.activeId + '&types=add'
  331. })
  332. }
  333. },
  334. };
  335. </script>
  336. <style lang="scss" scoped>
  337. .content {
  338. display: flex;
  339. flex-direction: column;
  340. .self-inf {
  341. // border-radius: 0rpx 0rpx 100% 100%;
  342. .img-name-box {
  343. height: 150rpx;
  344. margin-top: 20rpx;
  345. margin-bottom: 20rpx;
  346. display: flex;
  347. align-items: center;
  348. width: 85%;
  349. .auth-btn {
  350. margin-left: 30rpx;
  351. margin-top: 20rpx;
  352. font-size: 28rpx;
  353. background-color: #02a7f0;
  354. color: #fff;
  355. }
  356. .heade-img {
  357. z-index: 1;
  358. width: 100rpx;
  359. height: 100rpx;
  360. border-radius: 50%;
  361. // margin-left: 80rpx;
  362. }
  363. }
  364. .nickname {
  365. font-weight: 600;
  366. font-size: 28rpx;
  367. margin-left: 30rpx;
  368. margin-top: 20rpx;
  369. color: #555;
  370. letter-spacing: 1rpx;
  371. }
  372. }
  373. }
  374. .org-info-box {
  375. display: flex;
  376. justify-content: space-evenly;
  377. height: 80rpx;
  378. align-items: center;
  379. width: 100%;
  380. border-top: 1px solid #d4d4d4;
  381. color: #555;
  382. font-size: 28rpx;
  383. background: #fff;
  384. }
  385. .org-line {
  386. width: 1px;
  387. height: 82rpx;
  388. background: #d4d4d4;
  389. }
  390. .header-title {
  391. margin-top: 3%;
  392. margin-bottom: 1%;
  393. font-size: 32rpx;
  394. font-weight: bold
  395. }
  396. .active-title-box {
  397. padding-left: 3%;
  398. font-size: 26rpx;
  399. height: 100rpx;
  400. border-bottom: 4px solid #eeeeee;
  401. .time-select-box {
  402. width: 32%;
  403. margin-left: 5%;
  404. }
  405. picker {
  406. width: 25%;
  407. border: 1px solid #d7d7d7;
  408. height: 60rpx;
  409. line-height: 60rpx;
  410. border-radius: 10rpx;
  411. margin-left: 20rpx;
  412. padding: 0 10rpx;
  413. position: relative;
  414. image {
  415. width: 20rpx;
  416. height: 20rpx;
  417. position: absolute;
  418. top: 11px;
  419. right: 5px;
  420. }
  421. }
  422. button {
  423. width: 24%;
  424. font-size: 25rpx;
  425. background: #4988fd;
  426. color: #fff;
  427. margin-left: 25rpx;
  428. }
  429. }
  430. .margin-top-3 {
  431. margin-top: 3%;
  432. }
  433. .active-box {
  434. display: flex;
  435. position: relative;
  436. font-size: 28rpx;
  437. padding: 20rpx;
  438. width: 92%;
  439. margin-left: 1.5%;
  440. margin-bottom: 1%;
  441. box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
  442. .active-header {
  443. display: flex;
  444. width: 100%;
  445. }
  446. .active-type {
  447. width: 100rpx;
  448. height: 100rpx;
  449. border-radius: 50%;
  450. background-color: #ccc;
  451. text-align: center;
  452. display: flex;
  453. align-items: center;
  454. font-size: 26rpx;
  455. color: #fff;
  456. }
  457. .active-content-box{
  458. display: flex;
  459. flex-direction: column;
  460. // margin-left: 20rpx;
  461. }
  462. .active-content-box-img {
  463. display: flex;
  464. justify-content: flex-start;
  465. flex-wrap: wrap;
  466. image {
  467. width: 220rpx;
  468. height: 300rpx;
  469. }
  470. }
  471. .active-content {
  472. display: flex;
  473. align-items: center;
  474. // height: 45rpx;
  475. font-size: 26rpx;
  476. .active-title {
  477. font-size: 28rpx;
  478. margin-right: 10rpx;
  479. font-weight: bold;
  480. }
  481. .active-name {
  482. font-size: 26rpx;
  483. margin-right: 10rpx;
  484. }
  485. .active-date {
  486. color: #ccc;
  487. }
  488. }
  489. .edit-icon-box {
  490. position: absolute;
  491. right: 10px;
  492. top: 10px;
  493. image {
  494. width: 35rpx;
  495. height: 35rpx;
  496. margin-right: 10rpx;
  497. }
  498. }
  499. .bg-yellow {
  500. background-color: #ffdd40;
  501. }
  502. .bg-red {
  503. background-color: #ec808d;
  504. }
  505. .bg-blue {
  506. background-color: #81d3f8;
  507. }
  508. }
  509. .marginB40 {
  510. margin-bottom: 80rpx;
  511. }
  512. .marginR5{
  513. margin-right: 5rpx;
  514. }
  515. .footer-box-record{
  516. position: fixed;
  517. bottom: 0;
  518. background-color:#f59a23;
  519. width: 100%;
  520. border-radius: 0;
  521. color: #fff;
  522. font-size: 32rpx;
  523. }
  524. .img-container{
  525. display: flex;
  526. flex-direction: column;
  527. width: 90%;
  528. margin: 3% auto;
  529. font-size: 26rpx;
  530. label {
  531. width: 20%;
  532. margin-left: 2%;
  533. margin-bottom: 2%;
  534. }
  535. .note-image-box{
  536. width: 75%;
  537. display: flex;
  538. flex-wrap: wrap;
  539. .note-image-item{
  540. position: relative;
  541. //这两个百分比很关键
  542. width: 33.33%;
  543. height: 0;
  544. padding-top: 33.33%;
  545. box-sizing: border-box;
  546. .close-icon{
  547. display: flex;
  548. justify-content: center;
  549. align-items: center;
  550. position: absolute;
  551. right: 0;
  552. top: 0;
  553. width: 22px;
  554. height: 22px;
  555. border-radius: 50%;
  556. background-color: #d5d5d5;
  557. z-index: 2;
  558. }
  559. .image-box{
  560. display: flex;
  561. justify-content: center;
  562. align-items: center;
  563. position: absolute;
  564. top: 5px;
  565. right: 5px;
  566. bottom: 5px;
  567. left: 5px;
  568. border: 1px #eee solid;
  569. border-radius: 5px;
  570. overflow: hidden;
  571. image{
  572. width: 100%;
  573. height: 100%;
  574. }
  575. }
  576. }
  577. }
  578. }
  579. </style>