版本更新增加
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
"version" : "1.0",
|
"version" : "1.0",
|
||||||
"configurations" : [
|
"configurations" : [
|
||||||
{
|
{
|
||||||
"playground" : "custom",
|
"playground" : "standard",
|
||||||
"type" : "uni-app:app-android"
|
"type" : "uni-app:app-android"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
23
App.vue
23
App.vue
@@ -1,6 +1,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import { init } from '@/api/init.js';
|
import { ref } from 'vue';
|
||||||
import http from '@/http/http.js';
|
import { init,commonType } from '@/api/init.js';
|
||||||
export default {
|
export default {
|
||||||
onLaunch: function () {
|
onLaunch: function () {
|
||||||
console.log('App Launch');
|
console.log('App Launch');
|
||||||
@@ -11,17 +11,20 @@ export default {
|
|||||||
// } else {
|
// } else {
|
||||||
// uni.setStorageSync('isAI', false)
|
// uni.setStorageSync('isAI', false)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
onShow: function () {
|
onShow: function () {
|
||||||
init();
|
|
||||||
// ios是否在审核
|
// ios是否在审核
|
||||||
http.request({
|
commonType(919).then(res=>{
|
||||||
url: '/common/type/919'
|
uni.setStorageSync('isExamine', res.value);
|
||||||
}).then((res) => {
|
})
|
||||||
if (res.code == 0) {
|
// 热搜词
|
||||||
uni.setStorageSync('isExamine', res.data.value);
|
commonType(249).then(res=>{
|
||||||
}
|
uni.setStorageSync('moreSearch', res.value)
|
||||||
});
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
onHide: function () {
|
onHide: function () {
|
||||||
console.log('App Hide');
|
console.log('App Hide');
|
||||||
|
|||||||
@@ -1,5 +1,16 @@
|
|||||||
import http from '@/http/http.js'
|
import http from '@/http/http.js'
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取APP版本信息
|
||||||
|
*/
|
||||||
|
export const selectNewApp = (data) => {
|
||||||
|
return http.request({
|
||||||
|
url: '/user/selectNewApp',
|
||||||
|
data: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户信息
|
* 获取用户信息
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -53,6 +53,15 @@
|
|||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
</u-modal>
|
</u-modal>
|
||||||
|
|
||||||
|
<u-modal :show="datas.version.show" :confirm-text="datas.version.confirmText" :showCancelButton="datas.version.cancelText" @confirm='confirmUpdateVersion'
|
||||||
|
:title="datas.version.title" :title-style="{ fontWeight: '700' }" confirm-color="rgb(255, 117, 129)" @cancel="datas.version.show = false">
|
||||||
|
<view class="" style="padding-top: 30rpx;text-align: left;">
|
||||||
|
<scroll-view scroll-y="true" style="max-height: 50vh;">
|
||||||
|
<rich-text style="color:#666" :nodes="datas.version.content"></rich-text>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
</u-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
@@ -65,6 +74,9 @@ import {
|
|||||||
onReachBottom
|
onReachBottom
|
||||||
} from '@dcloudio/uni-app'
|
} from '@dcloudio/uni-app'
|
||||||
import contentlist from './components/contentlist.vue'
|
import contentlist from './components/contentlist.vue'
|
||||||
|
import { selectNewApp } from '@/api/user/user.js';
|
||||||
|
import config from '@/commons/config.js';
|
||||||
|
import { linkTo } from '@/utils/app.js';
|
||||||
let datas = reactive({
|
let datas = reactive({
|
||||||
noticeList: [], //公告列表
|
noticeList: [], //公告列表
|
||||||
|
|
||||||
@@ -78,9 +90,18 @@ let datas = reactive({
|
|||||||
rule_content: '', // 首页弹窗内容
|
rule_content: '', // 首页弹窗内容
|
||||||
|
|
||||||
//ios是否在审核 1是审核
|
//ios是否在审核 1是审核
|
||||||
isExamine: uni.getStorageSync('isExamine')
|
isExamine: uni.getStorageSync('isExamine'),
|
||||||
|
|
||||||
|
version: {
|
||||||
|
show: false,
|
||||||
|
title: "",
|
||||||
|
content: "",
|
||||||
|
confirmText: "",
|
||||||
|
cancelText: "",
|
||||||
|
}
|
||||||
})
|
})
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
|
versionUpdate()
|
||||||
getMsg()
|
getMsg()
|
||||||
getrecomVideo()
|
getrecomVideo()
|
||||||
getPop()
|
getPop()
|
||||||
@@ -90,6 +111,79 @@ onReachBottom(() => {
|
|||||||
++datas.page
|
++datas.page
|
||||||
getrecomVideo()
|
getrecomVideo()
|
||||||
})
|
})
|
||||||
|
function versionUpdate(){
|
||||||
|
//#ifdef APP-PLUS
|
||||||
|
plus.screen.lockOrientation('portrait-primary'); //竖屏正方向锁定
|
||||||
|
//获取当前系统版本信息
|
||||||
|
plus.runtime.getProperty(plus.runtime.appid, widgetInfo => {
|
||||||
|
//请求后台接口 解析数据 对比版本
|
||||||
|
selectNewApp().then(res => {
|
||||||
|
res = res[0];
|
||||||
|
let version;
|
||||||
|
if (uni.getSystemInfoSync().platform == 'android') {
|
||||||
|
version = res.version
|
||||||
|
}
|
||||||
|
if (uni.getSystemInfoSync().platform == 'ios') {
|
||||||
|
version = res.iosVersion
|
||||||
|
}
|
||||||
|
console.log(widgetInfo.version+'---'+version)
|
||||||
|
version = res.version
|
||||||
|
// && uni.getSystemInfoSync().platform == 'android'
|
||||||
|
if (widgetInfo.version < version) {
|
||||||
|
let downloadLink = '';
|
||||||
|
let androidLink = res.androidWgtUrl;
|
||||||
|
let iosLink = res.iosWgtUrl;
|
||||||
|
datas.version.show = true;
|
||||||
|
datas.version.title = "发现新版本";
|
||||||
|
datas.version.content = res.des;
|
||||||
|
if (res.method == "true") {
|
||||||
|
datas.version.confirmText = "立即更新"
|
||||||
|
} else {
|
||||||
|
datas.version.confirmText = "立即更新"
|
||||||
|
datas.version.cancelText = "下次更新"
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
//#endif
|
||||||
|
}
|
||||||
|
function confirmUpdateVersion(){
|
||||||
|
// plus.runtime.openURL(config.baseUrl + '/pages/login/appEq')
|
||||||
|
linkTo('/pages/login/download')
|
||||||
|
return
|
||||||
|
uni.showLoading({
|
||||||
|
title: '下载中...',
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
if (uni.getSystemInfoSync().platform == 'android') {
|
||||||
|
uni.downloadFile({
|
||||||
|
url: androidLink,
|
||||||
|
success: downloadResult => {
|
||||||
|
console.log(downloadResult)
|
||||||
|
if (downloadResult.statusCode === 200) {
|
||||||
|
plus.runtime .install(
|
||||||
|
downloadResult.tempFilePath, {
|
||||||
|
force: false
|
||||||
|
},
|
||||||
|
d => {
|
||||||
|
console.log('install success...');
|
||||||
|
plus.runtime
|
||||||
|
.restart();
|
||||||
|
},
|
||||||
|
e => {
|
||||||
|
console.log(e)
|
||||||
|
console.error('install fail...');
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (uni.getSystemInfoSync().platform == 'ios') {
|
||||||
|
plus.runtime.openURL(iosLink, function(res) {});
|
||||||
|
}
|
||||||
|
}
|
||||||
// 跳转公告链接
|
// 跳转公告链接
|
||||||
function goMsg(url) {
|
function goMsg(url) {
|
||||||
// if (url.indexOf('/pages/') !== -1 || url.indexOf('/me/') !== -1) {
|
// if (url.indexOf('/pages/') !== -1 || url.indexOf('/me/') !== -1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user