| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- <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.downloadFile({
- url: imgurl,
- success: function(res) {
- uni.showLoading()
- uni.saveImageToPhotosAlbum({
- filePath: res.tempFilePath,
- success: function(data) {
- uni.hideLoading()
- uni.showToast({
- title: '保存成功',
- icon: 'success',
- duration: 1500
- })
- },
- fail: function(err) {
- uni.hideLoading()
- if (err.errMsg === "saveImageToPhotosAlbum:fail auth deny") {
- uni.openSetting({
- success(settingdata) {
- if (settingdata.authSetting[
- 'scope.writePhotosAlbum']) {
- uni.showToast({
- title: '您已授权成功,请重新保存',
- icon: 'success',
- duration: 1500
- })
- } else {
- uni.showToast({
- title: '尚未授权,无法保存',
- icon: 'none',
- duration: 1500
- })
- }
- }
- })
- }
- },
- complete(res) {
- console.log(res);
- }
- })
- }
- })
- }
- },
- }
- </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>
|