1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/zp16162004-PCSHOP

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
app.js 1.6 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
o123123 Отправлено 30.11.2022 06:31 9c21aa4
//app.js
var util=require("/utils/util.js");
App({
onLaunch: function () {
// 展示本地存储能力
// var logs = wx.getStorageSync('logs') || []
// logs.unshift(Date.now())
// wx.setStorageSync('logs', logs)
var that=this;
var storage_data=wx.getStorageSync('global_data');
if(storage_data)
{
this.globalData=storage_data;
this.globalData.host="https://shop.e-notice.cn/index.php/";
this.globalData.domain="https://shopcdn.e-notice.cn";
}
},
onShow:function()
{
var that=this;
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
wx.request({
url: that.globalData.host+"/"+"Service"+"/"+"get_openid",
header: {
'content-type': 'application/x-www-form-urlencoded',
},
data:
{
code:res.code,
},
method:'Post',
dataType:'json',
success:function(res)
{
console.log(res);
var r=res;
if(r.data.code==1)
{
that.globalData.openid=r.data.data;
}
else
{
console.log('获取openid失败,错误信息:'+r.data.msg);
}
}
})
}
})
},
save_data:function()
{
wx.setStorageSync('global_data', this.globalData);
},
globalData: {
psaler:'0',
userInfo: null,
domain:'https://shopcdn.e-notice.cn',
host:"https://shop.e-notice.cn/index.php/Admin",
}
})

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/zp16162004-PCSHOP.git
git@api.gitlife.ru:oschina-mirror/zp16162004-PCSHOP.git
oschina-mirror
zp16162004-PCSHOP
zp16162004-PCSHOP
master