123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- // pages/user/personalSettle/personalSettle.js
- const app = getApp();
- const api = app.api;
- import regeneratorRuntime from '../../..//utils/runtime'
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- userInfo:undefined,
- isLogin:false,
- isShowPop:false,
- isAdmin: true
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- // this.getData();
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: async function () {
- this.getData();
- },
- async hasLogins(){
- if(!this.data.isLogin){
- if(await app.authorization()){
- this.notLoginGo();
- }
- this.setData({
- isLogin:true
- });
- return
- }else {
- this.notLoginGo();
- }
- },
- getData(){
- app.post(api.getBaseInfo,{},{noLogin:true,showLoading:false, needToken:false}).then(res=>{
- this.setData({
- userInfo:res.data
- })
- })
- },
- notLoginGo: async function(){
- const userInfo = await app.getToken();
- if (!userInfo.auth) {
- wx.switchTab({
- url:"/pages/index/index",
- success:(res)=>{
- this.setData({
- isLogin:false
- });
- }
- })
- return false
- }else{
- this.getData();
- }
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- },
- artUpload: function(){
- const that = this;
- app.post(api.getUserSettleInfo,{},{
- needToken:false
- }).then(res => {
- const settleInfo = res.data;
- if(settleInfo.isVerification==0){
- that.showPop()
- }else{
- wx.navigateTo({
- url: '/pages/user/artUpload/artUpload'
- })
- }
- })
- },
- goMall(){
- wx.navigateToMiniProgram({
- appId: 'wx7e1594d8fd280a80'
- });
- // wx.showToast({
- // title: '敬请期待',
- // icon: 'none',
- // duration: 2000
- // })
- },
- showPop(){
- this.setData({
- isShowPop:true
- });
- },
- hidePop(){
- this.setData({
- isShowPop:false
- });
- },
- // 邀请码核销
- openScan(){
- wx.scanCode({
- onlyFromCamera: true, // 仅允许从相机扫码
- scanType: ['qrCode'], // 仅支持二维码
- success (res) {
- wx.navigateTo({
- url: '../../invitation/verify/index?id=' + res.result,
- })
- },
- fail () {
- wx.showToast({
- title: '相机调用失败,请检查微信是否开启相机的使用权限'
- })
- }
- })
- }
- })
|