优化代码

pull/5/head
youngS 4 years ago
parent a5388cb9e7
commit d8f16e04c4
  1. 10
      fir_client/src/components/FirAppInfosBase.vue
  2. 9
      fir_client/src/components/FirAppInfostimeline.vue
  3. 10
      fir_client/src/components/FirApps.vue
  4. 5
      fir_client/src/components/FirDownload.vue
  5. 5
      fir_client/src/components/ShortDownload.vue
  6. 12
      fir_ser/api/utils/serializer.py
  7. 2
      fir_ser/api/views/download.py

@ -146,8 +146,14 @@
} }
}, },
appDownload() { appDownload() {
window.open(location.origin + '/' + this.appinfos.short, 'target', ''); let routeData = this.$router.resolve({name: 'FirDownload', params: {short: this.appinfos.short}});
// this.$router.push({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() { defaulttimeline() {
this.setfunactive('timeline', 5); this.setfunactive('timeline', 5);

@ -148,11 +148,16 @@
}) })
}, },
previewRelase(app) { previewRelase(app) {
this.$router.push({ let routeData = this.$router.resolve({
name: 'FirDownload', name: 'FirDownload',
params: {short: this.currentapp.short}, params: {short: this.currentapp.short},
query: {release_id: app.release_id} 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() { getapptimelineFun() {

@ -375,7 +375,7 @@
<i class="icon-pen el-icon-edit"></i> 管理 <i class="icon-pen el-icon-edit"></i> 管理
</el-button> </el-button>
<el-button @click="appDownload(r)" target="_blank" class="ng-binding"> <el-button @click="appDownload(r)" class="ng-binding">
<i class="icon-eye el-icon-view"></i> 预览 <i class="icon-eye el-icon-view"></i> 预览
</el-button> </el-button>
@ -736,7 +736,13 @@
this.$router.push({name: 'FirAppInfostimeline', params: {id: app.app_id}}) this.$router.push({name: 'FirAppInfostimeline', params: {id: app.app_id}})
}, },
appDownload(app) { 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: { }, computed: {
getDelappTitle() { getDelappTitle() {

@ -343,7 +343,10 @@
} }
}, },
getDownloadTokenFun() { 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) { if (this.$route.query.release_id) {
params["release_id"] = this.$route.query.release_id params["release_id"] = this.$route.query.release_id
} }

@ -337,7 +337,10 @@
} }
}, },
getDownloadTokenFun() { 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) { if (this.$route.query.release_id) {
params["release_id"] = this.$route.query.release_id params["release_id"] = this.$route.query.release_id
} }

@ -39,6 +39,18 @@ class AppsSerializer(serializers.ModelSerializer):
obj.has_combo.has_combo = None obj.has_combo.has_combo = None
return AppsSerializer(obj.has_combo, context=self.context).data 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() sign_type_choice = serializers.SerializerMethodField()
def get_sign_type_choice(self, obj): def get_sign_type_choice(self, obj):

@ -163,7 +163,7 @@ class ShortDownloadView(APIView):
"storage": Storage(app_obj.user_id)}) "storage": Storage(app_obj.user_id)})
res.data = app_serializer.data res.data = app_serializer.data
res.udid = udid 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) return Response(res.dict)
# key的设置 # key的设置

Loading…
Cancel
Save