| | |
| | | <script> |
| | | export default { |
| | | globalData: { |
| | | baseHttp: '', |
| | | baseUrll: '', |
| | | upVersion: 0, |
| | | }, |
| | | onLaunch: function() { |
| | | console.log('App Launch') |
| | | }, |
| | | onShow: function() { |
| | | // this.getVersion(); |
| | | // this.baseUrll = uni.getStorageSync("baseUrl") |
| | | console.log('App Show') |
| | | }, |
| | | onHide: function() { |
| | | console.log('App Hide') |
| | | }, |
| | | methods: { |
| | | //检测当前平台,如果是安卓则启动安卓更新 |
| | | getVersion() { |
| | | let that = this; |
| | | uni.getSystemInfo({ |
| | | success: (res) => { |
| | | if (res.platform == "android") { |
| | | that.AndroidCheckUpdate(); |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | // 获取当前版本号 |
| | | AndroidCheckUpdate() { |
| | | let that = this; |
| | | plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => { |
| | | that.version = wgtinfo.version //客户端版本号 |
| | | }) |
| | | setTimeout(()=>{ |
| | | that.getUpdateVersion() |
| | | },100) |
| | | }, |
| | | // 校验版本 |
| | | getUpdateVersion() { |
| | | let that = this |
| | | let type = 0 |
| | | if (that.baseUrl == 'http://undefined:undefined/undefined') { |
| | | return |
| | | } |
| | | |
| | | let url = that.baseUrl + '/appVersion/checkUpdate/' + that.version + '/' + type |
| | | uni.request({ |
| | | url: url, |
| | | method: 'GET', |
| | | success(res) { |
| | | console.log(res); |
| | | var res = res.data |
| | | if (res.data) { |
| | | that.filename = res.data.path |
| | | that.dialogContent = '发现新版本:' + res.data.version + ', 是否立即更新' |
| | | that.$refs.upVersion.open() |
| | | } else { |
| | | uni.showToast({ |
| | | title: res.msg, |
| | | icon: "none", |
| | | position: 'top' |
| | | }) |
| | | } |
| | | |
| | | } |
| | | }) |
| | | }, |
| | | dialogConfirm() { |
| | | this.$refs.upVersion.close() |
| | | this.downWgt() |
| | | }, |
| | | dialogClose() { |
| | | this.$refs.upVersion.close() |
| | | }, |
| | | downWgt() { |
| | | let that = this; |
| | | const downloadUrl = that.baseUrl + "/appVersion/downloadApp/" + that.filename |
| | | uni.showLoading({ |
| | | title: '更新中……' |
| | | }) |
| | | const downloadTask = uni.downloadFile({ //执行下载 |
| | | url: downloadUrl, //下载地址 |
| | | timeout: 1000 * 30, //30秒超时时间 |
| | | success: downloadResult => { //下载成功 |
| | | console.log(downloadResult); |
| | | that.showdownLine = false |
| | | uni.hideLoading(); |
| | | if (downloadResult.statusCode == 200) { |
| | | uni.showModal({ |
| | | title: '', |
| | | content: '更新成功,确定现在重启吗?', |
| | | confirmText: '重启', |
| | | confirmColor: '#EE8F57', |
| | | success: function(res) { |
| | | if (res.confirm == true) { |
| | | plus.runtime.install( //安装 |
| | | downloadResult.tempFilePath, { |
| | | force: true |
| | | }, |
| | | function(res) { |
| | | utils.showToast('更新成功,重启中'); |
| | | plus.runtime.restart(); |
| | | } |
| | | ); |
| | | } |
| | | } |
| | | }); |
| | | } else { |
| | | uni.hideLoading(); |
| | | that.showdownLine = false |
| | | uni.showToast({ |
| | | title:'请先上传安装包', |
| | | icon: 'error' |
| | | }) |
| | | } |
| | | }, |
| | | fail: err => { |
| | | uni.hideLoading(); |
| | | that.showdownLine = false |
| | | that.$u.toast(downloadResult.errMsg) |
| | | }, |
| | | complete: com => { |
| | | |
| | | console.log(com) |
| | | } |
| | | }); |
| | | |
| | | // 下载进度 |
| | | downloadTask.onProgressUpdate(res => { |
| | | that.downloadNum = res.progress |
| | | console.log('下载进度' + that.downloadNum); |
| | | }); |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | |
| | | export default { |
| | | data() { |
| | | return { |
| | | id: 0, |
| | | type: 'add', |
| | | orderIds: [], |
| | | orderId: '', |
| | |
| | | subTitle: '同行人', |
| | | placeholder: '请输入同行人', |
| | | placeholderStyle: 'font-size:20rpx', |
| | | value: '同行人', |
| | | value: '', |
| | | type: 'businessPeers', |
| | | inputType: 'input', |
| | | required: true |
| | |
| | | subTitle: '备注', |
| | | placeholder: '备注信息', |
| | | placeholderStyle: 'font-size:20rpx', |
| | | value: '备注', |
| | | value: '', |
| | | inputType: 'input', |
| | | type: 'businessNotes' |
| | | } |
| | |
| | | _this.form2[0].info[0].required = false |
| | | } |
| | | }) |
| | | |
| | | // 修改页面回传 |
| | | |
| | | eventChannel.on('modiGoBusinessDetl', function(data) { |
| | | if (data.data == 'modi') { |
| | | _this.form2[0].info[0].unshow = true |
| | | _this.form2[0].info[0].required = false |
| | | _this.form2[0].info[0].submitVal = data.detl.orderId |
| | | _this.type = 'modi' |
| | | _this.id = data.detl.id |
| | | for (let item of _this.form2) { |
| | | for (let subItem of item.info) { |
| | | // 输入框直接赋值 |
| | | if (subItem.inputType == 'input') { |
| | | subItem.value = data.detl[subItem.type] |
| | | } else if (subItem.inputType == 'select' || subItem.inputType == 'data') { |
| | | if (subItem.type == 'businessTransportation') { |
| | | subItem.value = _this.businessTransportations[0][data.detl[subItem.type]] |
| | | subItem.submitVal = data.detl[subItem.type] |
| | | } else if (subItem.type == 'businessReturn') { |
| | | subItem.value = _this.businessReturns[0][data.detl[subItem.type]] |
| | | subItem.submitVal = data.detl[subItem.type] |
| | | } else if (subItem.type == 'businessStartTimeDay') { |
| | | subItem.value = _this.businessStartTimeDays[0][data.detl[subItem.type]] |
| | | subItem.submitVal = data.detl[subItem.type] |
| | | } else if (subItem.type == 'businessEndTimeDay') { |
| | | subItem.value = _this.businessEndTimeDays[0][data.detl[subItem.type]] |
| | | subItem.submitVal = data.detl[subItem.type] |
| | | } else if (subItem.type == 'pcdStart') { |
| | | subItem.value = data.detl.pcdStart$ |
| | | subItem.submitVal = data.detl.pcdStart |
| | | } else if (subItem.type == 'pcdEnd') { |
| | | subItem.value = data.detl.pcdEnd$ |
| | | subItem.submitVal = data.detl.pcdEnd |
| | | } else { |
| | | subItem.value = data.detl[subItem.type] |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | }) |
| | | }, |
| | | mounted() { |
| | | this.handlePcd(); |
| | |
| | | let _this = this |
| | | uni.request({ |
| | | url: `${_this.baseUrl}/orderQueryName/auth`, |
| | | header: { 'token': uni.getStorageSync('token') }, |
| | | sslVerify: false, |
| | | header: { |
| | | 'token': uni.getStorageSync('token'), |
| | | 'content-type': 'application/x-www-form-urlencoded;charset=UTF-8', |
| | | }, |
| | | method: 'POST', |
| | | data: {condition: condition}, |
| | | success(res) { |
| | |
| | | if (sub.required) { |
| | | sub.placeholderStyle = 'font-size:20rpx;' |
| | | if (sub.value == '' || (sub.submitVal == '' && sub.submitVal < 0)) { |
| | | // console.log(sub); |
| | | sub.placeholderStyle = 'font-size:20rpx;color:red' |
| | | subPass = false |
| | | } |
| | |
| | | |
| | | } |
| | | } |
| | | this.formAdd(this.form) |
| | | // console.log(subPass); |
| | | // subPass 表单是否填写完成 |
| | | if (subPass) { |
| | | // console.log(this.form); |
| | | if (this.type == 'add') { |
| | | this.formAdd(this.form) |
| | | } else { |
| | | this.form['id'] = this.id |
| | | this.formModi(this.form) |
| | | } |
| | | } |
| | | |
| | | }, |
| | | formAdd(form) { |
| | | let _this = this |
| | |
| | | uni.navigateBack({}) |
| | | },1000) |
| | | } else if (res.code === 500) { |
| | | uni.showToast({title: '添加成功', icon: "none", position: 'top'}) |
| | | uni.showToast({title: res.msg, icon: "none", position: 'top'}) |
| | | } else { |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | }) |
| | | }, |
| | | formModi(form) { |
| | | let _this = this |
| | | uni.request({ |
| | | url: `${_this.baseUrl}/businessTrip/update/auth`, |
| | | header: { |
| | | 'token': uni.getStorageSync('token'), |
| | | 'content-type': 'application/x-www-form-urlencoded;charset=UTF-8' |
| | | }, |
| | | sslVerify: false, |
| | | data: form, |
| | | method: 'POST', |
| | | success(res) { |
| | | res = res.data |
| | | if (res.code === 200) { |
| | | uni.showToast({title: '修改成功', icon: "none", position: 'top'}) |
| | | setTimeout(()=>{ |
| | | uni.navigateBack({delta:2}) |
| | | },1000) |
| | | } else if (res.code === 500) { |
| | | uni.showToast({title: res.msg, icon: "none", position: 'top'}) |
| | | } else { |
| | | |
| | | } |
| | |
| | | |
| | | <view class="floor"> |
| | | <view class="wran">删除</view> |
| | | <view class="default" v-show="settle == 1">修改</view> |
| | | <view class="default" v-show="settle == 1" @click="edit()">修改</view> |
| | | <view class="primary" @click="submit()">{{subTitle}}</view> |
| | | </view> |
| | | </view> |
| | |
| | | reimburse() { |
| | | |
| | | }, |
| | | edit() { |
| | | let _this = this |
| | | uni.navigateTo({ |
| | | url: '/pages/business/goBusiness/addgoBusiness', |
| | | success: function(res) { |
| | | res.eventChannel.emit('modiGoBusinessDetl', { |
| | | data: 'modi', |
| | | detl: _this.list[0] |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | back() { |
| | | uni.navigateBack({}) |
| | | }, |
| | |
| | | <!-- 其他信息 --> |
| | | |
| | | <view class="container" v-show="info.length > 0"> |
| | | <view><y-title title="个新华配置"></y-title></view><view></view> |
| | | <view><y-title title="个性化"></y-title></view><view></view> |
| | | </view> |
| | | <view class="detail-box"> |
| | | <plan-detail :info="info"></plan-detail> |
| | |
| | | <view class="loging"> |
| | | <button class="button" @click="onLogin()" :loading="load.loading">{{load.btnText}}</button> |
| | | </view> |
| | | |
| | | <view> |
| | | <!-- 提示窗示例 --> |
| | | <uni-popup ref="upVersion" type="dialog"> |
| | | <uni-popup-dialog :type="msgType" title="通知" :content="dialogContent" @confirm="dialogConfirm" |
| | | @close="dialogClose"></uni-popup-dialog> |
| | | </uni-popup> |
| | | </view> |
| | | |
| | | <!-- #ifdef APP-PLUS --> |
| | | <view class="version"> |
| | | 当前版本: {{version}} |
| | |
| | | loading: false, |
| | | btnText: '登录' |
| | | }, |
| | | msgType: 'success', |
| | | filename: '', |
| | | dialogContent: '' |
| | | } |
| | | }, |
| | | onLoad: function() { |
| | |
| | | that.version = wgtinfo.version |
| | | }); |
| | | // #endif |
| | | }, |
| | | onShow() { |
| | | this.getVersion() |
| | | |
| | | }, |
| | | methods: { |
| | | changePassword: function() { |
| | | this.showPassword = !this.showPassword; |
| | | }, |
| | | //检测当前平台,如果是安卓则启动安卓更新 |
| | | getVersion() { |
| | | let that = this; |
| | | uni.getSystemInfo({ |
| | | success: (res) => { |
| | | //检测当前平台,如果是安卓则启动安卓更新 |
| | | if (res.platform == "android") { |
| | | that.AndroidCheckUpdate(); |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | // 获取当前版本号 |
| | | AndroidCheckUpdate() { |
| | | let that = this; |
| | | plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => { |
| | | that.version = wgtinfo.version //客户端版本号 |
| | | console.log('当前app版本信息:' + that.version); |
| | | }) |
| | | that.getUpdateVersion() |
| | | setTimeout(()=>{ |
| | | that.getUpdateVersion() |
| | | },100) |
| | | }, |
| | | // 校验版本 |
| | | getUpdateVersion() { |
| | | let that = this |
| | | let type = 0 |
| | | if (that.baseUrl == 'http://undefined:undefined/undefined') { |
| | | return |
| | | } |
| | | |
| | | let url = that.baseUrl + '/appVersion/checkUpdate/' + that.version + '/' + type |
| | | uni.request({ |
| | | url: url, |
| | | method: 'GET', |
| | | success(res) { |
| | | console.log(res); |
| | | var res = res.data |
| | | if (res.data) { |
| | | that.filename = res.data.path |
| | | that.dialogContent = '发现新版本:' + res.data.version + ', 是否立即更新' |
| | | that.$refs.upVersion.open() |
| | | } else { |
| | | uni.showToast({ |
| | | title: res.msg, |
| | | icon: "none", |
| | | position: 'top' |
| | | }) |
| | | } |
| | | |
| | | } |
| | | }) |
| | | }, |
| | | dialogConfirm() { |
| | | this.$refs.upVersion.close() |
| | | this.downWgt() |
| | | }, |
| | | dialogClose() { |
| | | this.$refs.upVersion.close() |
| | | }, |
| | | downWgt() { |
| | | let that = this; |
| | | // 获取当前app版本信息 |
| | | return |
| | | that.$req.get("/appUpdate/queryUpdate", {}, {}).then(function(res) { |
| | | console.log('res.data:' + JSON.stringify(res.data)) |
| | | console.log("现在的版本" + that.version + "数据库版本" + res.data.data.version + "进入查找app版本"); |
| | | if (res.data.data.version > that.version) { |
| | | // 这里下载apkurl从/appUpdate/queryUpdate接口请求返回数据中获取 |
| | | that.downloadUrl = BaseUrl + '/' + res.data.data.androidUrl |
| | | // 是否强制更新(0 否;1 是) |
| | | that.isForceUpdate = res.data.data.isForceUpdate |
| | | uni.showModal({ |
| | | // 更新提醒 |
| | | title: '发现新版本,是否更新', |
| | | content: '此版本号:' + that.version + '\xa0\xa0\xa0' + '待更新版本号:' + res.data.data |
| | | .version, |
| | | success: res => { |
| | | if (res.confirm) { |
| | | that.downWgt(); //下载文件 |
| | | // that.showdownLine = true; |
| | | // plus.runtime.openURL(androidUrl) |
| | | } else if (res.cancel) { |
| | | console.log('that.isForceUpdate:' + that.isForceUpdate); |
| | | // 不更新强制退出app |
| | | if (that.isForceUpdate == 1) { |
| | | console.log('that.isForceUpdate1:' + that.isForceUpdate); |
| | | uni.showModal({ |
| | | // 更新提醒 |
| | | title: '发现新版本,是否更新', |
| | | content: '此版本为强制更新版本如不升级将退出APP', |
| | | success: res => { |
| | | if (res.confirm) { |
| | | console.log('不更新强制退出app'); |
| | | plus.runtime.quit(); |
| | | } else if (res.cancel) { |
| | | that.AndroidCheckUpdate(); |
| | | } |
| | | const downloadUrl = that.baseUrl + "/appVersion/downloadApp/" + that.filename |
| | | uni.showLoading({ |
| | | title: '更新中……' |
| | | }) |
| | | const downloadTask = uni.downloadFile({ //执行下载 |
| | | url: downloadUrl, //下载地址 |
| | | timeout: 1000 * 30, //30秒超时时间 |
| | | success: downloadResult => { //下载成功 |
| | | console.log(downloadResult); |
| | | that.showdownLine = false |
| | | uni.hideLoading(); |
| | | if (downloadResult.statusCode == 200) { |
| | | uni.showModal({ |
| | | title: '', |
| | | content: '更新成功,确定现在重启吗?', |
| | | confirmText: '重启', |
| | | confirmColor: '#EE8F57', |
| | | success: function(res) { |
| | | if (res.confirm == true) { |
| | | plus.runtime.install( //安装 |
| | | downloadResult.tempFilePath, { |
| | | force: true |
| | | }, |
| | | function(res) { |
| | | utils.showToast('更新成功,重启中'); |
| | | plus.runtime.restart(); |
| | | } |
| | | }); |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | //dtask.start(); |
| | | }); |
| | | } else { |
| | | uni.hideLoading(); |
| | | that.showdownLine = false |
| | | uni.showToast({ |
| | | title:'请先上传安装包', |
| | | icon: 'error' |
| | | }) |
| | | } |
| | | }, |
| | | fail: err => { |
| | | uni.hideLoading(); |
| | | that.showdownLine = false |
| | | that.$u.toast(downloadResult.errMsg) |
| | | }, |
| | | complete: com => { |
| | | |
| | | console.log(com) |
| | | } |
| | | }).catch(error => { |
| | | uni.showToast({ |
| | | title: '调用请求失败', |
| | | mask: false, |
| | | duration: 5000, |
| | | icon: "none" |
| | | }); |
| | | }); |
| | | complete: () => {} |
| | | |
| | | // 下载进度 |
| | | downloadTask.onProgressUpdate(res => { |
| | | that.downloadNum = res.progress |
| | | console.log('下载进度' + that.downloadNum); |
| | | }); |
| | | }, |
| | | onLogin() { |
| | | let that = this |