| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <script>
- var md5 = require("./common/md5.js");
- export default {
- globalData: { //https://stock.xazhima.com/
- //shareUrl:'https://stock.xazhima.com/api/api.php',
- shareUrl: 'https://guolu.xazhima.com/api/api.php', //开发环境全局接口域名 线上:https://guolu.xazhima.com/
- glbalHeight:'',
- globalTimestamp: (Date.now()).toString(),
- user_id: '',
- open_id:'',
- user_name:'',
- user_headUrl:'',
- isAuth:true,
- sessionId: '',
- cleanPayTime: '',
- pageSize: 5, // 列表加载的pageSize
- isSetPassword: '',
- times:'',
- total_times:'',
- isAndroid:Boolean,
- isIos:false,
- globalShareCounts:10,
- isGetDayCounts:false,
- isShowDayCountsModal:true,
- inviteId:''
- },
- onLaunch: function() {
- console.log('App Launch')
- let equType = uni.getSystemInfoSync().platform;
- switch(equType){
- case 'android':
- console.log('运行Android上')
- break;
- case 'ios':
- console.log('运行iOS上');
- setTimeout(()=>{
- getApp().globalData.isIos = true
- },100)
- break;
- default:
- console.log('运行在开发者工具上')
- break;
- }
- },
- onShow: function() {
- console.log('App Show')
- },
- onHide: function() {
- console.log('App Hide')
- },
- methods:{
- getCodeRabot(res){
- uni.request({
- url:getApp().globalData.shareUrl, //需要设置为全局
- method: 'POST',
- header: {
- 'content-type': 'application/x-www-form-urlencoded'
- },
- data: {
- method: 'login',
- timestamp: getApp().globalData.globalTimestamp, //Date.now()
- code: res.code,
- sign: md5('login' + getApp().globalData.globalTimestamp),
- // invited:'invited'
- },
- success: res => {
- // 通过openid发起会员登录
- getApp().globalData.user_id = res.data.msg.id;
- getApp().globalData.open_id = res.data.msg.openid;
- getApp().globalData.isAuth = res.data.msg.isauth === '0';
- getApp().globalData.user_name = res.data.msg.name;
- getApp().globalData.user_headUrl = res.data.msg.headimg;
- getApp().globalData.times = res.data.msg.times;
- getApp().globalData.total_times = res.data.msg.total_times;
- }
- });
- },
- loginRabot(){
- uni.request({
- url: getApp().globalData.shareUrl, //需要设置为全局
- method: 'POST',
- header: {
- 'content-type': 'application/x-www-form-urlencoded'
- },
- data: {
- method: 'login',
- timestamp: getApp().globalData.globalTimestamp, //Date.now()
- wx_openid: res.data.data.openid,
- sign: md5('login' + getApp().globalData.globalTimestamp)
- },
- success: res => {
- if (res.data.code === 200) {
- if (res.data.data === 0) {
- // 没有会员数据,走默认注册逻辑
- } else {
- // 获取每个页面需要的memberId
- let member_id = res.data.data.member_id;
- getApp().globalData.member_id = member_id;
- }
- }
- }
- });
- }
- },
- }
- </script>
- <style>
- /*每个页面公共css */
- </style>
|