xuxueyang
2024-07-29 d89c495a7da517d653e9ea42b8e6405eef823ef6
store/index.js
@@ -258,47 +258,47 @@
                        clientType: data.clientType || 'app'
                    }
                })
                console.log('resp', resp)
                if (resp && resp.code == 0) {
                    // await getCurrentInfo()
                    // // this.$message.showToast('登录成功')
                    // console.log(resp)
                    storage.setItem('token', resp.data.access_token)
                    commit("updateLogin", true)
                    await dispatch('getCurrentInfo')
                    console.log('login,reLaunch')
                    // #ifdef APP
                    var KeepAliveModule = uni.requireNativePlugin("yh-nl") //保活组件
                    KeepAliveModule && KeepAliveModule.startLocation({
                        intervalTime: 5000, //定位间隔时间
                        gaodeApiKey: "0eef1axxxxxx7964", //高德地图Key,已停用,引入插件配置
                        locationMode: 1, //定位模式
                        purpose: 0, //定位场景
                        ifUpload: true, //是否上报服务器
                        uploadUrl: "http://bio51-api.fixbug.fun/api/current/employee/location", //上报接口
                        params: "{'lat':'1','lng':'3'}", //其他参数
                        headers: "{'authorization1':'Bearer xOHeJhg'}",
                    }, function (res) {
                        console.log("启用结果:", res);
                        let ret = KeepAliveModule.getCurrentLocation();
                        console.log("启用结果2:", ret);
                    });
                    // #endif
                    // uni.redirectTo({
                    //    url: '/views/app/app-home/app-home'
                    // })
                    uni.reLaunch({
                        url: '/pages/home/supplier-home'
                    })
                } else {
                    // this.$message.showToast('登录失败')
                }
            } else {}
                return resp
            }
      },
      loginAdmin: async function({
         commit,
         dispatch,
         state
      }, data) {
         {
            // + ((data
            //     .phoneNumber || data.tel) ? '/phone' : '')
            const resp = await http.request('post', '/api/login/admin/wx', {
               data: {
                  username: (data.phoneNumber || data.tel) ? (data.phoneNumber ||
                     data.tel) : data.username,
                  password: data.password,
                  tel: data.phoneNumber || data.tel,
                  smsCode: data.smsCode || ''
               },
               params: {
                  clientType: data.clientType || 'app'
               }
            })
            if (resp && resp.code == 0) {
               storage.setItem('token', resp.data.access_token)
               commit("updateLogin", true)
               await dispatch('getCurrentInfo')
               uni.reLaunch({
                  url: '/sub_pages/partner/delivery/delivery-home'
               })
            } else {}
            return resp
         }
        },
        loginSupplier: async function ({
                                           commit,
@@ -397,14 +397,16 @@
            }
        },
        submitShopping: async function ({commit, dispatch}, data) {
      submitShopping: async function({
         commit,
         dispatch
      }, data) {
            const resp = await http.request('post', '/api/customer/flower/cart/change-num', {
                    data: {
                        id: data.id,
                        num: 1
                    }
                }
            )
         })
            if (resp && resp.code === 0) {
                message.showToast('添加购物车成功')
                dispatch('sign_add', 'shopping')