Your Name 5 years ago
parent
commit
a73ee42dbb

+ 15 - 15
app.js

@@ -33,22 +33,22 @@ App({
33 33
     // console.log(wx.getStorageSync('access_token'))    //是否注册过
34 34
 
35 35
 
36
-    if (wx.getStorageSync('access_token')) {   //是否注册过
36
+    // if (wx.getStorageSync('access_token')) {   //是否注册过
37 37
       
38
-      wx.reLaunch({
39
-        url: '/pages/index/index'        //注册过 进入首页
40
-      })
41
-
42
-    } else if (wx.getStorageSync('wx_id')) {  //是否授权
43
-      // console.log(2);
44
-      wx.reLaunch({
45
-        url: '/pages/Landpage/Land/Land'    //授权过 进入登陆页
46
-      })  
47
-    }else {
48
-      wx.reLaunch({
49
-        url: '/pages/Jurisdiction/click_Jurisdiction/click_Jurisdiction'   //未授权  进入授权页
50
-      })
51
-    }
38
+    //   wx.reLaunch({
39
+    //     url: '/pages/index/index'        //注册过 进入首页
40
+    //   })
41
+
42
+    // } else if (wx.getStorageSync('wx_id')) {  //是否授权
43
+    //   // console.log(2);
44
+    //   wx.reLaunch({
45
+    //     url: '/pages/Landpage/Land/Land'    //授权过 进入登陆页
46
+    //   })  
47
+    // }else {
48
+    //   wx.reLaunch({
49
+    //     url: '/pages/Jurisdiction/click_Jurisdiction/click_Jurisdiction'   //未授权  进入授权页
50
+    //   })
51
+    // }
52 52
 
53 53
   
54 54
   },

+ 2 - 2
app.json

@@ -1,6 +1,7 @@
1 1
 {
2 2
   "pages": [
3
-        "pages/personal_core/vehicle/vehicle",
3
+    "pages/information/chat/chat",
4
+"pages/personal_core/vehicle/vehicle",
4 5
  "pages/personal_core/remind/remind",
5 6
   "pages/Jurisdiction/click_Jurisdiction/click_Jurisdiction",
6 7
   "pages/Setup/modify/modify",
@@ -14,7 +15,6 @@
14 15
   "pages/Setup/Aboutus/Aboutus",
15 16
    "pages/Setup/security/security",
16 17
    "pages/Setup/Setuplist/Setuplist",
17
-    "pages/information/chat/chat",
18 18
     "pages/payment/Member/Member",
19 19
     "pages/personal_core/Album/Album",
20 20
      "pages/personal_core/requirements/requirements",

BIN
image/jz.png


BIN
image/m_chat/extra/choose_picture.png


BIN
image/m_chat/extra/close_chat.png


BIN
image/m_chat/extra/take_photos.png


BIN
image/send_fail.png


+ 103 - 28
pages/information/chat/chat.js

@@ -1,5 +1,3 @@
1
-const webSocket = require('../../../utils/websocket.js');
2
-
3 1
 const app = getApp();
4 2
 
5 3
 Page({
@@ -10,42 +8,119 @@ Page({
10 8
   data: {
11 9
     focus: false,
12 10
     // scrollTop: 100,
11
+    menu: false, //菜单显示隐藏
12
+    uploadImages: ["/image/smyz2.png","/image/smyz1.png"], //相册放大图集
13
+    news:'',//input消息
14
+    inputValue: null,  //input 的 value 
15
+
16
+    messages:'',//接收消息数据
17
+    photo:'', //相片
13 18
   },
14 19
 
15
-  /**
16
-   * 生命周期函数--监听页面加载
17
-   */
20
+
18 21
   onLoad: function (options) {
19 22
     var that = this;
20
-    // that.bottom();
21
-  // 发送
22
-  //   webSocket.sendSocketMessage({
23
-  //     msg: JSON.stringify({
24
-  //       type: 'ping',
25
-  //       data: '1111',
26
-  //     })
27
-  //   });
28
-  //   webSocket.onSocketMessageCallback = this.onSocketMessageCallback;
29 23
 
30 24
   },
31 25
 
32
-  // 接收
33
-  // onSocketMessageCallback: function (e) {
34
-  //   console.log('33333' + e);
35
-  // }
26
+
27
+// 点击scroll-view 关闭底部菜单
28
+  resetInputStatus: function() {
29
+    var that = this;
30
+    that.setData({ 
31
+      menu: false, //关闭底部菜单
32
+    })
33
+  },
34
+
35
+// 底部菜单显示隐藏切换
36
+  chatInputExtraClickEvent:function(){
37
+        var that = this;
38
+    that.setData({
39
+      menu: !that.data.menu   
40
+    })
41
+  },
42
+
43
+
44
+// 相册点击放大
45
+  enlarge: function (e) {
46
+    var that = this;
47
+    // console.log(that.data.uploadImages)
48
+    // console.log(e.currentTarget.dataset.src,)
49
+    wx.previewImage({
50
+      current: e.currentTarget.dataset.src, // 当前显示图片的http链接
51
+      urls: that.data.uploadImages, // 需要预览的图片http链接列表
52
+    })
53
+
54
+
55
+  },
56
+
57
+
58
+
59
+// 发送消息事件
60
+  Sendout: function (e) {
61
+    var that = this;
62
+    console.log(that.data.news);
63
+
64
+    that.setData({
65
+      menu: false,  //隐藏底部菜单
66
+      inputValue: '',  //清空 input
67
+      messages: that.data.news,  //显示信息
68
+    })
69
+    console.log('发送');
70
+    
71
+  },
72
+
73
+  //输入框
74
+  Telephone: function (e) {
75
+    var that = this;
76
+    // console.log(e.detail.value);
77
+
78
+    that.setData({
79
+      news: e.detail.value,     //获取输入文字
80
+    })
81
+
82
+  },
83
+
84
+
85
+  // 上传图片
86
+  chooseImageTap: function () {
87
+    var that = this;
88
+    wx.chooseImage({
89
+      count: 1,
90
+      sizeType: ['original', 'compressed'],
91
+      sourceType: ['album', 'camera'],
92
+      success(res) {
93
+
94
+        console.log(res.tempFilePaths[0]);
95
+        // tempFilePath可以作为img标签的src属性显示图片
96
+        that.setData({
97
+          photo: res.tempFilePaths[0],
98
+        });
99
+
100
+      }
101
+    })
102
+
103
+
104
+  },
105
+  
106
+  // 重发消息
107
+  retransmission:function(){
108
+    wx.showModal({
109
+      content: '重发该消息?',
110
+      success(res) {
111
+        if (res.confirm) {
112
+          console.log('用户点击确定')
113
+        } else if (res.cancel) {
114
+          console.log('用户点击取消')
115
+        }
116
+      }
117
+    })
118
+
119
+  }
36 120
 
37 121
 
38
-  // 获取hei的id节点然后屏幕焦点调转到这个节点  
39
-  // bottom: function () {
40
-  //   var that = this;
41
-  //   that.setData({
42
-  //     scrollTop: 1000000
43
-  //   })
44
-  // },
45 122
 
46 123
 
47 124
 
48
-  // bindTextAreaBlur: function (e) {
49
-  //   console.log(e.detail.value)
50
-  // }
125
+  
51 126
 })

+ 90 - 52
pages/information/chat/chat.wxml

@@ -1,65 +1,63 @@
1 1
 
2 2
 <!-- <view class='HGJKHJKHJK'> -->
3
-<scroll-view class="history" scroll-y="true" scroll-with-animation  scroll-top="10000">
3
+<scroll-view class="history" scroll-y="true" scroll-with-animation  scroll-top="10000"   bindtap="resetInputStatus">
4 4
  
5 5
           <!-- 自己 -->
6
-          <view class='my_right c'>
7
-                    <text class='time'>下午 9:25</text>
8
-                      <!-- 文字-->
9
-                    <view class='information'>
10
-                            <text>啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的</text>
11
-                            <image  class='m_tx' src='/image/personal1.jpg'></image>
12
-                    </view>
13
-
14
-                                        <view class='information'>
15
-                            <text>啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的</text>
16
-                            <image  class='m_tx' src='/image/personal1.jpg'></image>
17
-                    </view>
18
-
19
-                                        <view class='information'>
20
-                            <text>啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的</text>
21
-                            <image  class='m_tx' src='/image/personal1.jpg'></image>
22
-                    </view>
23
-
24
-                                        <view class='information'>
25
-                            <text>啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的</text>
26
-                            <image  class='m_tx' src='/image/personal1.jpg'></image>
27
-                    </view>
28
-
29
-                                        <view class='information'>
30
-                            <text>啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的</text>
31
-                            <image  class='m_tx' src='/image/personal1.jpg'></image>
32
-                    </view>
33
-
34
-                                        <view class='information'>
35
-                            <text>啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的啊实打实的</text>
36
-                            <image  class='m_tx' src='/image/personal1.jpg'></image>
37
-                    </view>
38
-
39
-                     <!-- 图片 -->
40
-                    <!-- <view class='m_img'>
41
-                              <image class='m_picture' src='/image/smyz2.png' mode="widthFix"></image>
42
-                              <image class='m_tx'  src='/image/personal1.jpg'></image>
43
-                    </view> -->
44
-          </view>
6
+           <block  wx:if="{{messages || photo}}">  <!-- wx:for='{{home}}' wx:key="item" wx:for-index="id" -->
7
+                <view class='my_right c' >
8
+                          <text class='time'>下午 9:25</text>
9
+                            <!-- 文字-->
10
+                          <view class='information' wx:if="{{messages}}">
11
+                                  <!--  加载 -->
12
+                                  <view class='m_state'>
13
+                                         <image class='m_jz' src='/image/jz.png'></image>
14
+                                  </view>
15
+                                   <!--  失败 -->
16
+                                  <view class='m_state' bindtap="retransmission">
17
+                                           <image  class='m_jz' src='/image/send_fail.png' mode="aspectFill"></image>
18
+                                  </view>
19
+
20
+                                  <text>{{messages}}</text>
21
+
22
+
23
+                                  <image  class='m_tx' src='/image/personal1.jpg' mode="aspectFill"></image>
24
+                                  
25
+                                
26
+                          </view>
27
+
28
+                          <!-- 图片 --> 
29
+                          <view class='m_img' wx:elif="{{photo}}">
30
+                                  <!--  加载 -->
31
+                                  <view class='m_state'>
32
+                                         <image class='m_jz' src='/image/jz.png'></image>
33
+                                  </view>
34
+                                  <!--  失败 -->
35
+                                  <view class='m_state'> 
36
+                                           <image  class='m_jz' src='/image/send_fail.png' mode="aspectFill"></image>
37
+                                  </view>
38
+
39
+                                    <image class='m_picture' src='{{photo}}' mode="aspectFill" data-src='/image/smyz2.png'  bindtap='enlarge'></image>
40
+                                    <image class='m_tx'  src='/image/personal1.jpg'></image>
41
+                          </view>
42
+                </view>
43
+          </block>
45 44
 
46 45
          <!-- 他人 -->
47
-          <view class='my_left c'>
46
+          <!-- <view class='my_left c'>
48 47
                     <text class='l_time'>下午 9:25</text>
49
-                      <!-- 文字-->
50
-                    <!-- <view class='l_information'>
48
+                  
49
+                    <view class='l_information'>
51 50
                             <image  class='l_tx' src='/image/personal1.jpg'></image>
52 51
                             <text>阿萨德,啊实打实的,啊  ASD ASD</text>
53 52
 
54
-                    </view> -->
53
+                    </view>
55 54
 
56
-                     <!-- 图片 -->
55
+                    
57 56
                   <view class='l_img'>
58 57
                               <image class='l_tx'  src='/image/personal1.jpg'></image>
59
-                              <image class='l_picture' src='/image/smyz2.png' mode="widthFix"></image>
60
-                             
58
+                              <image class='l_picture' src='/image/smyz2.png'  data-src='/image/smyz2.png'  mode="widthFix"  bindtap='enlarge'></image>
61 59
                     </view> 
62
-          </view>
60
+          </view> -->
63 61
 
64 62
   
65 63
           <!-- <view style='height:148rpx'></view> -->
@@ -68,6 +66,7 @@
68 66
      <!-- </view> -->
69 67
 
70 68
 
69
+<!-- 功能栏 -->
71 70
 <view class='my_bottom_box'>
72 71
           <view class='my_bottom c'>
73 72
                 
@@ -76,11 +75,50 @@
76 75
                    
77 76
                    <!-- 输入框 -->
78 77
                   <view class="textarea-wrp">
79
-                       <textarea auto-height="true" confirm-type="done" bindfocus="focus" maxlength="-1"/>
78
+                       <input  
79
+                       type='text' 
80
+                       value="{{inputValue}}" 
81
+                       bindinput="Telephone" 
82
+                       confirm-type="send" 
83
+                       cursor-spacing="20" 
84
+                       adjust-position="true" 
85
+                       bindconfirm="Sendout"
86
+                       ></input>
80 87
                   </view>
81 88
 
82 89
                   <!-- 菜单 -->
83
-                 <image class='r_img' src='/image/jh1.png'></image>
84
-
90
+                  <view hover-class="press-style-opacity" catchtap="chatInputExtraClickEvent"  >
91
+                        <image class='r_img' src='/image/jh1.png'></image>
92
+                 </view>
85 93
           </view>
86
-</view>
94
+
95
+        <block wx:if="{{menu}}">
96
+
97
+          <view  class="extra-super c"  >
98
+
99
+                  <view class="flex-column" style="width: 25%" bindtap='chooseImageTap' data-index="{{index}}">
100
+                      <image class="extra-image-size" src="/image/m_chat/extra/choose_picture.png" />
101
+                      <text class="extra-text-size">图片</text>
102
+                  </view>
103
+
104
+                  <!-- <view class="flex-column" style="width: 25%" bindtap="chatInputExtraItemClickEvent" data-index="{{index}}">
105
+                      <image class="extra-image-size" src="/image/m_chat/extra/choose_picture.png" />
106
+                      <text class="extra-text-size">图片</text>
107
+                  </view>
108
+
109
+                  <view class="flex-column" style="width: 25%" bindtap="chatInputExtraItemClickEvent" data-index="{{index}}">
110
+                      <image class="extra-image-size" src="/image/m_chat/extra/choose_picture.png" />
111
+                      <text class="extra-text-size">图片</text>
112
+                  </view>
113
+
114
+                  <view class="flex-column" style="width: 25%" bindtap="chatInputExtraItemClickEvent" data-index="{{index}}">
115
+                      <image class="extra-image-size" src="/image/m_chat/extra/choose_picture.png" />
116
+                      <text class="extra-text-size">图片</text>
117
+                  </view> -->
118
+
119
+
120
+          </view> 
121
+
122
+       </block>
123
+</view>
124
+

+ 43 - 17
pages/information/chat/chat.wxss

@@ -15,12 +15,15 @@ page {background-color: #EDEDED; height: 100%;}
15 15
 .my_right .time{text-align:center;display:block;}
16 16
 /* 文字 */
17 17
 .my_right .information{margin-top:30rpx;float:right;}
18
-.my_right .information text{max-width:474rpx;display:block;float:left;margin-right:20rpx;background:#FFF;border-radius:10rpx;overflow:hidden;padding:18rpx 18rpx;}
18
+.my_right .information text{max-width:474rpx;display:block;float:left;margin-right:20rpx;background:#8FCBF7;border-radius:10rpx;overflow:hidden;padding:18rpx 18rpx;}
19 19
 .my_right  .m_tx{width:80rpx;height:80rpx;border-radius:6rpx;overflow:hidden;}
20 20
 
21
+.my_right .m_state{width:30rpx;float:left;height:80rpx;margin-right:15rpx;}
22
+.my_right .m_state  .m_jz{width:30rpx;height:30rpx;position:relative;top:22rpx;}
23
+
21 24
 /* 图片*/
22 25
 .my_right .m_img{margin-top:30rpx;float:right;}
23
-.my_right .m_img .m_picture{width:260rpx;float:left;margin-right:24rpx;border-radius:6rpx;max-height:260rpx;}
26
+.my_right .m_img .m_picture{max-width:260rpx;float:left;margin-right:24rpx;border-radius:6rpx;max-height:260rpx;}
24 27
 
25 28
 /* 他人 */
26 29
 .my_left{padding:20rpx;}
@@ -38,33 +41,56 @@ page {background-color: #EDEDED; height: 100%;}
38 41
 
39 42
 /* 底部 */
40 43
 .my_bottom_box{width:100%;background:rgba(246, 246, 246, 0.98);position:fixed;bottom:0;left:0;padding:20rpx 0 50rpx 0;}
41
-.my_bottom{padding:0 20rpx;position:relative;min-height:60rpx;}
42
-.my_bottom .l_img{width:60rpx;height:60rpx;display:block;position:absolute;bottom:0;}
43
-.my_bottom .r_img{width:60rpx;height:60rpx;display:block;position:absolute;bottom:0;right:24rpx;}
44
+.my_bottom{padding:0 20rpx;position:relative;height:80rpx;}
45
+.my_bottom .l_img{width:60rpx;height:60rpx;display:block;position:absolute;bottom:10rpx;}
46
+.my_bottom .r_img{width:60rpx;height:60rpx;display:block;position:absolute;bottom:10rpx;right:24rpx;}
44 47
 
45 48
 
46 49
 
47
-.textarea-wrp{float:left;width:500rpx;background-color: #fff;margin-left:86rpx;min-height: 60rpx;
48
-padding:0 20rpx;border-radius:6rpx;
50
+.textarea-wrp{float:left;width:500rpx;background-color: #fff;margin-left:86rpx;height:80rpx;
51
+    padding:0 20rpx;border-radius:6rpx;
49 52
     display: flex;
50
-    align-items: center;
53
+    align-items: center; 
51 54
     justify-content: space-around;        
52 55
     flex-direction: column;
53 56
 }
54 57
 
58
+.textarea-wrp input{
59
+    font-size:30rpx;
60
+    width:100%; 
61
+  }
55 62
 
56
-/* .textarea-wrp textarea{font-size:20rpx;} */
57
-
58
-textarea{
59
-font-size:30rpx;
60
-/* border: 1px  solid; */
61 63
 
62
-  /* margin: auto; */
63 64
 
64
-width:100%; 
65
-max-height:145rpx;overflow:auto;
65
+/* 更多功能 */
66
+.press-style-opacity{
67
+    opacity: 0.5;
68
+}
66 69
 
70
+.extra-super{
71
+    /* display: flex; */
72
+    margin-top:25rpx;
73
+    /* height: 234rpx; */
74
+    width: 100%;
75
+    background-color: rgba(246, 246, 246, 0.98);
76
+    border-top:1px solid #EEE;
67 77
 
68 78
 
79
+}
80
+.flex-column {
81
+      padding-top:30rpx ;
82
+  float: left;
83
+    display: flex;
84
+    flex-direction: column;
85
+    align-items: center;
86
+}
87
+.extra-image-size{
88
+    width: 114rpx;
89
+    height: 114rpx
90
+}
91
+.extra-text-size{
92
+    color: #666666;
93
+    font-size: 24rpx;
94
+    margin-top: 10rpx
95
+}
69 96
 
70
-}