Browse Source

小程序:农事天地

panyong 2 years ago
parent
commit
a13a4c62c8

+ 2 - 1
htmldev/wxMini/README.md

@@ -15,7 +15,8 @@
     - [x] 视频详情 mediaDetail 2
 - [x] 优秀合作社 partner 4
 - 农事天地 news 4
-- 我的 mine 4
+- [x] 我的 mine 4
+- 登录 bind 4
 - 商户端 businessHome 4
   - 产品管理 businessGoodsManage 6
     - 产品新增/编辑 businessGoodsEdit 16

+ 1 - 2
htmldev/wxMini/app.json

@@ -1,7 +1,6 @@
 {
   "pages": [
     "pages/home/home",
-    "pages/login/login",
     "pages/mine/mine",
     "pages/leavingAMessage/leavingAMessage",
     "pages/business/business",
@@ -55,4 +54,4 @@
       }
     ]
   }
-}
+}

+ 0 - 10
htmldev/wxMini/pages/login/api/index.js

@@ -1,10 +0,0 @@
-const { request } = require('../../../api/request')
-export const miniLogin = (obj) => request({
-  url: '/api/user/mini/login',
-  method: 'POST',
-  data: {
-    'code': obj.wxCode, // 小程序授权code
-    'encryptedData': obj.encryptedData, // 加密数据
-    'iv': obj.iv // iv
-  }
-})

+ 0 - 124
htmldev/wxMini/pages/login/login.js

@@ -1,124 +0,0 @@
-const { miniLogin } = require('./api/index')
-const { login, sessionStorageKey } = require('../../api/request')
-const { envDomain } = require('../../utils/config')
-const app = getApp()
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    checked: false,
-    booLock: false
-  },
-  wxCode: '',
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-    this.getWxCode()
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-  async getWxCode() {
-    try {
-      this.wxCode = await login()
-    } catch (e) {}
-  },
-  bindTip() {
-    wx.showToast({
-      title: '请阅读并勾选协议',
-      icon: 'none'
-    })
-  },
-  // 获取token
-  async getPhoneNumber(e) {
-    const { errMsg, encryptedData, iv } = e.detail
-    if (errMsg === 'getPhoneNumber:ok') {
-      this.setData({
-        booLock: true
-      })
-
-      try {
-        const { status, data } = await miniLogin({ wxCode: this.wxCode, encryptedData, iv })
-        if (status) {
-          try {
-            wx.setStorageSync(sessionStorageKey, data.token)
-          } catch (err) {}
-
-          await app.fetchUserData()
-
-          const pages = getCurrentPages()
-          if (pages.length > 1) {
-            const route = pages[pages.length - 2]
-            wx.navigateBack({
-              delta: 1
-            })
-            route.bindCallBack && route.bindCallBack()
-          }
-        } else {
-          wx.showToast({
-            title: '登录出错了,请重试',
-            icon: 'none'
-          })
-          this.getWxCode()
-        }
-      } catch (e) {
-        this.getWxCode()
-      }
-
-      this.setData({
-        booLock: false
-      })
-    }
-  },
-  jumpBind() {
-    wx.navigateTo({
-      url: '/pages/bind/bind'
-    })
-  },
-  // 去包个大巴服务协议
-  jumpAgreement() {
-    wx.navigateTo({
-      url: '/pages/h5/h5?url=' + envDomain.h5Domain + '/agreement'
-    })
-  },
-  // 去隐私政策
-  jumpPrivacy() {
-    wx.navigateTo({
-      url: '/pages/h5/h5?url=' + envDomain.h5Domain + '/privacy'
-    })
-  },
-  bindChange() {
-    this.setData({
-      checked: !(this.data.checked)
-    })
-  }
-})

+ 0 - 4
htmldev/wxMini/pages/login/login.json

@@ -1,4 +0,0 @@
-{
-  "usingComponents": {},
-  "navigationBarTitleText": "登录"
-}

+ 0 - 49
htmldev/wxMini/pages/login/login.wxml

