organInfo.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <view class="content">
  3. <!-- 自定义导航 -->
  4. <view class="navbar-box">
  5. <u-navbar title="机构信息" :safeAreaInsetTop="true" @leftClick="leftClick"></u-navbar>
  6. </view>
  7. <u-cell-group>
  8. <u-cell-item
  9. v-for="item in infoList" :key="item.title"
  10. :title="item.title"
  11. :value="item.filter?filterOrganiType(infoData[item.valueKey]):infoData[item.valueKey]"
  12. :arrow="false">
  13. </u-cell-item>
  14. </u-cell-group>
  15. </view>
  16. </template>
  17. <script>
  18. import {otherApiUrl} from '@/common/apiurl.js';
  19. export default {
  20. data() {
  21. return {
  22. infoList:[
  23. {title:'机构类型',valueKey:'organType',filter:true},
  24. {title:'机构名称',valueKey:'organName'},
  25. {title:'负责人',valueKey:'person'},
  26. {title:'联系电话',valueKey:'phone'},
  27. ],
  28. infoData:{},
  29. organiTypeList:[],
  30. }
  31. },
  32. onLoad() {
  33. this.getInfo();
  34. this.organiTypeDict();
  35. },
  36. computed:{
  37. filterOrganiType(){
  38. return function(value){
  39. let v = '';
  40. for (let i = 0; i < this.organiTypeList.length; i++){
  41. // console.log('value',value);
  42. // console.log('value',this.organiTypeList[i]);
  43. let item = this.organiTypeList[i];
  44. if (value == item.value) {
  45. v = item.label;
  46. break;
  47. }
  48. }
  49. return v
  50. }
  51. }
  52. },
  53. methods: {
  54. leftClick() {
  55. let canNavBack = getCurrentPages();
  56. if(canNavBack && canNavBack.length>1) {
  57. uni.navigateBack({
  58. delta: 1
  59. });
  60. } else {
  61. history.back();
  62. }
  63. },
  64. async getInfo(){
  65. let {code,data,msg} = await this.$u.api.loginInfo();
  66. this.infoData = data;
  67. },
  68. async organiTypeDict() {
  69. let { code, data, msg} = await this.$u.get(otherApiUrl.getDict + 'organizational_type')
  70. if(code === 200) {
  71. this.organiTypeList = data.map(item => {
  72. return {
  73. label: item.dictLabel,
  74. value: item.dictValue
  75. }
  76. })
  77. }
  78. },
  79. }
  80. }
  81. </script>
  82. <style lang="scss" scoped>
  83. </style>