versionInstr.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <div class="version_instr">
  3. <div class="version_head">
  4. <div class="version_title">
  5. <img src="../assets/version.png" alt="">
  6. <div style="font-size: 14px;">{{ message }}</div>
  7. </div>
  8. <div class="versionBtn" @click="handleClick">
  9. <div style="font-size: 14px;">{{ type === '1' ? '查看更新日历' : '返回' }}</div>
  10. <img v-if="type === '1'" src="../assets/date.png" alt="">
  11. </div>
  12. </div>
  13. <div class="version_middle">
  14. <div class="v_m_title">{{ tableData[0].update_title }}</div>
  15. <div class="v_m_instr">{{ tableData[0].update_desc }}</div>
  16. </div>
  17. <div class="version_content">
  18. <div class="version_left">
  19. <div style="font-size: 12px;">{{ tableData[0].update_at }}</div>
  20. <div class="v_l_items">
  21. <div class="v_l_item" v-for="(tag, index) in tagNameArray" :key="index">{{ tag }}</div>
  22. </div>
  23. </div>
  24. <div class="version_right">
  25. <p style="font-size: 18px;margin-bottom: 8px;" v-for="(details, index) in formattedDetails"
  26. :key="index">{{ details }}</p>
  27. </div>
  28. </div>
  29. </div>
  30. </template>
  31. <script>
  32. import { API_CONFIG } from '@/common/apiConfig';
  33. import { mapGetters } from 'vuex';
  34. export default {
  35. name: 'versionInstr',
  36. data() {
  37. return {
  38. message: '版本说明',
  39. type: this.$route.query.type,
  40. id: this.$route.query.id,
  41. tableData: [],
  42. }
  43. },
  44. computed: {
  45. ...mapGetters(["userid"]),
  46. tagNameArray() {
  47. // 将 tagName 字符串转换为数组
  48. return this.tableData[0].tagName ? this.tableData[0].tagName.split(',').map(tag => tag.trim()) : [];
  49. },
  50. formattedDetails() {
  51. // 检查 tableData 是否有数据,并按换行符分割 update_details
  52. return this.tableData[0]?.update_details
  53. ? this.tableData[0].update_details.split('\n')
  54. : [];
  55. }
  56. },
  57. mounted() {
  58. this.getData();
  59. console.log("👉", this.tableData[0]);
  60. },
  61. methods: {
  62. getData() {
  63. let params = [
  64. {
  65. functionName: "getVersionInstr",
  66. uid: this.userid,
  67. id: this.id
  68. }
  69. ];
  70. this.$ajax
  71. .post(API_CONFIG.baseUrl, params)
  72. .then((res) => {
  73. this.tableData = res.data[0];
  74. console.log("👉", this.tableData);
  75. })
  76. .catch((err) => {
  77. console.log(err);
  78. });
  79. },
  80. formatDate(dateString) {
  81. // 将字符串转换为 Date 对象
  82. const date = new Date(dateString);
  83. // 获取年份、月份和日期
  84. const year = date.getFullYear();
  85. const month = date.getMonth() + 1; // 月份从 0 开始,所以要加 1
  86. const day = date.getDate();
  87. // 返回格式化后的字符串
  88. return `${year}年${month}月${day}日`;
  89. },
  90. handleClick() {
  91. if (this.type === 1) {
  92. this.$router.push('/updateDate');
  93. } else {
  94. // 处理返回操作,例如返回到上一个页面
  95. this.$router.go(-1);
  96. }
  97. }
  98. }
  99. }
  100. </script>
  101. <style scoped>
  102. .version_instr {
  103. background-color: #fff;
  104. height: 100%;
  105. }
  106. .version_head {
  107. display: flex;
  108. align-items: center;
  109. border-bottom: 1px solid #E7E7E7;
  110. justify-content: space-between;
  111. height: 54px;
  112. }
  113. .version_title {
  114. display: flex;
  115. margin-left: 23px;
  116. }
  117. .version_title img {
  118. width: 16px;
  119. height: 16px;
  120. margin-right: 7px;
  121. }
  122. .versionBtn {
  123. gap: 5px;
  124. display: flex;
  125. border: 1px solid black;
  126. padding: 11px;
  127. border-radius: 5px;
  128. margin-right: 23px;
  129. cursor: pointer;
  130. }
  131. .version_middle {
  132. border-bottom: 1px solid #E7E7E7;
  133. display: flex;
  134. flex-direction: column;
  135. align-items: center;
  136. padding: 28px;
  137. }
  138. .v_m_title {
  139. font-size: 56px;
  140. }
  141. .v_m_instr {
  142. color: #00000099;
  143. display: -webkit-box;
  144. -webkit-box-orient: vertical;
  145. -webkit-line-clamp: 3;
  146. /* 限制显示的行数 */
  147. overflow: hidden;
  148. text-overflow: ellipsis;
  149. line-height: 31px;
  150. }
  151. .version_content {
  152. display: flex;
  153. margin: 39px 46px;
  154. ;
  155. }
  156. .v_l_items {
  157. display: flex;
  158. gap: 13px;
  159. flex-wrap: wrap;
  160. margin-top: 10px;
  161. }
  162. .v_l_item {
  163. padding: 2px 6px;
  164. background: rgb(240, 244, 255);
  165. color: rgb(51, 112, 255);
  166. border-radius: 4px;
  167. text-align: center;
  168. font-size: 14px;
  169. height: 20px;
  170. line-height: 20px;
  171. white-space: nowrap;
  172. /* 禁止换行 */
  173. overflow: hidden;
  174. /* 超出部分隐藏 */
  175. text-overflow: ellipsis;
  176. cursor: pointer;
  177. max-width: 165px;
  178. }
  179. .version_left {
  180. max-width: 232px;;
  181. }
  182. .version_right {
  183. margin-left: 65px;
  184. }
  185. </style>