doctorQr.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <view class="content">
  3. <view class="item">
  4. <image style="width: 222rpx;height: 144rpx;" mode="aspectFit" src="../static/images/no_data.png"></image>
  5. <view>暂无咨询</view>
  6. <!-- <image mode="aspectFit" :show-menu-by-longpress="true" :src="urls[0]" ></image> -->
  7. <!-- <view class="btn" @click="savePhoto()">
  8. 保存本地
  9. </view> -->
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. export default {
  15. data() {
  16. return {
  17. urls:['https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20221119/61b277f036444bdebf6be3e9626b272c.jpg']
  18. };
  19. },
  20. onLoad(option) {
  21. },
  22. onShow() {
  23. },
  24. methods: {
  25. savePhoto(){
  26. var that=this;
  27. uni.downloadFile({ //下载文件资源到本地,返回文件的本地临时路径
  28. url: that.urls[0], //网络图片路径
  29. success:(res)=>{
  30. var imageUrl=res.tempFilePath;//临时文件路径
  31. uni.saveImageToPhotosAlbum({ //保存图片到系统相册
  32. filePath: imageUrl,
  33. success: (res) => {
  34. console.log('图片保存成功');
  35. },
  36. fail: (err) => {
  37. console.log('图片保存失败');
  38. }
  39. })
  40. }
  41. })
  42. },
  43. showImg() {
  44. //预览图片
  45. uni.previewImage({
  46. urls: this.urls,
  47. current: this.urls[0],
  48. // 长按图片显示操作菜单,如不填默认为保存相册
  49. longPressActions:{
  50. itemList:[]
  51. }
  52. });
  53. },
  54. }
  55. }
  56. </script>
  57. <style lang="scss">
  58. .content{
  59. height: 100%;
  60. width: 100%;
  61. display: flex;
  62. align-items: center;
  63. justify-content: center;
  64. .item{
  65. display: flex;
  66. flex-direction: column;
  67. align-items: center;
  68. justify-content: center;
  69. width: 100vw;
  70. height: 100vh;
  71. image{
  72. width: 100%;
  73. height:100%;
  74. }
  75. .btn{
  76. margin-top: 30rpx;
  77. background-image: linear-gradient(#ff4545,red);
  78. padding: 30rpx 60rpx;
  79. border-radius: 60rpx;
  80. background-color: red;
  81. color: #fff;
  82. font-size: 30rpx;
  83. font-family: 'PingFangTC-Regular';
  84. font-weight: 600;
  85. }
  86. }
  87. }
  88. </style>