diff --git a/fir_client/src/components/FirAppInfosBase.vue b/fir_client/src/components/FirAppInfosBase.vue index d1846bd..8ef5d0c 100644 --- a/fir_client/src/components/FirAppInfosBase.vue +++ b/fir_client/src/components/FirAppInfosBase.vue @@ -146,8 +146,14 @@ } }, appDownload() { - window.open(location.origin + '/' + this.appinfos.short, 'target', ''); - // this.$router.push({name: 'FirDownload', params: {short: this.appinfos.short}}) + let routeData = this.$router.resolve({name: 'FirDownload', params: {short: this.appinfos.short}}); + // window.open(routeData.href, '_blank'); + let p_url = routeData.href; + // let p_url = location.origin + '/' + this.appinfos.short; + if (this.appinfos.preview_url && this.appinfos.preview_url.length > 6) { + p_url = this.appinfos.preview_url + p_url + } + window.open(p_url, 'target', ''); }, defaulttimeline() { this.setfunactive('timeline', 5); diff --git a/fir_client/src/components/FirAppInfostimeline.vue b/fir_client/src/components/FirAppInfostimeline.vue index f21b914..571afed 100644 --- a/fir_client/src/components/FirAppInfostimeline.vue +++ b/fir_client/src/components/FirAppInfostimeline.vue @@ -148,11 +148,16 @@ }) }, previewRelase(app) { - this.$router.push({ + let routeData = this.$router.resolve({ name: 'FirDownload', params: {short: this.currentapp.short}, query: {release_id: app.release_id} - }) + }); + let p_url = routeData.href; + if (this.currentapp.preview_url && this.currentapp.preview_url.length > 6) { + p_url = this.currentapp.preview_url + p_url + } + window.open(p_url, 'target', ''); }, getapptimelineFun() { diff --git a/fir_client/src/components/FirApps.vue b/fir_client/src/components/FirApps.vue index 7ad05b9..1900c4e 100644 --- a/fir_client/src/components/FirApps.vue +++ b/fir_client/src/components/FirApps.vue @@ -375,7 +375,7 @@ 管理 - + 预览 @@ -736,7 +736,13 @@ this.$router.push({name: 'FirAppInfostimeline', params: {id: app.app_id}}) }, appDownload(app) { - this.$router.push({name: 'FirDownload', params: {short: app.short}}) + // this.$router.push({name: 'FirDownload', params: {short: app.short}}); + let routeData = this.$router.resolve({name: 'FirDownload', params: {short: app.short}}); + let p_url = routeData.href; + if (app.preview_url && app.preview_url.length > 6) { + p_url = app.preview_url + p_url + } + window.open(p_url, 'target', ''); } }, computed: { getDelappTitle() { diff --git a/fir_client/src/components/FirDownload.vue b/fir_client/src/components/FirDownload.vue index 51860c9..49666e0 100644 --- a/fir_client/src/components/FirDownload.vue +++ b/fir_client/src/components/FirDownload.vue @@ -343,7 +343,10 @@ } }, getDownloadTokenFun() { - let params = {"short": this.$route.params.short, "time": new Date().getTime()}; + let params = { + "short": this.$route.params.short, + "time": new Date().getTime() + }; if (this.$route.query.release_id) { params["release_id"] = this.$route.query.release_id } diff --git a/fir_client/src/components/ShortDownload.vue b/fir_client/src/components/ShortDownload.vue index 9a5db39..9d405a3 100644 --- a/fir_client/src/components/ShortDownload.vue +++ b/fir_client/src/components/ShortDownload.vue @@ -337,7 +337,10 @@ } }, getDownloadTokenFun() { - let params = {"short": this.$route.params.short, "time": new Date().getTime()}; + let params = { + "short": this.$route.params.short, + "time": new Date().getTime() + }; if (this.$route.query.release_id) { params["release_id"] = this.$route.query.release_id } diff --git a/fir_ser/api/utils/serializer.py b/fir_ser/api/utils/serializer.py index f2bf5c9..b59eab7 100644 --- a/fir_ser/api/utils/serializer.py +++ b/fir_ser/api/utils/serializer.py @@ -39,6 +39,18 @@ class AppsSerializer(serializers.ModelSerializer): obj.has_combo.has_combo = None return AppsSerializer(obj.has_combo, context=self.context).data + preview_url = serializers.SerializerMethodField() + + def get_preview_url(self, obj): + preview_url = '' + if obj.domain_name: + preview_url = obj.domain_name + elif obj.user_id.domain_name: + preview_url = obj.user_id.domain_name + if preview_url: + return "http://%s" % preview_url + return '' + sign_type_choice = serializers.SerializerMethodField() def get_sign_type_choice(self, obj): diff --git a/fir_ser/api/views/download.py b/fir_ser/api/views/download.py index d0f8a6a..bb0a25f 100644 --- a/fir_ser/api/views/download.py +++ b/fir_ser/api/views/download.py @@ -163,7 +163,7 @@ class ShortDownloadView(APIView): "storage": Storage(app_obj.user_id)}) res.data = app_serializer.data res.udid = udid - res.domain_name = get_redirect_server_domain(request, app_obj.user_id, app_serializer.data['domain_name']) + res.domain_name = get_redirect_server_domain(request, app_obj.user_id, app_obj.domain_name) return Response(res.dict) # key的设置