center-simple.vue 7.2 KB

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