开启cdn,导致二维码生成失败,需要在阿里云cdn 添加自定义头

pull/5/head
youngS 4 years ago
parent c8465522f0
commit a5388cb9e7
  1. 35
      fir_client/src/components/FirAppInfosBase.vue
  2. 2
      fir_client/src/utils/index.js
  3. 4
      fir_ser/fir_ser/settings.py

@ -4,7 +4,7 @@
<div class="banner"> <div class="banner">
<div class="middle-wrapper"> <div class="middle-wrapper">
<div @click="defaulttimeline"> <div @click="defaulttimeline">
<img :src="icon_url" class="appicon" style="width:100px; height:100px"> <img ref="icon_url" :src="icon_url" class="appicon" style="width:100px; height:100px" alt="">
</div> </div>
<div class="badges"> <div class="badges">
<span class="bundleid">SHORT<b class="short">&nbsp;&nbsp;{{ appinfos.short }}</b></span> <span class="bundleid">SHORT<b class="short">&nbsp;&nbsp;{{ appinfos.short }}</b></span>
@ -19,7 +19,7 @@
width="288"> width="288">
<div style="text-align: center; margin: 0"> <div style="text-align: center; margin: 0">
<vue-qr :margin="qrinfo.margin" <vue-qr :margin="qrinfo.margin"
:logoSrc="b64_icon_url" :logoScale="qrinfo.logoScale" :logoSrc="icon_url" :logoScale="qrinfo.logoScale"
:logoCornerRadius="qrinfo.logoCornerRadius" :logoCornerRadius="qrinfo.logoCornerRadius"
:correctLevel="qrinfo.correctLevel" :correctLevel="qrinfo.correctLevel"
:text="short_url()" :size="266" :text="short_url()" :size="266"
@ -94,7 +94,6 @@
<script> <script>
import {apputils} from "../restful"; import {apputils} from "../restful";
import VueQr from 'vue-qr'; import VueQr from 'vue-qr';
import {ImgToBase64} from "../utils"
export default { export default {
name: "FirAppInfosBase", name: "FirAppInfosBase",
@ -103,19 +102,6 @@
}, },
data() { data() {
return { return {
save_qr() {
let dtype = "I";
if (this.master_release.release_type === 0) {
dtype = "A";
}
let a = document.createElement('a');
//
a.download = this.appinfos.name + '_' + dtype + "_下载码";
//url
a.href = this.$refs.qr.$el.src;
//
a.dispatchEvent(new MouseEvent('click'))
},
qrinfo: { qrinfo: {
logoScale: 0.3, logoScale: 0.3,
logoCornerRadius: 12, logoCornerRadius: 12,
@ -123,7 +109,6 @@
margin: 20 margin: 20
}, },
icon_url: "", icon_url: "",
b64_icon_url: '',
appinfos: {}, appinfos: {},
master_release: {}, master_release: {},
allapp: [], allapp: [],
@ -133,6 +118,19 @@
} }
}, },
methods: { methods: {
save_qr() {
let dtype = "I";
if (this.master_release.release_type === 0) {
dtype = "A";
}
let a = document.createElement('a');
//
a.download = this.appinfos.name + '_' + dtype + "_下载码";
//url
a.href = this.$refs.qr.$el.src;
//
a.dispatchEvent(new MouseEvent('click'))
},
short_url() { short_url() {
return location.origin + '/' + this.appinfos.short; return location.origin + '/' + this.appinfos.short;
}, },
@ -186,9 +184,6 @@
}, },
set_icon_url() { set_icon_url() {
this.icon_url = this.$store.state.currentapp.master_release.icon_url; this.icon_url = this.$store.state.currentapp.master_release.icon_url;
ImgToBase64(this.icon_url, dataURL => {
this.b64_icon_url = dataURL;
})
}, },
}, created() { }, created() {

@ -276,7 +276,7 @@ export function ImgToBase64(url, callback) {
let Img = new Image(), let Img = new Image(),
dataURL = ''; dataURL = '';
Img.src = url + '?v=' + Math.random(); Img.src = url + '?v=' + Math.random();
Img.setAttribute('crossOrigin', 'Anonymous'); Img.crossOrigin = 'Anonymous';
Img.onload = function () { Img.onload = function () {
let canvas = document.createElement('canvas'), let canvas = document.createElement('canvas'),
width = Img.width, width = Img.width,

@ -196,7 +196,9 @@ THIRD_PART_CONFIG = {
'name': 'local', 'name': 'local',
'type': 0, 'type': 0,
'auth': { 'auth': {
'domain_name': 'app.hehelucky.cn', # 正式环境需要填写正式的访问域名,如果配置cdn,可以填写cdn的域名,仅支持阿里云 cdn 'domain_name': 'app.hehelucky.cn',
# 正式环境需要填写正式的访问域名,如果配置cdn,可以填写cdn的域名,仅支持阿里云 cdn,
# 开启cdn之后,如果该域名和服务器域名不相同,需要设置阿里云cdn 缓存配置,自定义HTTP响应头 添加 Access-Control-Allow-Origin * 才可以
'is_https': True, 'is_https': True,
'download_auth_type': 0, # 0:不开启token 1:本地token 2:cdn 开启cdn,并且使用本地存储,使用阿里云cdn进行url鉴权, 'download_auth_type': 0, # 0:不开启token 1:本地token 2:cdn 开启cdn,并且使用本地存储,使用阿里云cdn进行url鉴权,
'cnd_auth_key': '', # 当cdn为阿里云并且 download_auth_type=2 的时候 生效,需要 开启阿里云OSS私有Bucket回源 'cnd_auth_key': '', # 当cdn为阿里云并且 download_auth_type=2 的时候 生效,需要 开启阿里云OSS私有Bucket回源

Loading…
Cancel
Save