index.vue 6.0 KB

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