index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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 getuserinfonew() {
  82. const res = await this.$myRequest({
  83. url: '/api/v2/theme/home/info/',
  84. })
  85. if(res.items && res.items.logo_url){
  86. this.userinfos.image = res.items.logo_url
  87. } else{
  88. this.userinfos.image = ''
  89. }
  90. },
  91. async getUsermsg(user) {
  92. const res = await this.$myRequest({
  93. url: '/api/api_gateway?method=home.homes.personal_center',
  94. data: {
  95. username: user
  96. }
  97. })
  98. this.userinfos = res
  99. this.getuserinfonew()
  100. }, //user.login.logout_user
  101. async getlogout() {
  102. const res = await this.$myRequest({
  103. url: '/api/api_gateway?method=user.login.logout_user',
  104. })
  105. },
  106. about() {
  107. uni.navigateTo({
  108. url: "../about/about"
  109. })
  110. },
  111. imageError(e) {
  112. if (e) {
  113. this.userinfos.image = "../../../static/images/my/user.png"
  114. }
  115. },
  116. userinfo() {
  117. uni.navigateTo({
  118. url: "../user-info/user-info?data=" + JSON.stringify(this.userinfos)
  119. })
  120. },
  121. outto() {
  122. uni.showModal({
  123. title: '提示',
  124. content: '是否退出登录',
  125. success: (res) => {
  126. if (res.confirm) {
  127. this.getlogout()
  128. uni.removeStorage({
  129. key: "session_key"
  130. })
  131. uni.reLaunch({
  132. url: "../../login/login"
  133. })
  134. } else if (res.cancel) {
  135. console.log('用户点击取消');
  136. }
  137. }
  138. });
  139. }
  140. },
  141. onLoad() {
  142. this.getUserlogin()
  143. this.getEquipList()
  144. },
  145. onShow() {
  146. this.getUserlogin()
  147. this.$forceUpdate()
  148. }
  149. }
  150. </script>
  151. <style lang="scss">
  152. .subject {
  153. width: 100%;
  154. height: 100vh;
  155. background-color: #F9F9F9;
  156. }
  157. .personal {
  158. width: 90%;
  159. margin: 0 auto;
  160. display: flex;
  161. padding: 20rpx 0 40rpx;
  162. box-sizing: border-box;
  163. .personal_left {
  164. width: 18%;
  165. margin-right: 30rpx;
  166. image {
  167. width: 124rpx;
  168. height: 120rpx;
  169. border-radius: 60rpx;
  170. }
  171. }
  172. .personal_center {
  173. padding-top: 20rpx;
  174. p:nth-child(1) {
  175. font-size: 34rpx;
  176. font-weight: 700;
  177. margin-bottom: 10rpx;
  178. }
  179. p:nth-child(2) {
  180. font-size: 24rpx;
  181. }
  182. }
  183. .personal_right {
  184. width: 150rpx;
  185. background-color: #55C87B;
  186. height: 60rpx;
  187. text-align: center;
  188. border-radius: 30rpx;
  189. line-height: 60rpx;
  190. color: #FFFFFF;
  191. position: absolute;
  192. top: 50rpx;
  193. right: 30rpx;
  194. }
  195. }
  196. .AboutUs,
  197. .quit,
  198. .opinion {
  199. width: 90%;
  200. height: 100rpx;
  201. line-height: 100rpx;
  202. margin: 20rpx auto 0;
  203. position: relative;
  204. padding-left: 20rpx;
  205. font-size: 28rpx;
  206. .icon_left {
  207. margin-right: 20rpx;
  208. color: #55C87B !important;
  209. font-size: 32rpx;
  210. }
  211. .icon_right {
  212. position: absolute;
  213. top: 0;
  214. right: 10rpx;
  215. font-size: 32rpx !important;
  216. }
  217. .update {
  218. position: absolute;
  219. top: 34rpx;
  220. right: 40rpx;
  221. font-size: 16rpx !important;
  222. background-color: #f00;
  223. border-radius: 25rpx;
  224. height: 30rpx;
  225. padding: 2rpx 16rpx;
  226. line-height: 30rpx;
  227. color: #fff;
  228. }
  229. }
  230. .opinion {
  231. margin: 0 auto;
  232. border-top: 2rpx solid #EAEAEA;
  233. }
  234. </style>