You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
1.9 KiB
79 lines
1.9 KiB
// app.js
|
|
App({
|
|
onLaunch() {
|
|
// 展示本地存储能力
|
|
// const logs = wx.getStorageSync('logs') || []
|
|
// logs.unshift(Date.now())
|
|
// wx.setStorageSync('logs', logs)
|
|
|
|
// 登录
|
|
wx.login({
|
|
success: res => {
|
|
// 发送 res.code 到后台换取 openId, sessionKey, unionId
|
|
}
|
|
})
|
|
},
|
|
|
|
globalData: {
|
|
userInfo: null,
|
|
// serverUrl:'http://81.71.138.239:8001/', //测试服务器
|
|
serverUrl:'https://znyunchecloudcar.cn/', //正式服务器
|
|
// serverUrl:"http://localhost:8001/",//本地
|
|
imageServerUrl: 'https://zhongnengyunche.com/recruitment/wx/static/images/', //统一图片地址
|
|
cacheServerUrl:''
|
|
},
|
|
onShow(){
|
|
// 获取首页轮播
|
|
wx.request({
|
|
url: this.globalData.serverUrl+'api/v1/banners',
|
|
success: res => {
|
|
wx.setStorage({
|
|
key: 'banner',
|
|
data: res.data.data
|
|
})
|
|
},
|
|
fail: e => {
|
|
}
|
|
})
|
|
// 获取首页邀请人
|
|
wx.request({
|
|
url: this.globalData.serverUrl+'api/v1/register/newusers',
|
|
success: res => {
|
|
wx.setStorage({
|
|
key: 'sentiment',
|
|
data: res.data.data
|
|
})
|
|
},
|
|
fail: e => {
|
|
}
|
|
})
|
|
},
|
|
global_share(title) {
|
|
let userInfo = wx.getStorageSync('userInfo');
|
|
return {
|
|
title: title || '上云车二手',
|
|
path: `pages/index/index?shareType=newusers&userId=${ userInfo.id }`,
|
|
// imageUrl: this.globalData.imageServerUrl+'common/share_image_new.png'
|
|
imageUrl:'/images/common/share_image_news2.png'
|
|
}
|
|
},
|
|
share_add_integral(shareType, userId) {
|
|
|
|
let data = {
|
|
userId,
|
|
shareType
|
|
}
|
|
if(userId){
|
|
console.log(22222)
|
|
const http = require('./utils/request')
|
|
http.xhr({
|
|
url: `api/v1/share/${data.shareType}/${data.userId}`,
|
|
//data
|
|
method:'Get'
|
|
}).then(res => {
|
|
console.log(res)
|
|
console.log('点好友链接进入')
|
|
})
|
|
}
|
|
},
|
|
})
|
|
|