index.vue 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <view class="app-container">
  3. <uni-nav-bar ref="refTitle" dark :fixed="true" shadow background-color="#007AFF" status-bar
  4. :title="title"/>
  5. <uni-section title="基本功能" subTitle="" type="line">
  6. <view class="warp">
  7. <button class="button" type="primary" @click="version">检查更新</button>
  8. </view>
  9. <view class="warp">
  10. <button class="button" type="primary" @click="moveReviewe">移位审核人</button>
  11. </view>
  12. </uni-section>
  13. <uni-section title="退出登录" subTitle="" type="line">
  14. <view class="warp">
  15. <button class="button" type="primary" @click="logOut">退出</button>
  16. </view>
  17. </uni-section>
  18. </view>
  19. </template>
  20. <script>
  21. import silenceUpdate from '@/uni_modules/rt-uni-update/js_sdk/silence-update.js'//引入静默更新
  22. import { latestEdition,download } from '@/api/wms/report.js'
  23. import request from '@/utils/request'
  24. export default {
  25. data() {
  26. return {
  27. title:"设置",
  28. };
  29. },
  30. methods:{
  31. logOut(){
  32. // 跳转到登录页面或其他需要重新登录的页面
  33. uni.navigateTo({
  34. url: '/pages/login'
  35. });
  36. },
  37. version(){
  38. //获取版本号,必须为数字
  39. let edition_number = ""
  40. try{
  41. plus.runtime.getProperty(plus.runtime.appid,(inf) => {
  42. edition_number = inf.versionCode
  43. //获取版本号,如果没有缓存的版本号再取app的版本号
  44. //传参
  45. let params = {
  46. edition_number: edition_number
  47. }
  48. //查询新版本接口
  49. latestEdition(params).then(res => {
  50. if(res.code === 200 && res.data){
  51. let baseUrl = uni.getStorageSync("baseUrl");
  52. res.data.edition_url = res.data.edition_url.replace("${baseUrl}",baseUrl);
  53. if (res.data.package_type == 1 && res.data.edition_silence == 1) {
  54. //调用静默更新方法 传入下载地址
  55. silenceUpdate(res.data)
  56. } else {
  57. //跳转更新页面 (注意!!!如果pages.json第一页的代码里有一打开就跳转其他页面的操作,下面这行代码最好写在setTimeout里面设置延时3到5秒再执行)
  58. uni.navigateTo({
  59. url: '/uni_modules/rt-uni-update/components/rt-uni-update/rt-uni-update?obj=' +
  60. JSON.stringify(res.data)
  61. });
  62. }
  63. }else{
  64. uni.showToast({
  65. title: '已是最新版本',
  66. icon: 'none'
  67. })
  68. }
  69. });
  70. })
  71. }catch(e){}
  72. },
  73. moveReviewe(){
  74. uni.navigateTo({
  75. url: "/pages/menu/stockMove/reviewerEdit"
  76. });
  77. },
  78. },
  79. onLoad: function (options) {
  80. this.$nextTick(() => {
  81. this.title = "设置("+ uni.getStorageSync('name') +")";
  82. });
  83. },
  84. }
  85. </script>
  86. <style lang="less">
  87. .warp .button{
  88. margin:5px;
  89. }
  90. </style>