mine.vue 7.6 KB

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