guhongwei 2 роки тому
батько
коміт
b48a7a09dd

+ 38 - 0
commpents/dialog/index.js

@@ -0,0 +1,38 @@
+// commpents/mobile-frame/mobile-main.js
+const app = getApp()
+Component({
+    /**
+     * 组件的属性列表
+     */
+    options: { multipleSlots: true },
+    properties: {
+        dialog: { type: Object },
+    },
+
+    // 生命周期函数,可以为函数,或一个在methods段中定义的方法名
+    attached: function () { }, // 此处attached的声明会被lifetimes字段中的声明覆盖
+    ready: function () { },
+    pageLifetimes: {
+        // 组件所在页面的生命周期函数
+        show: function () { },
+        hide: function () { },
+        resize: function () { },
+    },
+    /**
+     * 组件的初始数据
+     */
+    data: {
+
+    },
+    /**
+     * 组件的方法列表
+     */
+    methods: {
+        // 关闭弹框
+        toClose: function () {
+            const that = this;
+            that.triggerEvent('toClose')
+        }
+    }
+})
+

+ 4 - 0
commpents/dialog/index.json

@@ -0,0 +1,4 @@
+{
+    "component": true,
+    "usingComponents": {}
+}

+ 43 - 0
commpents/dialog/index.less

@@ -0,0 +1,43 @@
+.main {
+    position: fixed;
+    top: 60vw;
+    z-index: 9999;
+    display: flex;
+    box-sizing: border-box;
+    flex-direction: column;
+    width: 96vw;
+    margin: 0 2vw;
+    padding: 2vw;
+    background-color: var(--f9Color);
+    box-shadow: 0 0 5px var(--fcColor);
+    border-radius: 5px;
+    animation: mymove 2s;
+    animation-iteration-count: 1;
+
+    .one {
+        display: flex;
+        flex-direction: row;
+        justify-content: space-between;
+        margin: 0 0 1vw 0;
+
+        .one_1 {
+            font-size: var(--font18Size);
+            font-weight: bold;
+        }
+    }
+
+    .two {
+        max-height: 40vh;
+        overflow-y: auto;
+    }
+}
+
+@keyframes mymove {
+    from {
+        top: 0vw;
+    }
+
+    to {
+        top: 60vw;
+    }
+}

+ 11 - 0
commpents/dialog/index.wxml

@@ -0,0 +1,11 @@
+<view class="main" wx:if="{{dialog.show}}">
+    <view class="one">
+        <view class="one_1">{{dialog.title}}</view>
+        <view class="one_2">
+            <icon class="icon-small icon" type="cancel" size="23" bindtap="toClose"></icon>
+        </view>
+    </view>
+    <view class="two">
+        <slot name="info"></slot>
+    </view>
+</view>

+ 38 - 0
commpents/dialog/index.wxss

@@ -0,0 +1,38 @@
+.main {
+  position: fixed;
+  top: 60vw;
+  z-index: 9999;
+  display: flex;
+  box-sizing: border-box;
+  flex-direction: column;
+  width: 96vw;
+  margin: 0 2vw;
+  padding: 2vw;
+  background-color: var(--f9Color);
+  box-shadow: 0 0 5px var(--fcColor);
+  border-radius: 5px;
+  animation: mymove 2s;
+  animation-iteration-count: 1;
+}
+.main .one {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  margin: 0 0 1vw 0;
+}
+.main .one .one_1 {
+  font-size: var(--font18Size);
+  font-weight: bold;
+}
+.main .two {
+  max-height: 40vh;
+  overflow-y: auto;
+}
+@keyframes mymove {
+  from {
+    top: 0vw;
+  }
+  to {
+    top: 60vw;
+  }
+}

+ 11 - 0
pages/school/index.js

