123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- <template>
- <view class="content">
- <view class="user">
- <view class="left">
- <view class="img">
- <image v-if="user.avatar" :src="user.avatar" mode=""></image>
- <view class="avatar" v-if="!user.avatar" :style="{backgroundColor:bgColor[1]}">{{user.name.split('').pop()}}</view>
- </view>
- <view class="info">
- <view class="name">{{user.name}} <text style="color: #999;font-size: 14px;margin-left: 10px;" v-if="mobile">({{mobile}})</text> </view>
- <view class="section">{{user.section}}</view>
- </view>
- </view>
- <view class="right">
- <!-- <uni-icons type="arrowright"></uni-icons> -->
- </view>
- </view>
- <view class="tip" v-if="tip_password" @click="go_m_repassword()">
- <view class="icon"></view>
- <view class="text">当前密码为初始密码,请及时修改。</view>
- </view>
- <view class="tip" v-if="tip_mobile" @click="binding_phone()">
- <view class="icon"></view>
- <view class="text">未绑定手机号,请立即绑定手机号。</view>
- </view>
- </view>
- </template>
- <script>
- export default {
- name:"t-m-user",
- data() {
- return {
- // 用户基本信息
- user:{},
- // 手机号
- mobile:'',
- // 头像随机色
- bgColor:[],
- // 密码提示
- tip_password:false,
- // 手机绑定
- tip_mobile:false
- };
- },
- created() {
- console.log(uni.getStorageSync('user'))
- // 获取用户基本信息
- this.user = uni.getStorageSync('user');
- this.mobile = uni.getStorageSync('mobile');
- // 设置头像
- for(let i=0;i<2;i++){
- // 获取随机色
- let r = parseInt(Math.random() * 256)
- let g = parseInt(Math.random() * 256)
- let b = parseInt(Math.random() * 256)
-
- // ES6 字符串拼接
- // this.bgColor = `rgba(${r},${g},${b},0.3)`
- let color = "rgba(" + r + "," + g + "," + b + "," + 0.3 + ")"
- // console.log(color)
- this.bgColor.push(color)
- }
-
- // 判断是否为初始密码
- uni.getStorageSync('login_password')
- // console.log(uni.getStorageSync('login_password'))
- if(uni.getStorageSync('login_password') == "Zhks123456+"){
- this.tip_password = true
- }
-
- // 判断是否绑定手机号
- if(!this.mobile){
- this.tip_mobile = true
- }
-
- // setTimeout(()=>{
- // if(!this.mobile){
- // uni.showModal({
- // title: '温馨提示',
- // content: '当前还未绑定手机号,请及时绑定。',
- // showCancel:false,
- // success: function (res) {
- // if (res.confirm) {
- // console.log('用户点击确定');
- // uni.navigateTo({
- // url:"../../my/setPhone/setPhone"
- // })
- // }
- // }
- // });
- // }
- // },500)
- },
- methods:{
- // 绑定手机
- binding_phone(){
- uni.navigateTo({
- url:"../../my/setPhone/setPhone"
- })
- },
- // 修改密码
- go_m_repassword(){
- uni.navigateTo({
- url:"../../my/repassword/repassword"
- })
- },
- }
-
- }
- </script>
- <style lang="scss">
- .content{
- box-sizing: border-box;
- padding: 0 25rpx;
- }
- .user{
- margin-top: -50px;
- width: 700rpx;
- height: 100px;
- background: #FFFFFF;
- box-shadow: 0px 0px 3px 3px rgba(0,0,0,0.05);
- border-radius: 3px;
-
- display: flex;
- justify-content: space-between;
- align-items: center;
-
- box-sizing: border-box;
- padding-right: 14px;
- padding-left: 8px;
- .left{
- display: flex;
- align-items: center;
- .img{
- width: 66px;
- height: 66px;
- border-radius: 50%;
- overflow: hidden;
- image{
- width: 66px;
- height: 66px;
- }
- .avatar{
- width: 66px;
- height: 66px;
- text-align: center;
- line-height: 66px;
- color: #FFFFFF;
- font-size: 28px;
- }
- }
- .info{
- margin-left: 12px;
- .name{
- font-size: 19px;
- font-weight: 500;
- color: #232627;
- line-height: 26px;
- }
- .section{
- margin-top: 4px;
- font-size: 14px;
- font-weight: 500;
- color: #232627;
- line-height: 19px;
- }
- }
- }
- .right{
-
- }
- }
-
- .tip{
- margin-top: 8px;
- height: 45px;
- background: #FFFFFF;
- box-shadow: 0px 0px 3px 3px rgba(0,0,0,0.05);
- border-radius: 3px;
-
- display: flex;
- align-items: center;
-
- box-sizing: border-box;
- padding-left: 9px;
- .icon{
- width: 22px;
- height: 22px;
-
- background-image: url(./icon/tip.png);
- background-size: cover;
- background-repeat: no-repeat;
- }
- .text{
- margin-left: 6px;
- font-size: 15px;
- color: #7F8C8D;
- line-height: 19px;
- }
- }
- </style>
|