| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <template>
- <view class="flex-common-css iPhone-bottom box-border-box">
- <Nav title="实习岗位" leftColor="#fff" bgckgroundBox='transparent' titleColor="#fff"></Nav>
- <image class="bg" src="@/static/img/index/sxgw.png" mode=""></image>
- <image class="code-img" :src="codeImg" mode="aspectFit"></image>
- <image @click="saveImg" class="but-img" src="@/static/img/index/bcdxc.png" mode=""></image>
- </view>
- </template>
- <script>
- import {
- commonPracticeCode
- } from "@/api/common.js"
- export default {
- components: {},
- data() {
- return {
- codeImg: ''
- };
- },
- onLoad(data) {},
- mounted() {
- this.commonPracticeCode()
- },
- methods: {
- commonPracticeCode() {
- commonPracticeCode().then((res) => {
- if (res.code == 1) {
- this.codeImg = res.data.url
- }
- })
- },
- scrolltolower() {
- console.log('触底');
- },
- saveImg() {
- let that = this
- //获取授权列表,查看是否授权写入相册权限
- uni.getSetting({
- success(res) {
- if (!res.authSetting['scope.writePhotosAlbum']) {
- uni.authorize({
- scope: 'scope.writePhotosAlbum',
- success() {
- that.saveimgtoAlbum(that.codeImg)
- }
- })
- } else {
- that.saveimgtoAlbum(that.codeImg)
- }
- }
- })
- },
- saveimgtoAlbum(imgurl) {
- let that = this
- uni.chooseImage({
- count: 1,
- sourceType: ['camera'],
- success: function(res) {
- uni.saveImageToPhotosAlbum({
- filePath: imgurl,
- success: function() {
- tools.success("保存成功")
- }
- });
- }
- });
- }
- },
- }
- </script>
- <style lang="scss" scoped>
- .bg {
- width: 100%;
- height: 100vh;
- position: fixed;
- left: 0;
- top: 0;
- }
- .but-img {
- width: 670rpx;
- height: 88rpx;
- position: absolute;
- bottom: 56rpx;
- left: 40rpx;
- }
- .code-img {
- width: 340rpx;
- height: 340rpx;
- position: absolute;
- top: calc(50vh - (340rpx / 2));
- left: 204rpx;
- border-radius: 20rpx;
- }
- </style>
|