index - 副本.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  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. <footers v-if="isfootflag" :footerindex="footerindex"></footers>
  74. </view>
  75. </template>
  76. <script>
  77. import footers from '@/components/footer/footer.vue'
  78. import {findVersion} from "@/api/system/user.js"
  79. import {checkPermi,checkRole} from "@/utils/permission"; // 权限判断函数
  80. import config from '@/config'
  81. const baseUrl = config.baseUrl
  82. export default {
  83. data() {
  84. return {
  85. footerindex: 'mine',
  86. isfootflag: true,
  87. wgtcode: this.$store.state.user.wgtcode,
  88. platform: 'Android',
  89. name: this.$store.state.user.name,
  90. nvaHeight:44,
  91. }
  92. },
  93. components: {footers},
  94. computed: {
  95. avatar() {
  96. return this.$store.state.user.avatar
  97. },
  98. windowHeight() {
  99. return uni.getSystemInfoSync().windowHeight - 50
  100. }
  101. },
  102. onLoad() {
  103. var that=this;
  104. this.nvaHeight=uni.getSystemInfoSync().statusBarHeight+44;
  105. // #ifdef APP-PLUS
  106. plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) {
  107. that.$store.dispatch('SetwgtFn', widgetInfo.version).then(() => {
  108. that.wgtcode=widgetInfo.version
  109. })
  110. });
  111. // #endif
  112. },
  113. methods: {
  114. checkPermi,checkRole,
  115. handleToInfo() {
  116. this.$tab.navigateTo('/pages/mine/info/index')
  117. },
  118. handleToEditInfo() {
  119. this.$tab.navigateTo('/pages/mine/info/edit')
  120. },
  121. handleToSetting() {
  122. this.$tab.navigateTo('/pages/mine/setting/index')
  123. },
  124. handleToLogin() {
  125. this.$tab.reLaunch('/pages/login')
  126. },
  127. handleToAvatar() {
  128. this.$tab.navigateTo('/pages/mine/avatar/index')
  129. },
  130. handleHelp() {
  131. this.$tab.navigateTo('/pages/mine/help/index')
  132. },
  133. handleAbout() {
  134. this.$tab.navigateTo('/pages/mine/about/index')
  135. },
  136. handleJiaoLiuQun() {
  137. this.$modal.showToast('QQ群:①133713780(满)、②146013835(满)、③189091635')
  138. },
  139. handleBuilding() {
  140. this.$modal.showToast('模块建设中~')
  141. },
  142. onlineWgt() {
  143. let that = this;
  144. plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) {
  145. that.$store.dispatch('SetwgtFn', widgetInfo.version).then(() => {
  146. that.wgtcode=widgetInfo.version
  147. })
  148. that.comparisonVersionNo(widgetInfo.versionCode);
  149. });
  150. // that.comparisonVersionNo()
  151. },
  152. comparisonVersionNo(versionCode) {
  153. let that = this;
  154. // console.log("aaaaaaa===versionCode", versionCode);
  155. const parmas = {
  156. model: that.platform,
  157. appPort:that.appPort
  158. }
  159. findVersion(parmas).then(res => {
  160. if (res.code == "200") {
  161. let versionNos = res.data.code;
  162. console.log(versionNos, 'versionNos')
  163. // console.log(res.data.path);
  164. let filePath = res.data.path;
  165. if (Number(versionNos) > Number(versionCode)) { //服务器返回1更新,0则不更新
  166. uni.showModal({
  167. title: '提示',
  168. content: '发现新版本,是否升级',
  169. success: function(res) {
  170. // console.log(widgetInfo.version);
  171. if (res.confirm) {
  172. console.log('用户点击确定');
  173. that.getProperty(filePath);
  174. } else if (res.cancel) {
  175. console.log('用户点击取消');
  176. }
  177. }
  178. });
  179. } else {
  180. this.$toast('该版本已是最新版')
  181. }
  182. }
  183. }).catch(error => {
  184. uni.hideLoading()
  185. console.log(error)
  186. })
  187. },
  188. getProperty(getProperty) {
  189. // console.log("bbbbbbbbb----------->", getProperty)
  190. let that = this;
  191. // 在线升级app/热更新
  192. that.showwri = true;
  193. const downloadTask = uni.downloadFile({ //下载文件
  194. url: baseUrl + getProperty,
  195. success: (downloadResult) => {
  196. // console.log(downloadResult);
  197. if (downloadResult.statusCode == 200) {
  198. // 更新升级
  199. plus.runtime.install(downloadResult.tempFilePath, {
  200. force: true
  201. }, function() {
  202. // console.log('install success...');
  203. that.showwri = false;
  204. plus.nativeUI.alert("应用资源更新完成!", function() {
  205. plus.runtime.restart();
  206. });
  207. }, function(e) {
  208. that.showwri = false;
  209. plus.nativeUI.alert("更新失败,请稍后再试");
  210. });
  211. }
  212. }
  213. });
  214. downloadTask.onProgressUpdate((res) => { //下载文件的进度
  215. that.totalBytesWritten = res.totalBytesWritten; //当前下载大小
  216. that.progress = res.progress; //当前下载比例
  217. that.totalBytesExpectedToWrite = res.totalBytesExpectedToWrite; //
  218. });
  219. },
  220. }
  221. }
  222. </script>
  223. <style lang="scss" scoped>
  224. page {
  225. background-color: #f5f6f7;
  226. }
  227. .mine-container {
  228. width: 100%;
  229. height: 100%;
  230. .header-section {
  231. padding: 15px 15px 45px 15px;
  232. background-color: #3c96f3;
  233. color: white;
  234. .login-tip {
  235. font-size: 18px;
  236. margin-left: 10px;
  237. }
  238. .cu-avatar {
  239. border: 2px solid #eaeaea;
  240. .icon {
  241. font-size: 40px;
  242. }
  243. }
  244. .user-info {
  245. margin-left: 15px;
  246. .u_title {
  247. font-size: 18px;
  248. line-height: 30px;
  249. }
  250. }
  251. }
  252. .content-section {
  253. position: relative;
  254. top: -50px;
  255. .mine-actions {
  256. margin: 15px 15px;
  257. padding: 20px 0px;
  258. border-radius: 8px;
  259. background-color: white;
  260. .action-item {
  261. .icon {
  262. font-size: 28px;
  263. }
  264. .text {
  265. display: block;
  266. font-size: 13px;
  267. margin: 8px 0px;
  268. }
  269. }
  270. }
  271. }
  272. }
  273. </style>