diff --git a/Pages/agreement_page/index.js b/Pages/agreement_page/index.js new file mode 100644 index 0000000..109118e --- /dev/null +++ b/Pages/agreement_page/index.js @@ -0,0 +1,22 @@ +// Pages/webpage/index.js +import { API } from './../../utils/network/api' +const api = new API() +Page({ + + /** + * 页面的初始数据 + */ + data: { + src: "", + static_host: api.getStaticHost() + }, + + onLoad(options) { + console.log(options.agreement_id) + console.log(this.data.static_host+"/basic/file/agreement.htm?id="+options.agreement_id) + this.setData({ + src: this.data.static_host+"/basic/file/agreement.htm?id="+options.agreement_id + }) + }, + +}) \ No newline at end of file diff --git a/Pages/agreement_page/index.json b/Pages/agreement_page/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/Pages/agreement_page/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/Pages/agreement_page/index.wxml b/Pages/agreement_page/index.wxml new file mode 100644 index 0000000..22a9b46 --- /dev/null +++ b/Pages/agreement_page/index.wxml @@ -0,0 +1,2 @@ + + diff --git a/Pages/agreement_page/index.wxss b/Pages/agreement_page/index.wxss new file mode 100644 index 0000000..12b229e --- /dev/null +++ b/Pages/agreement_page/index.wxss @@ -0,0 +1 @@ +/* Pages/webpage/index.wxss */ \ No newline at end of file diff --git a/Pages/index/index.js b/Pages/index/index.js index af9f44f..f6259dd 100644 --- a/Pages/index/index.js +++ b/Pages/index/index.js @@ -1,8 +1,67 @@ // Pages/index/index.js +import { API } from './../../utils/network/api' +const api = new API() const app = getApp() Page({ data: { - loading: true + loading: true, + showEntryTip:false, + showEntryTip_second:false, + beforeClose(action){ + return new Promise((resolve) => { + if (action === 'confirm') { + resolve(true); + } else { + // 拦截取消操作 + resolve(false); + } + }) + }, + static_host: api.getStaticHost() + }, + onConfirmEntry(){ + //wx.setStorageSync('hasEntry', true); + }, + onCloseEntry(){ + this.setData({ + showEntryTip_second:true, + showEntryTip:true + }) + }, + onConfirmEntry_second(){ + this.setData({ + showEntryTip_second:false, + //showEntryTip:false, + }); + //wx.setStorageSync('hasEntry', true); + + }, + onCloseEntry_second(){ + + this.setData({ + showEntryTip_second:false, + showEntryTip:false, + }); + wx.exitMiniProgram({success: (res) => {}}) + }, + go(e){ + let url = e.currentTarget.dataset.url; + app.go(url); + }, + onLoad(option){ + let from = option.from; + let usertype = wx.getStorageSync('usertype'); + console.log("index onload: ", from, usertype) + this.setData({ + beforeClose: this.data.beforeClose.bind(this), + }) + if(from === "navbar"){ + //切换身份 + }else{ + if(usertype == 2 || usertype == 3){ + this.guideTo(usertype) + } + } }, /** * 生命周期函数--监听页面显示 @@ -13,80 +72,72 @@ Page({ tabBarShow:false, //true/false }) } + wx.getPrivacySetting({ + success: res => { + console.log(res) // 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' } + if (res.needAuthorization) { + // 需要弹出隐私协议 + this.setData({ + showEntryTip:true + }) + } else { + this.setData({ + showEntryTip:false + }) + // 用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用已声明过的隐私 + } + }, + fail: () => {}, + complete: () => {} + }) this.setData({ loading: false }); + if(app.globalData.isLogin){ + let usertype = wx.getStorageSync('usertype'); + this.guideTo(usertype) + } + // let isEntry=wx.getStorageSync('hasEntry'); + // console.log("onshow:"+isEntry) + // if(!isEntry){ + // this.setData({ + // showEntryTip:true + // }); + + // }else{ + // this.setData({ + // showEntryTip:false + // }); + // } }, + goCheck(e){ console.log(e); let usertype = e.currentTarget.dataset.usertype; let url = e.currentTarget.dataset.url; wx.setStorageSync('usertype', usertype); wx.setStorageSync('next_url', url); - let user_uuid = wx.getStorageSync('user_id'); - console.log(user_uuid); - if(user_uuid){ + this.guideTo(usertype); + }, + guideTo(usertype){ + let url; + if(usertype == 2){ + if(!wx.$TUIKit){ + app.imInit(); + } + url = "/Pages/yishi/index/index"; + }else{ + app.imLogout(); + url = "/Pages/yaoshi/home/home"; + } + let token = wx.getStorageSync('AUTH_TOKEN_'+usertype); + console.log(token); + console.log(url); + if(token){ wx.switchTab({ url: url }) }else{ app.go(app.globalData.login_url); } - }, - bindGetUserInfo(){ - wx.getUserInfo({ - success: function(res) { - var userInfo = res.userInfo - var nickName = userInfo.nickName - var avatarUrl = userInfo.avatarUrl - var gender = userInfo.gender //性别 0:未知、1:男、2:女 - var province = userInfo.province - var city = userInfo.city - var country = userInfo.country - console.log(res.userInfo) - } - }) - }, - shenfang(){ - wx.requestSubscribeMessage({ - tmplIds: [ - "5Tl-xmaWXrKP5BB8E6b3oTdPHbHa7WYWbmvZiuz4TLs", - "kUy70xHlr7ADo4aIHiictM4Te7MSec3E5kHsYvFQu40" - ], - success(res){ - console.log(res) - }, - fail(res){ - console.log(res) - }, - complete(res){ - console.log(res) - } - }) - }, - yici(){ - wx.requestSubscribeMessage({ - tmplIds: [ - "jhYUf91ULCTX_f69hazqAYwImdFf8ELasRAwB6X-MTM", - "JMPmlYGh1HcUSuEfJCVQUIsZv4H5ar3QvXZfrNYNFuc" - ], - success(res){ - console.log(res) - }, - fail(res){ - console.log(res) - }, - complete(res){ - console.log(res) - } - }) - }, - check(){ - wx.getSetting({ - withSubscriptions: true, - success (res) { - console.log(res.authSetting) - console.log(res.subscriptionsSetting) - } - }) + //test git } - -}) \ No newline at end of file +}) diff --git a/Pages/index/index.json b/Pages/index/index.json index 6ffda42..40f6b9e 100644 --- a/Pages/index/index.json +++ b/Pages/index/index.json @@ -1,6 +1,7 @@ { "component": true, "usingComponents": { - "t-image": "tdesign-miniprogram/image/image" + "t-image": "tdesign-miniprogram/image/image", + "van-dialog": "@vant/weapp/dialog/index" } } \ No newline at end of file diff --git a/Pages/index/index.wxml b/Pages/index/index.wxml index 57ad1f6..5954550 100644 --- a/Pages/index/index.wxml +++ b/Pages/index/index.wxml @@ -1,12 +1,10 @@ - -