Commit 2e325e8d378763f8f2b68e27820fe2c906820c0f

Authored by vking
1 parent 22137811

global layout get formid

@@ -128,6 +128,9 @@ @@ -128,6 +128,9 @@
128 "desc": "你的位置信息用于获得离你最近的餐厅" 128 "desc": "你的位置信息用于获得离你最近的餐厅"
129 } 129 }
130 }, 130 },
  131 + "usingComponents":{
  132 + "layout":"/components/layout"
  133 + },
131 "debug": true, 134 "debug": true,
132 "sitemapLocation": "sitemap.json" 135 "sitemapLocation": "sitemap.json"
133 } 136 }
  1 +// components/layout.js
  2 +Component({
  3 + properties:{
  4 +
  5 + },
  6 + data:{
  7 +
  8 + },
  9 + methods:{
  10 + formSubmit: function(e) {
  11 + console.log('layout.formids',e.detail.formId)
  12 + if("the formId is a mock one"!=e.detail.formId){
  13 + let formids=wx.getStorageSync('formids') || [];
  14 + formids.push(e.detail.formId);
  15 + formids=[...new Set(formids)];
  16 + wx.setStorage({key:'formids',data:formids});
  17 + }
  18 + },
  19 + },
  20 + attached(){
  21 +
  22 + }
  23 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {}
  4 +}
  1 +<!--components/layout.wxml-->
  2 +<form bindsubmit="formSubmit" report-submit class="layout">
  3 + <button formType="submit" class="button"
  4 + hover-class="none">
  5 + <view class="fixed"><slot></slot></view>
  6 + </button>
  7 +</form>
  1 +/* components/layout.wxss */
  2 +.layout {
  3 + display: inline-block;
  4 + padding-left: 0;
  5 + padding-right: 0;
  6 + box-sizing: border-box;
  7 + font-size: inherit;
  8 + text-align: left;
  9 + text-decoration: none;
  10 + line-height: inherit;
  11 + -webkit-tap-highlight-color: transparent;
  12 + color: inherit;
  13 + width: 100%;
  14 + position: relative;
  15 +}
  16 +.layout .button{
  17 + display: inline-block;
  18 + padding-left: 0;
  19 + padding-right: 0;
  20 + box-sizing: border-box;
  21 + font-size: inherit;
  22 + text-align: left;
  23 + text-decoration: none;
  24 + line-height: inherit;
  25 + -webkit-tap-highlight-color: #000;
  26 + color: inherit;
  27 + width: 100%;
  28 + position: relative;
  29 +}
  30 +.layout .button .fixed{
  31 + position:relative;
  32 + z-index: 9999;
  33 + width: 100%;
  34 +}
  35 +.layout .button:before,.layout .button:after{
  36 + border-width: 0;
  37 +}
1 <!--pages/reserve/detail.wxml--> 1 <!--pages/reserve/detail.wxml-->
  2 +<layout>
2 <nav>{{seller.sellername}}</nav> 3 <nav>{{seller.sellername}}</nav>
3 -<!-- 包间预定 --> 4 +<!-- 包间预定 -->
4 <view class="tabs flex-lr" wx:if="{{hasOnlineReserve}}"> 5 <view class="tabs flex-lr" wx:if="{{hasOnlineReserve}}">
5 <view class="tabs-item flex-vc" bindtap="switchTabs" data-act="detail"> 6 <view class="tabs-item flex-vc" bindtap="switchTabs" data-act="detail">
6 <view class="tabs-item-text {{activeTab=='detail'?'active':''}}">餐厅详情</view> 7 <view class="tabs-item-text {{activeTab=='detail'?'active':''}}">餐厅详情</view>
@@ -217,4 +218,5 @@ @@ -217,4 +218,5 @@
217 date="{{reserveDate}}" bindselecttime="selecttime"></dur> 218 date="{{reserveDate}}" bindselecttime="selecttime"></dur>
218 <view class="hasFullHouse Semibold flex-vc" wx:if="{{hasFullHouse}}">{{fullHouseMsg}}</view> 219 <view class="hasFullHouse Semibold flex-vc" wx:if="{{hasFullHouse}}">{{fullHouseMsg}}</view>
219 </view> 220 </view>
220 -</view>  
  221 +</view>
  222 +</layout>