detail.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <view>
  3. <view class="content">
  4. <view class="title" v-if="detail.title">
  5. {{ detail.title }}
  6. </view>
  7. <view v-if="detail.content" class="box">
  8. <u-parse :content="detail.content" />
  9. </view>
  10. <view v-if="showAttinfos" class="box">
  11. <view class="top">
  12. <view class="text">
  13. 附件
  14. </view>
  15. <view class="but" hover-class="navigator-hover" @click="showUModal = true">
  16. 发邮箱
  17. </view>
  18. </view>
  19. <view class="list" v-for="item in detail.attinfos" :key="item.attachmentid" @click="previewAttinof(item)"
  20. hover-class="navigator-hover">
  21. {{ item.document }}
  22. </view>
  23. </view>
  24. </view>
  25. <view style="height: 80px;" />
  26. <u-modal :show="showUModal" confirmColor='#C30D23' ref="uModal" showCancelButton :asyncClose="true"
  27. @confirm="onSend" @cancel="showUModal = false">
  28. <view class="slot-content">
  29. <view class="slot-title">
  30. 发送邮件
  31. </view>
  32. <view class="slot-tips">
  33. 文件将以邮件的形式发送到指定邮箱
  34. </view>
  35. <u--input :focus="focus" placeholder="请输入邮箱" v-model="eMail" border="bottom" clearable />
  36. </view>
  37. </u-modal>
  38. <view class="bottom" v-if="detail.readstatus != '已知'">
  39. <view class="but" hover-class="navigator-hover" @click="know">
  40. 确认已知晓公告
  41. </view>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. import { viewMedias, viewFlies, formattedFiles } from "../../utils/settleFiles"
  47. export default {
  48. data() {
  49. return {
  50. sat_noticeid: "",
  51. detail: { readstatus: '已知' },
  52. showAttinfos: false,
  53. showUModal: false,
  54. eMail: "",
  55. focus: false,
  56. }
  57. },
  58. watch: {
  59. showUModal: function (newVale) {
  60. setTimeout(() => {
  61. this.focus = newVale;
  62. }, 300)
  63. }
  64. },
  65. onLoad(options) {
  66. uni.setNavigationBarTitle({
  67. title: this.getApps('资料库', '/packageA/affiche/detail').remark || '企业公告',
  68. });
  69. this.sat_noticeid = options.id;
  70. this.getDetail();
  71. },
  72. methods: {
  73. getDetail() {
  74. this.$Http.basic({
  75. "id": "20221101095003",
  76. "content": {
  77. "sat_noticeid": this.sat_noticeid
  78. }
  79. }).then(res => {
  80. console.log("获取通告详情", res)
  81. if (this.cutoff(res.msg)) return;
  82. res.data.attinfos = formattedFiles(res.data.attinfos)
  83. this.detail = res.data;
  84. this.showAttinfos = res.data.attinfos.length != 0
  85. })
  86. },
  87. onSend() {
  88. let { CheckEmail } = require("../../utils/basicInspection");
  89. if (!CheckEmail(this.eMail || '')) return this.$refs.uModal.loading = false;
  90. this.$Http.basic({
  91. "id": "20240320153302",
  92. "content": {
  93. "sat_noticeid": this.detail.sat_noticeid,
  94. "email": this.eMail
  95. }
  96. }).then(res => {
  97. console.log("发送邮件", res)
  98. if (this.cutoff(res.msg, '发送成功')) return this.$refs.uModal.loading = false;
  99. this.showUModal = false;
  100. })
  101. },
  102. know() {
  103. let that = this;
  104. uni.showModal({
  105. title: '提示',
  106. content: '是否确定已经知晓该公告',
  107. success: ({ confirm }) => {
  108. if (confirm) that.$Http.basic({
  109. "id": "20240320152902",
  110. "content": {
  111. "sat_noticeid": that.sat_noticeid
  112. }
  113. }).then(res => {
  114. if (that.cutoff(res.msg, '确定成功')) return;
  115. that.getDetail();
  116. })
  117. },
  118. })
  119. },
  120. previewAttinof(item) {
  121. if (['image', 'video'].includes(item.fileType)) {
  122. const list = this.detail.attinfos.filter(v => v.fileType == item.fileType),
  123. index = list.findIndex(v => v.attachmentid == item.attachmentid);
  124. viewMedias(list, index, item.fileType)
  125. } else {
  126. viewFlies(item)
  127. }
  128. }
  129. },
  130. }
  131. </script>
  132. <style lang="scss">
  133. .content {
  134. padding: 10px;
  135. box-sizing: border-box;
  136. .title {
  137. width: 100%;
  138. font-family: Source Han Sans SC, Source Han Sans SC;
  139. font-weight: bold;
  140. font-size: 18px;
  141. color: #333333;
  142. text-align: center;
  143. }
  144. .box {
  145. width: 100%;
  146. background: #FFFFFF;
  147. border-radius: 8px;
  148. padding: 10px;
  149. box-sizing: border-box;
  150. margin-top: 10px;
  151. .top {
  152. display: flex;
  153. justify-content: space-between;
  154. .text {
  155. font-family: PingFang SC, PingFang SC;
  156. font-weight: bold;
  157. font-size: 16px;
  158. color: #333333;
  159. }
  160. .but {
  161. width: 66px;
  162. height: 32px;
  163. background: #C30D23;
  164. border-radius: 5px;
  165. margin-top: -3px;
  166. font-family: Source Han Sans SC, Source Han Sans SC;
  167. font-size: 14px;
  168. color: #FFFFFF;
  169. line-height: 32px;
  170. text-align: center;
  171. }
  172. }
  173. }
  174. }
  175. .slot-content {
  176. width: 100%;
  177. text-align: center;
  178. .slot-title {
  179. height: 26px;
  180. font-family: Source Han Sans SC, Source Han Sans SC;
  181. font-weight: bold;
  182. font-size: 18px;
  183. color: #000000;
  184. }
  185. .slot-tips {
  186. line-height: 20px;
  187. font-family: Source Han Sans SC, Source Han Sans SC;
  188. font-size: 14px;
  189. color: #666666;
  190. margin-bottom: 30px;
  191. margin-top: 10px;
  192. }
  193. }
  194. .list {
  195. font-family: Source Han Sans SC, Source Han Sans SC;
  196. font-size: 14px;
  197. color: #095DE0;
  198. line-height: 20px;
  199. margin-top: 10px;
  200. border-radius: 4px;
  201. }
  202. .bottom {
  203. position: fixed;
  204. bottom: 0;
  205. width: 100vw;
  206. height: 65px;
  207. background: #FFFFFF;
  208. box-shadow: 0px -2px 6px 1px rgba(0, 0, 0, 0.16);
  209. .but {
  210. width: 355px;
  211. height: 45px;
  212. line-height: 45px;
  213. background: #C30D23;
  214. border-radius: 5px;
  215. font-family: PingFang SC, PingFang SC;
  216. font-weight: bold;
  217. font-size: 14px;
  218. color: #FFFFFF;
  219. text-align: center;
  220. margin: 6px auto;
  221. }
  222. }
  223. </style>