t-m-info.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <view class="content">
  3. <view class="user" @click="go_information()">
  4. <view class="left" v-if="user.name">
  5. <view class="img">
  6. <image v-if="user.avatar" :src="user.avatar" mode="aspectFill"></image>
  7. <view class="avatar" v-if="!user.avatar" :style="{backgroundColor:bgColor[1]}">{{user.name.split('').pop()}}</view>
  8. </view>
  9. <view class="info">
  10. <view class="name">{{user.name}} <text style="color: #999;font-size: 26rpx;margin-left: 10px;" v-if="mobile">({{mobile}})</text> </view>
  11. <view class="section">{{user.section}}</view>
  12. </view>
  13. </view>
  14. <view class="right" v-if="user.name">
  15. <uni-icons type="arrowright" size="24"></uni-icons>
  16. </view>
  17. </view>
  18. <view class="tip" v-if="tip_password" @click="go_m_repassword()">
  19. <view class="icon"></view>
  20. <view class="text">当前密码为初始密码,请及时修改。</view>
  21. </view>
  22. <view class="tip" v-if="tip_mobile" @click="binding_phone()">
  23. <view class="icon"></view>
  24. <view class="text">未绑定手机号,请立即绑定手机号。</view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. name:"t-m-user",
  31. data() {
  32. return {
  33. // 用户基本信息
  34. user:{},
  35. // 手机号
  36. mobile:'',
  37. // 头像随机色
  38. bgColor:[],
  39. // 密码提示
  40. tip_password:false,
  41. // 手机绑定
  42. tip_mobile:false
  43. };
  44. },
  45. created() {
  46. // console.log(uni.getStorageSync('user'))
  47. // 获取用户基本信息
  48. this.user = uni.getStorageSync('user');
  49. this.mobile = uni.getStorageSync('mobile');
  50. // 设置头像
  51. for(let i=0;i<2;i++){
  52. // 获取随机色
  53. let r = parseInt(Math.random() * 256)
  54. let g = parseInt(Math.random() * 256)
  55. let b = parseInt(Math.random() * 256)
  56. // ES6 字符串拼接
  57. // this.bgColor = `rgba(${r},${g},${b},0.3)`
  58. let color = "rgba(" + r + "," + g + "," + b + "," + 0.3 + ")"
  59. // console.log(color)
  60. this.bgColor.push(color)
  61. }
  62. // 判断是否为初始密码
  63. uni.getStorageSync('login_password')
  64. // console.log(uni.getStorageSync('login_password'))
  65. if(uni.getStorageSync('login_password') == "Zhks123456+"){
  66. this.tip_password = true
  67. }
  68. // 判断是否绑定手机号
  69. if(!this.mobile){
  70. this.tip_mobile = true
  71. }
  72. // setTimeout(()=>{
  73. // if(!this.mobile){
  74. // uni.showModal({
  75. // title: '温馨提示',
  76. // content: '当前还未绑定手机号,请及时绑定。',
  77. // showCancel:false,
  78. // success: function (res) {
  79. // if (res.confirm) {
  80. // console.log('用户点击确定');
  81. // uni.navigateTo({
  82. // url:"../../my/setPhone/setPhone"
  83. // })
  84. // }
  85. // }
  86. // });
  87. // }
  88. // },500)
  89. },
  90. methods:{
  91. // 绑定手机
  92. binding_phone(){
  93. uni.navigateTo({
  94. url:"../../my/setPhone/setPhone"
  95. })
  96. },
  97. // 修改密码
  98. go_m_repassword(){
  99. uni.navigateTo({
  100. url:"../../my/repassword/repassword"
  101. })
  102. },
  103. // 个人信息
  104. go_information(){
  105. uni.navigateTo({
  106. url:"../../my/personal_information/personal_information"
  107. })
  108. }
  109. }
  110. }
  111. </script>
  112. <style lang="scss">
  113. .content{
  114. box-sizing: border-box;
  115. padding: 0 25rpx;
  116. }
  117. .user{
  118. margin-top: -50px;
  119. width: 700rpx;
  120. height: 100px;
  121. background: #FFFFFF;
  122. box-shadow: 0px 0px 3px 3px rgba(0,0,0,0.05);
  123. border-radius: 3px;
  124. display: flex;
  125. justify-content: space-between;
  126. align-items: center;
  127. box-sizing: border-box;
  128. padding-right: 14px;
  129. padding-left: 8px;
  130. .left{
  131. display: flex;
  132. align-items: center;
  133. .img{
  134. width: 66px;
  135. height: 66px;
  136. border-radius: 50%;
  137. overflow: hidden;
  138. image{
  139. width: 66px;
  140. height: 66px;
  141. }
  142. .avatar{
  143. width: 66px;
  144. height: 66px;
  145. text-align: center;
  146. line-height: 66px;
  147. color: #FFFFFF;
  148. font-size: 28px;
  149. }
  150. }
  151. .info{
  152. margin-left: 12px;
  153. .name{
  154. font-size: 34rpx;
  155. font-weight: 500;
  156. color: #232627;
  157. line-height: 26px;
  158. }
  159. .section{
  160. margin-top: 4px;
  161. font-size: 28rpx;
  162. font-weight: 500;
  163. color: #232627;
  164. line-height: 19px;
  165. }
  166. }
  167. }
  168. .right{
  169. }
  170. }
  171. .tip{
  172. margin-top: 8px;
  173. height: 45px;
  174. background: #FFFFFF;
  175. box-shadow: 0px 0px 3px 3px rgba(0,0,0,0.05);
  176. border-radius: 3px;
  177. display: flex;
  178. align-items: center;
  179. box-sizing: border-box;
  180. padding-left: 9px;
  181. .icon{
  182. width: 22px;
  183. height: 22px;
  184. background-image: url(./icon/tip.png);
  185. background-size: cover;
  186. background-repeat: no-repeat;
  187. }
  188. .text{
  189. margin-left: 6px;
  190. font-size: 15px;
  191. color: #7F8C8D;
  192. line-height: 19px;
  193. }
  194. }
  195. </style>