@@ -1,49 +0,0 @@
-<view class="login-wrapper">
-  <image class="logo" src="{{tools.imgFilter('/common/About_logo@2x.png')}}"></image>
-  <view class="main">
-    <view class="button-wrap">
-      <view class="disabled" hidden="{{checked}}" bind:tap="bindTip"></view>
-      <button class="get-phone"
-              disabled="{{booLock}}"
-              open-type="getPhoneNumber"
-              bindgetphonenumber="getPhoneNumber">微信用户一键登录
-      </button>
-    </view>
-    <view class="button-wrap">
-      <view class="disabled" hidden="{{checked}}" bind:tap="bindTip"></view>
-      <button class="jump-bind"
-              bind:tap="jumpBind">手机号码登录/注册
-      </button>
-    </view>
-    <view class="agreement-wrap">
-      <view class="check-box" bind:tap="bindChange">
-        <image src="{{tools.imgFilter('/common/Confirm_icon_uncheck@2x.png')}}"
-               hidden="{{checked}}"></image>
-        <image src="{{tools.imgFilter('/common/Confirm_icon_check@2x.png')}}"
-               hidden="{{!checked}}"></image>
-      </view>
-      <view class="text-wrap">
-        <text style="color: #666;"
-              wx:for="{{'登录代表您已同意'}}"
-              wx:for-item="a"
-              wx:for-index="aa"
-              wx:key="aa">{{a}}</text>
-        <text style="color: #3370FF;"
-              wx:for="{{'《包个大巴服务协议》'}}"
-              wx:for-item="b"
-              wx:for-index="bb"
-              wx:key="bb" bind:tap="jumpAgreement">{{b}}</text>
-        <text style="color: #666;">、</text>
-        <text style="color: #3370FF;"
-              wx:for="{{'《隐私政策》'}}"
-              wx:for-item="c"
-              wx:for-index="cc"
-              wx:key="cc" bind:tap="jumpPrivacy">{{c}}</text>
-      </view>
-    </view>
-  </view>
-</view>
-<view class="footer">
-  <view>18周岁以下用户禁止在平台包车,须由监护人下单</view>
-</view>
-<wxs src="../../components/wxs/index.wxs" module="tools"></wxs>

+ 0 - 95
htmldev/wxMini/pages/login/login.wxss

@@ -1,95 +0,0 @@
-page {
-  display: flex;
-  flex-direction: column;
-  min-height: 100%;
-}
-
-.login-wrapper {
-  flex: 1;
-  display: flex;
-  flex-direction: column;
-  align-items: center;
-}
-
-.logo {
-  width: 128rpx;
-  height: 128rpx;
-  margin-top: 127rpx;
-}
-
-.main {
-  display: flex;
-  flex-direction: column;
-  align-items: center;
-  margin-top: 310rpx;
-}
-
-.main .button-wrap {
-  position: relative;
-  left: 0;
-  top: 0;
-}
-
-.main .disabled {
-  position: absolute;
-  left: 0;
-  top: 0;
-  right: 0;
-  bottom: 0;
-  z-index: 1;
-}
-
-.main button {
-  width: 690rpx;
-  height: 104rpx;
-  padding: 0 !important;
-  border-radius: 24rpx;
-  font-size: 32rpx;
-  font-weight: 500;
-  line-height: 104rpx;
-}
-
-.get-phone {
-  margin: 0 !important;
-  background-color: rgba(74, 106, 150, 1);
-  color: #FFF;
-}
-
-.jump-bind {
-  margin: 40rpx 0 0 !important;
-  border: 1rpx solid #bbb;
-  background-color: #FFF;
-  color: #666666;
-}
-
-.agreement-wrap {
-  margin-top: 37rpx;
-}
-
-.check-box {
-  padding: 20rpx 8rpx;
-  font-size: 0;
-}
-
-.check-box image {
-  width: 28rpx;
-  height: 28rpx;
-  vertical-align: top;
-}
-
-.footer > view {
-  width: 100%;
-  padding: 40rpx 0;
-  color: rgba(102,102,102,1);
-  font-size: 24rpx;
-  line-height: 30rpx;
-  text-align: center;
-}
-
-.footer:after {
-  display: block;
-  content: '';
-  width: 100%;
-  padding-bottom: constant(safe-area-inset-bottom);
-  padding-bottom: env(safe-area-inset-bottom);
-}

+ 27 - 36
htmldev/wxMini/pages/mine/mine.js

