mine.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  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/fankui.png',
  138. name:'feedback',
  139. show:true
  140. },
  141. {
  142. itemName: '帮助中心',
  143. itemIcon: '/static/index/blue/shuoming.png',
  144. name:'help',
  145. show:true
  146. },
  147. {
  148. itemName: '用户协议',
  149. itemIcon: '/static/index/blue/xieyi1.png',
  150. name:'protocol',
  151. show:true
  152. }
  153. ]
  154. },
  155. loginOut(){
  156. let that=this
  157. try {
  158. uni.clearStorageSync();
  159. uni.showModal({
  160. showCancel:false,
  161. confirmText:"确认",
  162. content:"退出成功",
  163. success() {
  164. getApp().globalData.userInfo=''
  165. that.$Router.replaceAll({name:"login"})
  166. }
  167. })
  168. } catch (e) {
  169. uni.showToast({
  170. title:"退出失败",
  171. icon:"none"
  172. })
  173. }
  174. },
  175. /**
  176. * 订阅认证信息
  177. */
  178. subscribe(){
  179. // 获取用户的当前设置,判断是否点击了“总是保持以上,不在询问”
  180. uni.getSetting({
  181. withSubscriptions: true,//是否获取用户订阅消息的订阅状态,默认false不返回
  182. success(res){
  183. if(res.authSetting['scope.address']){
  184. uni.openSetting({ // 打开设置页
  185. success(res) {
  186. console.log(res.authSetting)
  187. },
  188. fail: (err) => {
  189. console.log(err);
  190. }
  191. });
  192. }
  193. else{// 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息
  194. uni.requestSubscribeMessage({
  195. tmplIds: that.$tmplIds,
  196. success (res) {
  197. console.log(res)
  198. },
  199. fail(err){
  200. console.error(err);
  201. }
  202. })
  203. }
  204. }
  205. })
  206. },
  207. /**
  208. * 加载员工信息
  209. */
  210. fetchStaffInfo(){
  211. let phone= this.$cache.get('phone')
  212. this.$api.enterprisestaff.detail({phone:phone}).then(res=>{
  213. this.staffInfo=res.data
  214. })
  215. },
  216. /**
  217. * 加载企业信息
  218. */
  219. fetchEnterpriseInfo(){
  220. let creditCode=this.$cache.get('creditCode')
  221. this.$api.enterprise.detail({creditCode:creditCode}).then(res=>{
  222. this.enterpriseInfo=res.data
  223. })
  224. },
  225. /**
  226. * 加载园区信息
  227. */
  228. fetchAgencyInfo(){
  229. console.log(getApp().globalData.userInfo);
  230. let agencyId=this.$cache.get('agencyId')
  231. this.$api.agency.page({id:agencyId}).then(res=>{
  232. this.agencyInfo=res.data[0]
  233. })
  234. },
  235. /**
  236. * 企业详情
  237. */
  238. goEnterpriseDetail(){
  239. uni.navigateTo({
  240. url:"/pages/company/company"
  241. })
  242. },
  243. /**
  244. * 园区详情
  245. */
  246. goAgencyDetail(){
  247. uni.navigateTo({
  248. url:"/pages/index/agency/agency"
  249. })
  250. },
  251. //功能跳转
  252. tapToMenu(name){
  253. let url=''
  254. switch (name){
  255. case 'feedback':
  256. url="/pages/mine/feedback/feedback"
  257. break;
  258. case 'changePhone':
  259. url="/pages/mine/editPhone/editPhone"
  260. break;
  261. case 'changePsw':
  262. url="/pages/mine/changePass/changePass"
  263. break;
  264. default:
  265. break;
  266. }
  267. if (!this.$isEmpty(url)) {
  268. uni.navigateTo({
  269. url:url
  270. })
  271. }else{
  272. uni.navigateTo({
  273. url:"/pages/mine/protocol/protocol"
  274. })
  275. }
  276. },
  277. //获取微信昵称和头像
  278. getUserInfo(e){
  279. this.userInfo=e.detail.userInfo
  280. console.log(this.userInfo.avatarUrl)
  281. this.$cache.put('userInfo',this.userInfo)
  282. },
  283. //获取用户信息
  284. apiGetUserInfo(){
  285. this.phone=this.$cache.get('phone') || ''
  286. this.userInfo= getApp().globalData.userInfo || {}
  287. },
  288. },
  289. };
  290. </script>
  291. <style lang="scss" scoped>
  292. .page{
  293. min-height: 100vh;
  294. background-color: #FFFFFF;
  295. // background-color: #f5f6f8;
  296. }
  297. button::after {
  298. border: none;
  299. }
  300. .mine_order_statue {
  301. //todo
  302. // box-shadow: 0 10rpx #e7f1fd ;
  303. background: #fff;
  304. padding: 10upx 20upx;
  305. border-radius: 20rpx;
  306. }
  307. .item_list {
  308. display: flex;
  309. flex-direction: column;
  310. background: #fff;
  311. margin-top: 15upx;
  312. // margin-left: 20rpx;
  313. // margin-right: 20rpx;
  314. border-radius: 10rpx;
  315. .item {
  316. display: flex;
  317. flex-direction: row;
  318. align-items: center;
  319. justify-content: space-between;
  320. padding: 0 30upx;
  321. height: 90upx;
  322. border-bottom: 1upx solid #f1f1f1;
  323. .item_content {
  324. display: flex;
  325. flex-direction: row;
  326. align-items: center;
  327. image {
  328. width: 42upx;
  329. height: 42upx;
  330. }
  331. text {
  332. font-size: 28upx;
  333. color: #333333;
  334. margin-left: 20upx;
  335. }
  336. }
  337. image {
  338. width: 10upx;
  339. height: 18upx;
  340. }
  341. }
  342. .item:last-child {
  343. border: none;
  344. }
  345. }
  346. </style>