فهرست منبع

通过数据字典控制注册按钮显示/隐藏状态

yindan 2 سال پیش
والد
کامیت
7c33fdd74c
3فایلهای تغییر یافته به همراه35 افزوده شده و 8 حذف شده
  1. 1 1
      model/api.js
  2. 33 6
      pages/login/login.js
  3. 1 1
      pages/login/login.wxml

+ 1 - 1
model/api.js

@@ -759,7 +759,7 @@ class Api {
         })
     }
 
-    //获取培训方向,培训形式,课程类型,典型分类数据 sys_train_direct、sys_train_form、sys_kc_type、sys_example_type,wifi_config
+    //获取培训方向,培训形式,课程类型,典型分类,注册按钮显示状态数据 sys_train_direct、sys_train_form、sys_kc_type、sys_example_type,wifi_config,sys_register_status
     static getPulishDict(pathV, isLoading) {
         return Http.request({
             url: `/system/app/home/dict/data/type/${pathV}`,

+ 33 - 6
pages/login/login.js

@@ -1,6 +1,13 @@
-import {getDataSet, getEventParam, isMobile, toast} from "../../utils/utils";
+import {
+    getDataSet,
+    getEventParam,
+    isMobile,
+    toast
+} from "../../utils/utils";
 import User from "../../model/user";
 import Route from "../../model/route";
+import Api from "../../model/api";
+import {logicStatus} from '../../model/enum';
 
 Page({
     data: {
@@ -9,8 +16,10 @@ Page({
             verify: '',
         },
         isShowBack: true,
+        showRegister: false
     },
     onLoad: function (options) {
+        this.getRegsiterDisplayStatus();
     },
     async login(e) {
         if (!isMobile(this.data.formData.phone)) {
@@ -24,8 +33,10 @@ Page({
         }
         await User.loginByPhone(this.data.formData);
         const eventChannel = this.getOpenerEventChannel()
-        if (eventChannel.emit){
-            eventChannel.emit('login', {isLogin: true});
+        if (eventChannel.emit) {
+            eventChannel.emit('login', {
+                isLogin: true
+            });
         }
         wx.navigateBack();
     },
@@ -36,7 +47,9 @@ Page({
         await User.loginByWechat();
         const eventChannel = this.getOpenerEventChannel()
         if (eventChannel.emit) {
-            eventChannel.emit('login', {isLogin: true});
+            eventChannel.emit('login', {
+                isLogin: true
+            });
         }
         wx.navigateBack();
     },
@@ -49,8 +62,22 @@ Page({
     back() {
         const eventChannel = this.getOpenerEventChannel()
         if (eventChannel.emit) {
-            eventChannel.emit('login', {isLogin: false});
+            eventChannel.emit('login', {
+                isLogin: false
+            });
         }
         wx.navigateBack();
+    },
+    async getRegsiterDisplayStatus() {
+        let {
+            data
+        } = await Api.getPulishDict('sys_register_status');
+        if (data && data.length > 0) {
+            let status = data[0]['dictValue'];
+            let showRegister = logicStatus.YES == status;
+            this.setData({
+                showRegister
+            });
+        }
     }
-});
+});

+ 1 - 1
pages/login/login.wxml

@@ -43,7 +43,7 @@
         </van-field>
 
         <edu-button title="登录" bind:click="login"></edu-button>
-        <view class="register-txt" bindtap="register">还没有账号,立即注册...</view>
+        <view wx:if="{{showRegister}}" class="register-txt" bindtap="register">还没有账号,立即注册...</view>
         <van-divider contentPosition="center" custom-style="margin:100rpx 0 0!important;">
             <van-image width="110rpx" height="110rpx" fit="cover" src="/images/ic_wechat.png"
                        bind:click="loginByWechat"/>