mine.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. <template>
  2. <view >
  3. <view >
  4. <view v-if="loginType=='staff'" class="mine_order_statue">
  5. <view class="flex justify-between" style="padding:30rpx 20rpx;">
  6. <view class="flex">
  7. <image :src="staffInfo.avatar?staffInfo.avatar:'http://139.9.103.171:8888/group1/M00/00/01/iwlnq1_AYZqAb30pAAAQNvkj3Wk302.png'" style="background-color: #FFFFFF;width: 106rpx;height: 106rpx;border-radius: 10rpx;" ></image>
  8. <view class="flex flex-direction padding-left-30">
  9. <text class="text-lg text-bold" v-text="staffInfo.realName"></text>
  10. <view class="text-df" style="padding: 20rpx 0;" >
  11. <text class="margin-top-40 text-df">手机号:{{staffInfo.phone}}</text>
  12. </view>
  13. </view>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="item_list" v-if="loginType=='staff'">
  18. <view class=" flex justify-between" style="padding: 34rpx 24rpx 34rpx 40rpx;">
  19. <view class="text-bold">所属公司</view>
  20. <view class="" @click="goEnterpriseDetail">
  21. <text class="text-black" style="font-size: 28rpx;" >{{staffInfo.enterpriseName}}</text>
  22. <text class="cuIcon-right text-gray padding-left-20" style="font-size: 24rpx;"></text>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="item_list" style="margin-top: 0;" v-if="loginType=='enterprise'">
  27. <view class="flex justify-between" style="padding: 50rpx 25rpx 60rpx 40rpx;">
  28. <view class="text-bold">我的公司</view>
  29. <view class="" @click="goEnterpriseDetail">
  30. <text class="text-black" v-if="loginType=='enterprise'">{{enterpriseInfo.enterpriseName}}</text>
  31. <text class="cuIcon-right text-gray padding-left-20" style="font-size: 24rpx;"></text>
  32. </view>
  33. </view>
  34. </view>
  35. <view class="item_list" style="margin-top: 0;" v-if="loginType=='agency'">
  36. <view class="flex justify-between" style="padding: 50rpx 25rpx 60rpx 40rpx;">
  37. <view class="text-bold">我的园区</view>
  38. <view class="" @click="goAgencyDetail">
  39. <text class="text-black">{{agencyInfo.agencyName}}</text>
  40. <text class="cuIcon-right text-gray padding-left-20" style="font-size: 24rpx;"></text>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="item_list" >
  45. <view class="item" v-if="item.show" v-for="(item, index) in systemItemList" :key="index" @tap="tapToMenu(item.name)">
  46. <view class="item_content">
  47. <image :src="item.itemIcon"></image>
  48. <text>{{ item.itemName }}</text>
  49. </view>
  50. <view class="">
  51. <image src="http://139.9.103.171:1888/img/image/arrow.png"></image>
  52. </view>
  53. </view>
  54. </view>
  55. <view @click="loginOut" class="cu-btn round flex bg-blue" style="padding: 40rpx;margin: 80rpx 15rpx 0;">
  56. 退出登陆
  57. </view>
  58. </view>
  59. <u-tabbar v-model="tabbarCurr"
  60. :icon-size="tabbar.iconSize"
  61. :active-color="tabbar.activeColor"
  62. :list="tabbar.list" :mid-button="false">
  63. </u-tabbar>
  64. </view>
  65. </template>
  66. <script>
  67. var app=getApp()
  68. import DtCustomBar from '@/components/dt_custom_bar.vue'
  69. import {tabbar} from "@/assets/js/tabbar.js"
  70. let that
  71. export default {
  72. components: {
  73. DtCustomBar
  74. },
  75. data() {
  76. return {
  77. background: {
  78. backgroundColor: '#f5f6f8',
  79. },
  80. //tabbar
  81. tabbarCurr:2,
  82. tabbar:tabbar,
  83. //登陆类型
  84. loginType:'',
  85. //员工信息
  86. staffInfo:{},
  87. //企业信息
  88. enterpriseInfo:{},
  89. //园区信息
  90. agencyInfo:{},
  91. //功能列表
  92. systemItemList:[],
  93. };
  94. },
  95. onShow() {
  96. this.apiGetUserInfo()
  97. },
  98. onLoad() {
  99. that=this
  100. this.fetchStaticData()
  101. if (this.loginType==this.$loginType.STAFF) {
  102. this.fetchStaffInfo()
  103. }else if (this.loginType==this.$loginType.ENTERPRISE) {
  104. this.fetchEnterpriseInfo()
  105. }else if (this.loginType==this.$loginType.AGENCY) {
  106. this.fetchAgencyInfo()
  107. }
  108. },
  109. methods: {
  110. fetchStaticData(){
  111. this.loginType=this.$cache.get('loginType') || ''
  112. this.systemItemList=[
  113. // {
  114. // itemName: '物业报修',
  115. // itemIcon: '/static/index/blue/wuye.png',
  116. // index:10
  117. // },
  118. // {
  119. // itemName: '人员认证',
  120. // itemIcon: '/static/index/blue/shenfen.png',
  121. // index:10
  122. // },
  123. {
  124. itemName: '换绑手机号',
  125. itemIcon: '/static/index/blue/change-phone.png',
  126. name:'changePhone',
  127. show:this.loginType==this.$loginType.STAFF
  128. },
  129. {
  130. itemName: '修改密码',
  131. itemIcon: '/static/index/blue/changePsw.png',
  132. name:'changePsw',
  133. show:this.loginType!=this.$loginType.STAFF
  134. },
  135. {
  136. itemName: '健康码',
  137. itemIcon: '/static/index/blue/healthcode.png',
  138. name:'healthcode',
  139. show:true
  140. },
  141. {
  142. itemName: '问题反馈',
  143. itemIcon: '/static/index/blue/fankui.png',
  144. name:'feedback',
  145. show:true
  146. },
  147. {
  148. itemName: '帮助中心',
  149. itemIcon: '/static/index/blue/shuoming.png',
  150. name:'help',
  151. show:true
  152. },
  153. {
  154. itemName: '用户协议',
  155. itemIcon: '/static/index/blue/xieyi1.png',
  156. name:'protocol',
  157. show:true
  158. }
  159. ]
  160. },
  161. loginOut(){
  162. let that=this
  163. try {
  164. uni.clearStorageSync();
  165. uni.showModal({
  166. showCancel:false,
  167. confirmText:"确认",
  168. content:"退出成功",
  169. success() {
  170. getApp().globalData.userInfo=''
  171. that.$Router.replaceAll({name:"login"})
  172. }
  173. })
  174. } catch (e) {
  175. uni.showToast({
  176. title:"退出失败",
  177. icon:"none"
  178. })
  179. }
  180. },
  181. /**
  182. * 订阅认证信息
  183. */
  184. subscribe(){
  185. // 获取用户的当前设置,判断是否点击了“总是保持以上,不在询问”
  186. uni.getSetting({
  187. withSubscriptions: true,//是否获取用户订阅消息的订阅状态,默认false不返回
  188. success(res){
  189. if(res.authSetting['scope.address']){
  190. uni.openSetting({ // 打开设置页
  191. success(res) {
  192. console.log(res.authSetting)
  193. },
  194. fail: (err) => {
  195. console.log(err);
  196. }
  197. });
  198. }
  199. else{// 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息
  200. uni.requestSubscribeMessage({
  201. tmplIds: that.$tmplIds,
  202. success (res) {
  203. console.log(res)
  204. },
  205. fail(err){
  206. console.error(err);
  207. }
  208. })
  209. }
  210. }
  211. })
  212. },
  213. /**
  214. * 加载员工信息
  215. */
  216. fetchStaffInfo(){
  217. let phone= this.$cache.get('phone')
  218. this.$api.enterprisestaff.detail({phone:phone}).then(res=>{
  219. this.staffInfo=res.data
  220. })
  221. },
  222. /**
  223. * 加载企业信息
  224. */
  225. fetchEnterpriseInfo(){
  226. let creditCode=this.$cache.get('creditCode')
  227. this.$api.enterprise.detail({creditCode:creditCode}).then(res=>{
  228. this.enterpriseInfo=res.data
  229. })
  230. },
  231. /**
  232. * 加载园区信息
  233. */
  234. fetchAgencyInfo(){
  235. console.log(getApp().globalData.userInfo);
  236. let agencyId=this.$cache.get('agencyId')
  237. this.$api.agency.page({id:agencyId}).then(res=>{
  238. this.agencyInfo=res.data[0]
  239. })
  240. },
  241. /**
  242. * 企业详情
  243. */
  244. goEnterpriseDetail(){
  245. uni.navigateTo({
  246. url:"/pages/company/company"
  247. })
  248. },
  249. /**
  250. * 园区详情
  251. */
  252. goAgencyDetail(){
  253. uni.navigateTo({
  254. url:"/pages/index/agency/agency"
  255. })
  256. },
  257. //功能跳转
  258. tapToMenu(name){
  259. let url=''
  260. switch (name){
  261. case 'feedback':
  262. url="/pages/mine/feedback/feedback"
  263. break;
  264. case 'changePhone':
  265. url="/pages/mine/editPhone/editPhone"
  266. break;
  267. case 'changePsw':
  268. url="/pages/mine/changePass/changePass"
  269. break;
  270. case 'healthcode':
  271. url="/pages/mine/healthcode/healthcode"
  272. break;
  273. default:
  274. break;
  275. }
  276. if (!this.$isEmpty(url)) {
  277. uni.navigateTo({
  278. url:url
  279. })
  280. }else{
  281. uni.navigateTo({
  282. url:"/pages/mine/protocol/protocol"
  283. })
  284. }
  285. },
  286. //获取微信昵称和头像
  287. getUserInfo(e){
  288. this.userInfo=e.detail.userInfo
  289. console.log(this.userInfo.avatarUrl)
  290. this.$cache.put('userInfo',this.userInfo)
  291. },
  292. //获取用户信息
  293. apiGetUserInfo(){
  294. this.phone=this.$cache.get('phone') || ''
  295. this.userInfo= getApp().globalData.userInfo || {}
  296. },
  297. },
  298. };
  299. </script>
  300. <style lang="scss" scoped>
  301. .page{
  302. min-height: 100vh;
  303. background-color: #FFFFFF;
  304. // background-color: #f5f6f8;
  305. }
  306. button::after {
  307. border: none;
  308. }
  309. .mine_order_statue {
  310. //todo
  311. // box-shadow: 0 10rpx #e7f1fd ;
  312. background: #fff;
  313. padding: 10upx 20upx;
  314. border-radius: 20rpx;
  315. }
  316. .item_list {
  317. display: flex;
  318. flex-direction: column;
  319. background: #fff;
  320. margin-top: 15upx;
  321. // margin-left: 20rpx;
  322. // margin-right: 20rpx;
  323. border-radius: 10rpx;
  324. .item {
  325. display: flex;
  326. flex-direction: row;
  327. align-items: center;
  328. justify-content: space-between;
  329. padding: 0 30upx;
  330. height: 90upx;
  331. border-bottom: 1upx solid #f1f1f1;
  332. .item_content {
  333. display: flex;
  334. flex-direction: row;
  335. align-items: center;
  336. image {
  337. width: 42upx;
  338. height: 42upx;
  339. }
  340. text {
  341. font-size: 28upx;
  342. color: #333333;
  343. margin-left: 20upx;
  344. }
  345. }
  346. image {
  347. width: 10upx;
  348. height: 18upx;
  349. }
  350. }
  351. .item:last-child {
  352. border: none;
  353. }
  354. }
  355. </style>