center.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <div class="center">
  3. <!-- 头部 -->
  4. <header>
  5. <div class="beijin"></div>
  6. <div class="flex aic users pixed" style="width:50%;">
  7. <img :src="require('../../../assets/img/personal/userHead.png')" class="imege" />
  8. <span class="f16 fff ml-20" v-if="userInfo.userNameNeedTranslate == '1'"><ww-open-data type='userName' :openid='userInfo.name'></ww-open-data></span>
  9. <span class="f16 fff ml-20" v-else>{{userInfo.name}} </span>
  10. </div>
  11. </header>
  12. <!-- 主体 -->
  13. <main class="mt-10">
  14. <div class="bg-fff">
  15. <van-cell title="账号" :title-style="'flex: 0.5;'" :value="userInfo.phone"></van-cell>
  16. <van-cell title="公司" :title-style="'flex: 0.5;'" :value="userInfo.companyName"></van-cell>
  17. <van-cell title="修改密码" isLink to="/my/set"></van-cell>
  18. </div>
  19. <van-cell :title="'绑定'+(isCorpWX?'企业':'')+'微信'" v-if="isCorpWX || isWX" @click="bindWeiXin" style="margin-top:10px;" :title-style="'flex: 2.5;'" label="绑定微信后可接收工时填报提醒">
  20. <template>
  21. <span v-if="(isCorpWX && userInfo.corpwxUserid == null) || (isWX && userInfo.wxOpenid == null)" style="color:#ff0000;">未绑定</span>
  22. <span v-if="(isCorpWX && userInfo.corpwxUserid != null) || (isWX && userInfo.wxOpenid != null)" style="color:#7CCD7C;">已绑定</span>
  23. </template>
  24. </van-cell>
  25. <van-button class="logout" @click="logout" block round type="danger" >退出登录</van-button>
  26. </main>
  27. <Footer page="my" />
  28. </div>
  29. </template>
  30. <script>
  31. import Footer from "@/components/Footer";
  32. import { mapGetters } from "vuex";
  33. export default {
  34. components: {
  35. Footer
  36. },
  37. computed: {
  38. ...mapGetters(["userId", "isLogin"])
  39. },
  40. data() {
  41. return {
  42. userInfo: JSON.parse(localStorage.userInfo),
  43. isCorpWX:false,
  44. isWX:false,
  45. }
  46. },
  47. methods: {
  48. logout() {
  49. this.$store.commit("updateLogin", false);
  50. localStorage.removeItem("userInfo");
  51. this.$router.push("/login");
  52. },
  53. bindWeiXin(){
  54. //企业微信
  55. if (this.isCorpWX && this.userInfo.corpwxUserid != null) {
  56. return;
  57. }
  58. //微信
  59. else if (this.isWX && this.userInfo.wxOpenid != null) {
  60. return;
  61. }
  62. var appId = "wx749c84daac654e1e";//工时管家公众号
  63. if (this.isCorpWX) {
  64. appId = "ww4e237fd6abb635af"; //企业微信第三方的SUIT ID
  65. }
  66. var url = "http://mobworktime.ttkuaiban.com/";//授权回调页面
  67. var weixinUrl="https://open.weixin.qq.com/connect/oauth2/authorize?appid="+appId+"&redirect_uri="+encodeURI(url)+"&response_type=code&scope=snsapi_base&state="+this.userInfo.id+"#wechat_redirect";
  68. window.location.href = weixinUrl;
  69. },
  70. },
  71. create() {
  72. },
  73. mounted() {
  74. var ua = navigator.userAgent.toLowerCase();
  75. if (ua.indexOf("wxwork") > 0) {
  76. this.isCorpWX = true;
  77. } else if (ua.indexOf("micromessenger") > 0) {
  78. this.isWX = true;
  79. }
  80. }
  81. };
  82. </script>
  83. <style lang="less" scoped>
  84. /* 本页公共样式 */
  85. .gray {
  86. color: #797d82;
  87. }
  88. .bott0 {
  89. bottom: 0;
  90. }
  91. .orange {
  92. color: #ff5f16
  93. }
  94. .yellow {
  95. color: #ffb232
  96. }
  97. .bd-gray {
  98. border-bottom: 1px solid #f5f5f5;
  99. }
  100. // 头部图片
  101. .beijin {
  102. background: url(../../../assets/img/personal/head_back.jpg) repeat-y center center;
  103. height: 200px;
  104. background-size: cover;
  105. margin-top: -44px;
  106. }
  107. // 用户名和头像
  108. .users {
  109. top: 55px;
  110. left: 22px;
  111. position: absolute;
  112. // 头像
  113. .imege {
  114. height: 65px;
  115. border-radius: 50%;
  116. }
  117. .fff {
  118. font-size: 22px;
  119. }
  120. }
  121. // 导航
  122. .nav {
  123. height: 75px;
  124. .iconfont {
  125. font-weight: bold;
  126. }
  127. .cit {
  128. height: 26px;
  129. }
  130. }
  131. .logout {
  132. width: 80%;
  133. margin: 50px auto 0;
  134. }
  135. // 主体
  136. main {
  137. .list {
  138. height: 50px;
  139. .image {
  140. height: 20px;
  141. }
  142. }
  143. .foun {
  144. font-size: 12px;
  145. }
  146. }
  147. /* 底部 */
  148. .footer {
  149. height: 50px;
  150. }
  151. </style>