index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <view class="page_container">
  3. <custom-nav-bar title="关于我们" />
  4. <view class="logo_area">
  5. <image src="../../../static/images/about_logo.png" mode=""></image>
  6. <view>{{ v }}</view>
  7. <info-item @click="show = true" class="check" title="上传日志" content="" />
  8. <u-modal showCancelButton :show="show" title="上传日志" @confirm="uploadLog" @cancel="show = false">
  9. <view class="slot-content">
  10. <u--input placeholder="日志数量" border="surround" v-model="line"></u--input>
  11. </view>
  12. </u-modal>
  13. </view>
  14. <view v-if="$u.os() === 'android'" style="font-size: 16px; margin: 20rpx; margin-left: 20px">
  15. {{ title }}
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. import CustomNavBar from '../../../components/CustomNavBar/index.vue';
  21. import { PageEvents } from '../../../constant';
  22. import InfoItem from '../selfInfo/InfoItem.vue';
  23. import { version } from '../../../common/config';
  24. import IMSDK from 'openim-uniapp-polyfill';
  25. export default {
  26. components: {
  27. CustomNavBar,
  28. InfoItem
  29. },
  30. data() {
  31. return {
  32. show: false,
  33. line: 10000,
  34. appVersion: '',
  35. loading: false,
  36. title: ''
  37. };
  38. },
  39. computed: {
  40. v() {
  41. return version;
  42. }
  43. },
  44. onLoad() {
  45. this.getAppVersion();
  46. let uid, nickName;
  47. if (this.$companyUserIsLogin()) {
  48. var user = JSON.parse(uni.getStorageSync('companyUser'));
  49. //console.log("qxj openImLogin companyUser",user);
  50. uid = 'C' + user.userId;
  51. nickName = user.imNickName || user.nickName;
  52. } else {
  53. var user = JSON.parse(uni.getStorageSync('userInfo'));
  54. uid = 'U' + user.userId;
  55. nickName = user.nickName;
  56. }
  57. this.title = '当前登录用户:' + nickName + ' 用户id:' + uid;
  58. uni.$on(PageEvents.CheckForUpdateResp, this.checkRespHandler);
  59. },
  60. onUnload() {
  61. uni.$off(PageEvents.CheckForUpdateResp, this.checkRespHandler);
  62. },
  63. mounted() {
  64. IMSDK.subscribe("uploadLogsProgress", this.uploadHandler);
  65. },
  66. beforeDestroy() {
  67. IMSDK.unsubscribe("uploadLogsProgress", this.uploadHandler);
  68. },
  69. methods: {
  70. uploadLog() {
  71. this.show = false;
  72. IMSDK.asyncApi('uploadLogs', IMSDK.uuid(), {
  73. line: this.line,
  74. ex: ''
  75. });
  76. uni.showLoading({
  77. title: '上传中',
  78. mask: true
  79. });
  80. },
  81. uploadHandler({ data: { current, size } }) {
  82. if (current >= size) {
  83. uni.hideLoading();
  84. uni.showToast({
  85. title: '上传成功',
  86. icon: 'none'
  87. });
  88. return;
  89. }
  90. },
  91. getAppVersion() {
  92. plus.runtime.getProperty(plus.runtime.appid, ({ version }) => (this.appVersion = version));
  93. },
  94. updateCheck() {
  95. this.loading = true;
  96. uni.$emit(PageEvents.CheckForUpdate, true);
  97. },
  98. checkRespHandler() {
  99. this.loading = false;
  100. }
  101. }
  102. };
  103. </script>
  104. <style lang="scss">
  105. .page_container {
  106. background-color: #f8f8f8;
  107. .logo_area {
  108. display: flex;
  109. flex-direction: column;
  110. align-items: center;
  111. margin: 24rpx 24rpx 0 24rpx;
  112. background: #fff;
  113. border-radius: 6px;
  114. padding: 48rpx 0 16rpx 0;
  115. color: $uni-text-color;
  116. image {
  117. width: 72px;
  118. height: 72px;
  119. margin-bottom: 24rpx;
  120. }
  121. }
  122. .check {
  123. margin-top: 26rpx;
  124. border-top: 1px #e8eaef solid;
  125. padding: 20rpx;
  126. width: 90%;
  127. }
  128. .btn_row {
  129. padding: 0 44rpx;
  130. }
  131. }
  132. </style>