PersonalPanel.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. <template>
  2. <div class="personal-panel">
  3. <div class="personal-desc" :style="{ 'background': this.$store.state.app.themeColor }">
  4. <div class="avatar-container u-f u-f-ajc">
  5. <!-- <img class="avatar" :src="require('@/assets/user.png')" /> -->
  6. <img class="avatar" :src="user.headSculpture?user.headSculpture:avatar" />
  7. </div>
  8. <!-- <div class="name-role">
  9. <template v-if="user.name == 'admin'">
  10. <span class="sender">{{ user.name }}</span>
  11. </template>
  12. <template v-else>
  13. <span class="sender">{{ user.id }} - {{ user.name }}</span>
  14. </template>
  15. </div> -->
  16. <div class="name-role">
  17. <template >
  18. <span class="sender">{{ user.deptName }} - {{ user.roleName }}</span>
  19. </template>
  20. <!-- <template v-if="user.name == 'admin'">
  21. <span class="sender">超级管理员</span>
  22. </template>
  23. <template v-else>
  24. <span class="sender">{{ user.deptName }} - {{ user.jobName }}</span>
  25. </template> -->
  26. </div>
  27. <template v-if="user.name != 'admin'">
  28. <div class="registe-info">
  29. <span class="registe-info">
  30. <li class="fa fa-clock-o"></li>
  31. {{ user.createTime }}
  32. </span>
  33. </div>
  34. </template>
  35. </div>
  36. <!-- <div class="personal-relation">
  37. <span class="relation-item">followers</span>
  38. <span class="relation-item">watches</span>
  39. <span class="relation-item">friends</span>
  40. </div> -->
  41. <!-- <div class="main-operation">
  42. <span class="main-operation-item">
  43. <el-button size="small" icon="fa fa-male"> 个人中心</el-button>
  44. </span>
  45. <span class="main-operation-item">
  46. <el-button size="small" icon="fa fa-key" @click="showPsdDialog"> 修改密码</el-button>
  47. </span>
  48. </div> -->
  49. <div class="other-operation">
  50. <div class="other-operation-item" @click="clearCache">
  51. <li class="fa fa-eraser" ></li>
  52. 清除缓存
  53. </div>
  54. <div class="other-operation-item" @click="recruiting" v-if="user.roleId!=='20'">
  55. <li class="fa fa-user"></li>
  56. 闪电增员
  57. </div>
  58. <!-- <div class="other-operation-item">
  59. <li class="fa fa-bell"></li>
  60. 访问次数
  61. </div> -->
  62. <div class="other-operation-item" @click="showPsdDialog">
  63. <li class="fa fa-key"></li>
  64. 修改密码
  65. </div>
  66. <!-- <div class="other-operation-item" @click="showBackupDialog">
  67. <li class="fa fa-undo"></li>
  68. {{ $t("common.backupRestore") }}
  69. </div> -->
  70. </div>
  71. <div class="personal-footer" @click="logout">
  72. <li class="fa fa-sign-out"></li>
  73. {{ $t("common.logout") }}
  74. </div>
  75. <!--备份还原界面-->
  76. <backup ref="backupDialog" @afterRestore="afterRestore"></backup>
  77. <!-- 修改密码 -->
  78. <psdreset ref="psdresetDialog" @afterRestore="afterReset"></psdreset>
  79. <!-- 闪电增员 -->
  80. <Recruiting ref="recruitingDialog" ></Recruiting>
  81. </div>
  82. </template>
  83. <script>
  84. import Cookies from "js-cookie"
  85. import QRCode from "qrcodejs2";
  86. import Backup from "@/views/Backup/Backup"
  87. import Psdreset from "@/views/Psdreset/Psdreset"
  88. import Recruiting from "@/views/Sys/Recruiting"
  89. export default {
  90. name: "qrCode",
  91. name: 'PersonalPanel',
  92. components: {
  93. Backup,
  94. Psdreset,
  95. Recruiting
  96. },
  97. props: {
  98. user: {
  99. type: Object,
  100. default: {
  101. id: "",
  102. name: "admin",
  103. avatar: "@/assets/user.png",
  104. deptId: "",
  105. deptName: "",
  106. jobCode: "",
  107. jobName: "",
  108. // role: "超级管理员",
  109. registeInfo: "注册时间:2018-12-25 ",
  110. createTime:'',
  111. }
  112. }
  113. },
  114. computed: {
  115. mainTabs: {
  116. get() { return this.$store.state.tab.mainTabs },
  117. set(val) { this.$store.commit('updateMainTabs', val) }
  118. },
  119. },
  120. data() {
  121. return {
  122. avatar: require("@/assets/user.png"),
  123. }
  124. },
  125. created(){
  126. // if (Cookies.get("user") != 'admin') {
  127. // this.userData.registeInfo = "入司时间:" + this.transformTime( this.userData.esmUserInternal.intime);
  128. // this.$api.dept.getDeptById( this.user.deptId).then(deptRes => {
  129. // this.user.deptName = deptRes.data.name;
  130. // });
  131. // }
  132. },
  133. mounted() {
  134. this.user.createTime = this.user.createTime.substr(0,10)
  135. },
  136. methods: {
  137. //闪电增员
  138. recruiting() {
  139. this.$refs.recruitingDialog.setBackupVisible(true)
  140. },
  141. // 清除缓存
  142. clearCache(){
  143. localStorage.clear()
  144. sessionStorage.removeItem("user")
  145. this.deleteCookie("token")
  146. this.deleteCookie("user")
  147. this.deleteCookie("name")
  148. this.mainTabs = [];
  149. this.$router.push("/login")
  150. Cookies.removeAllCookie();
  151. this.$api.login.logout().then((res) => {
  152. }).catch(function (res) {
  153. })
  154. },
  155. // 退出登录
  156. logout: function () {
  157. this.$confirm("确认退出吗?", "提示", {
  158. type: "warning"
  159. })
  160. .then(() => {
  161. localStorage.clear()
  162. sessionStorage.removeItem("user")
  163. this.deleteCookie("token")
  164. this.deleteCookie("user")
  165. this.deleteCookie("name")
  166. this.mainTabs = [];
  167. this.$router.push("/login")
  168. Cookies.removeAllCookie();
  169. this.$api.login.logout().then((res) => {
  170. }).catch(function (res) {
  171. })
  172. })
  173. .catch(() => { })
  174. },
  175. // 删除cookie
  176. deleteCookie: function (name) {
  177. Cookies.remove(name)
  178. },
  179. // 打开备份还原界面
  180. showBackupDialog: function () {
  181. this.$refs.backupDialog.setBackupVisible(true)
  182. },
  183. // 成功还原之后,重新登录
  184. afterRestore: function () {
  185. this.$refs.backupDialog.setBackupVisible(false)
  186. sessionStorage.removeItem("user")
  187. this.deleteCookie("token")
  188. this.deleteCookie("user")
  189. this.deleteCookie("name")
  190. this.$router.push("/login")
  191. this.$api.login.logout().then((res) => {
  192. }).catch(function (res) {
  193. })
  194. },
  195. showPsdDialog: function () {
  196. this.$refs.psdresetDialog.setBackupVisible(true)
  197. },
  198. afterReset: function () {
  199. }
  200. },
  201. mounted() {
  202. }
  203. }
  204. </script>
  205. <style scoped>
  206. .personal-panel {
  207. font-size: 14px;
  208. width: 280px;
  209. text-align: center;
  210. border-color: rgba(180, 190, 190, 0.2);
  211. border-width: 1px;
  212. border-style: solid;
  213. background: rgba(182, 172, 172, 0.1);
  214. margin: -14px;
  215. }
  216. .personal-desc {
  217. padding: 15px;
  218. color: #fff;
  219. }
  220. .avatar {
  221. width: 80px;
  222. height: 80px;
  223. border-radius: 90px;
  224. }
  225. .name-role {
  226. font-size: 16px;
  227. padding: 5px;
  228. }
  229. .personal-relation {
  230. font-size: 16px;
  231. padding: 12px;
  232. margin-right: 1px;
  233. background: rgba(200, 209, 204, 0.3);
  234. }
  235. .relation-item {
  236. padding: 12px;
  237. }
  238. .relation-item:hover {
  239. cursor: pointer;
  240. color: rgb(19, 138, 156);
  241. }
  242. .main-operation {
  243. padding: 8px;
  244. margin-right: 1px;
  245. border-color: rgba(201, 206, 206, 0.2);
  246. border-top-width: 1px;
  247. border-top-style: solid;
  248. }
  249. .main-operation-item {
  250. margin: 15px;
  251. }
  252. .other-operation {
  253. padding: 15px;
  254. margin-right: 1px;
  255. text-align: left;
  256. border-color: rgba(180, 190, 190, 0.2);
  257. border-top-width: 1px;
  258. border-top-style: solid;
  259. }
  260. .other-operation-item {
  261. padding: 12px;
  262. }
  263. .other-operation-item:hover {
  264. cursor: pointer;
  265. background: #9e94941e;
  266. color: rgb(19, 138, 156);
  267. }
  268. .personal-footer {
  269. margin-right: 1px;
  270. font-size: 14px;
  271. text-align: center;
  272. padding-top: 10px;
  273. padding-bottom: 10px;
  274. border-color: rgba(180, 190, 190, 0.2);
  275. border-top-width: 1px;
  276. border-top-style: solid;
  277. }
  278. .personal-footer:hover {
  279. cursor: pointer;
  280. color: rgb(19, 138, 156);
  281. background: #b1a6a61e;
  282. }
  283. </style>