@@ -2,12 +2,23 @@ const app = getApp()
 Page({
     data: {
         frameStyle: { useTop: true, name: '羽校', leftArrow: false, useBar: true },
+        dialog: { title: '弹框标题', show: false, type: '1' }
     },
     // 跳转菜单
     tabPath(e) {
         let { route } = e.detail.detail;
         if (route) wx.redirectTo({ url: `/${route}` })
     },
+    // 打开弹框
+    toJoin: function () {
+        const that = this;
+        that.setData({ dialog: { title: '弹框标题', show: true, type: '1' } });
+    },
+    // 关闭弹框
+    toClose: function () {
+        const that = this;
+        that.setData({ dialog: { title: '弹框标题', show: false, type: '1' } });
+    },
     /**
      * 生命周期函数--监听页面加载
      */

+ 3 - 2
pages/school/index.json

@@ -1,6 +1,7 @@
 {
     "component": true,
     "usingComponents": {
-      "mobile-main": "/commpents/mobile-frame/index"
+        "mobile-main": "/commpents/mobile-frame/index",
+        "dialog": "/commpents/dialog/index"
     }
-  }
+}

+ 9 - 2
pages/school/index.wxml

@@ -5,11 +5,18 @@
                 <input type="text" placeholder="请输入关键词" />
             </view>
             <view class="one_2">
-                <button type="primary">进入系统</button>
+                <button type="primary" bindtap="toJoin">进入系统</button>
             </view>
         </view>
         <view class="two">
             学校
         </view>
     </view>
-</mobile-main>
+</mobile-main>
+<dialog dialog="{{dialog}}" bind:toClose="toClose">
+    <view slot="info" class="dialog">
+        <view class="dialog_1" wx:if="{{dialog.type=='1'}}">
+            类型一
+        </view>
+    </view>
+</dialog>

+ 2 - 34
pages/test/index.js

@@ -13,31 +13,6 @@ Page({
         img_url: [],
         // dialog弹框
         dialog: { title: '弹框标题', show: false, type: '1' },
-        // 选项卡
-        tabs: {
-            active: 'a',
-            list: [
-                { title: '选项卡一', name: 'a' },
-                { title: '选项卡二', name: 'b' },
-                { title: '选项卡三', name: 'c' },
-
-            ],
-        },
-        // 侧导航
-
-        sidebar: {
-            active: 0,
-            list: [
-                { title: '标签一', disabled: false },
-                { title: '标签二', disabled: false },
-                { title: '标签三', disabled: false },
-            ]
-        }
-    },
-    // 侧导航选择
-    sidebarChange: function (e) {
-        const that = this;
-        that.setData({ 'sidebar.active': e.detail })
     },
     // 跳转菜单
     tabPath(e) {
@@ -72,18 +47,11 @@ Page({
         const that = this;
         that.setData({ dialog: { title: '弹框标题', show: false, type: '1' } })
     },
-    // 选项卡
-    tabsChange: function (e) {
-        const that = this;
-        that.setData({ 'tabs.active': e.detail.name });
-    },
+
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad: function (options) {
-        const that = this;
-
-    },
+    onLoad: function (options) { },
 
     /**
      * 生命周期函数--监听页面初次渲染完成

+ 2 - 1
pages/test/index.json

@@ -2,6 +2,7 @@
     "component": true,
     "usingComponents": {
         "mobile-main": "/commpents/mobile-frame/index",
-        "vanupload": "/commpents/upload/index"
+        "upload": "/commpents/upload/index",
+        "dialog": "/commpents/dialog/index"
     }
 }

+ 5 - 28
pages/test/index.wxml

@@ -3,7 +3,7 @@
         <view class="zero">
             <view>图片上传</view>
             <view>
-                <vanupload list="{{img_url}}" count="{{4}}" previewSize="{{80}}" bind:imgUpload="imgUpl" bind:imgDel="imgDel"></vanupload>
+                <upload list="{{img_url}}" count="{{1}}" previewSize="{{30}}" bind:imgUpload="imgUpl" bind:imgDel="imgDel"></upload>
             </view>
         </view>
         <view class="zero">
@@ -12,35 +12,12 @@
                 <button type="primary" size="mini" bindtap="toDialog">打开弹框</button>
             </view>
         </view>
-        <view class="zero">
-            <view>选项卡</view>
-            <view>
-                <e-tabs tabs="{{tabs}}" bind:tabsChange="tabsChange"></e-tabs>
-                <view wx:if="{{tabs.active=='a'}}" class="a">
-                    a
-                </view>
-                <view wx:elif="{{tabs.active=='b'}}" class="b">
-                    b
-                </view>
-                <view wx:elif="{{tabs.active=='c'}}" class="b">
-                    c
-                </view>
-            </view>
-        </view>
-        <view class="zero">
-            <view>侧导航</view>
-            <view>
-                <van-sidebar active-key="{{ sidebar.active }}" bind:change="sidebarChange" custom-class="sidebar">
-                    <van-sidebar-item wx:for="{{sidebar.list}}" wx:key="item" title="{{item.title}}" disabled="{{item.disabled}}" />
-                </van-sidebar>
-            </view>
-        </view>
     </view>
 </mobile-main>
-<e-dialog dialog="{{dialog}}" bind:toClose="toClose">
-    <view slot="info">
-        <view wx:if="{{dialog.type=='1'}}">
+<dialog dialog="{{dialog}}" bind:toClose="toClose">
+    <view slot="info" class="dialog">
+        <view class="dialog_1" wx:if="{{dialog.type=='1'}}">
             弹框
         </view>
     </view>
-</e-dialog>
+</dialog>