list.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. <template>
  2. <view class="content">
  3. <view>
  4. <view class="active-title-box">
  5. <view class="header-title">{{activeDesc.name}}</view>
  6. <view style="color: gray;">{{activeDesc.start_time}}</view>
  7. </view>
  8. <view class="active-box" v-for="(item,index) in activiList" :key="index" style="flex-direction: column;" :class="index===activiList.length-1?'marginB40':''">
  9. <view class="active-header">
  10. <!-- <view class="active-type">
  11. <text style="margin: 0 auto;">头像</text>
  12. </view> -->
  13. <view class="active-content-box">
  14. <view class="active-content margin-top-3">
  15. <view class="active-name">{{item.author}}</view>
  16. <!-- <view class="active-date">{{item.addtime}}</view> -->
  17. </view>
  18. <view class="active-content">
  19. <view class="active-date">{{item.addtime}}</view>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="active-content-box">
  24. <view class="active-content">
  25. <view class="active-title">{{item.content}}</view>
  26. </view>
  27. </view>
  28. <view class="active-content-box-img margin-top-3">
  29. <view v-for="(img,indexImg) in item.pic_list" :key="indexImg" class="marginR5">
  30. <image :src="img.pic_url_resize" mode="aspectFill" @click="showLarge(item.pic_list,indexImg)"></image>
  31. </view>
  32. </view>
  33. <view class="margin-top-3" style="color: #007AFF;" @click="tonewurl(item.web_url)" v-if="item.web_url">
  34. {{item.web_url}}
  35. </view>
  36. <view v-if="item.web_url" style="font-size: 24rpx;color: #ccc;">
  37. 点击链接可进行复制,前往浏览器查看。
  38. </view>
  39. <view class="edit-icon-box">
  40. <image src="/static/edit-icon.png" mode="aspectFit" v-if="item.edit_auth" @click="goEditPage(item.id)"></image>
  41. <image src="/static/del-icon.png" mode="aspectFit" v-if="item.del_auth" @click="delProcess(item.id)"></image>
  42. </view>
  43. </view>
  44. <button class="footer-box-record" @click="goRecord()">上传记录</button>
  45. </view>
  46. <share-modal @closeShare="closeShare" :isShowShare="isShowShareModal" :class="{ shareParent: isShowShareModal}"></share-modal>
  47. </view>
  48. </template>
  49. <script>
  50. import md5 from "@/common/md5.js";
  51. import shareModal from '@/components/share-modal/share-modal.vue'
  52. export default {
  53. components: {
  54. "share-modal": shareModal,
  55. },
  56. data() {
  57. return {
  58. isAuth:getApp().globalData.globalAuth,
  59. userHeadImg: getApp().globalData.user_headUrl,
  60. userNickName:getApp().globalData.user_name,
  61. globalUrl:getApp().globalData.shareUrl,
  62. activeId:'',
  63. branchId:'',
  64. recordId:'',
  65. activeDesc:{},
  66. activiList:[],
  67. isShowShareModal:false,
  68. };
  69. },
  70. onLoad(option) {
  71. this.recordId = option.id;
  72. this.readDesc(this.recordId)
  73. //this.readActive(this.recordId)
  74. },
  75. onShow() {
  76. this.readActive(this.recordId)
  77. },
  78. onShareAppMessage() {
  79. return {
  80. title: '农工笔记',
  81. path:'/pages/index/activity/activity'
  82. }
  83. },
  84. methods: {
  85. goEditPage(id){
  86. uni.navigateTo({
  87. url:'./record?id='+ id + '&bId=' + this.branchId + '&aId=' + this.activeId + '&types=edit'
  88. })
  89. },
  90. pageShowShare(obj){
  91. console.log(obj)
  92. this.isShowShareModal = true;
  93. },
  94. closeShare(e){
  95. this.isShowShareModal = false;
  96. },
  97. showLarge(urlList,index) {
  98. let imgList = urlList,imgArr = [];
  99. imgList.forEach((item,index)=>{
  100. imgArr.push(item.pic_url)
  101. })
  102. uni.previewImage({
  103. urls:imgArr,
  104. current:imgArr[index],
  105. longPressActions: {
  106. itemList: ["发送给朋友", "保存图片"],
  107. success: function (data) {},
  108. fail: function (err) {
  109. console.log(err.errMsg);
  110. },
  111. },
  112. });
  113. },
  114. delProcessRequeset(delId){
  115. let md5Sign = md5(
  116. "method=" +"activity" + "&timestamp=" + getApp().globalData.globalTimestamp +
  117. "&secret=" + getApp().globalData.secret
  118. );
  119. let url = getApp().globalData.shareUrl +"api/api.php" +
  120. "?method=activity&action=process_del&timestamp=" +
  121. getApp().globalData.globalTimestamp + "&sign=" + md5Sign;
  122. uni.request({
  123. url: url,
  124. method: "POST",
  125. header: {
  126. "content-type": "application/x-www-form-urlencoded",
  127. },
  128. data: {
  129. openid: getApp().globalData.open_id,
  130. id:delId
  131. },
  132. success: (res) => {
  133. if (res.data.code === 200) {
  134. uni.showToast({
  135. title: "删除成功",
  136. icon: "none",
  137. duration: 2500,
  138. success:()=>{
  139. this.readActive(this.activeId)
  140. }
  141. });
  142. }
  143. },
  144. fail: () => {
  145. console.log("连接失败");
  146. },
  147. });
  148. },
  149. delProcess(id){
  150. let that = this;
  151. uni.showModal({
  152. title: "确定删除此记录吗?",
  153. success(res) {
  154. if (res.confirm) {
  155. that.delProcessRequeset(id);
  156. } else if (res.cancel) {
  157. console.log("用户点击取消");
  158. }
  159. },
  160. });
  161. },
  162. readDesc(id){
  163. let md5Sign = md5(
  164. "method=" +"activity" + "&timestamp=" + getApp().globalData.globalTimestamp +
  165. "&secret=" + getApp().globalData.secret
  166. );
  167. let url = getApp().globalData.shareUrl +"api/api.php" +
  168. "?method=activity&action=info_by_id&timestamp=" +
  169. getApp().globalData.globalTimestamp + "&sign=" + md5Sign;
  170. uni.request({
  171. url: url,
  172. method: "POST",
  173. header: {
  174. "content-type": "application/x-www-form-urlencoded",
  175. },
  176. data: {
  177. openid:getApp().globalData.open_id,
  178. id:id
  179. },
  180. success: (res) => {
  181. if (res.data.code === 200) {
  182. this.activeDesc = res.data.data;
  183. this.branchId = res.data.data.branch_id;
  184. this.activeId = res.data.data.id;
  185. }
  186. },
  187. fail: () => {
  188. console.log("连接失败");
  189. },
  190. });
  191. },
  192. readActive(id){
  193. let md5Sign = md5(
  194. "method=" +"activity" + "&timestamp=" + getApp().globalData.globalTimestamp +
  195. "&secret=" + getApp().globalData.secret
  196. );
  197. let url = getApp().globalData.shareUrl +"api/api.php" +
  198. "?method=activity&action=process_list&timestamp=" +
  199. getApp().globalData.globalTimestamp + "&sign=" + md5Sign;
  200. uni.request({
  201. url: url,
  202. method: "POST",
  203. header: {
  204. "content-type": "application/x-www-form-urlencoded",
  205. },
  206. data: {
  207. openid:getApp().globalData.open_id,
  208. activity_id:id
  209. },
  210. success: (res) => {
  211. if (res.data.code === 200) {
  212. let listArr = res.data.data.list;
  213. listArr.forEach((item)=>{
  214. item.pic_list.forEach((child)=>{
  215. child.pic_url = this.globalUrl + child.pic_url;
  216. child.pic_url_resize = this.globalUrl + child.pic_url_resize;
  217. })
  218. })
  219. this.activiList = listArr;
  220. }
  221. },
  222. fail: () => {
  223. console.log("连接失败");
  224. },
  225. });
  226. },
  227. tonewurl(urls) {
  228. uni.setClipboardData({
  229. data: urls,
  230. success: function (res) {
  231. uni.showToast({
  232. title: '复制成功,请在手机浏览器中打开',
  233. icon:"none"
  234. });
  235. }
  236. })
  237. // uni.navigateTo({
  238. // url:'/pages/index/webview/web-view?url=' + urls
  239. // });
  240. },
  241. goRecord(){
  242. uni.navigateTo({
  243. url:'./record?bId=' + this.branchId + '&aId=' + this.activeId + '&types=add'
  244. })
  245. }
  246. },
  247. };
  248. </script>
  249. <style lang="scss" scoped>
  250. .content {
  251. display: flex;
  252. flex-direction: column;
  253. .self-inf {
  254. // border-radius: 0rpx 0rpx 100% 100%;
  255. .img-name-box {
  256. height: 150rpx;
  257. margin-top: 20rpx;
  258. margin-bottom: 20rpx;
  259. display: flex;
  260. align-items: center;
  261. width: 85%;
  262. .auth-btn {
  263. margin-left: 30rpx;
  264. margin-top: 20rpx;
  265. font-size: 28rpx;
  266. background-color: #02a7f0;
  267. color: #fff;
  268. }
  269. .heade-img {
  270. z-index: 1;
  271. width: 100rpx;
  272. height: 100rpx;
  273. border-radius: 50%;
  274. // margin-left: 80rpx;
  275. }
  276. }
  277. .nickname {
  278. font-weight: 600;
  279. font-size: 28rpx;
  280. margin-left: 30rpx;
  281. margin-top: 20rpx;
  282. color: #555;
  283. letter-spacing: 1rpx;
  284. }
  285. }
  286. }
  287. .org-info-box {
  288. display: flex;
  289. justify-content: space-evenly;
  290. height: 80rpx;
  291. align-items: center;
  292. width: 100%;
  293. border-top: 1px solid #d4d4d4;
  294. color: #555;
  295. font-size: 28rpx;
  296. background: #fff;
  297. }
  298. .org-line {
  299. width: 1px;
  300. height: 82rpx;
  301. background: #d4d4d4;
  302. }
  303. .header-title {
  304. margin-top: 3%;
  305. margin-bottom: 1%;
  306. font-size: 32rpx;
  307. font-weight: bold
  308. }
  309. .active-title-box {
  310. padding-left: 3%;
  311. font-size: 26rpx;
  312. height: 100rpx;
  313. border-bottom: 4px solid #eeeeee;
  314. .time-select-box {
  315. width: 32%;
  316. margin-left: 5%;
  317. }
  318. picker {
  319. width: 25%;
  320. border: 1px solid #d7d7d7;
  321. height: 60rpx;
  322. line-height: 60rpx;
  323. border-radius: 10rpx;
  324. margin-left: 20rpx;
  325. padding: 0 10rpx;
  326. position: relative;
  327. image {
  328. width: 20rpx;
  329. height: 20rpx;
  330. position: absolute;
  331. top: 11px;
  332. right: 5px;
  333. }
  334. }
  335. button {
  336. width: 24%;
  337. font-size: 25rpx;
  338. background: #4988fd;
  339. color: #fff;
  340. margin-left: 25rpx;
  341. }
  342. }
  343. .margin-top-3 {
  344. margin-top: 3%;
  345. }
  346. .active-box {
  347. display: flex;
  348. position: relative;
  349. font-size: 28rpx;
  350. padding: 20rpx;
  351. width: 92%;
  352. margin-left: 1.5%;
  353. margin-bottom: 1%;
  354. box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
  355. .active-header {
  356. display: flex;
  357. width: 100%;
  358. }
  359. .active-type {
  360. width: 100rpx;
  361. height: 100rpx;
  362. border-radius: 50%;
  363. background-color: #ccc;
  364. text-align: center;
  365. display: flex;
  366. align-items: center;
  367. font-size: 26rpx;
  368. color: #fff;
  369. }
  370. .active-content-box{
  371. display: flex;
  372. flex-direction: column;
  373. // margin-left: 20rpx;
  374. }
  375. .active-content-box-img {
  376. display: flex;
  377. justify-content: flex-start;
  378. flex-wrap: wrap;
  379. image {
  380. width: 220rpx;
  381. height: 300rpx;
  382. }
  383. }
  384. .active-content {
  385. display: flex;
  386. align-items: center;
  387. // height: 45rpx;
  388. font-size: 26rpx;
  389. .active-title {
  390. font-size: 28rpx;
  391. margin-right: 10rpx;
  392. font-weight: bold;
  393. }
  394. .active-name {
  395. font-size: 26rpx;
  396. margin-right: 10rpx;
  397. }
  398. .active-date {
  399. color: #ccc;
  400. }
  401. }
  402. .edit-icon-box {
  403. position: absolute;
  404. right: 10px;
  405. top: 10px;
  406. image {
  407. width: 35rpx;
  408. height: 35rpx;
  409. margin-right: 10rpx;
  410. }
  411. }
  412. .bg-yellow {
  413. background-color: #ffdd40;
  414. }
  415. .bg-red {
  416. background-color: #ec808d;
  417. }
  418. .bg-blue {
  419. background-color: #81d3f8;
  420. }
  421. }
  422. .marginB40 {
  423. margin-bottom: 80rpx;
  424. }
  425. .marginR5{
  426. margin-right: 5rpx;
  427. }
  428. .footer-box-record{
  429. position: fixed;
  430. bottom: 0;
  431. background-color:#f59a23;
  432. width: 100%;
  433. border-radius: 0;
  434. color: #fff;
  435. font-size: 32rpx;
  436. }
  437. </style>