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