123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- <template>
- <view class="body">
- <!-- 公共组件-每个页面必须引入 -->
- <public-module></public-module>
- <block v-for="(item,index) in list" :key="index">
- <my-list-item :item="item" :index="index" @weixinMsg="weixinMsg" @zhifubaoMsg="zhifubaoMsg"
- :someData="status"></my-list-item>
- </block>
- </view>
- </template>
- <script>
- import {
- mapState
- } from "vuex"
- import myListItem from "@/components/modules/my/my-list-item.vue";
- export default {
- components: {
- myListItem
- },
- data() {
- return {
- list: [{
- icon: "",
- name: "修改密码",
- clicktype: "navigateTo",
- url: "/pages/set/password",
- text: "去设置",
- auth: true
- },
- {
- icon: "",
- name: "修改手机号",
- clicktype: "navigateTo",
- url: "/pages/set/mobile",
- text: '',
- auth: true
- },
- {
- icon: "",
- name: "微信",
- clicktype: "weixin",
- url: "",
- text: '未绑定',
- },
- {
- icon: "",
- name: "支付宝",
- clicktype: "zhifubao",
- url: "",
- text: '未绑定',
- },
- ],
- status: {
- weixinstatus: false,
- zhifubaostatus: false,
- }
- }
- },
- async onLoad() {
- this.list[1].text = this.userInfo.sysUser.mobile;
- this.bindingStatus();
- this.isBindAlipay();
- },
- async onShow() {
- let args = plus.runtime.arguments;
- if (args) {
- plus.runtime.arguments = null; //进入之后就把urlscheme清空要不然下一次oushow时还会执行
- // 处理args参数,如直达到某新页面等
- //通过code请求获取user_id
- var authCode = args.split("=")[1];
- if (authCode != undefined && authCode != "" && authCode != null) {
- let res = await this.$http.post("/alipay/bind", {
- code: authCode,
- })
- if (res.code == '200') {
- uni.showToast({
- title: res.msg,
- icon: "success"
- });
- this.isBindAlipay();
- } else {
- uni.showToast({
- title: res.msg,
- icon: "none"
- });
- }
- }
- }
- },
- computed: {
- ...mapState(["userInfo"])
- },
- methods: {
- async bindingStatus() {
- let res = await this.$http.get("/user/isBindWechat")
- if (res.code == '200') {
- this.list[2].text = "已绑定"
- this.status.weixinstatus = true;
- } else {
- this.status.weixinstatus = false;
- }
- },
- async isBindAlipay() {
- let res = await this.$http.get("/alipay/isBindAlipay")
- if (res.code == '200') {
- this.list[3].text = "已绑定"
- this.status.zhifubaostatus = true;
- } else {
- this.status.zhifubaostatus = false;
- }
- },
- weixinMsg(res) {
- if (res.code == '200') {
- uni.showToast({
- title: res.msg,
- icon: "success"
- });
- this.bindingStatus();
- } else {
- uni.showToast({
- title: res.msg,
- icon: "none"
- });
- }
- },
- zhifubaoMsg(res) {
- if (res.code == '200') {
- uni.showToast({
- title: res.msg,
- icon: "success"
- });
- this.isBindAlipay();
- } else {
- uni.showToast({
- title: res.msg,
- icon: "none"
- });
- }
- }
- }
- }
- </script>
- <style>
- </style>
|