1002884655 4 vuotta sitten
vanhempi
commit
76240af530

+ 1
- 1
project.config.json Näytä tiedosto

@@ -27,7 +27,7 @@
27 27
 			"outputPath": ""
28 28
 		},
29 29
 		"useIsolateContext": true,
30
-		"useCompilerModule": true,
30
+		"useCompilerModule": false,
31 31
 		"userConfirmedUseCompilerModuleSwitch": false
32 32
 	},
33 33
 	"compileType": "miniprogram",

+ 34
- 0
src/components/GetUserPhone/index.jsx Näytä tiedosto

@@ -0,0 +1,34 @@
1
+import React, { useState } from 'react'
2
+import { Button } from '@tarojs/components'
3
+import request, { apis } from '@/utils/request'
4
+import '@/assets/css/reset.less'
5
+import '@/assets/css/iconfont.less'
6
+import './index.less'
7
+
8
+export default function GetUserPhone (props) {
9
+
10
+  const ToGetUserPhone = (e) => { // 授权手机号
11
+    request({
12
+      ...apis.getUserPhone,
13
+      params: {
14
+        sessionKey: e.detail.cloudId,
15
+        encryptedData: e.detail.encryptedData,
16
+        iv: e.detail.iv
17
+      }
18
+    }).then((res) => {
19
+      console.log(res)
20
+    })
21
+  }
22
+
23
+  return (
24
+    <view className='GetUserPhone'>
25
+      <view className='centerLabel'>
26
+        <text>您暂未授权手机号</text>
27
+        <view className='flex-h'>
28
+          <text className='flex-item'>取消</text>
29
+          <Button className='flex-item' open-type='getPhoneNumber' lang='zh_CN' onGetphonenumber={ToGetUserPhone}>授权手机</Button>
30
+        </view>
31
+      </view>
32
+    </view>
33
+  )
34
+}

+ 16
- 0
src/components/GetUserPhone/index.less Näytä tiedosto

@@ -0,0 +1,16 @@
1
+.GetUserPhone {
2
+  width: 100%;
3
+  position: fixed !important;
4
+  left: 0;
5
+  top: 0;
6
+  bottom: 0;
7
+  z-index: 1000;
8
+  background: rgba(0, 0, 0, 0.7);
9
+
10
+  >view {
11
+    width: 60%;
12
+    padding: 20px;
13
+    background: #fff;
14
+    border-radius: 10px;
15
+  }
16
+}

+ 18
- 4
src/pages/HuoDong/HuoDongDetail/index.jsx Näytä tiedosto

@@ -1,13 +1,17 @@
1 1
 import React, { useState, useEffect } from 'react'
2 2
 import Taro, { Current } from '@tarojs/taro'
3
-import { RichText } from '@tarojs/components'
3
+import { RichText, Button } from '@tarojs/components'
4 4
 import request, { apis } from '@/utils/request'
5
+import { useModel } from '@/store'
6
+import GetUserPhone from '@/components/GetUserPhone/index'
5 7
 import '@/assets/css/reset.less'
6 8
 import '@/assets/css/iconfont.less'
7 9
 import './index.less'
8 10
 
9 11
 export default function HuoDongDetail (props) {
10 12
 
13
+  const { user } = useModel('user')
14
+  const [ShowGetUserPhoneLayer, setShowGetUserPhoneLayer] = useState(false)
11 15
   const [CurrnetHuoDongId] = useState(Current.router.params.id) // 当前活动id
12 16
   const [ActivityDetail, setActivityDetail] = useState(null) // 活动详情
13 17
 
@@ -21,8 +25,18 @@ export default function HuoDongDetail (props) {
21 25
     })
22 26
   }
23 27
 
