mine.vue 6.8 KB

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