center-simple.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <template>
  2. <view class="container">
  3. <uni-nav-bar dark :fixed="true" backgroundColor="black" statusBar="false" left-icon="left" left-text="返回"
  4. @clickLeft="toBack">
  5. <view class="nav-title">
  6. <text>{{title}}</text>
  7. </view>
  8. </uni-nav-bar>
  9. <view class="cell-box">
  10. <u-cell-group :border="false">
  11. <u-cell-item title="修改密码" :border-bottom="false" @click="$u.func.route('/pages/user/modify-password')">
  12. <image slot="icon" src="/static/images/user/c8.png" class="icon" mode=""></image>
  13. </u-cell-item>
  14. </u-cell-group>
  15. </view>
  16. <u-gap height="100"></u-gap>
  17. <view class="cell-box">
  18. <u-cell-group :border="false">
  19. <button type="primary" plain="true" @click="logout()">退出登录</button>
  20. </u-cell-group>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. import http from '@/http/api.js'
  26. export default {
  27. onLoad() {
  28. console.log(JSON.stringify(this.userInfo))
  29. const that = this;
  30. http.request({
  31. url: '/galaxy-system/dept/detail?id=' + this.userInfo.dept_id,
  32. method: 'GET'
  33. }).then(res => {
  34. console.log(JSON.stringify(res.data))
  35. that.deptName = res.data.deptName;
  36. }).catch(err => {
  37. console.log(err)
  38. })
  39. http.request({
  40. url: '/galaxy-system/role/select?roleId=' + this.userInfo.role_id,
  41. method: 'GET'
  42. }).then(res => {
  43. console.log(JSON.stringify(res.data))
  44. var name = "";
  45. res.data.forEach(info => {
  46. name += name.length > 0 ? ":" : "";
  47. name += info.roleName;
  48. })
  49. that.roleName = name;
  50. }).catch(err => {
  51. console.log(err)
  52. })
  53. },
  54. data() {
  55. return {
  56. title: '用户信息',
  57. roleName: '',
  58. deptName: '',
  59. downloadurl: '',
  60. };
  61. },
  62. methods: {
  63. toBack() {
  64. uni.navigateBack({
  65. delta: 1
  66. })
  67. },
  68. logout() {
  69. this.$u.func.logout();
  70. },
  71. checkVersion() {
  72. // #ifdef APP-PLUS
  73. let that = this;
  74. let postData = {};
  75. postData['appId'] = plus.runtime.appid;
  76. postData['version'] = plus.runtime.version;
  77. http.request({
  78. url: '/galaxy-business/version/check',
  79. method: 'GET',
  80. data: postData,
  81. }).then(res => {
  82. console.log(JSON.stringify(res))
  83. if (res.data != null) {
  84. if (res.data.updateStatus == 1) {
  85. that.downloadurl = res.data.apkUrl;
  86. uni.showModal({
  87. title: "版本检查",
  88. content: "有新的APP版本需要更新",
  89. success: (res) => {
  90. if (res.confirm) {
  91. that.updateApp();
  92. }
  93. },
  94. })
  95. } else {
  96. uni.showModal({
  97. title: "提示",
  98. content: "当前已是最新版本!",
  99. showCancel: false,
  100. success: (res) => {
  101. }
  102. })
  103. }
  104. }
  105. }).catch(err => {
  106. console.log(err)
  107. })
  108. // #endif
  109. },
  110. updateApp() {
  111. // #ifdef APP-PLUS
  112. let task = plus.downloader.createDownload(this.downloadurl, {},
  113. function(d, status) {
  114. //下载完成
  115. if (status == 200) {
  116. var path = plus.io.convertLocalFileSystemURL(d
  117. .filename);
  118. plus.runtime.install(path, {}, function() {
  119. plus.nativeUI.closeWaiting();
  120. uni.showModal({
  121. title: "更新提示",
  122. content: "安装已完成,APP需重新启动!",
  123. showCancel: false,
  124. success: (res) => {
  125. plus.runtime.restart();
  126. }
  127. })
  128. }, function(e) {
  129. uni.showModal({
  130. title: "更新提示",
  131. content: "版本更新失败[" + e.code + "]:" + e.message,
  132. mask: false,
  133. duration: 1500,
  134. })
  135. })
  136. } else {
  137. uni.showModal({
  138. title: "更新提示",
  139. content: "下载安装包文件失败!",
  140. mask: false,
  141. duration: 1500,
  142. })
  143. }
  144. }
  145. )
  146. task.addEventListener("statechanged", function(download, status) {
  147. switch (download.state) {
  148. case 1:
  149. loadingDig.setTitle("开始下载");
  150. break;
  151. case 2:
  152. loadingDig.setTitle("已连接");
  153. break;
  154. case 3:
  155. //if (undefined != task.downloadedSize && null != task.downloadedSize && parseFloat(task
  156. // .downloadedSize) > 0.0) {
  157. // let prg = parseInt((parseFloat(task
  158. // .downloadedSize) /
  159. // parseFloat(task.totalSize)
  160. // ) *
  161. // 100.0);
  162. // if (undefined != prg && null != prg && (prg >= 0.0 && prg <= 100.0)) {
  163. // loadingDig.setTitle("安装包下载 " + prg + "%");
  164. // }
  165. loadingDig.setTitle("安装包下载中...");
  166. break;
  167. case 4:
  168. plus.nativeUI.closeWaiting();
  169. break;
  170. }
  171. })
  172. task.start();
  173. var loadingDig = plus.nativeUI.showWaiting("开始下载安装包");
  174. // #endif
  175. }
  176. }
  177. };
  178. </script>
  179. <style lang="scss">
  180. .container {
  181. background-color: #f7f7f7;
  182. min-height: 100vh;
  183. overflow: hidden;
  184. }
  185. .head {
  186. position: relative;
  187. top: 0;
  188. left: 0;
  189. z-index: 1;
  190. // min-height: 582rpx;
  191. min-height: 400rpx;
  192. overflow: hidden;
  193. background: #3F9EFF;
  194. .set-icon {
  195. vertical-align: middle;
  196. width: 41rpx;
  197. height: auto;
  198. margin-right: 35rpx;
  199. }
  200. .head-bg {
  201. position: absolute;
  202. left: 0px;
  203. top: 0px;
  204. z-index: -1;
  205. width: 750rpx;
  206. height: 582rpx;
  207. background: #0bb9c8;
  208. }
  209. }
  210. .user-box {
  211. display: flex;
  212. justify-content: space-between;
  213. padding: 0 20rpx 0 64rpx;
  214. margin-top: 36rpx;
  215. .left {
  216. display: flex;
  217. flex-direction: column;
  218. align-items: center;
  219. .avatar {
  220. width: 128rpx;
  221. height: 128rpx;
  222. background: #ffffff;
  223. border-radius: 50%;
  224. }
  225. .user-name {
  226. margin-top: 20rpx;
  227. font-size: 36rpx;
  228. font-family: Source Han Sans CN;
  229. font-weight: 500;
  230. color: #ffffff;
  231. }
  232. .tag {
  233. margin-top: 20rpx;
  234. display: flex;
  235. justify-content: center;
  236. align-items: center;
  237. padding: 5rpx 16rpx;
  238. border: 1px solid #f5f5f5;
  239. border-radius: 7rpx;
  240. font-size: 19rpx;
  241. font-family: Source Han Sans CN;
  242. font-weight: 300;
  243. color: #ffffff;
  244. }
  245. }
  246. .edit-btn {
  247. margin-top: 20rpx;
  248. margin-bottom: 10px;
  249. flex-shrink: 0;
  250. display: flex;
  251. justify-content: center;
  252. align-items: center;
  253. width: 165rpx;
  254. height: 54rpx;
  255. border: 2rpx solid #f5f5f5;
  256. border-radius: 11rpx;
  257. font-size: 27rpx;
  258. font-family: Source Han Sans CN;
  259. font-weight: 400;
  260. color: #ffffff;
  261. }
  262. }
  263. .nav {
  264. display: flex;
  265. //border-top: 2rpx solid #7dcdd6;
  266. margin: 36rpx 38rpx 0;
  267. padding: 36rpx 0 42rpx;
  268. .nav-item {
  269. width: calc(100% / 4);
  270. display: flex;
  271. flex-direction: column;
  272. align-items: center;
  273. justify-content: space-between;
  274. font-size: 25rpx;
  275. font-family: Source Han Sans CN;
  276. font-weight: 400;
  277. color: #ffffff;
  278. &:not(:last-of-type) {
  279. position: relative;
  280. &::after {
  281. position: absolute;
  282. right: 0;
  283. top: 50%;
  284. transform: translateY(-50%);
  285. content: '';
  286. display: block;
  287. width: 2rpx;
  288. background-color: #3ac4d1;
  289. height: 30rpx;
  290. }
  291. }
  292. .icon {
  293. width: 48rpx;
  294. height: 48rpx;
  295. margin-bottom: 6rpx;
  296. }
  297. }
  298. }
  299. .cell-box {
  300. background: #ffffff;
  301. margin: 18rpx;
  302. .icon {
  303. width: 32rpx;
  304. height: 32rpx;
  305. margin-right: 22rpx;
  306. }
  307. }
  308. </style>