picture.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <view>
  3. <view class="title">{{ detail.title }}</view>
  4. <view class="images">
  5. <u--image @click="previewimg(item.attinfos[0].url)" v-for="item in detail.attinfos_pic" :key="item.attachmentid"
  6. :src="item.cover" :fade="true" duration="450" :lazy-load="true" mode="widthFix" :width="tovw(355)"
  7. :height="'none'">
  8. <template v-slot:loading>
  9. <u-loading-icon color="red" />
  10. </template>
  11. </u--image>
  12. </view>
  13. <view style="height: 80px;" />
  14. <view class="footer">
  15. <view v-if="detail.candownload_c" class="sendmail but" hover-class="navigator-hover" @click="showUModal = true">
  16. 发送邮箱
  17. </view>
  18. <view class="book but" @click="previewBook" :style="{ width: detail.candownload_c ? '168px' : '100%' }"
  19. hover-class="navigator-hover">
  20. 查看电子书
  21. </view>
  22. </view>
  23. <u-modal :show="showUModal" confirmColor='#C30D23' ref="uModal" showCancelButton :asyncClose="true"
  24. @confirm="onSend" @cancel="showUModal = false">
  25. <view class="slot-content">
  26. <view class="slot-title">
  27. 发送邮件
  28. </view>
  29. <view class="slot-tips">
  30. 文件将以邮件的形式发送到指定邮箱
  31. </view>
  32. <u--input :focus="showUModal" placeholder="请输入邮箱" v-model="eMail" border="bottom" clearable />
  33. </view>
  34. </u-modal>
  35. </view>
  36. </template>
  37. <script>
  38. import { viewImage } from "../../utils/settleFiles";
  39. export default {
  40. data() {
  41. return {
  42. sat_sharematerialid: 0,
  43. showUModal: false,
  44. eMail: "",
  45. detail: {}
  46. }
  47. },
  48. onLoad(options) {
  49. this.sat_sharematerialid = options.id;
  50. this.getDetail();
  51. },
  52. methods: {
  53. getDetail() {
  54. this.$Http.basic({
  55. "id": 20240407094602,
  56. "content": {
  57. "sat_sharematerialid": this.sat_sharematerialid
  58. }
  59. }).then(res => {
  60. console.log("装备资源库详情", res)
  61. if (this.cutoff(res.msg)) return;
  62. res.data.attinfos_pic = res.data.attinfos_pic.map(v => {
  63. v.cover = this.getSpecifiedImage(v.attinfos[0], "compressed")
  64. return v
  65. })
  66. this.detail = res.data;
  67. uni.setNavigationBarTitle({
  68. title: res.data.title
  69. })
  70. })
  71. },
  72. onSend() {
  73. let { CheckEmail } = require("../../utils/basicInspection");
  74. if (!CheckEmail(this.eMail || '')) return this.$refs.uModal.loading = false;
  75. this.$Http.basic({
  76. "id": "20240408154702",
  77. "content": {
  78. "sat_sharematerialid": this.detail.sat_sharematerialid,
  79. "email": this.eMail
  80. }
  81. }).then(res => {
  82. console.log("发送邮件", res)
  83. if (this.cutoff(res.msg, '发送成功')) return this.$refs.uModal.loading = false;
  84. this.showUModal = false;
  85. })
  86. },
  87. previewBook() {
  88. /* const innerAudioContext = uni.createInnerAudioContext();
  89. innerAudioContext.src = 'https://web-ext-storage.dcloud.net.cn/uni-app/ForElise.mp3';
  90. innerAudioContext.autoplay = true;
  91. innerAudioContext.loop = true;
  92. innerAudioContext.play();
  93. this.$Http.innerAudioContext = innerAudioContext; */
  94. let parems = encodeURIComponent(JSON.stringify({
  95. "accesstoken": uni.getStorageSync('userMsg').token,
  96. "id": "20240407140002",
  97. "content": {
  98. "ownertable": "sat_sharematerial",
  99. "ownerid": this.sat_sharematerialid,
  100. "pageSize": "9999",
  101. }
  102. }))
  103. uni.navigateTo({
  104. url: `/pages/picture/index?parems=${parems}&title=${this.detail.title}`,
  105. })
  106. },
  107. previewimg(url) {
  108. viewImage(url)
  109. }
  110. },
  111. }
  112. </script>
  113. <style lang="scss" scoped>
  114. .title {
  115. width: 100vw;
  116. padding: 10px;
  117. font-family: PingFang SC, PingFang SC;
  118. font-weight: 500;
  119. font-size: 14px;
  120. color: #333333;
  121. line-height: 20px;
  122. background: #fff;
  123. font-weight: bold;
  124. box-sizing: border-box;
  125. }
  126. .slot-content {
  127. width: 100%;
  128. text-align: center;
  129. .slot-title {
  130. height: 26px;
  131. font-family: Source Han Sans SC, Source Han Sans SC;
  132. font-weight: bold;
  133. font-size: 18px;
  134. color: #000000;
  135. }
  136. .slot-tips {
  137. line-height: 20px;
  138. font-family: Source Han Sans SC, Source Han Sans SC;
  139. font-size: 14px;
  140. color: #666666;
  141. margin-bottom: 30px;
  142. margin-top: 10px;
  143. }
  144. }
  145. .images {
  146. display: flex;
  147. width: 100vw;
  148. flex-direction: column;
  149. align-items: center;
  150. }
  151. .footer {
  152. position: fixed;
  153. display: flex;
  154. justify-content: space-between;
  155. bottom: 0;
  156. width: 100vw;
  157. height: 65px;
  158. background: #FFFFFF;
  159. box-shadow: 0px -2px 6px 1px rgba(0, 0, 0, 0.16);
  160. border-radius: 0px 0px 0px 0px;
  161. padding: 5px 14px;
  162. box-sizing: border-box;
  163. .but {
  164. display: flex;
  165. align-items: center;
  166. justify-content: center;
  167. width: 168px;
  168. height: 45px;
  169. border-radius: 5px;
  170. box-sizing: border-box;
  171. font-family: PingFang SC, PingFang SC;
  172. font-size: 16px;
  173. }
  174. .sendmail {
  175. background: #FFFFFF;
  176. border: 1px solid #999999;
  177. color: #666666;
  178. }
  179. .book {
  180. background: #C30D23;
  181. color: #FFFFFF;
  182. }
  183. }
  184. </style>