优化第三方下载显示

super_signature 3.0.1
nineven 5 years ago
parent 31c075a3f8
commit 68c8db9339
  1. 62
      fir_client/src/components/FirAppInfostimeline.vue
  2. 536
      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,18 +28,12 @@
</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>
<textarea v-if="app.editing.changelog" <textarea v-if="app.editing.changelog"
v-model="app.changelog" v-model="app.changelog"
placeholder="更新日志" > placeholder="更新日志">
</textarea> </textarea>
<div class="release-actions editing " v-if="app.editing.changelog"> <div class="release-actions editing " v-if="app.editing.changelog">
@ -52,7 +46,7 @@
<el-input v-if="app.editing.binary_url" <el-input v-if="app.editing.binary_url"
v-model="app.binary_url" v-model="app.binary_url"
placeholder="下载地址,默认本服务器,填写第三方可以 自动跳转到第三方平台" > placeholder="下载地址,默认本服务器,填写第三方可以 自动跳转到第三方平台">
</el-input> </el-input>
<div class="release-actions editing " v-if="app.editing.binary_url"> <div class="release-actions editing " v-if="app.editing.binary_url">
@ -81,7 +75,7 @@
<el-button class="tooltip-top" tooltip="下载原文件" <el-button class="tooltip-top" tooltip="下载原文件"
@click="downloadPackage(app)"> @click="downloadPackage(app)">
<i class="el-icon-download"></i> <i class="el-icon-download"></i>
<span >{{app.binary_size}}</span> <span>{{app.binary_size}}</span>
</el-button> </el-button>
</el-tooltip> </el-tooltip>
@ -90,7 +84,7 @@
<el-button class="tooltip-top" tooltip="修改下载地址" <el-button class="tooltip-top" tooltip="修改下载地址"
@click="startEdit(app,'binary_url')"><i @click="startEdit(app,'binary_url')"><i
class="el-icon-link"></i> <span >下载地址</span> class="el-icon-link"></i> <span>下载地址</span>
</el-button> </el-button>
</el-tooltip> </el-tooltip>
@ -130,30 +124,34 @@
release_apps: [], release_apps: [],
currentapp: {}, currentapp: {},
activity: { activity: {
editing: {'changelog':false,'binary_url':false} editing: {'changelog': false, 'binary_url': false}
}, },
updatas:{}, updatas: {},
} }
}, },
methods: { methods: {
downloadPackage(app){ downloadPackage(app) {
getdownloadurl(res=>{ getdownloadurl(res => {
if(res.code === 1000){ if (res.code === 1000) {
window.location.href=res.data.download_url; window.location.href = res.data.download_url;
} }
}, { }, {
'data': { 'data': {
'token': app.download_token, 'token': app.download_token,
'short': this.currentapp.short, 'short': this.currentapp.short,
'release_id': app.release_id, 'release_id': app.release_id,
"isdownload":true "isdownload": true
}, },
'app_id': this.currentapp.app_id 'app_id': this.currentapp.app_id
}) })
}, },
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() {
@ -236,19 +234,19 @@
}); });
}, },
endEdit(app,type) { endEdit(app, type) {
if(type==='changelog'){ if (type === 'changelog') {
app.editing.changelog = false; app.editing.changelog = false;
}else if(type === 'binary_url'){ } else if (type === 'binary_url') {
app.editing.binary_url = false; app.editing.binary_url = false;
} }
}, },
updateChangelog(app,type) { updateChangelog(app, type) {
if(type==='changelog'){ if (type === 'changelog') {
this.activity.editing.changelog = false; this.activity.editing.changelog = false;
this.updatas = {"changelog": app.changelog} this.updatas = {"changelog": app.changelog}
}else if(type === 'binary_url') { } else if (type === 'binary_url') {
this.activity.editing.binary_url = false; this.activity.editing.binary_url = false;
this.updatas = {"binary_url": app.binary_url} this.updatas = {"binary_url": app.binary_url}
} }
@ -257,9 +255,9 @@
"release_id": app.release_id, "release_id": app.release_id,
"data": this.updatas "data": this.updatas
}); });
this.updatas={} this.updatas = {}
}, },
startEdit(app,type) { startEdit(app, type) {
if (type === 'changelog') { if (type === 'changelog') {
app.editing.changelog = true; app.editing.changelog = true;
@ -275,10 +273,10 @@
this.$store.dispatch('doappInfoIndex', [[5, 5], [5, 5]]); this.$store.dispatch('doappInfoIndex', [[5, 5], [5, 5]]);
this.getapptimelineFun(); this.getapptimelineFun();
}, filters: { }, filters: {
downcontent(content){ downcontent(content) {
if(content){ if (content) {
return content return content
}else{ } else {
return "修改下载地址" return "修改下载地址"
} }
}, },
@ -292,7 +290,7 @@
let ftype = ''; let ftype = '';
if (type === 1) { if (type === 1) {
ftype = '内测版' ftype = '内测版'
} else if(type === 2) { } else if (type === 2) {
ftype = '企业版' ftype = '企业版'
} }
return ftype return ftype

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<el-container > <el-container>
<el-header style="height: 100px"> <el-header style="height: 100px">
@ -17,31 +17,32 @@
<el-dialog class="upload-app" <el-dialog class="upload-app"
:visible.sync="willuploadApp" :visible.sync="willuploadApp"
:destroy-on-close="true" :destroy-on-close="true"
:show-close="!uploading" :show-close="!uploading"
width="40%" width="40%"
:close-on-click-modal="false" :close-on-click-modal="false"
@closed="closeUpload" > @closed="closeUpload">
<div v-if="!uploading" style=""> <div v-if="!uploading" style="">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="6"> <el-col :span="6">
<div class="grid-content bg-purple"> <div class="grid-content bg-purple">
<div style="width: 100px;height: 100px"> <div style="width: 100px;height: 100px">
<el-avatar shape="square" :size="100" :src="analyseappinfo.icon"></el-avatar> <el-avatar shape="square" :size="100" :src="analyseappinfo.icon"></el-avatar>
</div> </div>
</div> </div>
</el-col> </el-col>
<el-col :span="18"> <el-col :span="18">
<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;">
<el-col :span="18" > <el-col :span="18">
<el-input v-model="analyseappinfo.appname"></el-input> <el-input v-model="analyseappinfo.appname"></el-input>
</el-col> </el-col>
@ -57,7 +58,7 @@
<div class="grid-content bg-purple"> <div class="grid-content bg-purple">
<el-row :gutter="20" style="margin-top: 18px;"> <el-row :gutter="20" style="margin-top: 18px;">
<el-col :span="18" :offset="8"> <el-col :span="18" :offset="8">
<span >短连接</span> <span>短连接</span>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
@ -65,7 +66,7 @@
<el-col :span="18"> <el-col :span="18">
<div class="grid-content bg-purple"> <div class="grid-content bg-purple">
<el-row :gutter="20" style="margin-top: 10px;"> <el-row :gutter="20" style="margin-top: 10px;">
<el-col :span="18" > <el-col :span="18">
<el-input v-model="analyseappinfo.short"> <el-input v-model="analyseappinfo.short">
<template slot="prepend">{{analyseappinfo.domain_name}}/</template> <template slot="prepend">{{analyseappinfo.domain_name}}/</template>
</el-input> </el-input>
@ -81,7 +82,7 @@
<div class="grid-content bg-purple"> <div class="grid-content bg-purple">
<el-row :gutter="20" style="margin-top: 18px;"> <el-row :gutter="20" style="margin-top: 18px;">
<el-col :span="18" :offset="8"> <el-col :span="18" :offset="8">
<span >更新日志</span> <span>更新日志</span>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
@ -89,12 +90,12 @@
<el-col :span="18"> <el-col :span="18">
<div class="grid-content bg-purple"> <div class="grid-content bg-purple">
<el-row :gutter="20" style="margin-top: 10px;"> <el-row :gutter="20" style="margin-top: 10px;">
<el-col :span="18" > <el-col :span="18">
<el-input type="textarea" <el-input type="textarea"
v-model="analyseappinfo.changelog" v-model="analyseappinfo.changelog"
placeholder="请输入内容" placeholder="请输入内容"
rows="5" rows="5"
show-word-limit></el-input> show-word-limit></el-input>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
@ -156,17 +157,19 @@
<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>
</el-radio-group> </el-radio-group>
@ -261,7 +264,7 @@
<div <div
ref="appmain" style="margin: 40px 20px"> ref="appmain" style="margin: 40px 20px">
<el-row style="max-height: 460px; margin: 0 auto;" :gutter="10" class="page-apps"> <el-row style="max-height: 460px; margin: 0 auto;" :gutter="10" class="page-apps">
@ -284,83 +287,92 @@
</div> </div>
</el-col> </el-col>
<el-col style="width: 33%;height: 460px" <el-col style="width: 33%;height: 460px"
v-for="(r,index) in applists" :key="r.id" @click="appInfos(index)"> v-for="(r,index) in applists" :key="r.id" @click="appInfos(index)">
<div class=" app-animator"> <div class=" app-animator">
<div class="card app card-ios"> <div class="card app card-ios">
<i class=" type-icon iconfont icon-ios" v-if="r.type === 1" src=""></i> <i class=" type-icon iconfont icon-ios" v-if="r.type === 1" src=""></i>
<i class="type-icon iconfont icon-android2" v-if="r.type === 0"></i> <i class="type-icon iconfont icon-android2" v-if="r.type === 0"></i>
<div class="type-mark" v-if="r.type === 1"></div> <div class="type-mark" v-if="r.type === 1"></div>
<div class="type-mark" style="border-top: 48px solid #A4C639" v-if="r.type === 0"></div> <div class="type-mark" style="border-top: 48px solid #A4C639" v-if="r.type === 0"></div>
<a class="appicon" @click="appInfos(r)"> <a class="appicon" @click="appInfos(r)">
<img class="icon ng-isolate-scope" width="100" height="100" <img class="icon ng-isolate-scope" width="100" height="100"
:src="r.master_release.icon_url|make_icon_url"></a> :src="r.master_release.icon_url|make_icon_url"></a>
<div class="combo-info ng-scope" v-if="r.has_combo !== null "> <div class="combo-info ng-scope" v-if="r.has_combo !== null ">
<i class="el-icon-copy-document" style="transform:rotateX(180deg);"></i> <i class="el-icon-copy-document" style="transform:rotateX(180deg);"></i>
<a @click="appInfos(r.has_combo)"> <a @click="appInfos(r.has_combo)">
<img class="icon ng-isolate-scope" width="45" height="45" <img class="icon ng-isolate-scope" width="45" height="45"
:src="r.has_combo.master_release.icon_url|make_icon_url"> :src="r.has_combo.master_release.icon_url|make_icon_url">
</a> </a>
</div> </div>
<br> <br>
<p class="appname"><i class="el-icon-user-solid"></i><span class="ng-binding">{{ r.name }}</span> <p class="appname"><i class="el-icon-user-solid"></i><span class="ng-binding">{{ r.name }}</span>
</p> </p>
<table> <table>
<tbody> <tbody>
<tr>
<td class="ng-binding">应用大小</td>
<tr> <td><span
<td class="ng-binding">应用大小</td> class="ng-binding">{{ r.master_release.binary_size }}</span>
<td><span </td>
class="ng-binding">{{ r.master_release.binary_size }}</span> </tr>
</td> <tr>
</tr> <td class="ng-binding">应用平台</td>
<tr> <td><span class="ng-binding">{{ r.type |getapptype }}</span></td>
<td class="ng-binding">应用平台</td> </tr>
<td><span class="ng-binding">{{ r.type |getapptype }}</span></td> <tr>
</tr> <td class="ng-binding">应用标识</td>
<tr> <td><span class="ng-binding">{{ r.bundle_id | autoformat }}</span></td>
<td class="ng-binding">应用标识</td> </tr>
<td><span class="ng-binding">{{ r.bundle_id | autoformat }}</span></td> <tr>
</tr> <td class="ng-binding">最新版本</td>
<tr> <td><span class="ng-binding">{{ r.master_release.app_version }}Build {{ r.master_release.build_version }}</span>
<td class="ng-binding">最新版本</td> </td>
<td><span class="ng-binding">{{ r.master_release.app_version }}Build {{ r.master_release.build_version }}</span> </tr>
</td> <tr v-if="r.type === 1 && r.master_release.binary_url === ''">
</tr> <td class="ng-binding">打包类型</td>
<tr v-if="r.type === 1"> <td><span class="ng-binding">
<td class="ng-binding">打包类型</td>
<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 !== ''">
</tbody> <td>第三方平台下载</td>
</table> <td>
<div class="action"> <span>
<el-button @click="appInfos(r)"> <el-tooltip :content="r.master_release.binary_url" placement="top">
<i class="icon-pen el-icon-edit"></i> 管理 <a target="_blank" :href="r.master_release.binary_url">{{ r.master_release.binary_url| autoformat}}</a>
</el-button> </el-tooltip>
</span>
<el-button @click="appDownload(r)" target="_blank" class="ng-binding"> </td>
<i class="icon-eye el-icon-view"></i> 预览 </tr>
</el-button>
</tbody>
</table>
<div class="action">
<el-button @click="appInfos(r)">
<i class="icon-pen el-icon-edit"></i> 管理
</el-button>
<el-button @click="appDownload(r)" target="_blank" class="ng-binding">
<i class="icon-eye el-icon-view"></i> 预览
</el-button>
<el-button @click="DeleteApp(r)" class="btn btn-remove" icon="el-icon-delete"
circle></el-button>
</div>
</div>
</div>
<el-button @click="DeleteApp(r)" class="btn btn-remove" icon="el-icon-delete" </el-col>
circle></el-button>
</div>
</div>
</div>
</el-col>
</el-row> </el-row>
@ -372,38 +384,47 @@
</template> </template>
<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",
data() { data() {
return { return {
analyseappinfo:{'appname':'','short':'','changelog':''}, analyseappinfo: {'appname': '', 'short': '', 'changelog': ''},
keysearch: '', keysearch: '',
searchfromtype: '', searchfromtype: '',
applists: [], applists: [],
orgapplists: [], orgapplists: [],
hdata: {}, hdata: {},
willDeleteApp: false, willDeleteApp: false,
willuploadApp:false, willuploadApp: false,
uploading:false, uploading: false,
delapp: {}, delapp: {},
has_next:false, has_next: false,
query:{'page':1,size:20}, query: {'page': 1, size: 20},
searchflag:false, searchflag: false,
uploadflag:false, uploadflag: false,
autoloadflag:true, autoloadflag: true,
firstloadflag:true, firstloadflag: true,
currentfile:null, currentfile: null,
uploadprocess:0, uploadprocess: 0,
uploadsuccess:0, uploadsuccess: 0,
loadingobj:null loadingobj: null
} }
}, methods: { }, methods: {
updateappinfo(file){ updateappinfo(file) {
this.uploadsuccess +=1; this.uploadsuccess += 1;
if(this.uploadsuccess === 2){ if (this.uploadsuccess === 2) {
this.$message.success(file.name + '上传成功'); this.$message.success(file.name + '上传成功');
analyseApps(data => { analyseApps(data => {
if (data.code === 1000) { if (data.code === 1000) {
@ -411,135 +432,171 @@
this.closeUpload(); this.closeUpload();
this.$router.push({name: 'FirAppInfostimeline', params: {id: app_uuid}}); this.$router.push({name: 'FirAppInfostimeline', params: {id: app_uuid}});
} }
},{'methods':'PUT','data':this.analyseappinfo}); }, {'methods': 'PUT', 'data': this.analyseappinfo});
} }
}, },
uploadtostorage(file,certinfo){ uploadtostorage(file, certinfo) {
if(this.analyseappinfo.storage === 1){ if (this.analyseappinfo.storage === 1) {
// eslint-disable-next-line no-unused-vars,no-unreachable // eslint-disable-next-line no-unused-vars,no-unreachable
uploadqiniuoss(file,certinfo,this,res=>{ uploadqiniuoss(file, certinfo, this, res => {
this.updateappinfo(file) this.updateappinfo(file)
},process=>{ }, process => {
if(this.uploadsuccess === 1) { if (this.uploadsuccess === 1) {
this.uploadprocess = process; this.uploadprocess = process;
} }
}) })
}else if(this.analyseappinfo.storage === 2){ } else if (this.analyseappinfo.storage === 2) {
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
uploadaliyunoss(file,certinfo,this,res=>{ uploadaliyunoss(file, certinfo, this, res => {
this.updateappinfo(file) this.updateappinfo(file)
},process=>{ }, process => {
if(this.uploadsuccess === 1) { if (this.uploadsuccess === 1) {
this.uploadprocess = process; this.uploadprocess = process;
} }
}); });
}else { } else {
// //
certinfo.upload_url = getuploadurl(); certinfo.upload_url = getuploadurl();
certinfo.ftype = 'app'; certinfo.ftype = 'app';
certinfo.app_id = this.analyseappinfo.app_uuid; certinfo.app_id = this.analyseappinfo.app_uuid;
// eslint-disable-next-line no-unused-vars,no-unreachable // eslint-disable-next-line no-unused-vars,no-unreachable
uploadlocalstorage(file,certinfo,this,res=>{ uploadlocalstorage(file, certinfo, this, res => {
this.updateappinfo(file) this.updateappinfo(file)
},process=>{ }, process => {
if(this.uploadsuccess === 1) { if (this.uploadsuccess === 1) {
this.uploadprocess = process; this.uploadprocess = process;
} }
}) })
} }
}, },
getuploadtoken(loading){ getuploadtoken(loading) {
analyseApps(data =>{ analyseApps(data => {
if(data.code === 1000){ if (data.code === 1000) {
this.analyseappinfo.short = data.data.short; this.analyseappinfo.short = data.data.short;
this.analyseappinfo.domain_name = data.data.domain_name; this.analyseappinfo.domain_name = data.data.domain_name;
this.analyseappinfo.app_uuid= data.data.app_uuid; this.analyseappinfo.app_uuid = data.data.app_uuid;
this.analyseappinfo.upload_token= data.data.upload_token; this.analyseappinfo.upload_token = data.data.upload_token;
this.analyseappinfo.upload_key= data.data.upload_key; this.analyseappinfo.upload_key = data.data.upload_key;
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.willuploadApp=true; this.analyseappinfo.binary_url = data.data.binary_url;
}else { this.willuploadApp = true;
} 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() {
this.uploadflag=true; 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.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;
this.uploadprocess=0; this.uploadprocess = 0;
this.uploadflag=false; this.uploadflag = false;
this.uploading = false; this.uploading = false;
this.willuploadApp=false; this.willuploadApp = false;
this.currentfile=null; this.currentfile = null;
this.uploadflag = false; this.uploadflag = false;
this.analyseappinfo={}; this.analyseappinfo = {};
}, },
searchFun(){ searchFun() {
let keysearch = this.keysearch.replace(/^\s+|\s+$/g, ""); let keysearch = this.keysearch.replace(/^\s+|\s+$/g, "");
if(keysearch === ''){ if (keysearch === '') {
this.searchflag=false; this.searchflag = false;
this.applists=[]; this.applists = [];
this.orgapplists=[]; this.orgapplists = [];
this.query.page=1; this.query.page = 1;
if(this.searchfromtype){ if (this.searchfromtype) {
this.getappsFun({"type": this.searchfromtype}); this.getappsFun({"type": this.searchfromtype});
}else { } else {
this.getappsFun({}); this.getappsFun({});
} }
}else { } else {
this.searchflag=true this.searchflag = true
} }
if(this.searchflag){ if (this.searchflag) {
this.applists=[]; this.applists = [];
this.orgapplists=[]; this.orgapplists = [];
if(this.searchfromtype){ if (this.searchfromtype) {
this.getappsFun({"type": this.searchfromtype,'page':1,size:999}); this.getappsFun({"type": this.searchfromtype, 'page': 1, size: 999});
}else { } else {
this.getappsFun({'page':1,size:999}); this.getappsFun({'page': 1, size: 999});
} }
} }
}, },
auto_load(){ auto_load() {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
// console.log(getScrollTop() , getWindowHeight(),getScrollTop() + getWindowHeight(), getScrollHeight()); // console.log(getScrollTop() , getWindowHeight(),getScrollTop() + getWindowHeight(), getScrollHeight());
if(getScrollTop() + getWindowHeight() >= getScrollHeight()){ if (getScrollTop() + getWindowHeight() >= getScrollHeight()) {
if(this.has_next){ //
if(this.autoloadflag) {
this.autoloadflag = false;
if (this.applists.length === 0) {
this.query.page = 1;
} else {
this.query.page += 1;
}
if (this.searchfromtype !== '') {
this.query.type = this.searchfromtype;
}
this.getappsFun(this.query);
}
}else{ if (this.has_next) { //
if(! this.has_next){ if (this.autoloadflag) {
this.$message.success("已经到底啦") this.autoloadflag = false;
if (this.applists.length === 0) {
this.query.page = 1;
} else {
this.query.page += 1;
}
if (this.searchfromtype !== '') {
this.query.type = this.searchfromtype;
} }
this.getappsFun(this.query);
} }
} else {
if (!this.has_next) {
this.$message.success("已经到底啦")
}
}
} }
}, },
searchapps() { searchapps() {
@ -567,27 +624,27 @@
getapps(data => { getapps(data => {
if (data.code === 1000) { if (data.code === 1000) {
this.loadingobj.close(); this.loadingobj.close();
if(this.firstloadflag){ if (this.firstloadflag) {
window.addEventListener('scroll',this.auto_load); window.addEventListener('scroll', this.auto_load);
this.firstloadflag = false this.firstloadflag = false
} }
this.autoloadflag = true; this.autoloadflag = true;
if(this.uploadflag){ if (this.uploadflag) {
this.applists = data.data ; this.applists = data.data;
this.uploadflag = false; this.uploadflag = false;
}else { } else {
this.applists = this.applists.concat(data.data) ; this.applists = this.applists.concat(data.data);
} }
this.has_next = data.has_next; this.has_next = data.has_next;
this.orgapplists = this.applists.slice(); // this.orgapplists = this.applists.slice(); //
this.hdata = data.hdata; this.hdata = data.hdata;
this.$store.dispatch("getUser",data.userinfo); this.$store.dispatch("getUser", data.userinfo);
this.searchapps(); this.searchapps();
let upload_domain=data.hdata.upload_domain; let upload_domain = data.hdata.upload_domain;
if(!upload_domain){ if (!upload_domain) {
upload_domain=location.origin; upload_domain = location.origin;
} }
// this.$store.dispatch('doucurrentapp', {'firapps':1}); // this.$store.dispatch('doucurrentapp', {'firapps':1});
@ -599,22 +656,22 @@
}, parms); }, parms);
}, },
beforeAvatarUpload(file){ beforeAvatarUpload(file) {
const loading = this.$loading({ const loading = this.$loading({
lock: true, lock: true,
text: '应用解析中', text: '应用解析中',
spinner: 'el-icon-loading', spinner: 'el-icon-loading',
// background: 'rgba(0, 0, 0, 0.7)' // background: 'rgba(0, 0, 0, 0.7)'
}); });
getappinfo(file,appinfo =>{ getappinfo(file, appinfo => {
if(appinfo.bundleid){ if (appinfo.bundleid) {
this.analyseappinfo = appinfo; this.analyseappinfo = appinfo;
this.getuploadtoken(loading); this.getuploadtoken(loading);
this.currentfile = file; this.currentfile = file;
}else { } else {
this.$message.error("应用解析失败,请检查是否为APP应用") this.$message.error("应用解析失败,请检查是否为APP应用")
} }
},err=>{ }, err => {
loading.close(); loading.close();
this.$message.error("应用解析失败,请检查是否为APP应用"); this.$message.error("应用解析失败,请检查是否为APP应用");
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
@ -623,23 +680,23 @@
return false; return false;
}, },
delApp() { delApp() {
this.willDeleteApp = false; this.willDeleteApp = false;
deleteapp(data => { deleteapp(data => {
if (data.code === 1000) { if (data.code === 1000) {
for(let i=0;i< this.applists.length;i++){ for (let i = 0; i < this.applists.length; i++) {
if(this.delapp.app_id === this.applists[i].app_id){ if (this.delapp.app_id === this.applists[i].app_id) {
this.applists.splice(i,1); this.applists.splice(i, 1);
this.orgapplists.splice(i,1); this.orgapplists.splice(i, 1);
}
}
this.$message.success(this.delapp.name+'删除成功');
this.delapp={};
} else {
this.$message.error('删除失败,请联系管理员');
} }
}, { }
"app_id": this.delapp.app_id this.$message.success(this.delapp.name + '删除成功');
}); this.delapp = {};
} else {
this.$message.error('删除失败,请联系管理员');
}
}, {
"app_id": this.delapp.app_id
});
}, },
DeleteApp(delapp) { DeleteApp(delapp) {
// //
@ -650,7 +707,7 @@
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}})
} }
}, computed: { }, computed: {
getDelappTitle() { getDelappTitle() {
@ -673,7 +730,7 @@
let ftype = ''; let ftype = '';
if (type === 1) { if (type === 1) {
ftype = '内测版' ftype = '内测版'
} else if(type === 2) { } else if (type === 2) {
ftype = '企业版' ftype = '企业版'
} }
return ftype return ftype
@ -684,7 +741,7 @@
autoformat: function (packname) { autoformat: function (packname) {
if ((packname.length) > 20) { if ((packname.length) > 20) {
return packname.split('').slice(0, 20).join('') + '...'; return packname.split('').slice(0, 20).join('') + '...';
}else { } else {
return packname return packname
} }
}, },
@ -697,12 +754,19 @@
} }
return ftype return ftype
}, },
make_icon_url(icon_url){ make_icon_url(icon_url) {
if(!icon_url.startsWith("http")){ if (!icon_url.startsWith("http")) {
return location.origin+icon_url return location.origin + icon_url
}else { } else {
return icon_url return icon_url
} }
},
get_upload_text(is_new) {
if (is_new) {
return '新应用上传'
} else {
return '应用更新'
}
} }
}, mounted() { }, mounted() {
@ -710,7 +774,7 @@
this.getappsFun({}); this.getappsFun({});
// window.addEventListener('scroll',this.auto_load); // window.addEventListener('scroll',this.auto_load);
}, },
destroyed(){ destroyed() {
window.removeEventListener('scroll', this.auto_load, false); window.removeEventListener('scroll', this.auto_load, false);
this.loadingobj.close(); this.loadingobj.close();
}, },
@ -723,8 +787,8 @@
}, },
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
searchfromtype: function (val, oldVal) { searchfromtype: function (val, oldVal) {
this.applists=[]; this.applists = [];
this.query.page=1; this.query.page = 1;
// this.keysearch=''; // this.keysearch='';
this.searchFun(); this.searchFun();
// this.getappsFun({"type": this.searchfromtype}); // this.getappsFun({"type": this.searchfromtype});
@ -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