28
+  const ToJoin = () => { // 去报名
29
+    const { personId, phone } = user
30
+    const { dynamicId } = ActivityDetail
31
+    console.log(personId, phone, dynamicId)
32
+  }
33
+
24 34
   return (
25 35
     <view className='HuoDongDetail'>
36
+      {
37
+        ShowGetUserPhoneLayer &&
38
+        <GetUserPhone></GetUserPhone>
39
+      }
26 40
       <view className='BannerLayer'></view>
27 41
       {
28 42
         ActivityDetail !== null &&
@@ -35,7 +49,7 @@ export default function HuoDongDetail (props) {
35 49
         <view className='Info'>
36 50
           <view className='MainInfo'>
37 51
             <text className='Name'>{ActivityDetail.title}</text>
38
-            <text className='Tips'>{ActivityDetail.enlistNum}人已报名</text>
52
+            <text className='Tips'>{ActivityDetail.enlisted}人已报名</text>
39 53
             <view className='flex-h'>
40 54
               <text>活动时间:</text>
41 55
               <view className='flex-item'>{ActivityDetail.startDate}<text>限{ActivityDetail.enlistNum}人</text></view>
@@ -52,10 +66,10 @@ export default function HuoDongDetail (props) {
52 66
 
53 67
           <view className='Desc'>
54 68
             <text>活动介绍</text>
55
-            <RichText nodes={null}></RichText>
69
+            <RichText nodes={ActivityDetail.desc}></RichText>
56 70
           </view>
57 71
 
58
-          <text className='BottomBtn'>立即参加</text>
72
+          <text className='BottomBtn' onClick={ToJoin}>立即参加</text>
59 73
 
60 74
         </view>
61 75
       }

+ 1
- 1
src/pages/ShouYe/ZiXun/index.jsx Näytä tiedosto

@@ -21,7 +21,7 @@ export default function ShouYeZiXun (props) {
21 21
   }, [PageNum])
22 22
 
23 23
   const GetNewsList = (done = () => { }) => { // 获取资讯列表
24
-    request({ ...apis.getNewsList, params: { pageNum: PageNum, pageSize: 6 } }).then((res) => {
24
+    request({ ...apis.getNewsList, params: { pageNumber: PageNum, pageSize: 6 } }).then((res) => {
25 25
       if (PageNum === 1) {
26 26
         setNewsList([...res.records])
27 27
       } else {

+ 6
- 0
src/pages/ShouYe/index.jsx Näytä tiedosto

@@ -1,5 +1,6 @@
1 1
 import React, { useState, useEffect } from 'react'
2 2
 import NavHeader from '@/components/NavHeader/index'
3
+import GetUserPhone from '@/components/GetUserPhone/index'
3 4
 import { Swiper, SwiperItem, Text } from '@tarojs/components'
4 5
 import request, { apis } from '@/utils/request'
5 6
 import { useModel } from '@/store'
@@ -13,6 +14,7 @@ import './index.less'
13 14
 export default function Index (props) {
14 15
 
15 16
   const { user } = useModel('user')
17
+  const [ShowGetUserPhoneLayer, setShowGetUserPhoneLayer] = useState(true)
16 18
   const [ShowAdvLayer, setShowAdvLayer] = useState(false)
17 19
   const [IsPull, setIsPull] = useState(false)
18 20
   const [OwnerList] = useState([
@@ -123,6 +125,10 @@ export default function Index (props) {
123 125
   return (
124 126
     <Page>
125 127
       <view className='ShouYe flex-v'>
128
+        {
129
+          ShowGetUserPhoneLayer &&
130
+          <GetUserPhone></GetUserPhone>
131
+        }
126 132
         <NavHeader BgColor='#f35844' Title='首页'></NavHeader>
127 133
         <view className='flex-item'>
128 134
 

+ 4
- 0
src/utils/api.js Näytä tiedosto

@@ -1,6 +1,10 @@
1 1
 const prefix = `${HOST}/api/wx`
2 2
 
3 3
 const $api = {
4
+  getUserPhone: { // 获取用户手机号
5
+    method: 'post',
6
+    url: `${prefix}/userPhone`
7
+  },
4 8
   getActivityList: { // 获取活动列表
5 9
     method: 'get',
6 10
     url: `${prefix}/buildingDynamiceList`