168 lines
3.9 KiB
Vue
168 lines
3.9 KiB
Vue
<template>
|
|
<view class="app">
|
|
<image src="../../static/logo.png" mode=""></image>
|
|
<view class="title">
|
|
泉医到家
|
|
</view>
|
|
<u-toast ref="uToast" />
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
appLogin
|
|
} from '@/api/login/index.js'
|
|
import {
|
|
appFileInfoByOneId
|
|
} from '@/api/startup.js'
|
|
export default {
|
|
data() {
|
|
return {
|
|
apknumber: null,
|
|
};
|
|
},
|
|
onShow() {
|
|
this.info();
|
|
//自动更新
|
|
// var that = this;
|
|
// plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
|
|
// this.apknumber = wgtinfo.version
|
|
// appFileInfoByOneId().then(res => {
|
|
// if (res.fileVersion > this.apknumber) {
|
|
// uni.showToast({
|
|
// title: '有新的版本发布,程序已启动自动更新。新版本下载完成后将自动弹出安装程序。',
|
|
// mask: false,
|
|
// duration: 5000,
|
|
// icon: "none"
|
|
// });
|
|
// var dtask = plus.downloader.createDownload(
|
|
// res.fileUrl, {},
|
|
// function(d, status) {
|
|
// //下载完成
|
|
// if (status == 200) {
|
|
// plus.runtime.install(plus.io.convertLocalFileSystemURL(d
|
|
// .filename), {}, {}, function(error) {
|
|
// uni.showToast({
|
|
// title: '安装失败',
|
|
// mask: false,
|
|
// duration: 1500
|
|
// });
|
|
// })
|
|
// } else {
|
|
// uni.showToast({
|
|
// title: '更新失败',
|
|
// mask: false,
|
|
// duration: 1500
|
|
// });
|
|
// }
|
|
// });
|
|
// try {
|
|
// dtask.start(); // 开启下载的任务
|
|
// var prg = 0;
|
|
// var showLoading = plus.nativeUI.showWaiting(
|
|
// "正在下载"); //创建一个showWaiting对象
|
|
// dtask.addEventListener('statechanged', function(
|
|
// task,
|
|
// status
|
|
// ) {
|
|
// // 给下载任务设置一个监听 并根据状态 做操作
|
|
// switch (task.state) {
|
|
// case 1:
|
|
// showLoading.setTitle("正在下载");
|
|
// break;
|
|
// case 2:
|
|
// showLoading.setTitle("已连接到服务器");
|
|
// break;
|
|
// case 3:
|
|
// prg = parseInt(
|
|
// (parseFloat(task.downloadedSize) /
|
|
// parseFloat(task.totalSize)) *
|
|
// 100
|
|
// );
|
|
// showLoading.setTitle(" 正在下载" + prg + "% ");
|
|
// break;
|
|
// case 4:
|
|
// plus.nativeUI.closeWaiting();
|
|
// //下载完成
|
|
// break;
|
|
// }
|
|
// });
|
|
// } catch (err) {
|
|
// plus.nativeUI.closeWaiting();
|
|
// uni.showToast({
|
|
// title: '更新失败',
|
|
// mask: false,
|
|
// duration: 1500
|
|
// });
|
|
// that.info();
|
|
// }
|
|
// } else {
|
|
// that.info();
|
|
// }
|
|
// })
|
|
// })
|
|
},
|
|
methods: {
|
|
info() {
|
|
var that = this
|
|
try {
|
|
const value = uni.getStorageSync('phonenumber');
|
|
const value2 = uni.getStorageSync('password');
|
|
if (value && value2) {
|
|
appLogin(value, value2).then(res => {
|
|
if (res.code == 200) {
|
|
setTimeout(() => {
|
|
uni.reLaunch({
|
|
url: '/pages/homepage/homepage',
|
|
})
|
|
}, 2000);
|
|
} else {
|
|
setTimeout(() => {
|
|
uni.reLaunch({
|
|
url: '/pages/login/login'
|
|
});
|
|
}, 2000);
|
|
}
|
|
})
|
|
} else {
|
|
setTimeout(() => {
|
|
uni.reLaunch({
|
|
url: '/pages/login/login'
|
|
});
|
|
}, 2000);
|
|
}
|
|
} catch (e) {
|
|
setTimeout(() => {
|
|
uni.reLaunch({
|
|
url: '/pages/login/login'
|
|
});
|
|
}, 2000);
|
|
}
|
|
}
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
image {
|
|
width: 50%;
|
|
height: 200rpx;
|
|
position: absolute;
|
|
left: 25%;
|
|
top: 28%;
|
|
}
|
|
|
|
.title {
|
|
width: 80%;
|
|
height: 48rpx;
|
|
font-size: 49rpx;
|
|
text-align: center;
|
|
font-family: DengXian;
|
|
font-weight: bold;
|
|
color: #000000;
|
|
position: absolute;
|
|
top: 50%;
|
|
left: 10%;
|
|
}
|
|
</style>
|