"use strict"; const common_vendor = require("../../common/vendor.js"); const api_request = require("../../api/request.js"); const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({ __name: "test", setup(__props) { let waybillToken = ""; let access_token = ""; const userLogin = () => { common_vendor.index.request({ url: api_request.testUrl + "/user/login", method: "POST", data: { userAccount: "feiyi", userPassword: 123456 }, success: (res) => { console.log(res); } }); }; const getWxLoginCode = () => { common_vendor.wx$1.login({ success: (res) => { console.log(res.code); } }); }; const testMap = () => { common_vendor.wx$1.openLocation({ latitude: 45.867741, longitude: 126.560037, name: "哈尔滨师范大学(松北校区)", address: "黑龙江省哈尔滨市呼兰区利民经济开发区师大路1号", success: (res) => { console.log(res); } }); }; const chooseAddress = () => { common_vendor.wx$1.chooseAddress({ success: (res) => { console.log(res); } }); }; const chooseLocation = () => { common_vendor.wx$1.chooseLocation({ latitude: 28.58, longitude: 121.48, success: (res) => { console.log(res); } }); }; const getToken = () => { common_vendor.index.request({ url: "https://api.weixin.qq.com/cgi-bin/token", method: "GET", data: { grant_type: "client_credential", appid: "wx61b63e27bddf4ea2", secret: "5ef9e1f17acd8180afe2d80199fd466e" }, success: (res) => { access_token = res.data.access_token; console.log(access_token); } }); }; const toDelieverPage2 = () => { common_vendor.index.request({ url: "https://api.weixin.qq.com/cgi-bin/express/delivery/open_msg/trace_waybill?access_token=" + access_token, method: "POST", data: { openid: "oydCP7TGAWUqN_d0g3y6bbQkbe2I", waybill_id: "YT8949374567344", receiver_phone: "123456566", goods_info: { detail_list: [ { goods_name: "测试名字", goods_img_url: "https://carbon2.obs.cn-north-4.myhuaweicloud.com:443/feiyi%2Ftest%2F0%2FSnnMkwOn-1ab7a54755e0a23722c1b9dd0ae981c4.png" }, { goods_name: "测试名字2", goods_img_url: "https://carbon2.obs.cn-north-4.myhuaweicloud.com:443/feiyi%2Ftest%2F0%2FSnnMkwOn-1ab7a54755e0a23722c1b9dd0ae981c4.png" } ] } }, success: (res) => { console.log(res.data); waybillToken = res.data.waybill_token; plugin.openWaybillTracking({ waybillToken }); } }); }; var plugin = requirePlugin("logisticsPlugin"); const toDelieverPage = () => { common_vendor.index.request({ url: api_request.baseUrl + "/logistics/get/info", method: "POST", data: { id: 125125278 }, header: { "cookie": common_vendor.wx$1.getStorageSync("cookie") }, success: (res) => { console.log(res.data.data); waybillToken = res.data.data.waybill_token; plugin.openWaybillTracking({ waybillToken }); } }); }; const login = () => { common_vendor.index.login({ provider: "weixin", //使用微信登录 success: function(loginRes) { if (loginRes.code !== null) { console.log("获取code:" + loginRes.code); loginUser(loginRes.code); } else { console.log("code为空"); } } }); }; const loginUser = async (code) => { const res = await common_vendor.index.request({ url: api_request.baseUrl + "/user/login/wx_open", method: "GET", data: { code } }); console.log(res); console.log("loginUser后台返回的==>", res.header["Set-Cookie"]); common_vendor.index.removeStorageSync("cookie"); common_vendor.index.setStorageSync("cookie", res.header["Set-Cookie"]); if (res.data.code == 1) { common_vendor.index.showToast({ title: "登录成功", duration: 2e3 //提示两秒 }); common_vendor.index.setStorageSync("userInfo", res.data.data); } else { common_vendor.index.showToast({ icon: "error", title: "登录失败,请重试" }); return; } }; return (_ctx, _cache) => { return { a: common_vendor.o(login), b: common_vendor.o(toDelieverPage), c: common_vendor.o(getToken), d: common_vendor.o(toDelieverPage2), e: common_vendor.o(chooseAddress), f: common_vendor.o(chooseLocation), g: common_vendor.o(testMap), h: common_vendor.o(userLogin), i: common_vendor.o(getWxLoginCode) }; }; } }); const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "D:/微信小程序/课设整合/匠承非遗小程序端/jiangchengfeiyi-xiaochengxu/pages/test/test.vue"]]); wx.createPage(MiniProgramPage);