index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <template>
  2. <view class="mine-container" :style="{height: `${windowHeight}px`}">
  3. <!--顶部个人信息栏-->
  4. <view class="header-section">
  5. <view class="flex padding justify-between">
  6. <view class="flex align-center">
  7. <view v-if="!avatar" class="cu-avatar xl round bg-white">
  8. <view class="iconfont icon-people text-gray icon"></view>
  9. </view>
  10. <image v-if="avatar" @click="handleToAvatar" :src="avatar" class="cu-avatar xl round" mode="widthFix">
  11. </image>
  12. <view v-if="!name" @click="handleToLogin" class="login-tip">
  13. 点击登录
  14. </view>
  15. <view v-if="name" @click="handleToInfo" class="user-info">
  16. <view class="u_title">
  17. 用户名:{{ name }}
  18. </view>
  19. </view>
  20. </view>
  21. <view @click="handleToInfo" class="flex align-center">
  22. <text>个人信息</text>
  23. <view class="iconfont icon-right"></view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="content-section">
  28. <view class="mine-actions grid col-4 text-center">
  29. <view class="action-item" @click="handleJiaoLiuQun">
  30. <view class="iconfont icon-friendfill text-pink icon"></view>
  31. <text class="text">交流群</text>
  32. </view>
  33. <view class="action-item" @click="handleBuilding">
  34. <view class="iconfont icon-service text-blue icon"></view>
  35. <text class="text">在线客服</text>
  36. </view>
  37. <view class="action-item" @click="handleBuilding">
  38. <view class="iconfont icon-community text-mauve icon"></view>
  39. <text class="text">反馈社区</text>
  40. </view>
  41. <view class="action-item" @click="handleBuilding">
  42. <view class="iconfont icon-dianzan text-green icon"></view>
  43. <text class="text">点赞我们</text>
  44. </view>
  45. </view>
  46. <view class="menu-list">
  47. <view class="list-cell list-cell-arrow" @click="handleToEditInfo">
  48. <view class="menu-item-box">
  49. <view class="iconfont icon-user menu-icon"></view>
  50. <view>编辑资料</view>
  51. </view>
  52. </view>
  53. <view class="list-cell list-cell-arrow" @click="handleHelp">
  54. <view class="menu-item-box">
  55. <view class="iconfont icon-help menu-icon"></view>
  56. <view>常见问题</view>
  57. </view>
  58. </view>
  59. <view class="list-cell list-cell-arrow" @click="handleAbout">
  60. <view class="menu-item-box">
  61. <view class="iconfont icon-aixin menu-icon"></view>
  62. <view>关于我们</view>
  63. </view>
  64. </view>
  65. <view class="list-cell list-cell-arrow" @click="handleToSetting">
  66. <view class="menu-item-box">
  67. <view class="iconfont icon-setting menu-icon"></view>
  68. <view>应用设置</view>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. </template>
  75. <script>
  76. import footers from '@/components/footer/footer.vue'
  77. import {findVersion} from "@/api/system/user.js"
  78. import {checkPermi,checkRole} from "@/utils/permission"; // 权限判断函数
  79. import config from '@/config'
  80. const baseUrl = config.baseUrl
  81. export default {
  82. data() {
  83. return {
  84. footerindex: 'mine',
  85. isfootflag: true,
  86. wgtcode: this.$store.state.user.wgtcode,
  87. platform: 'Android',
  88. name: this.$store.state.user.name,
  89. nvaHeight:44,
  90. }
  91. },
  92. components: {footers},
  93. computed: {
  94. avatar() {
  95. return this.$store.state.user.avatar
  96. },
  97. windowHeight() {
  98. return uni.getSystemInfoSync().windowHeight - 50
  99. }
  100. },
  101. onLoad() {
  102. var that=this;
  103. this.nvaHeight=uni.getSystemInfoSync().statusBarHeight+44;
  104. // #ifdef APP-PLUS
  105. plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) {
  106. that.$store.dispatch('SetwgtFn', widgetInfo.version).then(() => {
  107. that.wgtcode=widgetInfo.version
  108. })
  109. });
  110. // #endif
  111. },
  112. methods: {
  113. checkPermi,checkRole,
  114. handleToInfo() {
  115. this.$tab.navigateTo('/pages/mine/info/index')
  116. },
  117. handleToEditInfo() {
  118. this.$tab.navigateTo('/pages/mine/info/edit')
  119. },
  120. handleToSetting() {
  121. this.$tab.navigateTo('/pages/mine/setting/index')
  122. },
  123. handleToLogin() {
  124. this.$tab.reLaunch('/pages/login')
  125. },
  126. handleToAvatar() {
  127. this.$tab.navigateTo('/pages/mine/avatar/index')
  128. },
  129. handleHelp() {
  130. this.$tab.navigateTo('/pages/mine/help/index')
  131. },
  132. handleAbout() {
  133. this.$tab.navigateTo('/pages/mine/about/index')
  134. },
  135. handleJiaoLiuQun() {
  136. this.$modal.showToast('QQ群:①133713780(满)、②146013835(满)、③189091635')
  137. },
  138. handleBuilding() {
  139. this.$modal.showToast('模块建设中~')
  140. },
  141. onlineWgt() {
  142. let that = this;
  143. plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) {
  144. that.$store.dispatch('SetwgtFn', widgetInfo.version).then(() => {
  145. that.wgtcode=widgetInfo.version
  146. })
  147. that.comparisonVersionNo(widgetInfo.versionCode);
  148. });
  149. // that.comparisonVersionNo()
  150. },
  151. comparisonVersionNo(versionCode) {
  152. let that = this;
  153. // console.log("aaaaaaa===versionCode", versionCode);
  154. const parmas = {
  155. model: that.platform,
  156. appPort:that.appPort
  157. }
  158. findVersion(parmas).then(res => {
  159. if (res.code == "200") {
  160. let versionNos = res.data.code;
  161. console.log(versionNos, 'versionNos')
  162. // console.log(res.data.path);
  163. let filePath = res.data.path;
  164. if (Number(versionNos) > Number(versionCode)) { //服务器返回1更新,0则不更新
  165. uni.showModal({
  166. title: '提示',
  167. content: '发现新版本,是否升级',
  168. success: function(res) {
  169. // console.log(widgetInfo.version);
  170. if (res.confirm) {
  171. console.log('用户点击确定');
  172. that.getProperty(filePath);
  173. } else if (res.cancel) {
  174. console.log('用户点击取消');
  175. }
  176. }
  177. });
  178. } else {
  179. this.$toast('该版本已是最新版')
  180. }
  181. }
  182. }).catch(error => {
  183. uni.hideLoading()
  184. console.log(error)
  185. })
  186. },
  187. getProperty(getProperty) {
  188. // console.log("bbbbbbbbb----------->", getProperty)
  189. let that = this;
  190. // 在线升级app/热更新
  191. that.showwri = true;
  192. const downloadTask = uni.downloadFile({ //下载文件
  193. url: baseUrl + getProperty,
  194. success: (downloadResult) => {
  195. // console.log(downloadResult);
  196. if (downloadResult.statusCode == 200) {
  197. // 更新升级
  198. plus.runtime.install(downloadResult.tempFilePath, {
  199. force: true
  200. }, function() {
  201. // console.log('install success...');
  202. that.showwri = false;
  203. plus.nativeUI.alert("应用资源更新完成!", function() {
  204. plus.runtime.restart();
  205. });
  206. }, function(e) {
  207. that.showwri = false;
  208. plus.nativeUI.alert("更新失败,请稍后再试");
  209. });
  210. }
  211. }
  212. });
  213. downloadTask.onProgressUpdate((res) => { //下载文件的进度
  214. that.totalBytesWritten = res.totalBytesWritten; //当前下载大小
  215. that.progress = res.progress; //当前下载比例
  216. that.totalBytesExpectedToWrite = res.totalBytesExpectedToWrite; //
  217. });
  218. },
  219. }
  220. }
  221. </script>
  222. <style lang="scss" scoped>
  223. page {
  224. background-color: #f5f6f7;
  225. }
  226. .mine-container {
  227. width: 100%;
  228. height: 100%;
  229. .header-section {
  230. padding: 15px 15px 45px 15px;
  231. background-color: #3c96f3;
  232. color: white;
  233. .login-tip {
  234. font-size: 18px;
  235. margin-left: 10px;
  236. }
  237. .cu-avatar {
  238. border: 2px solid #eaeaea;
  239. .icon {
  240. font-size: 40px;
  241. }
  242. }
  243. .user-info {
  244. margin-left: 15px;
  245. .u_title {
  246. font-size: 18px;
  247. line-height: 30px;
  248. }
  249. }
  250. }
  251. .content-section {
  252. position: relative;
  253. top: -50px;
  254. .mine-actions {
  255. margin: 15px 15px;
  256. padding: 20px 0px;
  257. border-radius: 8px;
  258. background-color: white;
  259. .action-item {
  260. .icon {
  261. font-size: 28px;
  262. }
  263. .text {
  264. display: block;
  265. font-size: 13px;
  266. margin: 8px 0px;
  267. }
  268. }
  269. }
  270. }
  271. }
  272. </style>