mine.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  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:{},
  83. //登陆类型
  84. loginType:'',
  85. //员工信息
  86. staffInfo:{},
  87. //企业信息
  88. enterpriseInfo:{},
  89. //园区信息
  90. agencyInfo:{},
  91. //功能列表
  92. systemItemList:[],
  93. };
  94. },
  95. onShow() {
  96. this.apiGetUserInfo()
  97. },
  98. onReady() {
  99. if (this.$cache.get('loginType')!=this.$loginType.STAFF) {
  100. let tmp=this.$u.deepClone(tabbar)
  101. tmp.list.splice(1,1)
  102. this.tabbar=tmp
  103. }else{
  104. this.tabbar=tabbar
  105. }
  106. },
  107. onLoad() {
  108. that=this
  109. this.fetchStaticData()
  110. if (this.loginType==this.$loginType.STAFF) {
  111. this.fetchStaffInfo()
  112. }else if (this.loginType==this.$loginType.ENTERPRISE) {
  113. this.fetchEnterpriseInfo()
  114. }else if (this.loginType==this.$loginType.AGENCY) {
  115. this.fetchAgencyInfo()
  116. }
  117. },
  118. methods: {
  119. fetchStaticData(){
  120. this.loginType=this.$cache.get('loginType') || ''
  121. this.systemItemList=[
  122. // {
  123. // itemName: '物业报修',
  124. // itemIcon: '/static/index/blue/wuye.png',
  125. // index:10
  126. // },
  127. // {
  128. // itemName: '人员认证',
  129. // itemIcon: '/static/index/blue/shenfen.png',
  130. // index:10
  131. // },
  132. {
  133. itemName: '换绑手机号',
  134. itemIcon: '/static/index/blue/change-phone.png',
  135. name:'changePhone',
  136. show:this.loginType==this.$loginType.STAFF
  137. },
  138. {
  139. itemName: '修改密码',
  140. itemIcon: '/static/index/blue/changePsw.png',
  141. name:'changePsw',
  142. show:this.loginType!=this.$loginType.STAFF
  143. },
  144. {
  145. itemName: '问题反馈',
  146. itemIcon: '/static/index/blue/fankui.png',
  147. name:'feedback',
  148. show:true
  149. },
  150. {
  151. itemName: '帮助中心',
  152. itemIcon: '/static/index/blue/shuoming.png',
  153. name:'help',
  154. show:true
  155. },
  156. {
  157. itemName: '用户协议',
  158. itemIcon: '/static/index/blue/xieyi1.png',
  159. name:'protocol',
  160. show:true
  161. }
  162. ]
  163. },
  164. loginOut(){
  165. let that=this
  166. try {
  167. uni.clearStorageSync();
  168. uni.showModal({
  169. showCancel:false,
  170. confirmText:"确认",
  171. content:"退出成功",
  172. success() {
  173. getApp().globalData.userInfo=''
  174. that.$Router.replaceAll({name:"login"})
  175. }
  176. })
  177. } catch (e) {
  178. uni.showToast({
  179. title:"退出失败",
  180. icon:"none"
  181. })
  182. }
  183. },
  184. /**
  185. * 订阅认证信息
  186. */
  187. subscribe(){
  188. // 获取用户的当前设置,判断是否点击了“总是保持以上,不在询问”
  189. uni.getSetting({
  190. withSubscriptions: true,//是否获取用户订阅消息的订阅状态,默认false不返回
  191. success(res){
  192. if(res.authSetting['scope.address']){
  193. uni.openSetting({ // 打开设置页
  194. success(res) {
  195. console.log(res.authSetting)
  196. },
  197. fail: (err) => {
  198. console.log(err);
  199. }
  200. });
  201. }
  202. else{// 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息
  203. uni.requestSubscribeMessage({
  204. tmplIds: that.$tmplIds,
  205. success (res) {
  206. console.log(res)
  207. },
  208. fail(err){
  209. console.error(err);
  210. }
  211. })
  212. }
  213. }
  214. })
  215. },
  216. /**
  217. * 加载员工信息
  218. */
  219. fetchStaffInfo(){
  220. let phone= this.$cache.get('phone')
  221. this.$api.enterprisestaff.page({phone:phone,examine:1}).then(res=>{
  222. this.staffInfo=res.data.records[0]
  223. })
  224. },
  225. /**
  226. * 加载企业信息
  227. */
  228. fetchEnterpriseInfo(){
  229. let creditCode=this.$cache.get('creditCode')
  230. this.$api.enterprise.detail({creditCode:creditCode}).then(res=>{
  231. this.enterpriseInfo=res.data
  232. })
  233. },
  234. /**
  235. * 加载园区信息
  236. */
  237. fetchAgencyInfo(){
  238. console.log(getApp().globalData.userInfo);
  239. let agencyId=this.$cache.get('agencyId')
  240. this.$api.agency.page({id:agencyId}).then(res=>{
  241. this.agencyInfo=res.data[0]
  242. })
  243. },
  244. /**
  245. * 企业详情
  246. */
  247. goEnterpriseDetail(){
  248. uni.navigateTo({
  249. url:"/pages/company/company"
  250. })
  251. },
  252. /**
  253. * 园区详情
  254. */
  255. goAgencyDetail(){
  256. uni.navigateTo({
  257. url:"/pages/index/agency/agency"
  258. })
  259. },
  260. //功能跳转
  261. tapToMenu(name){
  262. let url=''
  263. switch (name){
  264. case 'feedback':
  265. url="/pages/mine/feedback/feedback"
  266. break;
  267. case 'changePhone':
  268. url="/pages/mine/editPhone/editPhone"
  269. break;
  270. case 'changePsw':
  271. url="/pages/mine/changePass/changePass"
  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>