picture.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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="focus" 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. focus: false,
  47. }
  48. },
  49. onLoad(options) {
  50. this.sat_sharematerialid = options.id;
  51. this.getDetail();
  52. },
  53. watch: {
  54. showUModal: function (newVale) {
  55. setTimeout(() => {
  56. this.focus = newVale;
  57. }, 300)
  58. }
  59. },
  60. methods: {
  61. getDetail() {
  62. this.$Http.basic({
  63. "id": 20240407094602,
  64. "content": {
  65. "sat_sharematerialid": this.sat_sharematerialid
  66. }
  67. }).then(res => {
  68. console.log("装备资源库详情", res)
  69. if (this.cutoff(res.msg)) return;
  70. res.data.attinfos_pic = res.data.attinfos_pic.map(v => {
  71. v.cover = this.getSpecifiedImage(v.attinfos[0], "compressed")
  72. return v
  73. })
  74. this.detail = res.data;
  75. uni.setNavigationBarTitle({
  76. title: res.data.title
  77. })
  78. })
  79. },
  80. onSend() {
  81. let { CheckEmail } = require("../../utils/basicInspection");
  82. if (!CheckEmail(this.eMail || '')) return this.$refs.uModal.loading = false;
  83. this.$Http.basic({
  84. "id": "20240408154702",
  85. "content": {
  86. "sat_sharematerialid": this.detail.sat_sharematerialid,
  87. "email": this.eMail
  88. }
  89. }).then(res => {
  90. console.log("发送邮件", res)
  91. if (this.cutoff(res.msg, '发送成功')) return this.$refs.uModal.loading = false;
  92. this.showUModal = false;
  93. })
  94. },
  95. previewBook() {
  96. /* const innerAudioContext = uni.createInnerAudioContext();
  97. innerAudioContext.src = 'https://web-ext-storage.dcloud.net.cn/uni-app/ForElise.mp3';
  98. innerAudioContext.autoplay = true;
  99. innerAudioContext.loop = true;
  100. innerAudioContext.play();
  101. this.$Http.innerAudioContext = innerAudioContext; */
  102. let parems = encodeURIComponent(JSON.stringify({
  103. "accesstoken": uni.getStorageSync('userMsg').token,
  104. "id": "20240407140002",
  105. "content": {
  106. "ownertable": "sat_sharematerial",
  107. "ownerid": this.sat_sharematerialid,
  108. "pageSize": "9999",
  109. }
  110. }))
  111. uni.navigateTo({
  112. url: `/pages/picture/index?parems=${parems}&title=${this.detail.title}`,
  113. })
  114. },
  115. previewimg(url) {
  116. viewImage(url)
  117. }
  118. },
  119. }
  120. </script>
  121. <style lang="scss" scoped>
  122. .title {
  123. width: 100vw;
  124. padding: 10px;
  125. font-family: PingFang SC, PingFang SC;
  126. font-weight: 500;
  127. font-size: 14px;
  128. color: #333333;
  129. line-height: 20px;
  130. background: #fff;
  131. font-weight: bold;
  132. box-sizing: border-box;
  133. }
  134. .slot-content {
  135. width: 100%;
  136. text-align: center;
  137. .slot-title {
  138. height: 26px;
  139. font-family: Source Han Sans SC, Source Han Sans SC;
  140. font-weight: bold;
  141. font-size: 18px;
  142. color: #000000;
  143. }
  144. .slot-tips {
  145. line-height: 20px;
  146. font-family: Source Han Sans SC, Source Han Sans SC;
  147. font-size: 14px;
  148. color: #666666;
  149. margin-bottom: 30px;
  150. margin-top: 10px;
  151. }
  152. }
  153. .images {
  154. display: flex;
  155. width: 100vw;
  156. flex-direction: column;
  157. align-items: center;
  158. }
  159. .footer {
  160. position: fixed;
  161. display: flex;
  162. justify-content: space-between;
  163. bottom: 0;
  164. width: 100vw;
  165. height: 65px;
  166. background: #FFFFFF;
  167. box-shadow: 0px -2px 6px 1px rgba(0, 0, 0, 0.16);
  168. border-radius: 0px 0px 0px 0px;
  169. padding: 5px 14px;
  170. box-sizing: border-box;
  171. .but {
  172. display: flex;
  173. align-items: center;
  174. justify-content: center;
  175. width: 168px;
  176. height: 45px;
  177. border-radius: 5px;
  178. box-sizing: border-box;
  179. font-family: PingFang SC, PingFang SC;
  180. font-size: 16px;
  181. }
  182. .sendmail {
  183. background: #FFFFFF;
  184. border: 1px solid #999999;
  185. color: #666666;
  186. }
  187. .book {
  188. background: #C30D23;
  189. color: #FFFFFF;
  190. }
  191. }
  192. </style>