index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <view>
  3. <cu-custom class="home-custom" bgColor=".bg-sancolor"
  4. bgImage="https://ahwgh.oss-cn-hangzhou.aliyuncs.com/enterprise/64bdccea7bd72.png">
  5. <block slot="content">个人中心</block>
  6. </cu-custom>
  7. <scroll-view scroll-y class="scrollPage">
  8. <view class="userInfo">
  9. <view class="userPhoto">
  10. <view class="cu-avatar round lg"
  11. style="background-image:url('https://ahwgh.oss-cn-hangzhou.aliyuncs.com/enterprise/64bdccd118a88.jpg');">
  12. <view class="cu-tag badge bg-orange" v-if="userInfo.person_group != null">
  13. <block>{{ userInfo.person_group }}</block>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="content">
  18. <view class="text-white">{{ userInfo.name }}</view>
  19. <view class="subText padding-top-sm">{{ userInfo.unitId }}</view>
  20. </view>
  21. </view>
  22. </scroll-view>
  23. <view class="cu-list menu card-menu margin-top-xl margin-bottom-xl shadow-lg radius text-xxl">
  24. <view class="cu-item arrow">
  25. <navigator class="content" url="/pages/my/modifyUserInfo" hover-class="none">
  26. <text class="cuIcon-myfill text-green text-xl"></text>
  27. <text class="text-grey">个人信息</text>
  28. </navigator>
  29. </view>
  30. <view class="cu-item arrow">
  31. <navigator class="content" url="/pages/my/modifyPassword" hover-class="none">
  32. <text class="cuIcon-commandfill text-red text-xl"></text>
  33. <text class="text-grey">密码修改</text>
  34. </navigator>
  35. </view>
  36. <!-- <view class="cu-item arrow">
  37. <view class="content" @tap="bendWechat">
  38. <text class="cuIcon-weixin text-cyan text-xl"></text>
  39. <text class="text-grey">微信绑定</text>
  40. <text class="text-grey" style="float: right" v-if="!userInfo.openid">未绑定</text>
  41. <text class="text-grey" style="float: right" v-if="!!userInfo.openid">已绑定</text>
  42. </view>
  43. </view> -->
  44. </view>
  45. <view class="cu-list menu card-menu margin-top-xl margin-bottom-xl shadow-lg radius text-xxl">
  46. <view class="cu-item">
  47. <button class="cu-btn content" @tap="outLogin">
  48. <text class="cuIcon-exit text-cyan text-xl"></text>
  49. <text class="text-grey">退出登录</text>
  50. </button>
  51. </view>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. import {_my} from "./my-model";
  57. export default {
  58. data() {
  59. return {
  60. userInfo:{}
  61. };
  62. },
  63. created() {
  64. // this.getRoleName();
  65. const userInfo = uni.getStorageSync('userInfo');
  66. if (userInfo) {
  67. console.log(userInfo);
  68. this.userInfo = userInfo
  69. }
  70. },
  71. methods: {//微信号绑定
  72. getRoleName() {
  73. let role = uni.getStorageSync("role");
  74. if (role == "") {
  75. console.log("未登录");
  76. } else {
  77. console.log("已经登录");
  78. }
  79. },
  80. bendWechat() {
  81. let _this = this;
  82. uni.showModal({
  83. title: "微信绑定",
  84. content: "确定要绑定当前微信么?",
  85. cancelText: "取消",
  86. confirmText: "确认",
  87. success: res => {
  88. if (res.confirm) {
  89. uni.login({
  90. success:res=> {
  91. _my.bandWxOpenid(res.code, res => {
  92. console.log(res);
  93. if (res.code === 200) {
  94. uni.showToast({
  95. icon: "none",
  96. title: "绑定成功",
  97. duration: 1000
  98. });
  99. } else {
  100. this.$msg("绑定失败");
  101. }
  102. });
  103. }
  104. });
  105. }
  106. }
  107. });
  108. },
  109. outLogin() {
  110. uni.showModal({
  111. title: "退出登录",
  112. content: "确定要退出当前账号么?",
  113. cancelText: "取消",
  114. confirmText: "退出",
  115. success: res => {
  116. if(res.confirm){
  117. //uni.clearStorageSync();
  118. uni.navigateTo({
  119. url: "/pages/login/index"
  120. });
  121. console.log("全局变量:"+wx.getStorageSync('username'));
  122. }else if(res.cancel){
  123. console.log("取消退出");
  124. }
  125. }
  126. });
  127. }
  128. }
  129. };
  130. </script>
  131. <style>
  132. .iconfont {
  133. margin-right: 10upx;
  134. width: 1.6em;
  135. text-align: center;
  136. }
  137. .userInfo {
  138. background: rgb(73, 182, 75);
  139. /*border-radius:0,0,100upx,0;*/
  140. border-bottom-right-radius: 140upx 40upx;
  141. padding: 40upx;
  142. display: flex;
  143. }
  144. .userPhoto {
  145. width: 150upx;
  146. height: 150upx;
  147. background-color: rgba(255, 255, 255, 0.3);
  148. border-radius: 50%;
  149. }
  150. .cu-avatar.lg {
  151. margin: 10upx;
  152. width: 130upx;
  153. height: 130upx;
  154. }
  155. .userInfo .content {
  156. padding-left: 50upx;
  157. font-size: 36upx;
  158. display: flex;
  159. flex-direction: column;
  160. justify-content: center;
  161. align-items: center;
  162. }
  163. .subText {
  164. font-size: 30upx;
  165. color: #d5d5d5;
  166. }
  167. </style>