index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <view>
  3. <view class="subject">
  4. <view style="width: 100%;background-color: #FFFFFF;position: relative;">
  5. <view class="personal">
  6. <view class="personal_left">
  7. <image :src="userinfos.image" mode="" @error="imageError"></image>
  8. </view>
  9. <view class="personal_center">
  10. <p>{{usernames}}</p>
  11. <p>{{userinfos.email?userinfos.email:userinfos.mobile}}</p>
  12. </view>
  13. <view class="personal_right" @click="userinfo">
  14. <uni-icons type="compose" style="color: #FFFFFF;margin-right: 10rpx;"></uni-icons>
  15. 编辑
  16. </view>
  17. </view>
  18. </view>
  19. <view style="background-color: #FFFFFF;margin: 20rpx auto 0;">
  20. <view class="AboutUs" @click="about">
  21. <u-icon name="pingtai" custom-prefix="custom-icon" class="icon_left"></u-icon>
  22. {{$isneutral?"关于我们":"关于更新"}}
  23. <p class="update" v-if="updateTF">NEW</p>
  24. <uni-icons type="arrowright" class="icon_right"></uni-icons>
  25. </view>
  26. </view>
  27. <view style="background-color: #FFFFFF;">
  28. <view class="quit" @click="outto">
  29. <u-icon name="tuichudenglu" custom-prefix="custom-icon" class="icon_left"></u-icon>
  30. 退出登录
  31. <uni-icons type="arrowright" class="icon_right"></uni-icons>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. export default {
  39. data() {
  40. return {
  41. usernames: '',
  42. userinfos: {},
  43. versions: "",
  44. updateTF: false
  45. }
  46. },
  47. methods: {
  48. async getEquipList() {
  49. const res = await this.$myRequest({
  50. url: '/api/api_gateway?method=home.homes.app_version_record',
  51. data: {
  52. ret: "first"
  53. }
  54. })
  55. console.log(res)
  56. // this.appName = res[0].app_name
  57. this.versions = Number(res[0].app_num.match(/\d+/g).join(""))
  58. var ids = Number(plus.runtime.version.match(/\d+/g).join(""))
  59. if (this.versions > ids) {
  60. this.updateTF = true
  61. } else {
  62. this.updateTF = false
  63. }
  64. },
  65. //user.login.user_login_info
  66. //home.homes.personal_center
  67. async getUserlogin() {
  68. const res = await this.$myRequest({
  69. url: '/api/api_gateway?method=user.login.user_login_info',
  70. })
  71. console.log(res.children)
  72. this.usernames = res.username
  73. this.getUsermsg(this.usernames)
  74. uni.setStorage({
  75. key: 'jurisdiction',
  76. data: JSON.stringify(res.children),
  77. success: () => {
  78. }
  79. })
  80. },
  81. async getUsermsg(user) {
  82. const res = await this.$myRequest({
  83. url: '/api/api_gateway?method=home.homes.personal_center',
  84. data: {
  85. username: user
  86. }
  87. })
  88. console.log(res)
  89. this.userinfos = res
  90. }, //user.login.logout_user
  91. async getlogout() {
  92. const res = await this.$myRequest({
  93. url: '/api/api_gateway?method=user.login.logout_user',
  94. })
  95. },
  96. about() {
  97. uni.navigateTo({
  98. url: "../about/about"
  99. })
  100. },
  101. imageError(e) {
  102. if (e) {
  103. this.userinfos.image = "../../../static/images/my/user.png"
  104. }
  105. },
  106. userinfo() {
  107. uni.navigateTo({
  108. url: "../user-info/user-info?data=" + JSON.stringify(this.userinfos)
  109. })
  110. },
  111. outto() {
  112. uni.showModal({
  113. title: '提示',
  114. content: '是否退出登录',
  115. success: (res) => {
  116. if (res.confirm) {
  117. this.getlogout()
  118. uni.removeStorage({
  119. key: "session_key"
  120. })
  121. uni.reLaunch({
  122. url: "../../login/login"
  123. })
  124. } else if (res.cancel) {
  125. console.log('用户点击取消');
  126. }
  127. }
  128. });
  129. }
  130. },
  131. onLoad() {
  132. this.getUserlogin()
  133. this.getEquipList()
  134. },
  135. onShow() {
  136. this.getUserlogin()
  137. this.$forceUpdate()
  138. }
  139. }
  140. </script>
  141. <style lang="scss">
  142. .subject {
  143. width: 100%;
  144. height: 100vh;
  145. background-color: #F9F9F9;
  146. }
  147. .personal {
  148. width: 90%;
  149. margin: 0 auto;
  150. display: flex;
  151. padding: 20rpx 0 40rpx;
  152. box-sizing: border-box;
  153. .personal_left {
  154. width: 18%;
  155. margin-right: 30rpx;
  156. image {
  157. width: 124rpx;
  158. height: 120rpx;
  159. border-radius: 60rpx;
  160. }
  161. }
  162. .personal_center {
  163. padding-top: 20rpx;
  164. p:nth-child(1) {
  165. font-size: 34rpx;
  166. font-weight: 700;
  167. margin-bottom: 10rpx;
  168. }
  169. p:nth-child(2) {
  170. font-size: 24rpx;
  171. }
  172. }
  173. .personal_right {
  174. width: 150rpx;
  175. background-color: #55C87B;
  176. height: 60rpx;
  177. text-align: center;
  178. border-radius: 30rpx;
  179. line-height: 60rpx;
  180. color: #FFFFFF;
  181. position: absolute;
  182. top: 50rpx;
  183. right: 30rpx;
  184. }
  185. }
  186. .AboutUs,
  187. .quit,
  188. .opinion {
  189. width: 90%;
  190. height: 100rpx;
  191. line-height: 100rpx;
  192. margin: 20rpx auto 0;
  193. position: relative;
  194. padding-left: 20rpx;
  195. font-size: 28rpx;
  196. .icon_left {
  197. margin-right: 20rpx;
  198. color: #55C87B !important;
  199. font-size: 32rpx;
  200. }
  201. .icon_right {
  202. position: absolute;
  203. top: 0;
  204. right: 10rpx;
  205. font-size: 32rpx !important;
  206. }
  207. .update {
  208. position: absolute;
  209. top: 34rpx;
  210. right: 40rpx;
  211. font-size: 16rpx !important;
  212. background-color: #f00;
  213. border-radius: 25rpx;
  214. height: 30rpx;
  215. padding: 2rpx 16rpx;
  216. line-height: 30rpx;
  217. color: #fff;
  218. }
  219. }
  220. .opinion {
  221. margin: 0 auto;
  222. border-top: 2rpx solid #EAEAEA;
  223. }
  224. </style>