@@ -1,72 +1,63 @@
-const { sessionStorageKey } = require('../../api/request')
-const app = getApp()
-
 Page({
 
   /**
    * 页面的初始数据
    */
-  data: {
-    navBarHeight: app.globalData.navBarHeight,
-    navBarConfig: {
-      booFixed: true,
-      backgroundColor: ''
-    },
-    sessionId: '',
-    userInfo: {}
-  },
+  data: {},
 
   /**
    * 生命周期函数--监听页面加载
    */
-  onLoad: function (options) {
+  onLoad(options) {
 
   },
 
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
-  onReady: function () {
+  onReady() {
 
   },
 
   /**
    * 生命周期函数--监听页面显示
    */
-  onShow: function () {
-    this.setData({
-      sessionId: wx.getStorageSync(sessionStorageKey),
-      userInfo: app.globalData.userInfo
-    })
+  onShow() {
+
   },
 
   /**
    * 生命周期函数--监听页面隐藏
    */
-  onHide: function () {
+  onHide() {
 
   },
 
   /**
    * 生命周期函数--监听页面卸载
    */
-  onUnload: function () {
+  onUnload() {
 
   },
-  jump(e) {
-    const { navigate } = e.currentTarget.dataset
-    const index = ['order', 'invoice', 'setting', 'feedback'].findIndex(item => item === navigate)
-    if (!this.data.sessionId && index > -1) {
-      wx.navigateTo({
-        url: '/pages/login/login'
-      })
-      return
-    }
-    if (this.data.sessionId && navigate === 'login') {
-      return
-    }
-    wx.navigateTo({
-      url: `/pages/${navigate}/${navigate}`
-    })
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+
   }
 })

+ 1 - 4
htmldev/wxMini/pages/mine/mine.json

@@ -1,6 +1,3 @@
 {
-  "usingComponents": {
-    "navigation-bar": "../../components/navigationBar/navigationBar"
-  },
-  "navigationStyle": "custom"
+  "usingComponents": {}
 }

+ 144 - 0
htmldev/wxMini/pages/mine/mine.scss

@@ -0,0 +1,144 @@
+.wrapper {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  width: 100%;
+  padding: 40rpx 0 100rpx;
+}
+
+.portrait {
+  width: 169rpx;
+  height: 169rpx;
+  border-radius: 50%;
+  overflow: hidden;
+
+  image {
+    display: block;
+    width: 100%;
+    height: 100%;
+    background: pink;
+  }
+}
+
+.nickname-wrap {
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  width: 100%;
+  margin-top: 23rpx;
+
+  input {
+    width: 100%;
+    font-size: 36rpx;
+    color: rgba(51, 51, 51, 1);
+    text-align: center;
+  }
+
+  text {
+    font-size: 36rpx;
+    color: rgba(51, 51, 51, 1);
+  }
+
+  image {
+    margin-left: 10rpx;
+    width: 26rpx;
+    height: 28rpx;
+    background: pink;
+  }
+}
+
+.account {
+  margin-top: 11rpx;
+  line-height: 38rpx;
+  font-size: 24rpx;
+  color: rgba(153, 153, 153, 1);
+}
+
+.main {
+  padding-top: 31rpx;
+}
+
+.business-account {
+  display: flex;
+  justify-content: space-between;
+  flex-direction: column;
+  width: 690rpx;
+  min-height: 232rpx;
+  padding: 37rpx 34rpx 29rpx;
+  margin-bottom: 20rpx;
+  border-radius: 20rpx;
+  background: green;
+
+  .describe {
+    line-height: 48rpx;
+    line-height: 36rpx;
+    color: rgba(255, 255, 255, 1);
+  }
+
+  .box {
+    display: flex;
+    align-items: center;
+  }
+
+  &-name-wrap {
+    width: calc(100% - 208rpx);
+  }
+
+  &-name {
+    line-height: 44rpx;
+    font-size: 28rpx;
+    color: rgba(255, 255, 255, 1);
+    word-break: break-all;
+    word-wrap: break-word;
+  }
+
+  .dashboard {
+    display: flex;
+    align-items: center;
+    margin-top: 8rpx;
+
+    view {
+      line-height: 30rpx;
+      font-size: 20rpx;
+      color: rgba(255, 255, 255, 1);
+
+      &:nth-of-type(2) {
+        margin-left: 20rpx;
+      }
+    }
+  }
+
+  button.btn[type="default"] {
+    width: 208rpx;
+    height: 66rpx;
+    border-radius: 20rpx;
+    background-color: rgba(255, 255, 255, 1);
+    font-size: 26rpx;
+    color: rgba(107, 133, 89, 1);
+  }
+
+}
+
+.list {
+  display: flex;
+  align-items: center;
+  width: 690rpx;
+  height: 100rpx;
+  padding-left: 38rpx;
+  margin-bottom: 16rpx;
+  background: rgba(255, 255, 255, 1);
+  box-shadow: 0 12rpx 98rpx 0 rgba(55, 55, 55, 0.05);
+
+  .label {
+    width: 31rpx;
+    height: 38rpx;
+    background: pink;
+  }
+
+  .value {
+    margin-left: 23px;
+    line-height: 44rpx;
+    font-size: 32rpx;
+    color: rgba(51, 62, 99, 1);
+  }
+}

+ 44 - 55
htmldev/wxMini/pages/mine/mine.wxml

@@ -1,64 +1,53 @@
-<view class="min-wrapper">
-  <navigation-bar
-    navBarConfig="{{navBarConfig}}"/>
-  <view style="padding-top: {{navBarHeight}}px;" class="header"
-        bind:tap="jump"
-        data-navigate="login">
-    <image class="bg" src="{{tools.imgFilter('/mine/Me_bg@2x.png')}}"></image>
-    <view class="user-info">
-      <!-- 头像:未登录 -->
-      <image class="portrait"
-             src="{{tools.imgFilter('/mine/Me_Avatar_pic_default@2x.png')}}"
-             wx:if="{{!sessionId}}"></image>
-      <!-- 头像:已登录 -->
-      <image class="portrait"
-             src="{{userInfo.user_head_img_url || tools.imgFilter('/mine/Me_avatar_male_default@2x.png')}}"
-             wx:else></image>
-      <view>
-        <block wx:if="{{sessionId}}">
-          <view class="name">{{userInfo.user_nickname}}</view>
-          <view class="phone">{{userInfo.user_phone}}</view>
-        </block>
-        <view class="name" wx:else>未登录</view>
-      </view>
-    </view>
+<view class="wrapper">
+  <view class="portrait">
+    <image src=""></image>
   </view>
-  <view class="navigate-list">
-    <view class="list" data-navigate="order" bind:tap="jump">
-      <view class="label-wrap">
-        <image class="label" src="{{tools.imgFilter('/mine/Me_list_icon_order@2x.png')}}"></image>
-        <text class="label">我的订单</text>
+  <view class="nickname-wrap">
+    <block wx:if="{{true}}">
+      <text>农户1234</text>
+      <image src=""></image>
+    </block>
+    <block wx:if="{{false}}">
+      <input
+        placeholder-class="app_header-search-placeholder"
+        value=""
+        placeholder="请输入昵称"></input>
+    </block>
+  </view>
+  <view class="account">账号:12345678900</view>
+  <view class="main">
+    <view class="business-account" wx:if="{{true}}">
+      <view class="describe">已有商家账号</view>
+      <view class="box">
+        <view class="business-account-name-wrap">
+          <view class="business-account-name">绍兴吧啦供应商</view>
+          <view class="dashboard">
+            <view>上架商品:23</view>
+            <view>今日销量:10</view>
+          </view>
+        </view>
+        <button class="btn" type="default">点击切换</button>
       </view>
-      <image class="arrow" src="{{tools.imgFilter('/mine/Me_list_icon_arrow@2x.png')}}"></image>
     </view>
-    <view class="list margin-top-20 padding-bottom-22" data-navigate="invoice" bind:tap="jump">
-      <view class="label-wrap">
-        <image class="label" src="{{tools.imgFilter('/mine/Me_list_icon_invoice@2x.png')}}"></image>
-        <text class="label">开具发票</text>
-      </view>
-      <image class="arrow" src="{{tools.imgFilter('/mine/Me_list_icon_arrow@2x.png')}}"></image>
+    <view class="list" wx:if="{{false}}">
+      <image class="label" src=""></image>
+      <text class="value">申请入住(成为农户)</text>
     </view>
-    <view class="list margin-top-22" data-navigate="help" bind:tap="jump">
-      <view class="label-wrap">
-        <image class="label" src="{{tools.imgFilter('/mine/Me_list_icon_service@2x.png')}}"></image>
-        <text class="label">客服中心</text>
-      </view>
-      <image class="arrow" src="{{tools.imgFilter('/mine/Me_list_icon_arrow@2x.png')}}"></image>
+    <view class="list">
+      <image class="label" src=""></image>
+      <text class="value">农产品收藏</text>
     </view>
-    <view class="list margin-top-20" data-navigate="feedback" bind:tap="jump">
-      <view class="label-wrap">
-        <image class="label" src="{{tools.imgFilter('/mine/Me_list_icon_feedback@2x.png')}}"></image>
-        <text class="label">意见反馈</text>
-      </view>
-      <image class="arrow" src="{{tools.imgFilter('/mine/Me_list_icon_arrow@2x.png')}}"></image>
+    <view class="list">
+      <image class="label" src=""></image>
+      <text class="value">农户收藏</text>
     </view>
-    <view class="list margin-top-20" data-navigate="setting" bind:tap="jump">
-      <view class="label-wrap">
-        <image class="label" src="{{tools.imgFilter('/mine/Me_list_icon_setting@2x.png')}}"></image>
-        <text class="label">设置</text>
-      </view>
-      <image class="arrow" src="{{tools.imgFilter('/mine/Me_list_icon_arrow@2x.png')}}"></image>
+    <view class="list">
+      <image class="label" src=""></image>
+      <text class="value">客服电话</text>
+    </view>
+    <view class="list">
+      <image class="label" src=""></image>
+      <text class="value">设置</text>
     </view>
   </view>
 </view>
-<wxs src="../../components/wxs/index.wxs" module="tools"></wxs>

+ 0 - 111
htmldev/wxMini/pages/mine/mine.wxss

@@ -1,111 +0,0 @@
-.min-wrapper .header {
-  position: relative;
-  left: 0;
-  top: 0;
-  width: 100%;
-  height: 460rpx;
-}
-
-.nav-bar {
-  background: rgba(255, 255, 255, 0);
-}
-
-.min-wrapper .header .bg {
-  position: absolute;
-  left: 0;
-  top: 0;
-  right: 0;
-  bottom: 0;
-  display: block;
-  width: 100%;
-}
-
-.user-info {
-  position: relative;
-  left: 0;
-  top: 0;
-  z-index: 1;
-  display: flex;
-  align-items: center;
-  padding-top: 71rpx;
-  padding-left: 40rpx;
-}
-
-.user-info .portrait {
-  width: 128rpx;
-  height: 128rpx;
-  overflow: hidden;
-  margin-right: 32rpx;
-  border-radius: 24rpx;
-  border: 2rpx solid #F7F7F7;
-  background: rgba(255, 255, 255, 1);
-}
-
-.user-info .name {
-  color: rgba(0, 0, 0, 1);
-  font-size: 40rpx;
-  font-weight: 500;
-}
-
-.user-info .phone {
-  color: rgba(102, 102, 102, 1);
-  font-size: 28rpx;
-}
-
-.navigate-list {
-  margin-top: 70rpx;
-  padding: 0 24rpx 320rpx;
-}
-
-.list {
-  display: flex;
-  align-items: center;
-  justify-content: space-between;
-}
-
-.label-wrap {
-  display: flex;
-  align-items: center;
-}
-
-.label-wrap image.label {
-  width: 100rpx;
-  height: 100rpx;
-}
-
-.label-wrap text.label {
-  margin-left: 8rpx;
-  color: rgba(51, 51, 51, 1);
-  font-size: 32rpx;
-  font-weight: 500;
-  line-height: 40rpx;
-}
-
-.list .arrow {
-  width: 28rpx;
-  height: 28rpx;
-}
-
-.list.padding-bottom-22 {
-  position: relative;
-  left: 0;
-  top: 0;
-  padding-bottom: 22rpx;
-}
-
-.list.padding-bottom-22:after {
-  position: absolute;
-  left: -24rpx;
-  right: -24rpx;
-  bottom: 0;
-  content: '';
-  border-bottom: 1rpx solid #EEEEEE;
-}
-
-.list.margin-top-20 {
-  margin-top: 20rpx;
-}
-
-.list.margin-top-22 {
-  margin-top: 22rpx;
-}

+ 1 - 1
htmldev/wxMini/project.private.config.json

@@ -8,7 +8,7 @@
       "list": [
         {
           "name": "1111",
-          "pathName": "pages/news/news",
+          "pathName": "pages/mine/mine",
           "query": "",
           "launchMode": "default",
           "scene": null