1 Star 0 Fork 0

王剑韬/weixin

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
app.js 11.83 KB
一键复制 编辑 原始数据 按行查看 历史
王剑涛 提交于 2024-12-31 10:37 . t
App({
onShow: function (data) {
var that = this
//通过appid获取店铺id ttee8a983771b41cd301 wx.getAccountInfoSync().miniProgram.appId
wx.request({
url:that.globalData._url+"/api/mini/store/list?app_id="+wx.getAccountInfoSync().miniProgram.appId,
header: {
"content-type": "application/json",
},
method: "get",
dataType: "json", // 指定返回数据的类型为 json
responseType: "text",
success(res) {
console.log("通过appid获取店铺id");
console.log(res.data.data)
for(var x=0;x<res.data.data.length;x++){
if(res.data.data[x].app_number==1){
that.globalData._shopid1 = res.data.data[x].id
that.globalData._shopid_id1 = res.data.data[x].shop_id
}else{
var name = '_shopid'+res.data.data[x].app_number
that.globalData[name] = res.data.data[x].id
var name2 = '_shopid_id'+res.data.data[x].app_number
that.globalData[name2] = res.data.data[x].shop_id
}
}
console.log("-----");
},
fail(res) {
console.log("调用失败", res.errMsg);
},
});
// wx.request({
// url:that.globalData._url+"/api/douyin/message/backpass",
// data:data.query,
// header: {
// "content-type": "application/json",
// },
// method: "get",
// dataType: "json", // 指定返回数据的类型为 json
// responseType: "text",
// success(res) {
// console.log("调用成功apponload");
// console.log(JSON.stringify(data.query))
// },
// fail(res) {
// console.log("调用失败", res.errMsg);
// },
// });
wx.setStorage({key:'live_room_id',data:data.query.live_room_id})
wx.setStorage({key:'demand_id',data:data.query.demand_id})
wx.setStorage({key:'ad_params',data:data.query.ad_params})
wx.setStorage({key:'clickid',data:data.query.clickid})
wx.setStorage({key:'convert_data',data:JSON.stringify(data.query)})
wx.login({
force: true,
success(res) {
console.log(`login 调用成功 code: ${res.code}, anonymousCode: ${res.anonymousCode}`);
console.log(res);
//获取openid
wx.request({
url:that.globalData._url+"/api/wechat-mini/openid",
data:{
js_code:res.code,
app_id:wx.getAccountInfoSync().miniProgram.appId
},
header: {
"content-type": "application/json",
},
method: "post",
dataType: "json", // 指定返回数据的类型为 json
responseType: "text",
success(response) {
console.log('获取openid')
console.log(response.data)
if(response.data.msg.code==0){
that.globalData._openid = response.data.data.openid
}else{
wx.showToast({
title: response.data.msg.info,
duration: 2000,
icon:'fail',
success(res) {
console.log(res);
},
fail(res) {
console.log("showToast 调用失败", res);
},
});
}
},
fail(response) {
console.log("调用失败", response.errMsg);
},
});
},
fail(err) {
console.log(`login 调用失败`, err);
},
});
wx.getLocation({
type: 'wgs84',
success(res) {
console.log(`经度${res.longitude}纬度${res.latitude}`);
wx.request({
url:that.globalData._url+'/api/coding/geo',
header: {
"content-type": "application/json",
},
data:{
lat:res.latitude,
lng:res.longitude,
},
method: "get",
dataType: "json", // 指定返回数据的类型为 json
responseType: "text",
success(res2) {
console.log('当前地址测试======')
console.log(res2)
if(res2.data.msg.code==0){
console.log('当前地址测试======')
console.log(JSON.parse(res2.data.data))
var ipsheng = JSON.parse(res2.data.data).result.addressComponent.province
var ipshi = JSON.parse(res2.data.data).result.addressComponent.city
var ipqu = JSON.parse(res2.data.data).result.addressComponent.district
wx.setStorage({key:'ipsheng',data:ipsheng})
wx.setStorage({key:'ipshi',data:ipshi})
wx.setStorage({key:'ipqu',data:ipqu})
}else{
wx.setStorage({key:'ipsheng',data:''})
wx.setStorage({key:'ipshi',data:''})
wx.setStorage({key:'ipqu',data:''})
}
}
})
},
fail(res) {
console.log("getLocation调用失败", res);
wx.setStorage({key:'ipsheng',data:''})
wx.setStorage({key:'ipshi',data:''})
wx.setStorage({key:'ipqu',data:''})
},
});
},
globalData: {//上放记得修改了!!!!!!!!======
// '_url':'https://storep.91haoka.cn',//正式地址
'_url':'https://store.91haoka.cn',//测试地址
// '_url_indexjson':'https://file.storep.91haoka.cn/web-store/',//正式地址
'_url_indexjson':'https://file.storep.91haoka.cn/test-web-store/',//测试地址
// '_url_detjson':'https://file.storep.91haoka.cn/web-page/',//正式地址
'_url_detjson':'https://file.storep.91haoka.cn/test-web-page/',//测式地址
'_openid':'',//appid ttee8a983771b41cd301
'_shopid':'',//
'_shopid1':'',//店铺id 212
'_shopid2':'',//店铺id
'_shopid3':'',//店铺id
'_shopid4':'',//店铺id
'_shopid5':'',//店铺id
'_shopid6':'',//店铺id
'_shopid7':'',//店铺id
'_shopid8':'',//店铺id
'_shopid9':'',//店铺id
'_shopid10':'',//店铺id
'_shopid11':'',//店铺id
'_shopid12':'',//店铺id
'_shopid13':'',//店铺id
'_shopid14':'',//店铺id
'_shopid15':'',//店铺id
'_shopid16':'',//店铺id
'_shopid17':'',//店铺id
'_shopid18':'',//店铺id
'_shopid19':'',//店铺id
'_shopid20':'',//店铺id
'_shopid21':'',//店铺id
'_shopid22':'',//店铺id
'_shopid23':'',//店铺id
'_shopid24':'',//店铺id
'_shopid25':'',//店铺id
'_shopid26':'',//店铺id
'_shopid27':'',//店铺id
'_shopid28':'',//店铺id
'_shopid29':'',//店铺id
'_shopid30':'',//店铺id
'_shopid31':'',//店铺id
'_shopid32':'',//店铺id
'_shopid33':'',//店铺id
'_shopid34':'',//店铺id
'_shopid35':'',//店铺id
'_shopid36':'',//店铺id
'_shopid37':'',//店铺id
'_shopid38':'',//店铺id
'_shopid39':'',//店铺id
'_shopid40':'',//店铺id
'_shopid41':'',//店铺id
'_shopid42':'',//店铺id
'_shopid43':'',//店铺id
'_shopid44':'',//店铺id
'_shopid45':'',//店铺id
'_shopid46':'',//店铺id
'_shopid47':'',//店铺id
'_shopid48':'',//店铺id
'_shopid49':'',//店铺id
'_shopid50':'',//店铺id
'_shopid51':'',//店铺id
'_shopid52':'',//店铺id
'_shopid53':'',//店铺id
'_shopid54':'',//店铺id
'_shopid55':'',//店铺id
'_shopid56':'',//店铺id
'_shopid57':'',//店铺id
'_shopid58':'',//店铺id
'_shopid59':'',//店铺id
'_shopid60':'',//店铺id
'_shopid61':'',//店铺id
'_shopid62':'',//店铺id
'_shopid63':'',//店铺id
'_shopid64':'',//店铺id
'_shopid65':'',//店铺id
'_shopid66':'',//店铺id
'_shopid67':'',//店铺id
'_shopid68':'',//店铺id
'_shopid69':'',//店铺id
'_shopid70':'',//店铺id
'_shopid71':'',//店铺id
'_shopid72':'',//店铺id
'_shopid73':'',//店铺id
'_shopid74':'',//店铺id
'_shopid75':'',//店铺id
'_shopid76':'',//店铺id
'_shopid77':'',//店铺id
'_shopid78':'',//店铺id
'_shopid79':'',//店铺id
'_shopid80':'',//店铺id
'_shopid81':'',//店铺id
'_shopid82':'',//店铺id
'_shopid83':'',//店铺id
'_shopid84':'',//店铺id
'_shopid85':'',//店铺id
'_shopid86':'',//店铺id
'_shopid87':'',//店铺id
'_shopid88':'',//店铺id
'_shopid89':'',//店铺id
'_shopid90':'',//店铺id
'_shopid91':'',//店铺id
'_shopid92':'',//店铺id
'_shopid93':'',//店铺id
'_shopid94':'',//店铺id
'_shopid95':'',//店铺id
'_shopid96':'',//店铺id
'_shopid97':'',//店铺id
'_shopid98':'',//店铺id
'_shopid99':'',//店铺id
'_shopid100':'',//店铺id
'_shopid_id':'',//店铺====================
'_shopid_id1':'',//店铺id
'_shopid_id2':'',//店铺id
'_shopid_id3':'',//店铺id
'_shopid_id4':'',//店铺id
'_shopid_id5':'',//店铺id
'_shopid_id6':'',//店铺id
'_shopid_id7':'',//店铺id
'_shopid_id8':'',//店铺id
'_shopid_id9':'',//店铺id
'_shopid_id10':'',//店铺id
'_shopid_id11':'',//店铺id
'_shopid_id12':'',//店铺id
'_shopid_id13':'',//店铺id
'_shopid_id14':'',//店铺id
'_shopid_id15':'',//店铺id
'_shopid_id16':'',//店铺id
'_shopid_id17':'',//店铺id
'_shopid_id18':'',//店铺id
'_shopid_id19':'',//店铺id
'_shopid_id20':'',//店铺id
'_shopid_id21':'',//店铺id
'_shopid_id22':'',//店铺id
'_shopid_id23':'',//店铺id
'_shopid_id24':'',//店铺id
'_shopid_id25':'',//店铺id
'_shopid_id26':'',//店铺id
'_shopid_id27':'',//店铺id
'_shopid_id28':'',//店铺id
'_shopid_id29':'',//店铺id
'_shopid_id30':'',//店铺id
'_shopid_id31':'',//店铺id
'_shopid_id32':'',//店铺id
'_shopid_id33':'',//店铺id
'_shopid_id34':'',//店铺id
'_shopid_id35':'',//店铺id
'_shopid_id36':'',//店铺id
'_shopid_id37':'',//店铺id
'_shopid_id38':'',//店铺id
'_shopid_id39':'',//店铺id
'_shopid_id40':'',//店铺id
'_shopid_id41':'',//店铺id
'_shopid_id42':'',//店铺id
'_shopid_id43':'',//店铺id
'_shopid_id44':'',//店铺id
'_shopid_id45':'',//店铺id
'_shopid_id46':'',//店铺id
'_shopid_id47':'',//店铺id
'_shopid_id48':'',//店铺id
'_shopid_id49':'',//店铺id
'_shopid_id50':'',//店铺id
'_shopid_id51':'',//店铺id
'_shopid_id52':'',//店铺id
'_shopid_id53':'',//店铺id
'_shopid_id54':'',//店铺id
'_shopid_id55':'',//店铺id
'_shopid_id56':'',//店铺id
'_shopid_id57':'',//店铺id
'_shopid_id58':'',//店铺id
'_shopid_id59':'',//店铺id
'_shopid_id60':'',//店铺id
'_shopid_id61':'',//店铺id
'_shopid_id62':'',//店铺id
'_shopid_id63':'',//店铺id
'_shopid_id64':'',//店铺id
'_shopid_id65':'',//店铺id
'_shopid_id66':'',//店铺id
'_shopid_id67':'',//店铺id
'_shopid_id68':'',//店铺id
'_shopid_id69':'',//店铺id
'_shopid_id70':'',//店铺id
'_shopid_id71':'',//店铺id
'_shopid_id72':'',//店铺id
'_shopid_id73':'',//店铺id
'_shopid_id74':'',//店铺id
'_shopid_id75':'',//店铺id
'_shopid_id76':'',//店铺id
'_shopid_id77':'',//店铺id
'_shopid_id78':'',//店铺id
'_shopid_id79':'',//店铺id
'_shopid_id80':'',//店铺id
'_shopid_id81':'',//店铺id
'_shopid_id82':'',//店铺id
'_shopid_id83':'',//店铺id
'_shopid_id84':'',//店铺id
'_shopid_id85':'',//店铺id
'_shopid_id86':'',//店铺id
'_shopid_id87':'',//店铺id
'_shopid_id88':'',//店铺id
'_shopid_id89':'',//店铺id
'_shopid_id90':'',//店铺id
'_shopid_id91':'',//店铺id
'_shopid_id92':'',//店铺id
'_shopid_id93':'',//店铺id
'_shopid_id94':'',//店铺id
'_shopid_id95':'',//店铺id
'_shopid_id96':'',//店铺id
'_shopid_id97':'',//店铺id
'_shopid_id98':'',//店铺id
'_shopid_id99':'',//店铺id
'_shopid_id100':'',//店铺id
}
})
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wang-jiantaos-git_0/weixin.git
git@gitee.com:wang-jiantaos-git_0/weixin.git
wang-jiantaos-git_0
weixin
weixin
master

搜索帮助