更新功能对接

master
guoshuang 2 years ago
parent f3c51e150f
commit 7f3218a911

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

@ -3,42 +3,22 @@ import store from '@/store';
import http from '@/utils/request'; import http from '@/utils/request';
// import { url } from '@/utils/url'; // import { url } from '@/utils/url';
// import { session } from '@/store/modules/session'; // import { session } from '@/store/modules/session';
//import { stringify } from 'query-string';
@Module({ @Module({
namespaced: true, namespaced: true,
dynamic: true, dynamic: true,
store, store,
name: 'product.model', name: 'page.shouye',
}) })
export class ReceiptModule extends VuexModule { export class shouye extends VuexModule {
/** checkversion: any = {};
*
*/
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 };
// }
@MutationAction @MutationAction
async checkupdate() { async checkupdate() {
const result = await http.post('///'); const result: any = await http.post('/prod-api/system/apkFile/getLastApkVersion', {
const checkversion = result.data; factory: 1000,
return checkversion; });
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')) { // if (config.url.includes('/api')) {
// config.baseURL = 'http://192.168.202.23:5001'; // config.baseURL = 'http://192.168.202.23:5001';
// } else { // } else {
// config.baseURL = 'http://192.168.202.20:9000'; // config.baseURL = 'http://192.168.202.34:30000';
// } // }
// 所有请求默认提示加载中 // 所有请求默认提示加载中
if (!loading) { if (!loading) {

@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-unused-vars */ /* 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'; // const qianzhuione = '/prod-api';
export const url = { export const url = {
wmspda: { wmspda: {

@ -3,9 +3,9 @@ module.exports = {
proxy: { proxy: {
'/prod-api': { '/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, changeOrigin: true,
// pathRewrite: { // pathRewrite: {
// '^/prod-ap': '', // '^/prod-ap': '',

Loading…
Cancel
Save