| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416 |
- // StepPage/pages/zero/zero.js
- import Dialog from '../../miniprogram_npm/@vant/weapp/dialog/dialog';
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- is_shi:true,
- is_pan:true,
- is_lin:true,
- is_tui:true,
- is_diao:true,
- is_shen:true
- },
- handleQrCode(){
- let app = getApp();
- if(!app.globalData.openID){
- return Dialog.confirm({
- title: '确认登录',
- message: '当前账户未登录是否登录?',
- }).then(() => {
- // on confirm
- wx.redirectTo({
- url: '../beforeLogin/beforeLogin',
- })
- })
- .catch(() => {
- // on cancel
- });
- }else{
- wx.p.request({
- url: `${app.globalData.url}wx/wxCheck`,
- method:'POST',
- data:{
- type:1,
- openid:app.globalData.openID
- }
- }).then(req=>{
- if(req.data.code==200){
- wx.redirectTo({
- url: '../../StepPage/pages/qrCode/qrCode',
- })
- }else{
- wx.showToast({
- icon:'none',
- title: req.data.msg
- })
- if(req.data.code==1){
- wx.redirectTo({
- url: '../beforeLogin/beforeLogin',
- })
- }
- }
- })
- }
- },
- changeShi(){
- this.data.is_shi = !this.data.is_shi;
- this.setData({
- is_shen:true,
- is_shi:this.data.is_shi,
- is_pan:true,
- is_lin:true,
- is_tui:true,
- is_diao:true
- })
- },
- changeLin(){
- this.data.is_lin = !this.data.is_lin;
- this.setData({
- is_shen:true,
- is_shi:true,
- is_pan:true,
- is_lin:this.data.is_lin,
- is_tui:true,
- is_diao:true
- })
- },
- changeTui(){
- this.data.is_tui = !this.data.is_tui;
- this.setData({
- is_shen:true,
- is_shi:true,
- is_pan:true,
- is_lin:true,
- is_tui:this.data.is_tui,
- is_diao:true
- })
- },
- changePan(){
- this.data.is_pan = !this.data.is_pan;
- this.setData({
- is_shen:true,
- is_shi:true,
- is_pan:this.data.is_pan,
- is_lin:true,
- is_tui:true,
- is_diao:true
- })
- },
- changeDiao(){
- this.data.is_diao = !this.data.is_diao;
- this.setData({
- is_shen:true,
- is_shi:true,
- is_pan:true,
- is_lin:true,
- is_tui:true,
- is_diao:this.data.is_diao
- })
- },
- changeShen(){
- this.data.is_shen = !this.data.is_shen;
- this.setData({
- is_shen:this.data.is_shen,
- is_shi:true,
- is_pan:true,
- is_lin:true,
- is_tui:true,
- is_diao:true
- })
- },
- creatPan(){
- let app = getApp();
- app.globalData.typePage = 2;
- wx.redirectTo({
- url: '../../StepPage/pages/first/first',
- })
- },
- creatLin(){
- wx.redirectTo({
- url: '../../StepPage/pages/firstLin/firstLin',
- })
- },
- creatTui(){
- wx.redirectTo({
- url: '../../StepPage/pages/firstTui/firstTui',
- })
- },
- creatDiao(){
- wx.navigateTo({
- url: '../../StepPage/pages/diao/diao',
- })
- },
- creatShen(){
- wx.navigateTo({
- url: '../../StepPage/pages/shen/shen',
- })
- },
- creatWork(){
- let app = getApp();
- let openid = app.globalData.openID;
- wx.p.request({
- url: `${app.globalData.url}wx/getWxConstructionData`,
- method:'POST',
- data:{
- type:1,
- openid
- }
- }).then(req=>{
- if(req.data.code==200){
- if(req.data.data.data&&req.data.data.length!=0){
- let data = JSON.parse(req.data.data.data);
- let sort = 1;
- data.stepData.forEach(ele => {
- console.log(ele);
- if((ele.sort*1)>sort){
- sort = ele.sort;
- }
- });
- app.globalData = data;
- app.globalData.typePage=1;
- app.globalData.set_status = '';
- switch(sort){
- case 1:
- wx.redirectTo({
- url: '../../StepPage/pages/first/first',
- })
- break;
- case 2:
- wx.redirectTo({
- url: '../../StepPage/pages/second/second',
- })
- break;
- case 3:
- wx.redirectTo({
- url: '../../StepPage/pages/third/third',
- })
- break;
- case 4:
- wx.redirectTo({
- url: '../../StepPage/pages/writeVIN/writeVIN',
- })
- break;
- case 5:
- wx.redirectTo({
- url: '../../StepPage/pages/fourth/fourth',
- })
- break;
- case 6:
- wx.redirectTo({
- url: '../../StepPage/pages/fifth/fifth',
- })
- break;
- }
- }else{
- app.globalData.typePage = 1;
- app.globalData.set_status = '';
- wx.redirectTo({
- url: '../../StepPage/pages/first/first',
- })
- }
- }
- })
- },
- handleCreate(){
- //新增
- if(this.data.is_diao&&this.data.is_shen&&this.data.is_tui&&this.data.is_lin&&this.data.is_pan&&this.data.is_shi){
- return wx.showToast({
- icon:'error',
- title: '请选择'
- })
- }
- let app = getApp();
- if(!app.globalData.openID){
- return Dialog.confirm({
- title: '确认登录',
- message: '当前账户未登录是否登录?',
- }).then(() => {
- // on confirm
- wx.redirectTo({
- url: '../beforeLogin/beforeLogin',
- })
- })
- .catch(() => {
- // on cancel
- });
- }else{
- wx.p.request({
- url: `${app.globalData.url}wx/wxCheck`,
- method:'POST',
- data:{
- type:1,
- openid:app.globalData.openID
- }
- }).then(req=>{
- if(req.data.code==200){
- app.globalData.set_status = '';
- if(!this.data.is_pan){
- this.creatPan()
- }else if(!this.data.is_shen){
- this.creatShen()
- }else if(!this.data.is_shi){
- this.creatWork()
- }else if(!this.data.is_lin){
- this.creatLin()
- }else if(!this.data.is_diao){
- this.creatDiao()
- }else if(!this.data.is_tui){
- this.creatTui()
- }
- }else{
- wx.showToast({
- icon:'none',
- title: req.data.msg
- })
- if(req.data.code==1){
- wx.redirectTo({
- url: '../beforeLogin/beforeLogin',
- })
- }
- }
- })
- }
- },
- handleCheck(){
- //查询
- if(this.data.is_diao&&this.data.is_shen&&this.data.is_tui&&this.data.is_lin&&this.data.is_pan&&this.data.is_shi){
- return wx.showToast({
- icon:'error',
- title: '请选择'
- })
- }
- let app = getApp();
- if(!app.globalData.openID){
- return Dialog.confirm({
- title: '确认登录',
- message: '当前账户未登录是否登录?',
- })
- .then(() => {
- // on confirm
- wx.redirectTo({
- url: '../beforeLogin/beforeLogin',
- })
- })
- .catch(() => {
- // on cancel
- });
- }else{
- wx.p.request({
- url: `${app.globalData.url}wx/wxCheck`,
- method:'POST',
- data:{
- type:1,
- openid:app.globalData.openID
- }
- }).then(req=>{
- if(req.data.code==200){
- if(!this.data.is_pan){
- wx.redirectTo({
- url: '../../StepPage/pages/report/PanList/PanList',
- })
- }else if(!this.data.is_shen){
- wx.redirectTo({
- url: '../../StepPage/pages/report/ShenList/ShenList',
- })
- }else if(!this.data.is_shi){
- wx.redirectTo({
- url: '../../StepPage/pages/report/ShiList/ShiList',
- })
- }else if(!this.data.is_lin){
- wx.redirectTo({
- url: '../../StepPage/pages/report/LinList/LinList',
- })
- }else if(!this.data.is_diao){
- wx.redirectTo({
- url: '../../StepPage/pages/report/DiaoList/DiaoList',
- })
- }else if(!this.data.is_tui){
- wx.redirectTo({
- url: '../../StepPage/pages/report/TuiList/TuiList',
- })
- }
- }else{
- wx.showToast({
- icon:'none',
- title: req.data.msg
- })
- if(req.data.code==1){
- wx.redirectTo({
- url: '../beforeLogin/beforeLogin',
- })
- }
- }
- })
- }
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- let app = getApp();
- if(app.globalData.openID){
- wx.p.request({
- url: `${app.globalData.url}wx/wxCheckWb`,
- method:'POST',
- data:{
- openid:app.globalData.openID
- }
- }).then(req=>{
- if(req.data.data&&req.data.data.is_wb){
- this.creatWork()
- }
- })
- }
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|