setings.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <view class="content">
  3. <!-- #ifdef MP-WEIXIN -->
  4. <u-navbar :is-back="false" title=" " :background="{ background: '#ffffff' }" :border-bottom="false"></u-navbar>
  5. <!-- #endif -->
  6. <!-- #ifndef MP-WEIXIN -->
  7. <view class="status_bar"></view>
  8. <!-- #endif -->
  9. <u-cell-group>
  10. <u-cell-item title="账号与安全" @click="linkToAccount" :title-style="{ marginLeft: '10rpx' }"></u-cell-item>
  11. </u-cell-group>
  12. <view style="height: 10rpx;"></view>
  13. <u-cell-group>
  14. <u-cell-item @click="linkToCommon(index)" v-for="(item, index) in groupList" :key="index" :title="item.title" :title-style="{ marginLeft: '10rpx' }">
  15. </u-cell-item>
  16. </u-cell-group>
  17. <view style="height: 10rpx;"></view>
  18. <u-cell-group>
  19. <u-cell-item @tap="upApp" title="检查更新" :title-style="{ marginLeft: '10rpx' }">
  20. </u-cell-item>
  21. </u-cell-group>
  22. <!--<view style="height: 10rpx;"></view>
  23. <u-cell-group>
  24. <u-cell-item :arrow="false">
  25. <view style="text-align: center;">切换账号</view>
  26. </u-cell-item>
  27. </u-cell-group>-->
  28. <view style="height: 10rpx;"></view>
  29. <u-cell-group>
  30. <u-cell-item :arrow="false" @click="logout">
  31. <view style="text-align: center;">退出登录</view>
  32. </u-cell-item>
  33. </u-cell-group>
  34. </view>
  35. </template>
  36. <script>
  37. import apiconfig from '../../apiconfig.js'
  38. export default {
  39. data() {
  40. return {
  41. groupList: [
  42. /* { title: '新消息通知', color: '#409eff', icon: 'star' }, */
  43. /* { title: '隐私', color: '#409eff', icon: 'photo' }, */
  44. { title: '通用', color: '#409eff', icon: 'coupon' },
  45. /* { title: '帮助与反馈', color: '#ff9900', icon: 'heart' } */
  46. ],
  47. }
  48. },
  49. methods: {
  50. linkToCommon(index){
  51. this.$u.route({
  52. url: 'pages/my/common'
  53. });
  54. },
  55. linkToAccount(){
  56. this.$u.route({
  57. url: 'pages/my/account'
  58. });
  59. },
  60. logout(){
  61. uni.clearStorageSync();
  62. // this.$u.route({
  63. // url: 'pages/login/loginV2'
  64. // });
  65. this.$u.route({
  66. url: 'pages/login/loginV2'
  67. });
  68. },
  69. upApp(){
  70. // #ifdef APP-PLUS
  71. plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) {
  72. apiconfig.getCheckVersion({}).then(res=>{
  73. if(widgetInfo.version == res.data.data.version){
  74. uni.showToast({
  75. icon:"none",
  76. duration:2000,
  77. title:'暂无版本更新'
  78. })
  79. return;
  80. }
  81. uni.showLoading({
  82. title:'下载中....'
  83. })
  84. uni.downloadFile({
  85. url: res.data.data.android,
  86. success: (downloadResult) => {
  87. if (downloadResult.statusCode === 200) {
  88. plus.runtime.install(downloadResult.tempFilePath, {
  89. force: false
  90. }, function() {
  91. plus.runtime.restart();
  92. uni.hideLoading()
  93. }, function(e) {
  94. uni.hideLoading()
  95. });
  96. }
  97. },
  98. fail: (res) =>{
  99. uni.showToast({
  100. icon:"none",
  101. duration:2000,
  102. title:res
  103. })
  104. }
  105. });
  106. });
  107. });
  108. // #endif
  109. }
  110. }
  111. }
  112. </script>
  113. <style lang="scss" scoped>
  114. </style>