mine.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. <template>
  2. <view>
  3. <view class="">
  4. <view class="header">
  5. <view class="" style="height: 25rpx;"></view>
  6. <view class="flex justify-between">
  7. <view class="flex">
  8. <view class="avatar">
  9. <open-data style="width: 120rpx;height: 120rpx; " type="userAvatarUrl"></open-data>
  10. </view>
  11. <view style="padding: 10rpx 20rpx;" v-if="loginType=='staff'">
  12. <open-data style="font-size: 32rpx;color: #FFFFFF;" type="userNickName"></open-data>
  13. <view class="text-white text-df padding-top-20">
  14. {{$cache.get('phone')}}
  15. </view>
  16. </view>
  17. <view v-else class="nickname text-white">
  18. <open-data type="userNickName"></open-data>
  19. </view>
  20. </view>
  21. <view @click="loginOut" class="flex justify-center align-center" style="text-decoration: underline;color: #FFFFFF;padding-right: 80rpx;">
  22. <image src="../../static/login/logout.png" style="width: 50rpx;height: 50rpx;" ></image>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="info" @click="jump">
  27. <text v-text="loginType=='agency'?'我的园区':'所属公司'"></text>
  28. <text>{{title}}</text>
  29. </view>
  30. <view class="item_list" >
  31. <view class="item">
  32. <text style="font-size: 32rpx;">系统功能</text>
  33. </view>
  34. <view v-if="item.show" class="item" v-for="(item, index) in systemItemList" :key="index" @tap="tapToMenu(item.name)">
  35. <view class="item_content">
  36. <image :src="item.itemIcon"></image>
  37. <text>{{ item.itemName }}</text>
  38. </view>
  39. <view class="">
  40. <image src="/static/icon/arrow.png"></image>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <u-tabbar
  46. :icon-size="tabbar.iconSize"
  47. :active-color="tabbar.activeColor"
  48. :mid-button-size="tabbar.MinButtonSize"
  49. :list="tabbar.list" :mid-button="true">
  50. </u-tabbar>
  51. </view>
  52. </template>
  53. <script>
  54. var app=getApp()
  55. import {tabbar} from "@/assets/js/tabbar.js"
  56. let that
  57. export default {
  58. data() {
  59. return {
  60. //tabbar
  61. tabbar:tabbar,
  62. //登陆类型
  63. loginType:'',
  64. title:'',
  65. //功能列表
  66. systemItemList:[]
  67. }
  68. },
  69. onLoad() {
  70. that=this
  71. this.fetchStaticData()
  72. if (this.loginType==this.$loginType.STAFF) {
  73. console.log("1");
  74. this.fetchStaffInfo()
  75. }else if (this.loginType==this.$loginType.ENTERPRISE) {
  76. console.log("2");
  77. this.fetchEnterpriseInfo()
  78. }else if (this.loginType==this.$loginType.AGENCY) {
  79. console.log("3");
  80. this.fetchAgencyInfo()
  81. }
  82. },
  83. // onReady() {
  84. // if (this.$cache.get('loginType')!=this.$loginType.STAFF) {
  85. // let tmp=this.$u.deepClone(tabbar)
  86. // tmp.list.splice(1,1)
  87. // this.tabbar=tmp
  88. // }else{
  89. // this.tabbar=tabbar
  90. // }
  91. // },
  92. methods: {
  93. loginOut(){
  94. let that=this
  95. try {
  96. uni.clearStorageSync();
  97. uni.showModal({
  98. showCancel:false,
  99. confirmText:"确认",
  100. content:"退出成功",
  101. success() {
  102. getApp().globalData.userInfo=''
  103. uni.reLaunch({
  104. url:"/pages/login/login"
  105. })
  106. }
  107. })
  108. } catch (e) {
  109. uni.showToast({
  110. title:"退出失败",
  111. icon:"none"
  112. })
  113. }
  114. },
  115. fetchStaticData(){
  116. this.loginType=this.$cache.get('loginType') || ''
  117. this.systemItemList=[
  118. {
  119. itemName: '换绑手机号',
  120. itemIcon: '/static/icon/phone.png',
  121. name:'changePhone',
  122. show:this.loginType==this.$loginType.STAFF
  123. },
  124. {
  125. itemName: '修改密码',
  126. itemIcon: '/static/icon/mima.png',
  127. name:'changePsw',
  128. show:this.loginType!=this.$loginType.STAFF
  129. },
  130. {
  131. itemName: '问题反馈',
  132. itemIcon: '/static/icon/fankui.png',
  133. name:'feedback',
  134. show:true
  135. }
  136. ]
  137. },
  138. /**
  139. * 加载员工信息
  140. */
  141. fetchStaffInfo(){
  142. let phone= this.$cache.get('phone')
  143. this.$api.enterprisestaff.page({phone:phone,auditStatus:1}).then(res=>{
  144. this.title=res.data.records[0].enterpriseName
  145. })
  146. },
  147. /**
  148. * 加载企业信息
  149. */
  150. fetchEnterpriseInfo(){
  151. let creditCode=this.$cache.get('creditCode')
  152. this.$api.enterprise.detail({creditCode:creditCode}).then(res=>{
  153. this.title=res.data.enterpriseName
  154. })
  155. },
  156. /**
  157. * 加载园区信息
  158. */
  159. fetchAgencyInfo(){
  160. let agencyId=this.$cache.get('agencyId')
  161. this.$api.agency.page({id:agencyId}).then(res=>{
  162. this.title=res.data.records[0].name
  163. })
  164. },
  165. /**
  166. * 企业详情
  167. */
  168. jump(){
  169. let url=''
  170. if (this.loginType==this.$loginType.AGENCY) {
  171. url='/pages/agency/agency'
  172. }else{
  173. url='/pages/company/company'
  174. }
  175. uni.navigateTo({
  176. url
  177. })
  178. },
  179. //功能跳转
  180. tapToMenu(name){
  181. let url=''
  182. switch (name){
  183. case 'feedback':
  184. url="/pages/mine/feedback/feedback"
  185. break;
  186. case 'changePhone':
  187. url="/pages/mine/editPhone/editPhone"
  188. break;
  189. case 'changePsw':
  190. url="/pages/mine/changePass/changePass"
  191. break;
  192. default:
  193. break;
  194. }
  195. if (!this.$isEmpty(url)) {
  196. uni.navigateTo({
  197. url:url
  198. })
  199. }else{
  200. uni.navigateTo({
  201. url:"/pages/mine/protocol/protocol"
  202. })
  203. }
  204. },
  205. }
  206. }
  207. </script>
  208. <style>
  209. page{
  210. background-color: #FFFFFF;
  211. }
  212. </style>
  213. <style lang="scss" scoped>
  214. .header{
  215. background-color: $base-color;
  216. height: 250rpx;
  217. .avatar{
  218. display: block;
  219. margin-left: 50rpx;
  220. overflow:hidden;
  221. width: 120rpx;
  222. height: 120rpx;
  223. left: 50%;
  224. border-radius: 50%;
  225. }
  226. .nickname{
  227. display: flex;
  228. justify-content: center;
  229. align-items: center;
  230. padding-left: 30rpx;
  231. font-size: 34rpx;
  232. }
  233. }
  234. .info{
  235. padding:30rpx 20rpx;
  236. text-align: center;
  237. margin: -60rpx 25rpx 20rpx;
  238. background-color: #FFFFFF;
  239. border-radius: 20rpx;
  240. box-shadow: 0 10rpx #e7f1fd ;
  241. display: flex;
  242. justify-content: space-between;
  243. text:first-child{
  244. font-size: 30rpx;
  245. padding-left: 15rpx;
  246. color: #000000;
  247. font-weight: 800;
  248. }
  249. text:last-child{
  250. color: #333;
  251. padding-right: 20rpx;
  252. font-size: 28rpx;
  253. }
  254. }
  255. .item_list {
  256. display: flex;
  257. flex-direction: column;
  258. background: #fff;
  259. margin: 20rpx;
  260. border-radius: 20rpx;
  261. .item {
  262. display: flex;
  263. flex-direction: row;
  264. align-items: center;
  265. justify-content: space-between;
  266. padding: 0 30upx;
  267. height: 90upx;
  268. border-bottom: 1upx solid #f1f1f1;
  269. .item_content {
  270. display: flex;
  271. flex-direction: row;
  272. align-items: center;
  273. image {
  274. width: 42upx;
  275. height: 42upx;
  276. }
  277. text {
  278. font-size: 28upx;
  279. color: #333333;
  280. margin-left: 20upx;
  281. }
  282. }
  283. image {
  284. width: 10upx;
  285. height: 18upx;
  286. }
  287. }
  288. .item:first-child{
  289. border: none;
  290. }
  291. .item:last-child {
  292. border: none;
  293. }
  294. }
  295. </style>