components.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <view class="wrap">
  3. <page-nav :desc="desc" title="nav.components"></page-nav>
  4. <view class="list-wrap">
  5. <u-cell-group title-bg-color="rgb(243, 244, 246)" :title="getGroupTitle(item)" v-for="(item, index) in list" :key="index">
  6. <u-cell-item :titleStyle="{fontWeight: 500}" @click="openPage(item1.path)" :title="getFieldTitle(item1)"
  7. v-for="(item1, index1) in item.list" :key="index1">
  8. <image slot="icon" class="u-cell-icon" :src="getIcon(item1.icon)" mode="widthFix"></image>
  9. </u-cell-item>
  10. </u-cell-group>
  11. </view>
  12. <u-gap height="70"></u-gap>
  13. <!-- <u-tabbar :list="vuex_tabbar" :mid-button="true"></u-tabbar> -->
  14. </view>
  15. </template>
  16. <script>
  17. import list from "./components.config.js";
  18. import getUrlParams from "../../utils/getUrlParams.js";
  19. export default {
  20. data() {
  21. return {
  22. list: list,
  23. //desc: '众多组件覆盖开发过程的各个需求,组件功能丰富,多端兼容。让你快速集成,开箱即用。',
  24. }
  25. },
  26. computed: {
  27. getIcon() {
  28. return path => {
  29. return 'https://cdn.uviewui.com/uview/example/' + path + '.png';
  30. }
  31. },
  32. desc() {
  33. return this.$t('components.desc');
  34. }
  35. },
  36. onShow() {
  37. uni.setNavigationBarTitle({
  38. title: this.$t('nav.components')
  39. });
  40. let locationLocaturl = window.location.search;
  41. let openId = getUrlParams(locationLocaturl,"openId");
  42. if(!this.vuex_hasLogin&&!!openId){
  43. this.$u.api.getuseinfo(openId).then(res => {
  44. console.log('getuseinfo',res.retBody);
  45. this.$u.vuex('vuex_user', res.retBody);
  46. this.$u.vuex('vuex_hasLogin', true);
  47. this.$u.vuex('vuex_token', res.retBody.token);
  48. if(!res.retBody.phone){
  49. this.openPage('/pages/template/bindPhoneNumber/bindPhoneNumber')
  50. }
  51. })
  52. }
  53. },
  54. created() {
  55. },
  56. methods: {
  57. openPage(path) {
  58. this.$u.route({
  59. url: path
  60. })
  61. },
  62. getGroupTitle(item) {
  63. return this.$i18n.locale == 'zh' ? item.groupName : item.groupName_en
  64. },
  65. getFieldTitle(item) {
  66. return this.$i18n.locale == 'zh' ? item.title : item.title_en
  67. }
  68. }
  69. }
  70. </script>
  71. <style>
  72. /* page {
  73. background-color: rgb(240, 242, 244);
  74. } */
  75. </style>
  76. <style lang="scss" scoped>
  77. .u-cell-icon {
  78. width: 36rpx;
  79. height: 36rpx;
  80. margin-right: 8rpx;
  81. }
  82. </style>