黎海 2 yıl önce
ebeveyn
işleme
921bf21417

+ 1 - 1
config/index.js

@@ -8,7 +8,7 @@ const config = {
8 8
     828: 1.81 / 2
9 9
   },
10 10
   sourceRoot: 'src',
11
-  outputRoot: 'dist',
11
+  outputRoot: `dist/${process.env.TARO_ENV}`,
12 12
   plugins: [],
13 13
   defineConstants: {
14 14
   },

+ 3 - 2
package.json

@@ -4,7 +4,7 @@
4 4
   "private": true,
5 5
   "description": "liaotian ",
6 6
   "templateInfo": {
7
-    "name": "default",
7
+    "name": "redux",
8 8
     "typescript": false,
9 9
     "css": "less"
10 10
   },
@@ -26,7 +26,8 @@
26 26
     "dev:rn": "npm run build:rn -- --watch",
27 27
     "dev:qq": "npm run build:qq -- --watch",
28 28
     "dev:jd": "npm run build:jd -- --watch",
29
-    "dev:quickapp": "npm run build:quickapp -- --watch"
29
+    "dev:quickapp": "npm run build:quickapp -- --watch",
30
+    "deploy": "gh-pages -d dist"
30 31
   },
31 32
   "browserslist": [
32 33
     "last 3 versions",

+ 33 - 32
src/app.config.js

@@ -1,5 +1,6 @@
1 1
 export default defineAppConfig({
2 2
   pages: [
3
+    'pages/index/index',
3 4
     'pages/chat/index',
4 5
     'pages/collection/index',
5 6
     "pages/task/index",
@@ -17,37 +18,37 @@ export default defineAppConfig({
17 18
       provider: 'wx069ba97219f66d99'
18 19
     }
19 20
   },
20
-  // tabBar: {
21
-  //   color: "#000000",
22
-  //   selectedColor: "#FF5819",
23
-  //   borderStyle: "white",
24
-  //   backgroundColor: "#fff",
25
-  //   list: [
26
-  //     {
27
-  //       pagePath: "pages/collection/index",
28
-  //       iconPath: "images/nav/like.png",
29
-  //       selectedIconPath: "images/nav/like_pin.png",
30
-  //       text: "收藏"
21
+  tabBar: {
22
+    color: "#000000",
23
+    selectedColor: "#FF5819",
24
+    borderStyle: "white",
25
+    backgroundColor: "#fff",
26
+    list: [
27
+      {
28
+        pagePath: "pages/collection/index",
29
+        iconPath: "images/nav/like.png",
30
+        selectedIconPath: "images/nav/like_pin.png",
31
+        text: "收藏"
31 32
 
32
-  //     },
33
-  //     {
34
-  //       pagePath: "pages/chat/index",
35
-  //       iconPath: "images/nav/play.png",
36
-  //       selectedIconPath: "images/nav/play_pin.png",
37
-  //       text: "首页"
38
-  //     },
39
-  //     {
40
-  //       pagePath: "pages/task/index",
41
-  //       iconPath: "images/nav/task.png",
42
-  //       selectedIconPath: "images/nav/task_pin.png",
43
-  //       text: "领福利"
44
-  //     },
45
-  //     {
46
-  //       pagePath: "pages/mine/index",
47
-  //       iconPath: "images/nav/my.png",
48
-  //       selectedIconPath: "images/nav/my_pin.png",
49
-  //       text: "我的"
50
-  //     }
51
-  //   ]
52
-  // },
33
+      },
34
+      {
35
+        pagePath: "pages/index/index",
36
+        iconPath: "images/nav/play.png",
37
+        selectedIconPath: "images/nav/play_pin.png",
38
+        text: "首页"
39
+      },
40
+      {
41
+        pagePath: "pages/task/index",
42
+        iconPath: "images/nav/task.png",
43
+        selectedIconPath: "images/nav/task_pin.png",
44
+        text: "领福利"
45
+      },
46
+      {
47
+        pagePath: "pages/mine/index",
48
+        iconPath: "images/nav/my.png",
49
+        selectedIconPath: "images/nav/my_pin.png",
50
+        text: "我的"
51
+      }
52
+    ]
53
+  },
53 54
 })

+ 27 - 41
src/pages/chat/index.jsx

@@ -6,8 +6,8 @@ import './index.less'
6 6
 import tool from '../../common/tool'
7 7
 
8 8
 export default class Albums_play extends Component {
9
-  plugin = requirePlugin("WechatSI");
10
-  manager = this.plugin.getRecordRecognitionManager();
9
+  plugin = process.env.TARO_ENV == 'weapp' ? requirePlugin("WechatSI") : '';
10
+  manager = process.env.TARO_ENV == 'weapp' ? this.plugin.getRecordRecognitionManager() : '';
11 11
   options = {
12 12
     sampleRate: 44100,
13 13
     numberOfChannels: 1,
@@ -35,9 +35,10 @@ export default class Albums_play extends Component {
35 35
   }
36 36
 
37 37
   componentDidShow () {
38
-    console.log('页面启动',this.state.userId);
39
-    this.userinfo()
40
-    this.initRecord()
38
+    console.log('页面启动', this.state.userId);
39
+    if (process.env.TARO_ENV == 'weapp') {
40
+      this.initRecord()
41
+    }
41 42
     // this.setState({
42 43
     //   userId: this.generateUserID()
43 44
     // })
@@ -65,30 +66,7 @@ export default class Albums_play extends Component {
65 66
   // })
66 67
 
67 68
   componentDidHide () { }
68
-  
69
-  // 获取用户信息并且登录,获取openid
70
-  userinfo () {
71
-    var that = this;
72
-    that.setState({
73
-      login: false
74
-    })
75
-    Taro.getUserInfo({
76
-      success: function (res) {
77
-        console.log(res, 'userinfo');
78
-        var userInfo = res.userInfo
79
-        var nickName = userInfo.nickName
80
-        var avatarUrl = userInfo.avatarUrl
81
-        var gender = userInfo.gender //性别 0:未知、1:男、2:女
82
-        var province = userInfo.province
83
-        var city = userInfo.city
84
-        var country = userInfo.country
85
-        let data = {
86
-          "user_name": nickName,
87
-          "user_img": avatarUrl
88
-        };
89
-      }
90
-    })
91
-  }
69
+
92 70
   // 提交文字
93 71
   submitTo () {
94 72
     let inputHtml = document.getElementById('advice_textarea').props.value
@@ -113,6 +91,10 @@ export default class Albums_play extends Component {
113 91
       user_id: this.state.userId,
114 92
       text: inputHtml
115 93
     }
94
+    if (process.env.TARO_ENV == 'tt') {
95
+      params['app_id'] = 'tt6e291894f116667e01'
96
+    }
97
+
116 98
     api.getAsk(params).then(res => {
117 99
       if (res.code == 200) {
118 100
         let otherInfo = {
@@ -138,19 +120,19 @@ export default class Albums_play extends Component {
138 120
         })
139 121
       }
140 122
     })
141
-    .catch(res=>{
142
-      console.log("请求超时");
143
-      this.setState({
144
-        sendDisabled: true,//是否禁用发送按钮
145
-        value: '',
146
-        height: 63,
147
-        userId: 0,
148
-        isAnswer: true,//机器人是否已经回答
149
-        isRecognize: false,
150
-        showResult: false,
151
-        isSpeechSounds: false,//是否是语音写入
123
+      .catch(res => {
124
+        console.log("请求超时");
125
+        this.setState({
126
+          sendDisabled: true,//是否禁用发送按钮
127
+          value: '',
128
+          height: 63,
129
+          userId: 0,
130
+          isAnswer: true,//机器人是否已经回答
131
+          isRecognize: false,
132
+          showResult: false,
133
+          isSpeechSounds: false,//是否是语音写入
134
+        })
152 135
       })
153
-    })
154 136
   }
155 137
   //文字输入
156 138
   focus (e) {
@@ -301,7 +283,10 @@ export default class Albums_play extends Component {
301 283
             <View className='in_voice_icon_tips'>机器人思考中...</View>
302 284
           }
303 285
           <View className="sendmessage" style={`bottom:${this.state.input_bottom}px`}>
286
+            {
287
+              process.env.TARO_ENV=='weapp'&&
304 288
             <Image className='add_icon' style={!this.state.isAnswer ? 'opacity: .3;' : ''} onClick={e => (this.changeSpeak(e))} id='1' src='https://we-spa.oss-cn-shenzhen.aliyuncs.com/total_picture/1677739244529.png'></Image>
289
+            }
305 290
             {
306 291
               this.state.isSpeechSounds ?
307 292
                 <View
@@ -325,6 +310,7 @@ export default class Albums_play extends Component {
325 310
                   autoHeight
326 311
                   disabled={!this.state.isAnswer}
327 312
                   id='advice_textarea'
313
+                  className='advice_textarea'
328 314
                   cursorSpacing='5'
329 315
                   showConfirmBar=''
330 316
                   confirmType='send'

+ 5 - 5
src/pages/chat/index.less

@@ -22,14 +22,14 @@ page {
22 22
   color: #F2F2F2;
23 23
   top: -70px;
24 24
   font-size: 28px;
25
-  padding: 10px 50px;
25
+  padding: 10px 50px 20px 50px;
26 26
   background-color: #948c8c94;
27 27
   border-radius: 5px;
28 28
   // background: url(https://we-spa.oss-cn-shenzhen.aliyuncs.com/total_picture/1677810251249.png);
29 29
 }
30 30
 
31 31
 .sendmessage {
32
-  margin: 20px;
32
+  margin: 20px 20px 40px 20px;
33 33
   z-index: 2;
34 34
   display: flex;
35 35
   align-items: flex-end;
@@ -41,7 +41,7 @@ page {
41 41
   margin: 0 auto;
42 42
 }
43 43
 
44
-.sendmessage Input {
44
+.sendmessage .advice_textarea {
45 45
   flex: 1;
46 46
   padding: 10px;
47 47
   height: 60px;
@@ -84,7 +84,7 @@ page {
84 84
   padding:  20px;
85 85
   justify-content: flex-end;
86 86
   .mine-text{
87
-    background-color: #9EE770;
87
+    background-color: #f8f8f8;
88 88
     border-radius: 10px;
89 89
     padding: 20px;
90 90
     max-width: 485px;
@@ -100,7 +100,7 @@ page {
100 100
       width: 0;
101 101
       height: 0;
102 102
       border-top: 20px solid transparent;
103
-      border-left: 20px solid #9EE770;
103
+      border-left: 20px solid #f8f8f8;
104 104
       border-right: 20px solid transparent;
105 105
       border-bottom: 20px solid transparent;
106 106
     }

+ 3 - 0
src/pages/index/index.config.js

@@ -0,0 +1,3 @@
1
+export default definePageConfig({
2
+  navigationBarTitleText: '首页'
3
+})

+ 24 - 0
src/pages/index/index.jsx

@@ -0,0 +1,24 @@
1
+import { Component } from 'react'
2
+import { View, Text, Button, Image, scrollView, Input } from '@tarojs/components'
3
+import './index.less'
4
+
5
+export default class Mine extends Component {
6
+
7
+  componentWillMount() { }
8
+
9
+  componentDidMount() { }
10
+
11
+  componentWillUnmount() { }
12
+
13
+  componentDidShow() { }
14
+
15
+  componentDidHide() { }
16
+
17
+  render() {
18
+    return (
19
+     <View>
20
+      mine
21
+     </View>
22
+    )
23
+  }
24
+}

+ 379 - 0
src/pages/index/index.less

@@ -0,0 +1,379 @@
1
+page {
2
+  background-color: #f2f2f2;
3
+  height: 100%;
4
+  padding: 0 auto;
5
+  margin: 0 auto;
6
+}
7
+.login{
8
+  z-index: 999;
9
+  position: fixed;
10
+  top: 300rpx;
11
+  height: 100rpx;
12
+  text-align: center;
13
+  line-height: 100rpx;
14
+  width: 400rpx;
15
+  left: 50%;
16
+  margin-left: -200rpx;
17
+  background: white;
18
+}
19
+.Phone{
20
+  top: 500rpx;
21
+  width: 400rpx;
22
+}
23
+.login_zz{
24
+  position: fixed;
25
+  left: 0;
26
+  top: 0;
27
+  width: 100%;
28
+  height: 100%;
29
+  z-index: 998;
30
+  
31
+background-color: rgba(0,0,0,0.5);
32
+}
33
+swiper {
34
+  height: 180rpx;
35
+}
36
+ 
37
+swiper swiper-item .slide-image {
38
+  width: 100%;
39
+  height: 180rpx;
40
+}
41
+ 
42
+.jia_img {
43
+  height: 80rpx;
44
+  width: 90rpx;
45
+}
46
+ 
47
+.time {
48
+  text-align: center;
49
+  padding: 5rpx 20rpx 5rpx 20rpx;
50
+  border-radius: 10rpx;
51
+  display: block;
52
+  height: 38rpx;
53
+  line-height: 38rpx;
54
+  position: relative;
55
+  margin: 0 auto;
56
+  margin-bottom: 20rpx;
57
+  width: 90rpx;
58
+  color: white;
59
+  font-size: 26rpx;
60
+  background-color: #dedede;
61
+}
62
+ 
63
+.tab {
64
+  bottom: 120rpx;
65
+}
66
+ 
67
+.tab_1 {
68
+  position: fixed;
69
+  bottom: 50rpx;
70
+  width: 200rpx;
71
+  font-size: 26rpx;
72
+  left: 50%;
73
+  margin-left: -45rpx;
74
+  height: 100rpx;
75
+}
76
+ 
77
+.tab_2 {
78
+  right: 30rpx;
79
+  position: fixed;
80
+}
81
+ 
82
+/* 聊天 */
83
+ 
84
+.my_right {
85
+  float: right;
86
+  margin-top: 30rpx;
87
+  position: relative;
88
+}
89
+ 
90
+.my_audio {
91
+  height: 60rpx;
92
+  width: 60rpx;
93
+  z-index: 2;
94
+  position: relative;
95
+  top: 10rpx;
96
+  left: 20rpx;
97
+}
98
+ 
99
+.you_left {
100
+  margin-top: 30rpx;
101
+  float: left;
102
+  position: relative;
103
+  padding-left: 5rpx;
104
+}
105
+ 
106
+.new_img {
107
+  width: 85rpx;
108
+  height: 85rpx;
109
+  overflow: hidden;
110
+}
111
+ 
112
+.page_r {
113
+  float: right;
114
+}
115
+ 
116
+.new_txt {
117
+  min-width: 380rpx;
118
+  width: 460rpx;
119
+  word-break: break-all;
120
+}
121
+ 
122
+.new_txt_my {
123
+  border-radius: 7rpx;
124
+  background: #9fe75a;
125
+  position: relative;
126
+  right: 30rpx;
127
+  padding: 17rpx 30rpx 17rpx 30rpx;
128
+  float: right;
129
+  border: 1px solid #d0d0d0;
130
+}
131
+ 
132
+.new_txt_my .arrow {
133
+  position: absolute;
134
+  z-index: 2;
135
+  width: 40rpx;
136
+  right: -38rpx;
137
+}
138
+ 
139
+.new_txt_my .arrow em {
140
+  position: absolute;
141
+  border-style: solid;
142
+  border-width: 15rpx;
143
+  border-color: transparent transparent transparent #d0d0d0;
144
+  top: 1rpx;
145
+}
146
+ 
147
+.new_txt_my .arrow span {
148
+  position: absolute;
149
+  top: 5rpx;
150
+  border-style: solid;
151
+  border-width: 15rpx;
152
+  border-color: transparent transparent transparent #9fe75a;
153
+}
154
+ 
155
+.new_txt_my_2 {
156
+  word-break: break-all;
157
+  border-radius: 7rpx;
158
+  background: #9fe75a;
159
+  min-width: 330rpx;
160
+  max-width: 530rpx;
161
+  padding: 17rpx 30rpx 17rpx 30rpx;
162
+  float: right;
163
+}
164
+ 
165
+.new_txt_ai {
166
+  border-radius: 7rpx;
167
+  left: 20rpx;
168
+  background-color: #fff;
169
+  position: relative;
170
+  border: 1px solid #d0d0d0;
171
+  float: left;
172
+}
173
+ 
174
+.new_txt_ai .arrow {
175
+  position: relative;
176
+  width: 40rpx;
177
+  left: -30rpx;
178
+}
179
+ 
180
+.new_txt_ai .arrow em {
181
+  position: absolute;
182
+  border-style: solid;
183
+  border-width: 15rpx;
184
+  top: 20rpx;
185
+  border-color: transparent #d0d0d0 transparent transparent;
186
+}
187
+ 
188
+.new_txt_ai .arrow span {
189
+  position: absolute;
190
+  top: 20rpx;
191
+  border-style: solid;
192
+  border-width: 15rpx;
193
+  border-color: transparent #fff transparent transparent;
194
+  left: 2rpx;
195
+}
196
+ 
197
+.ai_content {
198
+  word-break: break-all;
199
+  padding: 17rpx 30rpx 17rpx 30rpx;
200
+}
201
+ 
202
+.sanjiao {
203
+  top: 25rpx;
204
+  position: relative;
205
+  width: 0px;
206
+  height: 0px;
207
+  border-width: 15rpx;
208
+  border-style: solid;
209
+}
210
+ 
211
+.my {
212
+  border-color: transparent transparent transparent #9fe75a;
213
+}
214
+ 
215
+.you {
216
+  border-color: transparent #fff transparent transparent;
217
+}
218
+ 
219
+._span {
220
+  border-color: #fff transparent transparent;
221
+  top: -17px;
222
+}
223
+ 
224
+.is_ai_btn {
225
+  border-radius: 0 0 7px 7px;
226
+  border-top: 1px solid #d0d0d0;
227
+  background: white;
228
+  position: relative;
229
+  bottom: 0;
230
+  left: 0;
231
+  width: 100%;
232
+  height: 80rpx;
233
+  line-height: 80rpx;
234
+  display: flex;
235
+  flex-direction: row;
236
+  text-align: center;
237
+}
238
+ 
239
+.is_ai_btn view {
240
+  width: 50%;
241
+}
242
+ 
243
+.is_ai_btn image {
244
+  width: 32rpx;
245
+  position: relative;
246
+  top: 4rpx;
247
+  height: 32rpx;
248
+}
249
+ 
250
+.is_ai_btn .two {
251
+  border-left: 1px solid #d0d0d0;
252
+}
253
+ 
254
+.yes_problem_log {
255
+  border-top: 1px solid #d0d0d0;
256
+  height: 80rpx;
257
+  text-align: center;
258
+  line-height: 80rpx;
259
+}
260
+ 
261
+.voice_icon {
262
+  width: 60rpx;
263
+  height: 60rpx;
264
+  margin: 0 auto;
265
+  padding: 10rpx 10rpx 10rpx 10rpx;
266
+}
267
+ 
268
+.add_icon {
269
+  width: 70rpx;
270
+  height: 70rpx;
271
+  margin: 0 auto;
272
+  padding: 20rpx 10rpx 10rpx 15rpx;
273
+}
274
+ 
275
+.voice_ing {
276
+  width: 90%;
277
+  height: 75rpx;
278
+  line-height: 85rpx;
279
+  text-align: center;
280
+  border-radius: 15rpx;
281
+  border: 1px solid #d0d0d0;
282
+}
283
+ 
284
+.zezhao {
285
+  height: 100%;
286
+  position: absolute;
287
+  top: 0;
288
+  left: 0;
289
+  z-index: 2;
290
+  width: 100%;
291
+  background: rgba(0, 0, 0, 0.5);
292
+}
293
+ 
294
+.in_voice_icon {
295
+  z-index: 3;
296
+  left: 0;
297
+  bottom: 0;
298
+  width: 100%;
299
+  position: absolute;
300
+  height: 500rpx;
301
+  background: #f8f8f8;
302
+}
303
+ 
304
+.in_voice_icon .item {
305
+  position: relative;
306
+  margin-top: 50rpx;
307
+  margin-left: 50rpx;
308
+  text-align: center;
309
+  width: 140rpx;
310
+}
311
+ 
312
+.in_voice_icon .img {
313
+  width: 80rpx;
314
+  height: 80rpx;
315
+  border-radius: 15rpx;
316
+}
317
+ 
318
+.in_voice_icon .text {
319
+  font-size: 32rpx;
320
+  margin-top: 20rpx;
321
+}
322
+ 
323
+.sendmessage {
324
+  width: 100%;
325
+  z-index: 2;
326
+  display: flex;
327
+  position: fixed;
328
+  bottom: 0px;
329
+  background-color: #f8f8f8;
330
+  flex-direction: row;
331
+  height: 100rpx;
332
+}
333
+ 
334
+.sendmessage input {
335
+  width: 78%;
336
+  height: 80rpx;
337
+  line-height: 80rpx;
338
+  font-size: 28rpx;
339
+  margin-top: 10rpx;
340
+  margin-left: 20rpx;
341
+  border-bottom: 1px solid #d0d0d0;
342
+  padding-left: 20rpx;
343
+}
344
+ 
345
+.sendmessage button {
346
+  border: 1px solid white;
347
+  width: 18%;
348
+  height: 80rpx;
349
+  background: #0c0;
350
+  color: white;
351
+  line-height: 80rpx;
352
+  margin-top: 10rpx;
353
+  font-size: 28rpx;
354
+}
355
+ 
356
+.hei {
357
+  height: 20rpx;
358
+}
359
+ 
360
+.history {
361
+  height: 88%;
362
+  display: flex;
363
+  font-size: 14px;
364
+  line-height: 50rpx;
365
+  position: relative;
366
+  top: 20rpx;
367
+}
368
+ 
369
+.icno_kf {
370
+  position: fixed;
371
+  bottom: 160rpx;
372
+  margin: 0 auto;
373
+  text-align: center;
374
+  left: 50%;
375
+  margin-left: -40rpx;
376
+  width: 100rpx;
377
+  height: 100rpx;
378
+  border-radius: 50%;
379
+}