list.vue 9.8 KB

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