优化第三方下载显示

super_signature 3.0.1
nineven 5 years ago
parent 31c075a3f8
commit 68c8db9339
  1. 14
      fir_client/src/components/FirAppInfostimeline.vue
  2. 90
      fir_client/src/components/FirApps.vue
  3. 2
      fir_ser/api/models.py
  4. 9
      fir_ser/api/views/uploads.py

@ -10,7 +10,7 @@
<div class="directive-view-release"> <div class="directive-view-release">
<i class="el-icon-cloudy" v-if="! app.is_master"></i> <i class="el-icon-cloudy" v-if="! app.is_master"></i>
<i class="el-icon-cloudy" style="background-color: #409eff" v-else></i> <i class="el-icon-cloudy" style="background-color: rgb(96, 200, 279)" v-else></i>
<b class="ng-binding">{{app.app_version}} (Build {{app.build_version}})</b> <b class="ng-binding">{{app.app_version}} (Build {{app.build_version}})</b>
<div class="release-metainfo ng-hide" <div class="release-metainfo ng-hide"
@ -28,12 +28,6 @@
</small> &nbsp;&nbsp;·&nbsp;&nbsp; </small> &nbsp;&nbsp;·&nbsp;&nbsp;
<small>{{app.release_type|getiOStype}}</small> <small>{{app.release_type|getiOStype}}</small>
<!-- <i-->
<!-- v-if="app.changelog" class="ng-hide">&nbsp;&nbsp;·&nbsp;&nbsp;</i>-->
<!-- <small v-if="app.changelog"-->
<!-- ng-bind="activity.distribution_name"-->
<!-- class="ng-binding ng-hide"> {{app.changelog}}</small>-->
</div> </div>
<p>{{app.changelog}}</p> <p>{{app.changelog}}</p>
@ -153,7 +147,11 @@
}) })
}, },
previewRelase(app) { previewRelase(app) {
this.$router.push({name: 'FirDownload', params: { short: this.currentapp.short },query:{release_id:app.release_id}}) this.$router.push({
name: 'FirDownload',
params: {short: this.currentapp.short},
query: {release_id: app.release_id}
})
}, },
getapptimelineFun() { getapptimelineFun() {

@ -37,7 +37,8 @@
<div class="grid-content bg-purple"> <div class="grid-content bg-purple">
<el-row :gutter="20" style="margin-top: 8px;"> <el-row :gutter="20" style="margin-top: 8px;">
<el-col :span="18"> <el-col :span="18">
{{ analyseappinfo.version}} (Build {{ analyseappinfo.buildversion}}) {{ analyseappinfo.release_type_id|getiOStype}} {{ analyseappinfo.version}} (Build {{ analyseappinfo.buildversion}}) {{
analyseappinfo.release_type_id|getiOStype}}
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20" style="margin-top: 18px;"> <el-row :gutter="20" style="margin-top: 18px;">
@ -156,15 +157,17 @@
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-progress :text-inside="true" :stroke-width="26" :percentage="uploadprocess" v-if="uploadflag === true"></el-progress> <el-progress :text-inside="true" :stroke-width="26" :percentage="uploadprocess"
<el-button type="primary" plain @click="uploadcloud" v-else>开始上传</el-button> v-if="uploadflag === true"></el-progress>
<el-button type="primary" plain @click="uploadcloud" v-else>{{ analyseappinfo.is_new|get_upload_text}}</el-button>
</span> </span>
</el-dialog> </el-dialog>
<el-row> <el-row>
<el-col :span="4"> <el-col :span="4">
<el-radio-group v-model="searchfromtype"> <el-radio-group v-model="searchfromtype">
<el-radio-button label="android" icon="el-icon-mobile-phone"><i class="iconfont icon-android2"/> <el-radio-button label="android" icon="el-icon-mobile-phone"><i
class="iconfont icon-android2"/>
</el-radio-button> </el-radio-button>
<el-radio-button label="ios"><i class="iconfont icon-ios"/> <el-radio-button label="ios"><i class="iconfont icon-ios"/>
</el-radio-button> </el-radio-button>
@ -313,8 +316,6 @@
</p> </p>
<table> <table>
<tbody> <tbody>
<tr> <tr>
<td class="ng-binding">应用大小</td> <td class="ng-binding">应用大小</td>
<td><span <td><span
@ -334,15 +335,26 @@
<td><span class="ng-binding">{{ r.master_release.app_version }}Build {{ r.master_release.build_version }}</span> <td><span class="ng-binding">{{ r.master_release.app_version }}Build {{ r.master_release.build_version }}</span>
</td> </td>
</tr> </tr>
<tr v-if="r.type === 1"> <tr v-if="r.type === 1 && r.master_release.binary_url === ''">
<td class="ng-binding">打包类型</td> <td class="ng-binding">打包类型</td>
<td><span class="ng-binding"> <td><span class="ng-binding">
{{ r.master_release.release_type|getiOStype }} {{ r.master_release.release_type|getiOStype }}
</span></td> </span></td>
</tr> </tr>
<tr v-if=" r.master_release.binary_url !== ''">
<td>第三方平台下载</td>
<td>
<span>
<el-tooltip :content="r.master_release.binary_url" placement="top">
<a target="_blank" :href="r.master_release.binary_url">{{ r.master_release.binary_url| autoformat}}</a>
</el-tooltip>
</span>
</td>
</tr>
</tbody> </tbody>
</table> </table>
<div class="action"> <div class="action">
<el-button @click="appInfos(r)"> <el-button @click="appInfos(r)">
<i class="icon-pen el-icon-edit"></i> 管理 <i class="icon-pen el-icon-edit"></i> 管理
@ -373,7 +385,16 @@
<script> <script>
import {getapps, deleteapp, analyseApps, getuploadurl} from "../restful"; import {getapps, deleteapp, analyseApps, getuploadurl} from "../restful";
import {getScrollHeight,getScrollTop,getWindowHeight,getappinfo,uploadqiniuoss,dataURLtoFile,uploadaliyunoss,uploadlocalstorage} from "../utils"; import {
getScrollHeight,
getScrollTop,
getWindowHeight,
getappinfo,
uploadqiniuoss,
dataURLtoFile,
uploadaliyunoss,
uploadlocalstorage
} from "../utils";
export default { export default {
name: "FirApps", name: "FirApps",
@ -461,24 +482,60 @@
this.analyseappinfo.png_key = data.data.png_key; this.analyseappinfo.png_key = data.data.png_key;
this.analyseappinfo.png_token = data.data.png_token; this.analyseappinfo.png_token = data.data.png_token;
this.analyseappinfo.storage = data.data.storage; this.analyseappinfo.storage = data.data.storage;
this.analyseappinfo.is_new = data.data.is_new;
this.analyseappinfo.binary_url = data.data.binary_url;
this.willuploadApp = true; this.willuploadApp = true;
} else { } else {
this.$message.error("上传token获取失败,请刷新重试") this.$message.error("上传token获取失败,请刷新重试")
} }
loading.close(); loading.close();
},{'methos':true,'data':{"bundleid":this.analyseappinfo.bundleid,"type":this.analyseappinfo.type}}) }, {
'methos': true,
'data': {"bundleid": this.analyseappinfo.bundleid, "type": this.analyseappinfo.type}
})
}, },
uploadcloud() { uploadcloud() {
if (this.analyseappinfo.binary_url !== '') {
this.$confirm(`该应用存在第三方下载链接 <a target="_blank" href="${this.analyseappinfo.binary_url}"> ${this.analyseappinfo.binary_url} </a>更新之后,将不会自动跳转第三方下载;若您还需要第三方跳转,请在第三方平台更新该应用。`, '确定更新应用?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
dangerouslyUseHTMLString: true,
type: 'warning'
}).then(() => {
this.$message({
type: 'success',
message: '开始更新'
});
this.uploadstorage()
}).catch(() => {
this.$message({
type: 'info',
message: '已取消更新'
});
this.closeUpload();
});
} else {
this.uploadstorage()
}
},
uploadstorage() {
this.uploadflag = true; this.uploadflag = true;
this.uploading = true; this.uploading = true;
let file = dataURLtoFile(this.analyseappinfo.icon, this.analyseappinfo.png_key); let file = dataURLtoFile(this.analyseappinfo.icon, this.analyseappinfo.png_key);
this.uploadtostorage(file,{'upload_key':this.analyseappinfo.png_key,'upload_token':this.analyseappinfo.png_token}); this.uploadtostorage(file, {
'upload_key': this.analyseappinfo.png_key,
'upload_token': this.analyseappinfo.png_token
});
file = this.currentfile; file = this.currentfile;
this.uploadtostorage(file,{'upload_key':this.analyseappinfo.upload_key,'upload_token':this.analyseappinfo.upload_token}); this.uploadtostorage(file, {
'upload_key': this.analyseappinfo.upload_key,
'upload_token': this.analyseappinfo.upload_token
});
}, },
closeUpload() { closeUpload() {
this.uploadsuccess = 0; this.uploadsuccess = 0;
@ -703,6 +760,13 @@
} else { } else {
return icon_url return icon_url
} }
},
get_upload_text(is_new) {
if (is_new) {
return '新应用上传'
} else {
return '应用更新'
}
} }
}, mounted() { }, mounted() {
@ -906,7 +970,7 @@
.page-apps .card.app .action { .page-apps .card.app .action {
position: absolute; position: absolute;
padding: 40px 0 40px 40px; padding: 20px 0 40px 40px;
left: 0; left: 0;
bottom: 0; bottom: 0;
width: 100% width: 100%

@ -125,7 +125,7 @@ class AppReleaseInfo(models.Model):
release_type = models.SmallIntegerField(choices=release_choices, default=0, verbose_name="版本类型") release_type = models.SmallIntegerField(choices=release_choices, default=0, verbose_name="版本类型")
minimum_os_version = models.CharField(max_length=64,verbose_name="应用可安装的最低系统版本") minimum_os_version = models.CharField(max_length=64,verbose_name="应用可安装的最低系统版本")
binary_size = models.BigIntegerField(verbose_name="应用大小") binary_size = models.BigIntegerField(verbose_name="应用大小")
binary_url = models.CharField(max_length=128,blank=True,verbose_name="APPurl") binary_url = models.CharField(max_length=128,blank=True,verbose_name="第三方下载URL")
icon_url = models.CharField(max_length=128,blank=True,verbose_name="图标url") icon_url = models.CharField(max_length=128,blank=True,verbose_name="图标url")
changelog = models.TextField('更新日志', blank=True, null=True, default=None, ) changelog = models.TextField('更新日志', blank=True, null=True, default=None, )

@ -36,9 +36,15 @@ class AppAnalyseView(APIView):
release_id = make_from_user_uuid(request.user) release_id = make_from_user_uuid(request.user)
png_id = make_from_user_uuid(request.user) png_id = make_from_user_uuid(request.user)
app_obj = Apps.objects.filter(app_id=app_uuid).first() app_obj = Apps.objects.filter(app_id=app_uuid).first()
binary_url=''
if app_obj: if app_obj:
is_new=False
short = app_obj.short short = app_obj.short
app_release_obj=AppReleaseInfo.objects.filter(app_id=app_obj,is_master=True).first()
if app_release_obj:
binary_url = app_release_obj.binary_url
else: else:
is_new=True
short = get_random_short() short = get_random_short()
if app_type == 'iOS': if app_type == 'iOS':
upload_key = release_id+'.ipa' upload_key = release_id+'.ipa'
@ -63,7 +69,8 @@ class AppAnalyseView(APIView):
"upload_key":upload_key, "upload_key":upload_key,
"png_token":png_token, "png_token":png_token,
"png_key":png_key, "png_key":png_key,
"storage":storage_type} "storage":storage_type,
"is_new":is_new,"binary_url":binary_url}
else: else:
res.code = 1003 res.code = 1003

Loading…
Cancel
Save