index.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <view class="container">
  3. <navBar title="图片预览" :back="true" color="#333333" background="#FFFFFF" />
  4. <!-- <web-view :src="url1"></web-view> -->
  5. <image :src="url1" mode="widthFix" show-menu-by-longpress></image>
  6. <!-- <u-modal :show="show" title="温馨提示" confirmText="我知道了" content="" @confirm="confirm">
  7. <view class="slot-content">
  8. 如要保存,请长按图片以保存至手机相册
  9. </view>
  10. </u-modal> -->
  11. <view class="btnBox">
  12. <view class="btn" @click="toSave">
  13. 保存到手机相册
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. // import navBar from '@/components/navBar/index.vue'
  20. // import {
  21. // getKefu,
  22. // } from '@/api/index/index.js'
  23. export default {
  24. // components: {
  25. // navBar
  26. // },
  27. data() {
  28. return {
  29. url1: '',
  30. show: false
  31. }
  32. },
  33. onLoad(o) {
  34. // this.getabout()
  35. this.url1 = o.url
  36. setTimeout(() => {
  37. this.show = true
  38. }, 1000)
  39. },
  40. methods: {
  41. toSave() {
  42. wx.showShareImageMenu({
  43. path: this.url1,
  44. success: (r) => {
  45. console.log('r--------------', r);
  46. uni.showToast({
  47. title: '操作成功',
  48. icon: 'success'
  49. })
  50. }
  51. })
  52. // wx.saveImageToPhotosAlbum({
  53. // filePath: this.url1,
  54. // success: (res) => {
  55. // wx.showToast({
  56. // title: '保存成功',
  57. // icon: 'success'
  58. // })
  59. // }
  60. // })
  61. },
  62. confirm() {
  63. this.show = false
  64. },
  65. // async getabout() {
  66. // let res1 = await getKefu()
  67. // console.log('关于我们返回值--------2', res1);
  68. // if (res1.code == 0) {
  69. // this.content = res1.data.about.value
  70. // } else {
  71. // this.$toast(res1.message)
  72. // }
  73. // },
  74. // toProtocol(type) {
  75. // uni.navigateTo({
  76. // url: '/pages/my/protocol/index?type=' + type
  77. // })
  78. // }
  79. }
  80. }
  81. </script>
  82. <style lang="scss" scoped>
  83. @import "./index.scss";
  84. </style>