record.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <view class="content">
  3. <view class="details" v-for="item in pageList" :key="item.id">
  4. <view class="view">
  5. <!-- <span class="label">发布时间:</span> -->
  6. <span style="width: 80%;color: darkgray;">{{ item.publishTime }}</span>
  7. </view>
  8. <view class="view">
  9. <!-- <span class="label">详情:</span> -->
  10. <span>{{ item.content }}</span>
  11. </view>
  12. <view class="view">
  13. <!-- <span class="label">图片:</span> -->
  14. <view class="flex-box">
  15. <view v-if="imageList.length == 0">-</view>
  16. <image :src="item.url" v-for="item in imageList" :key="item.id" mode="aspectFit" @click="showlarge(item.url)"/>
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. import md5 from "@/common/md5.js";
  24. export default {
  25. data() {
  26. return {
  27. id: "",
  28. details: "",
  29. imageList: [],
  30. time: "",
  31. pageList:[
  32. {
  33. id:'1',
  34. content:'从现在起直到21世纪中叶的30年,将有可能成为“人类命运共同体”在世界范围逐步实现的关键阶段。随着“人类命运共同体”在世界范围逐步成为现实,大国关系包含中美关系经过种种曲折,逐步转化到一个相互尊重、平等相待、和平共处、合作共赢的轨道上来,这才是人心所向',
  35. imgList:[],
  36. publishTime:'2021.12.25 14:15:00'
  37. },
  38. {
  39. id:'2',
  40. content:'从现在起直到21世纪中叶的30年,将有可能成为“人类命运共同体”在世界范围逐步实现的关键阶段。随着“人类命运共同体”在世界范围逐步成为现实,大国关系包含中美关系经过种种曲折,逐步转化到一个相互尊重、平等相待、和平共处、合作共赢的轨道上来,这才是人心所向',
  41. imgList:[],
  42. publishTime:'2021.12.26 12:11:00'
  43. },
  44. {
  45. id:'3',
  46. content:'从现在起直到21世纪中叶的30年,将有可能成为“人类命运共同体”在世界范围逐步实现的关键阶段。随着“人类命运共同体”在世界范围逐步成为现实,大国关系包含中美关系经过种种曲折,逐步转化到一个相互尊重、平等相待、和平共处、合作共赢的轨道上来,这才是人心所向',
  47. imgList:[],
  48. publishTime:'2021.12.27 13:35:00'
  49. },
  50. ]
  51. };
  52. },
  53. onLoad() {
  54. this.getRecordList();
  55. },
  56. methods: {
  57. showlarge(src){
  58. uni.previewImage({
  59. urls: [src],
  60. longPressActions: {
  61. itemList: ["发送给朋友", "保存图片"],
  62. success: function (data) {},
  63. fail: function (err) {
  64. console.log(err.errMsg);
  65. },
  66. },
  67. });
  68. },
  69. getRecordList() {
  70. let md5Sign = md5(
  71. "method=" +
  72. "activity" +
  73. "&timestamp=" +
  74. getApp().globalData.globalTimestamp +
  75. "&secret=" +
  76. getApp().globalData.secret
  77. );
  78. let url =
  79. getApp().globalData.shareUrl +
  80. "api/api.php" +
  81. "?method=activity&action=my_process&timestamp=" +
  82. getApp().globalData.globalTimestamp +
  83. "&sign=" +
  84. md5Sign;
  85. let postData = {
  86. // id: this.id,
  87. openid : getApp().globalData.open_id,
  88. };
  89. //获取文章
  90. uni.request({
  91. url: url,
  92. method: "POST",
  93. header: {
  94. "content-type": "application/x-www-form-urlencoded",
  95. },
  96. data: postData,
  97. success: (res) => {
  98. console.log(res.data.data);
  99. if (res.data.code === 200) {
  100. let data = res.data.data;
  101. this.details = data.content;
  102. this.title = data.title;
  103. let time = this.$options.filters["globalTime"](data.addtime);
  104. let timeSecond = this.$options.filters["globalTimeSecond"](
  105. data.addtime
  106. );
  107. this.time = time + " " + timeSecond;
  108. this.info.name = data.company_name;
  109. this.info.code = data.company_code;
  110. this.info.tel = data.phone;
  111. this.imageList = data.attach_list.map((item) => {
  112. item.url = getApp().globalData.shareUrl + item.url;
  113. return item;
  114. });
  115. }
  116. },
  117. fail: () => {
  118. console.log("连接失败");
  119. },
  120. });
  121. },
  122. },
  123. };
  124. </script>
  125. <style lang="scss" scoped>
  126. .flex-box {
  127. display: flex;
  128. }
  129. .view {
  130. display: flex;
  131. }
  132. .content {
  133. font-size: 32rpx;
  134. .title {
  135. margin: 4% 5%;
  136. }
  137. .details {
  138. font-size: 28rpx;
  139. width: 90%;
  140. margin: 0 2%;
  141. padding: 2% 3%;
  142. border-bottom: 1px solid #f2f2f2;
  143. // border-radius: 50rpx;
  144. // box-shadow: rgba(100, 100, 111, 0.2) 0rpx 14rpx 50rpx 14rpx;
  145. image {
  146. width: 180rpx;
  147. height: 150rpx;
  148. border-radius: 30rpx;
  149. margin: 0 2%;
  150. }
  151. .view {
  152. margin: 2% 0;
  153. }
  154. .label {
  155. display: inline-block;
  156. width:150rpx;
  157. vertical-align: middle;
  158. margin-right: 10rpx;
  159. }
  160. }
  161. .info {
  162. font-size: 28rpx;
  163. width: 90%;
  164. margin: 4% 2%;
  165. padding: 2% 3%;
  166. border-radius: 40rpx;
  167. box-shadow: rgba(100, 100, 111, 0.2) 0rpx 14rpx 50rpx 14rpx;
  168. .title {
  169. margin: 4% 0;
  170. font-size: 32rpx;
  171. }
  172. .view {
  173. display: flex;
  174. align-items: center;
  175. margin: 5% 0;
  176. }
  177. .label {
  178. display: inline-block;
  179. width: 150rpx;
  180. vertical-align: middle;
  181. margin-right: 10rpx;
  182. }
  183. }
  184. }
  185. </style>