safe.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <view class="body">
  3. <!-- 公共组件-每个页面必须引入 -->
  4. <public-module></public-module>
  5. <block v-for="(item,index) in list" :key="index">
  6. <my-list-item :item="item" :index="index" @weixinMsg="weixinMsg" :someData="status"></my-list-item>
  7. </block>
  8. </view>
  9. </template>
  10. <script>
  11. import {
  12. mapState
  13. } from "vuex"
  14. import myListItem from "@/components/modules/my/my-list-item.vue";
  15. export default {
  16. components: {
  17. myListItem
  18. },
  19. data() {
  20. return {
  21. list: [{
  22. icon: "",
  23. name: "修改密码",
  24. clicktype: "navigateTo",
  25. url: "/pages/set/password",
  26. text: "去设置",
  27. auth: true
  28. },
  29. {
  30. icon: "",
  31. name: "修改手机号",
  32. clicktype: "navigateTo",
  33. url: "/pages/set/mobile",
  34. text: '',
  35. auth: true
  36. },
  37. {
  38. icon: "",
  39. name: "微信",
  40. clicktype: "weixin",
  41. url: "",
  42. text: '未绑定',
  43. },
  44. ],
  45. status: false,
  46. }
  47. },
  48. async onLoad() {
  49. this.list[1].text = this.userInfo.sysUser.mobile;
  50. this.bindingStatus();
  51. },
  52. computed: {
  53. ...mapState(["userInfo"])
  54. },
  55. methods: {
  56. async bindingStatus() {
  57. let res = await this.$http.get("/user/isBindWechat")
  58. if (res.code == '200') {
  59. this.list[2].text = "已绑定"
  60. this.status = true;
  61. } else {
  62. this.status = false;
  63. }
  64. },
  65. weixinMsg(res) {
  66. if (res.code == '200') {
  67. uni.showToast({
  68. title: res.msg,
  69. icon: "success"
  70. });
  71. this.bindingStatus();
  72. } else {
  73. uni.showToast({
  74. title: res.msg,
  75. icon: "none"
  76. });
  77. }
  78. },
  79. }
  80. }
  81. </script>
  82. <style>
  83. </style>