更新功能对接

master
guoshuang 2 years ago
parent f3c51e150f
commit 7f3218a911

@ -34,7 +34,7 @@
</view>
</view>
<view class="astyle">
<view @click="checkupdate"> </view>
<view @click="checkupdate()"> </view>
<!-- <u-button
@click.native="
uni.navigateTo({
@ -64,7 +64,7 @@ export default class RawHome extends BasePage {
model = model;
src: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg';
today = dayjs().format('YYYY-MM-DD dddd');
version: '0.01';
version = '0.0.0';
checkversion: any = {};
onLoad() {
// this.model.getMenuList();
@ -94,18 +94,18 @@ export default class RawHome extends BasePage {
}
async checkupdate() {
try {
this.checkversion = await model.checkupdate();
const queryversion = this.checkversion.Version.match(/\d+\.\d+\.\d+/)[0];
let versionNumber = this.compareVersion(this.version, queryversion);
versionNumber = 1;
await this.model.checkupdate();
const queryversion = this.model.checkversion.version;
//const queryversion = this.checkversion.Version.match(/\d+\.\d+\.\d+/)[0];
let versionNumber = this.compareVersion(this.version, queryversion); //this.version, queryversion
if (versionNumber == -1) {
//
uni.showModal({
content: '新版本为:' + this.checkversion.Version + ',' + '是否更新?',
content: '新版本为:' + this.model.checkversion.version + ',' + '是否更新?',
success: (res) => {
if (res.confirm) {
//
let downloadApkUrl = this.checkversion.url;
let downloadApkUrl = this.checkversion.fileAddress;
uni.showLoading({
title: '下载中',
});

@ -1,44 +1,24 @@
import { getModule, Module, MutationAction, VuexModule } from 'vuex-module-decorators';
import store from '@/store';
import http from '@/utils/request';
//import { url } from '@/utils/url';
//import { session } from '@/store/modules/session';
//import { stringify } from 'query-string';
// import { url } from '@/utils/url';
// import { session } from '@/store/modules/session';
@Module({
namespaced: true,
dynamic: true,
store,
name: 'product.model',
name: 'page.shouye',
})
export class ReceiptModule extends VuexModule {
/**
*
*/
menuList = [];
/**
*
*/
// @MutationAction
// async getMenuList() {
// const result: any = await http.post(
// url.menu,
// stringify({
// // factoryCode: session.factoryCode,
// loginName: session.loginName,
// resType: 4,
// }),
// );
// console.log('aaaa', result);
// const menuList = result.data;
// return { menuList };
// }
export class shouye extends VuexModule {
checkversion: any = {};
@MutationAction
async checkupdate() {
const result = await http.post('///');
const checkversion = result.data;
return checkversion;
const result: any = await http.post('/prod-api/system/apkFile/getLastApkVersion', {
factory: 1000,
});
const checkversion: any = result.data;
return { checkversion };
}
}
export default getModule(ReceiptModule);
export default getModule(shouye);

@ -26,7 +26,7 @@ http.interceptors.request.use(
// if (config.url.includes('/api')) {
// config.baseURL = 'http://192.168.202.23:5001';
// } else {
// config.baseURL = 'http://192.168.202.20:9000';
// config.baseURL = 'http://192.168.202.34:30000';
// }
// 所有请求默认提示加载中
if (!loading) {

@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
const qianzhuione = '/dev-api'; // '/prod-api'生产环境 // '/dev-api'开发环境是调后端本地时使用
const qianzhuione = '/prod-api'; // '/prod-api'生产环境 // '/dev-api'开发环境是调后端本地时使用
// const qianzhuione = '/prod-api';
export const url = {
wmspda: {

@ -3,9 +3,9 @@ module.exports = {
proxy: {
'/prod-api': {
//正式生产
//target: 'http://192.168.202.34:30000',
target: 'http://192.168.202.34:30000',
//测试生产
target: 'http://192.168.202.20:9000',
//target: 'http://192.168.202.20:9000',
changeOrigin: true,
// pathRewrite: {
// '^/prod-ap': '',

Loading…
Cancel
Save