baseline: 小军 WMS 二开代码原始快照(含 SynOABusiness.cs Debugger.Break)
This commit is contained in:
commit
c2b0e7be0d
6522 files changed
+3530643
No files matched your search
+81
@@ -0,0 +1,81 @@
|
||||
## 说明
|
||||
|
||||
检测版本更新,并自动下载安装的组件
|
||||
|
||||
后台逻辑用户自定义,我的是java
|
||||
|
||||
联系QQ: 1397551270
|
||||
|
||||
|
||||
## 用法
|
||||
|
||||
**父组件**
|
||||
|
||||
```html
|
||||
<template>
|
||||
<view>
|
||||
<yomol-upgrade :type="upgradeType" :url="upgradeUrl" title="发现新版本" :content="upgradeContent" ref="yomolUpgrade"></yomol-upgrade>
|
||||
</view>
|
||||
</template>
|
||||
```
|
||||
|
||||
```js
|
||||
<script>
|
||||
import yomolUpgrade from '@/components/yomol-upgrade/yomol-upgrade.vue'
|
||||
export default {
|
||||
components:{
|
||||
yomolUpgrade
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
upgradeType: 'pkg', //pkg 整包 wgt 升级包
|
||||
upgradeContent: '', //更新内容
|
||||
upgradeUrl: '', //更新地址
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/*
|
||||
* 检测版本升级
|
||||
*/
|
||||
checkVersionClick() {
|
||||
// 获取版本信息
|
||||
plus.runtime.getProperty(plus.runtime.appid, (widgetInfo) => {
|
||||
var platform = uni.getSystemInfoSync().platform
|
||||
//根据当前平台去后台检测版本号
|
||||
//这是我的逻辑,可自定义
|
||||
uni.request({
|
||||
url: 'https://www.cheshangji.cn/csj-web/app/check/' + platform,
|
||||
data: {
|
||||
version: widgetInfo.version,
|
||||
name: widgetInfo.name //没啥用
|
||||
},
|
||||
success: (res) => {
|
||||
console.log(res);
|
||||
if (res.data.status == 200 && res.data.data.update) {
|
||||
//我的后台会返回一个安装包地址(pkgUrl),升级包地址(wgtUrl)
|
||||
//判空来判断是非是整包升级还是资源包升级
|
||||
//content是版本更新内容 \n换行
|
||||
//ios用户pkgUrl是苹果市场App地址,android自定义下载地址
|
||||
if (res.data.data.pkgUrl != '' && res.data.data.wgtUrl == '') {
|
||||
this.upgradeType = 'pkg'
|
||||
this.upgradeContent = res.data.data.content
|
||||
this.upgradeUrl = res.data.data.pkgUrl
|
||||
this.$refs.yomolUpgrade.show()
|
||||
} else {
|
||||
this.upgradeType = 'wgt'
|
||||
this.upgradeContent = res.data.data.content
|
||||
this.upgradeUrl = res.data.data.wgtUrl
|
||||
this.$refs.yomolUpgrade.show()
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: (error) => {
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
```
|
||||
+196
@@ -0,0 +1,196 @@
|
||||
<template>
|
||||
<view v-if="visible" class="mark">
|
||||
<view class="view">
|
||||
<text class="title">{{title}}</text>
|
||||
<view class="tip">新版更新内容</view>
|
||||
<scroll-view class="scroll" scroll-y>
|
||||
<view class="item">
|
||||
{{content}}
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view v-if="!downloading" class="btns">
|
||||
<image class="icon" src="https://download.cheshangji.cn/app/upgrade.png"></image>
|
||||
<view class="sure" @click="onSureClick()">马上升级</view>
|
||||
</view>
|
||||
<cmd-progress v-else class="progress" type="circle" stroke-color="#C40000" :percent="progress" @description></cmd-progress>
|
||||
<!-- <image src="@/static/login/icon-clear.png" style="height: 30upx;width: 30upx;position: absolute;right: 20upx;top: 20upx;" @click="onCancelClick"></image> -->
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import cmdProgress from '../cmd-progress/cmd-progress.vue'
|
||||
export default {
|
||||
components: {
|
||||
cmdProgress
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
progress: 0,
|
||||
contents: [],
|
||||
downloading: false,
|
||||
success: true
|
||||
}
|
||||
},
|
||||
props: {
|
||||
type: {
|
||||
type: String,
|
||||
default: 'pkg'
|
||||
},
|
||||
url: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: '版本更新'
|
||||
},
|
||||
content: {
|
||||
type: String,
|
||||
default: ""
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
show(data) {
|
||||
if(data.Fversiondownloadurl && data.Fversionupdatedesc.length > 0){
|
||||
this.url = data.Fversiondownloadurl;
|
||||
this.content = data.Fversionupdatedesc;
|
||||
this.visible = true;
|
||||
}
|
||||
},
|
||||
hide(){
|
||||
setTimeout(() => {
|
||||
this.visible = false
|
||||
}, 100);
|
||||
},
|
||||
onCancelClick(){
|
||||
this.hide()
|
||||
},
|
||||
onSureClick(){
|
||||
console.log("+++++PR1++++"+this.url);
|
||||
console.log("+++++PR2++++"+this.content);
|
||||
// #ifdef APP-PLUS
|
||||
var platform = uni.getSystemInfoSync().platform
|
||||
if(platform == 'ios' && this.type == 'pkg'){
|
||||
plus.runtime.openURL(this.url);
|
||||
}else{
|
||||
this.downloading = true
|
||||
var downloadTask = uni.downloadFile({
|
||||
url: this.url,
|
||||
success: (downloadResult) => {
|
||||
console.log("--------this.url------"+this.url);
|
||||
console.log("--------downloadResult.statusCode------"+downloadResult.statusCode);
|
||||
this.hide()
|
||||
if (downloadResult.statusCode === 200) {
|
||||
plus.runtime.install(downloadResult.tempFilePath, {
|
||||
force: false
|
||||
}, function() {
|
||||
plus.runtime.restart();
|
||||
}, (e) => {
|
||||
console.log(e);
|
||||
this.success = false
|
||||
uni.showToast({
|
||||
title: '安装升级包失败',
|
||||
icon: 'none'
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
downloadTask.onProgressUpdate((e)=>{
|
||||
this.progress = e.progress
|
||||
})
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.mark{
|
||||
position: fixed;
|
||||
top: 0;
|
||||
margin: auto;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background: rgba(0,0,0,0.6);
|
||||
display: flex;
|
||||
flex-flow: row nowrap;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.view{
|
||||
position: relative;
|
||||
width: 80vw;
|
||||
background-color: white;
|
||||
border-radius: 15upx;
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.title{
|
||||
margin-top: 20upx;
|
||||
color: #C40000;
|
||||
font-weight: bold;
|
||||
font-size: 38upx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.tip{
|
||||
margin-top: 20upx;
|
||||
margin-left: 30upx;
|
||||
align-self: flex-start;
|
||||
font-size: 32upx;
|
||||
font-weight: 600;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.scroll{
|
||||
width: 100%;
|
||||
height: 300upx;
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.item{
|
||||
margin-left: 50upx;
|
||||
text-align: left;
|
||||
font-size: 30upx;
|
||||
}
|
||||
|
||||
.btns{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-flow: row nowrap;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-bottom: 10upx;
|
||||
}
|
||||
|
||||
.icon{
|
||||
width: 45upx;
|
||||
height: 45upx;
|
||||
margin-right: 10upx;
|
||||
}
|
||||
|
||||
.sure{
|
||||
padding: 10upx 0;
|
||||
text-align: center;
|
||||
color: #C40000;
|
||||
font-size: 30upx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.progress{
|
||||
margin-bottom: 60upx;
|
||||
}
|
||||
|
||||
</style>
|
||||
Reference in new issue
Block a user