Internship-position.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <view class="flex-common-css iPhone-bottom box-border-box">
  3. <Nav title="实习岗位" leftColor="#fff" bgckgroundBox='transparent' titleColor="#fff"></Nav>
  4. <image class="bg" src="@/static/img/index/sxgw.png" mode=""></image>
  5. <image class="code-img" :src="codeImg" mode="aspectFit"></image>
  6. <image @click="saveImg" class="but-img" src="@/static/img/index/bcdxc.png" mode=""></image>
  7. </view>
  8. </template>
  9. <script>
  10. import {
  11. commonPracticeCode
  12. } from "@/api/common.js"
  13. export default {
  14. components: {},
  15. data() {
  16. return {
  17. codeImg: ''
  18. };
  19. },
  20. onLoad(data) {},
  21. mounted() {
  22. this.commonPracticeCode()
  23. },
  24. methods: {
  25. commonPracticeCode() {
  26. commonPracticeCode().then((res) => {
  27. if (res.code == 1) {
  28. this.codeImg = res.data.url
  29. }
  30. })
  31. },
  32. scrolltolower() {
  33. console.log('触底');
  34. },
  35. saveImg() {
  36. let that = this
  37. //获取授权列表,查看是否授权写入相册权限
  38. uni.getSetting({
  39. success(res) {
  40. if (!res.authSetting['scope.writePhotosAlbum']) {
  41. uni.authorize({
  42. scope: 'scope.writePhotosAlbum',
  43. success() {
  44. that.saveimgtoAlbum(that.codeImg)
  45. }
  46. })
  47. } else {
  48. that.saveimgtoAlbum(that.codeImg)
  49. }
  50. }
  51. })
  52. },
  53. saveimgtoAlbum(imgurl) {
  54. let that = this
  55. uni.chooseImage({
  56. count: 1,
  57. sourceType: ['camera'],
  58. success: function(res) {
  59. uni.saveImageToPhotosAlbum({
  60. filePath: imgurl,
  61. success: function() {
  62. tools.success("保存成功")
  63. }
  64. });
  65. }
  66. });
  67. }
  68. },
  69. }
  70. </script>
  71. <style lang="scss" scoped>
  72. .bg {
  73. width: 100%;
  74. height: 100vh;
  75. position: fixed;
  76. left: 0;
  77. top: 0;
  78. }
  79. .but-img {
  80. width: 670rpx;
  81. height: 88rpx;
  82. position: absolute;
  83. bottom: 56rpx;
  84. left: 40rpx;
  85. }
  86. .code-img {
  87. width: 340rpx;
  88. height: 340rpx;
  89. position: absolute;
  90. top: calc(50vh - (340rpx / 2));
  91. left: 204rpx;
  92. border-radius: 20rpx;
  93. }
  94. </style>