Commit adf71f5db6c0ef218b7b9e1dadb90c98d910f6e4

Authored by wangfan
1 parent 9b7bfc96

nav

@@ -5,7 +5,12 @@ const { regeneratorRuntime } = global @@ -5,7 +5,12 @@ const { regeneratorRuntime } = global
5 App({ 5 App({
6 openid:"", 6 openid:"",
7 system:{}, 7 system:{},
  8 + shareTicket:"",
8 onLaunch: async function (opt) { 9 onLaunch: async function (opt) {
  10 + console.log('onLaunch',opt);
  11 + if(opt.shareTicket){
  12 + this.shareTicket=opt.shareTicket;
  13 + }
9 this.getSystemInfo(); 14 this.getSystemInfo();
10 this.openid=await this.getOpenid(); 15 this.openid=await this.getOpenid();
11 console.log('this.openid',this.openid); 16 console.log('this.openid',this.openid);
@@ -8,10 +8,11 @@ @@ -8,10 +8,11 @@
8 "pages/book/b_desk", 8 "pages/book/b_desk",
9 "pages/customer/detail_owner", 9 "pages/customer/detail_owner",
10 "pages/customer/detail_customer", 10 "pages/customer/detail_customer",
11 - "pages/customer/list",  
12 - "pages/customer/invite" 11 + "pages/customer/invite",
  12 + "pages/customer/list"
13 ], 13 ],
14 "window": { 14 "window": {
  15 + "navigationStyle":"custom",
15 "backgroundTextStyle": "light", 16 "backgroundTextStyle": "light",
16 "navigationBarBackgroundColor": "#199095", 17 "navigationBarBackgroundColor": "#199095",
17 "navigationBarTitleText": "点餐商户端", 18 "navigationBarTitleText": "点餐商户端",
  1 +// components/nav/nav.js
  2 +Component({
  3 + /**
  4 + * 组件的属性列表
  5 + */
  6 + properties: {
  7 + backgroundColor:{
  8 + type:String,
  9 + value:'#ffffff'
  10 + },
  11 + color:{
  12 + type:String,
  13 + value:'#000000'
  14 + },
  15 + hasHome:{
  16 + type:Boolean,
  17 + value:false
  18 + }
  19 + },
  20 +
  21 + /**
  22 + * 组件的初始数据
  23 + */
  24 + data: {
  25 + disHome:false,
  26 + disBack:false,
  27 + },
  28 + attached(){
  29 + let disBack = false;
  30 + let disHome = false;
  31 + let pages = getCurrentPages();
  32 + console.log('pages.length',pages.length);
  33 + if (pages.length > 1) {
  34 + disBack = true;
  35 + } else {
  36 + if (getApp().shareTicket && this.data.hasHome) {
  37 + disHome = true;
  38 + }
  39 + }
  40 + this.setData({
  41 + statusBarHeight: getApp().system.statusBarHeight,
  42 + disHome: disHome,
  43 + disBack: disBack,
  44 + })
  45 + console.log('this.setData',this.data);
  46 + },
  47 + /**
  48 + * 组件的方法列表
  49 + */
  50 + methods: {
  51 + back(){
  52 + wx.navigateBack()
  53 + },
  54 + home(){
  55 + wx.reLaunch({
  56 + url:'/pages/customer/index'
  57 + })
  58 + }
  59 + }
  60 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {}
  4 +}
  1 +<!--components/nav/nav.wxml-->
  2 +<view class="nav" style="padding-top: {{statusBarHeight*2}}rpx;background-color: {{backgroundColor}};color:{{color}};">
  3 + <view class="flex-lr part">
  4 + <view class="opt flex-ll">
  5 + <view class="back flex-vc" bindtap="back" wx:if="{{disBack}}">
  6 + <image class="back-image" src="http://qn.colorcun.com/custom/lite-yd/image/back.png"></image>
  7 + </view>
  8 + <view class="home flex-vc" bindtap="home" wx:if="{{disHome}}">
  9 + <image class="home-image" src="http://qn.colorcun.com/custom/lite-yd/image/home.svg"></image>
  10 + </view>
  11 + </view>
  12 + <view class="title" bindtap="home">
  13 + <slot></slot>
  14 + </view>
  15 + <view class="opt">
  16 + <view></view>
  17 + </view>
  18 + </view>
  19 +
  20 +</view>
  1 +/* components/nav/nav.wxss */
  2 +@import "../../app.wxss";
  3 +.nav{
  4 + font-size: 30rpx;
  5 + font-weight: bold;
  6 +}
  7 +.nav .part{
  8 + background-color: #ffffff;
  9 + line-height: 68rpx;
  10 + height: 68rpx;
  11 + margin-top: 10rpx;
  12 + text-align: center;
  13 +}
  14 +.nav .part .title{
  15 + width: 100%;
  16 +}
  17 +.nav .part .opt{
  18 + min-width: 188rpx;
  19 +}
  20 +.nav .part .opt view{
  21 + width: 68rpx;
  22 + height: 68rpx;
  23 + margin-left: 26rpx;
  24 +}
  25 +.nav .part .opt .back-image{
  26 + height: 32rpx;
  27 + width: 18rpx;
  28 +}
  29 +.nav .part .opt .home-image{
  30 + height: 34rpx;
  31 + width: 36rpx;
  32 +}
@@ -17,6 +17,9 @@ Page({ @@ -17,6 +17,9 @@ Page({
17 */ 17 */
18 onLoad: function (options) { 18 onLoad: function (options) {
19 this.id=options.id; 19 this.id=options.id;
  20 + wx.showShareMenu({
  21 + withShareTicket: true
  22 + })
20 }, 23 },
21 24
22 /** 25 /**
@@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
4 "navigationBarTitleText":"订个座儿", 4 "navigationBarTitleText":"订个座儿",
5 "usingComponents": { 5 "usingComponents": {
6 "userinfo": "/components/userinfo/userinfo", 6 "userinfo": "/components/userinfo/userinfo",
7 - "formids":"/components/formids/formids" 7 + "formids":"/components/formids/formids",
  8 + "nav":"/components/nav/nav"
8 } 9 }
9 } 10 }
1 <!--pages/customer/list.wxml--> 1 <!--pages/customer/list.wxml-->
  2 +<nav hasHome>订个座儿</nav>
2 <view class="page"> 3 <view class="page">
3 <view class="tabs flex-cc"> 4 <view class="tabs flex-cc">
4 <view class="item {{0==tabFlag?'active':''}}" 5 <view class="item {{0==tabFlag?'active':''}}"
@@ -74,7 +74,12 @@ @@ -74,7 +74,12 @@
74 "name": "pages/customer/index", 74 "name": "pages/customer/index",
75 "pathName": "pages/customer/index", 75 "pathName": "pages/customer/index",
76 "query": "", 76 "query": "",
77 - "scene": "1001" 77 + "scene": "1044",
  78 + "shareInfo": {
  79 + "groupName": "测试模拟群1",
  80 + "shareName": "8DEbIRpK4pa9mH_QY2vU4ZUKYPuI97WoQ4BQoFej-Q8@cr4dev",
  81 + "shareKey": "PZhnqMlY2TnRuHhATyGeSamVmBQUDXXr_WtjRSddeeFK17UAiOP-HNOdhxiEN7PFub5S1DjAeUl0IXOdW-VDqg~~"
  82 + }
78 }, 83 },
79 { 84 {
80 "id": -1, 85 "id": -1,