2 Star 3 Fork 1

赵能/前端代码-一划租房-微信小程序 uni-app

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
App.vue 2.85 KB
一键复制 编辑 原始数据 按行查看 历史
赵能 提交于 2021-07-13 11:59 . 强制更新
<script>
//导入接口请求文件
import {
Request
} from './utils/request.js';
import Config from './utils/config.js';
export default {
globalData: {
//用户登陆状态
Logincode: '',
//用户openid
openid: '',
//用户id
userid: '',
//
state: '',
//
code: '',
host: '',
//
houseList: '',
//版本参数:development 开发版本,online 上线版本
DevelopVersion: 'online',
//项目名:使用上线版本是需传入->项目名参数:renthouse 使用开发版本传入->项目名参数:huali
project: 'renthouse',
// 租客上线版本的小程序版本的appid:wx96570dd0829f1548
// 测试板appid:wx1a26121e88e594bc
//此参数为首页筛选 的变量名
select_city: '',
select_hotid: '' ,
select_district: '',
select_chooseTimeId: '',
select_startmoney: '',
select_endmoney: '',
select_livingId: '',
select_bedId: '',
select_toiletId: '',
select_labelName: '',
},
onLaunch: function() {
this.$scope.globalData.host = Config.service.host;
var date = new Date('2021-04-01 19:43:00');
// 有三种方式获取
// var time1 = date.getTime();
// var time2 = date.valueOf();
// var time3 = Date.parse(date);
// console.log(time1);//1398250549123
// console.log(time2);//1398250549123
// console.log(time3);//1398250549000
// console.log('App Launch');
//login接口拿到code给后台,拿去交换openid
uni.login({
success: (res) => {
// console.log('成功',res)
this.code = res.code
this.$scope.globalData.code = res.code
//获取openid,用户信息接口
new Request('User_Login/GetUserOpendInfoAndRegister').request(
() => {return 'POST';},
() => {
return {
code: this.code,
DevelopVersion: this.$scope.globalData.DevelopVersion,
project: this.$scope.globalData.project,
}
},
(res) => {
this.$scope.globalData.Logincode = res.data.data.LoginCode
this.$scope.globalData.openid = res.data.data.openid
this.$scope.globalData.userid = res.data.data.userid
// this.$scope.globalData.userid = 47;
// this.$scope.globalData.openid = 'oYJnf4jSbRlcJlx26unZeuZUA_Y4';
// this.$scope.globalData.openid = 'oYJnf4l0VQJTGS0gFayRKDoV-VHU';
// this.$scope.globalData.userid = 45;
// this.$scope.globalData.openid = 'oYJnf4sospOztdLzgwuCSlylzC4k';
// this.$scope.globalData.userid = 122;
// console.log(this.$scope.globalData.openid)
}
);
},
fail: (err) => {
// console.log('失败')
}
})
},
onShow: function() {
// console.log('App Show')
},
onHide: function() {
// console.log('App Hide')
}
}
</script>
<style>
/*每个页面公共css */
</style>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
微信
1
https://gitee.com/honpaoxie/one-row-rental.git
git@gitee.com:honpaoxie/one-row-rental.git
honpaoxie
one-row-rental
前端代码-一划租房-微信小程序 uni-app
master

搜索帮助