xcx il y a 4 ans
Parent
révision
37322e2e08

+ 1
- 0
src/app.config.js Voir le fichier

@@ -4,6 +4,7 @@ export default {
4 4
     'pages/Index/index', // 首页
5 5
     'pages/Index/Search/index', // 搜索页
6 6
     'pages/Index/BookDetail/index', // 详情
7
+    'pages/Index/BookAnswer/index', // 答题
7 8
 
8 9
     'pages/Study/index', // 学习天地
9 10
 

+ 3
- 3
src/components/MainPage/index.vue Voir le fichier

@@ -76,7 +76,7 @@ export default {
76 76
     ...mapUserActions([
77 77
       'WxGetPhoneAuth',
78 78
       'WxLogin',
79
-      'UpdateUserInfo'
79
+      'PutUserInfo'
80 80
     ]),
81 81
     ...mapUserMutations([
82 82
       'EditUserInfo'
@@ -122,7 +122,7 @@ export default {
122 122
     },
123 123
     GetUserIcon (e) {
124 124
       if (e.detail.userInfo.avatarUrl) {
125
-        this.UpdateUserInfo({ data: { data: { avatar: e.detail.userInfo.avatarUrl, personId: this.UserInfo.personId } } }).then(() => {
125
+        this.PutUserInfo({ data: { data: { avatar: e.detail.userInfo.avatarUrl, personId: this.UserInfo.personId } } }).then(() => {
126 126
           this.EditUserInfo({ name: 'avatar', value: e.detail.userInfo.avatarUrl })
127 127
           this.ShowUserIconAuthPopup = false
128 128
           if (!this.UserInfo.phone) {
@@ -141,7 +141,7 @@ export default {
141 141
       }
142 142
       this.WxGetPhoneAuth({ data: { data: { ...this.WxInfoData, sessionKey: this.UserInfo.sessionKey } } }).then((res) => {
143 143
         if (res.data.data.phone) {
144
-          this.UpdateUserInfo({ data: { data: { phone: res.data.data.phone, personId: this.UserInfo.personId } } }).then(() => {
144
+          this.PutUserInfo({ data: { data: { phone: res.data.data.phone, personId: this.UserInfo.personId } } }).then(() => {
145 145
             this.EditUserInfo({ name: 'phone', value: res.data.data.phone })
146 146
             this.ShowPhoneAuthPopup = false
147 147
             this.$emit('UserInfoChange')

+ 2
- 2
src/components/ReadedItem/index.vue Voir le fichier

@@ -14,7 +14,7 @@
14 14
         <text>类型:{{Data.tags && Data.tags.length ? Data.tags[0] : '-'}}</text>
15 15
       </view>
16 16
     </view>
17
-    <view class="ProgressContainer">
17
+    <!-- <view class="ProgressContainer">
18 18
       <view class="centerLabel">
19 19
         <view class="Progress">
20 20
           <view class="Sector"></view>
@@ -26,7 +26,7 @@
26 26
         <text class="Length">总时长</text>
27 27
         <text class="Length">1小时25分钟36秒</text>
28 28
       </view>
29
-    </view>
29
+    </view> -->
30 30
   </navigator>
31 31
 </template>
32 32
 

+ 4
- 0
src/pages/Index/BookAnswer/index.config.js Voir le fichier

@@ -0,0 +1,4 @@
1
+export default {
2
+  // navigationStyle: 'custom',
3
+  navigationBarTitleText: '答题'
4
+}

+ 62
- 0
src/pages/Index/BookAnswer/index.vue Voir le fichier

@@ -0,0 +1,62 @@
1
+<template>
2
+  <view class="page">
3
+    <MainPage ref="MainPage" @UserInfoChange="Init">
4
+      <view class="page">
5
+        <PageBottom></PageBottom>
6
+      </view>
7
+    </MainPage>
8
+  </view>
9
+</template>
10
+
11
+<script>
12
+import Taro from '@tarojs/taro'
13
+import MainPage from '../../../components/MainPage'
14
+import PageBottom from '../../../components/PageBottom'
15
+import { createNamespacedHelpers } from 'vuex'
16
+const { mapState: mapUserState, mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
17
+export default {
18
+  name: 'BookDetail',
19
+  data () {
20
+    return {
21
+      ArticleInfo: {},
22
+      DataLock: false
23
+    }
24
+  },
25
+  computed: {
26
+    ...mapUserState({
27
+      UserInfo: x => x.UserInfo // 用户信息
28
+    })
29
+  },
30
+  components: {
31
+    MainPage,
32
+    PageBottom
33
+  },
34
+  created () {
35
+  },
36
+  mounted () {
37
+    this.$nextTick(() => {
38
+    })
39
+  },
40
+  methods: {
41
+    ...mapUserActions([
42
+      'GetArticleDetail'
43
+    ]),
44
+    ...mapUserMutations([
45
+    ]),
46
+    Init () {
47
+      if (this.UserInfo !== null) {
48
+        this.GetArticleDetail({ urlData: { id: Taro.getCurrentInstance().router.params.id } }).then((res) => {
49
+          this.ArticleInfo = res.data.data || {}
50
+        })
51
+        if (this.UserInfo.studentId === null || this.UserInfo.studentId === '') {
52
+          this.$refs.MainPage.ShowStudentIdPopup = true
53
+        }
54
+      }
55
+    }
56
+  }
57
+}
58
+</script>
59
+
60
+<style lang="scss">
61
+@import "page.scss";
62
+</style>

+ 188
- 0
src/pages/Index/BookAnswer/page.scss Voir le fichier

@@ -0,0 +1,188 @@
1
+.page {
2
+  width: 100%;
3
+  height: 100%;
4
+  overflow: hidden;
5
+  background: #f8f8f8;
6
+  > .flex-item {
7
+    position: relative;
8
+    overflow: hidden;
9
+    > view {
10
+      width: 100%;
11
+      position: absolute;
12
+      left: 0;
13
+      top: 0;
14
+      bottom: 0;
15
+      overflow-y: scroll;
16
+      -webkit-overflow-scrolling: touch;
17
+      > .FrontInfo {
18
+        position: relative;
19
+        overflow: hidden;
20
+        > .Img {
21
+          padding: 30px 120px;
22
+          > view {
23
+            width: 100%;
24
+            padding-bottom: 120%;
25
+            position: relative;
26
+            overflow: hidden;
27
+            > image {
28
+              width: 100%;
29
+              height: 100%;
30
+            }
31
+          }
32
+        }
33
+        > .SubInfo {
34
+          position: relative;
35
+          overflow: hidden;
36
+          > .Tag {
37
+            font-size: 0;
38
+            white-space: nowrap;
39
+            padding: 0 30px;
40
+            > text {
41
+              display: inline-block;
42
+              vertical-align: middle;
43
+              font-size: 28px;
44
+              font-weight: bold;
45
+              line-height: 60px;
46
+              margin-right: 10px;
47
+              &.iconfont {
48
+                font-weight: normal;
49
+                font-size: 40px;
50
+              }
51
+            }
52
+          }
53
+          > .flex-h {
54
+            align-items: center;
55
+            padding: 0 30px;
56
+            > view {
57
+              align-items: center;
58
+              > text {
59
+                font-size: 28px;
60
+                line-height: 40px;
61
+                white-space: nowrap;
62
+                overflow: hidden;
63
+                text-overflow: ellipsis;
64
+                color: #999;
65
+                &:first-child {
66
+                  margin-right: 10px;
67
+                }
68
+              }
69
+            }
70
+          }
71
+          > .Desc {
72
+            padding: 0 30px;
73
+            position: relative;
74
+            overflow: hidden;
75
+            > text {
76
+              width: 100%;
77
+              display: block;
78
+              font-size: 28px;
79
+              line-height: 40px;
80
+              color: #999;
81
+            }
82
+          }
83
+        }
84
+        > .Article {
85
+          position: relative;
86
+          overflow: hidden;
87
+          border-top: 2px solid #eee;
88
+          padding: 30px;
89
+          margin-top: 30px;
90
+        }
91
+        > .ToAnswer {
92
+          padding: 30px;
93
+          position: relative;
94
+          overflow: hidden;
95
+          > navigator {
96
+            display: block;
97
+            text-align: center;
98
+            font-size: 28px;
99
+            background: #f4c819;
100
+            line-height: 80px;
101
+            border-radius: 40px;
102
+            color: #333;
103
+          }
104
+        }
105
+      }
106
+    }
107
+  }
108
+  > .Bottom {
109
+    position: relative;
110
+    overflow: hidden;
111
+    background: #fff;
112
+    align-items: center;
113
+    padding-left: 30px;
114
+    z-index: 2;
115
+    box-shadow: 0 0 10px 10px rgba(0, 0, 0, 0.05);
116
+    > .Share,
117
+    .Like {
118
+      font-size: 0;
119
+      white-space: nowrap;
120
+      margin-right: 30px;
121
+      > text {
122
+        display: inline-block;
123
+        vertical-align: middle;
124
+        font-size: 28px;
125
+        color: #333;
126
+        line-height: 40px;
127
+        &:first-child {
128
+          font-size: 36px;
129
+          &.active {
130
+            color: #f4c819;
131
+          }
132
+        }
133
+      }
134
+    }
135
+    > .Answer {
136
+      position: relative;
137
+      overflow: hidden;
138
+      > navigator {
139
+        display: block;
140
+        width: 180px;
141
+        text-align: center;
142
+        line-height: 100px;
143
+        background: #f4c819;
144
+        color: #333;
145
+        font-size: 28px;
146
+      }
147
+    }
148
+    > .ReadInfo {
149
+      position: relative;
150
+      overflow: hidden;
151
+      > text {
152
+        display: block;
153
+        white-space: nowrap;
154
+        font-size: 26px;
155
+        color: #333;
156
+        line-height: 32px;
157
+        overflow: hidden;
158
+        text-overflow: ellipsis;
159
+        text-align: right;
160
+      }
161
+      > .Progress {
162
+        align-items: center;
163
+        margin-top: 10px;
164
+        > .flex-item {
165
+          height: 10px;
166
+          background: rgba(41, 141, 248, 0.5);
167
+          border-radius: 10px;
168
+          position: relative;
169
+          overflow: hidden;
170
+          margin-right: 20px;
171
+          > view {
172
+            width: 0;
173
+            height: 100%;
174
+            position: absolute;
175
+            left: 0;
176
+            top: 0;
177
+            background: rgba(41, 141, 248, 1);
178
+          }
179
+        }
180
+        > text {
181
+          font-size: 26px;
182
+          color: #333;
183
+          line-height: 32px;
184
+        }
185
+      }
186
+    }
187
+  }
188
+}

+ 10
- 2
src/pages/Index/BookDetail/index.vue Voir le fichier

@@ -49,6 +49,11 @@
49 49
                 <rich-text :nodes="ArticleInfo.content"></rich-text>
50 50
               </view>
51 51
 
52
+              <!-- 去答题 -->
53
+              <view class="ToAnswer">
54
+                <navigator :url="`/pages/Index/BookAnswer/index?id=${ArticleInfo.postId}`" hover-class="none">去答题</navigator>
55
+              </view>
56
+
52 57
             </view>
53 58
 
54 59
             <PageBottom></PageBottom>
@@ -66,7 +71,10 @@
66 71
             <text>收藏</text>
67 72
           </view>
68 73
           <view class="flex-item"></view>
69
-          <view class="ReadInfo">
74
+          <view class="Answer">
75
+            <navigator :url="`/pages/Index/BookAnswer/index?id=${ArticleInfo.postId}`" hover-class="none">去答题</navigator>
76
+          </view>
77
+          <!-- <view class="ReadInfo">
70 78
             <text>阅读时长:1小时22分钟22秒</text>
71 79
             <view class="Progress flex-h">
72 80
               <view class="flex-item">
@@ -74,7 +82,7 @@
74 82
               </view>
75 83
               <text>完成进度</text>
76 84
             </view>
77
-          </view>
85
+          </view> -->
78 86
         </view>
79 87
       </view>
80 88
     </MainPage>

+ 28
- 1
src/pages/Index/BookDetail/page.scss Voir le fichier

@@ -88,6 +88,20 @@
88 88
           padding: 30px;
89 89
           margin-top: 30px;
90 90
         }
91
+        > .ToAnswer {
92
+          padding: 30px;
93
+          position: relative;
94
+          overflow: hidden;
95
+          > navigator {
96
+            display: block;
97
+            text-align: center;
98
+            font-size: 28px;
99
+            background: #f4c819;
100
+            line-height: 80px;
101
+            border-radius: 40px;
102
+            color: #333;
103
+          }
104
+        }
91 105
       }
92 106
     }
93 107
   }
@@ -95,8 +109,8 @@
95 109
     position: relative;
96 110
     overflow: hidden;
97 111
     background: #fff;
98
-    padding: 20px 30px;
99 112
     align-items: center;
113
+    padding-left: 30px;
100 114
     z-index: 2;
101 115
     box-shadow: 0 0 10px 10px rgba(0, 0, 0, 0.05);
102 116
     > .Share,
@@ -118,6 +132,19 @@
118 132
         }
119 133
       }
120 134
     }
135
+    > .Answer {
136
+      position: relative;
137
+      overflow: hidden;
138
+      > navigator {
139
+        display: block;
140
+        width: 180px;
141
+        text-align: center;
142
+        line-height: 100px;
143
+        background: #f4c819;
144
+        color: #333;
145
+        font-size: 28px;
146
+      }
147
+    }
121 148
     > .ReadInfo {
122 149
       position: relative;
123 150
       overflow: hidden;

+ 13
- 3
src/pages/Mine/MyInfo/index.vue Voir le fichier

@@ -21,7 +21,7 @@
21 21
           <view class="flex-h">
22 22
             <view>姓名</view>
23 23
             <view class="flex-item">
24
-              <text>{{UserInfo.name}}</text>
24
+              <input placeholder="请输入姓名" v-model="Form.name" />
25 25
               <!-- <input placeholder="请输入姓名" /> -->
26 26
             </view>
27 27
           </view>
@@ -89,6 +89,8 @@ export default {
89 89
       IsPull: false,
90 90
       DataLock: false,
91 91
       Form: {
92
+        name: null,
93
+        personId: null,
92 94
         sex: null,
93 95
         phone: null,
94 96
         email: null,
@@ -114,9 +116,10 @@ export default {
114 116
   },
115 117
   methods: {
116 118
     ...mapUserActions([
117
-      'UpdateUserInfo'
119
+      'PutUserInfo'
118 120
     ]),
119 121
     ...mapUserMutations([
122
+      'UpdateUserInfo'
120 123
     ]),
121 124
     Init () {
122 125
       if (this.UserInfo !== null) {
@@ -138,7 +141,14 @@ export default {
138 141
             Data[key] = this.Form[key]
139 142
           }
140 143
         }
141
-        this.UpdateUserInfo({ data: { data: { ...Data } } }).then(() => {
144
+        this.PutUserInfo({ data: { data: { ...Data } } }).then((res) => {
145
+          console.log(res.data.data)
146
+          this.UpdateUserInfo({ ...res.data.data })
147
+          wx.showToast({
148
+            title: '保存成功',
149
+            icon: 'none',
150
+            duration: 2000
151
+          })
142 152
           this.DataLock = false
143 153
         }).catch(() => {
144 154
           this.DataLock = false

+ 1
- 1
src/store/user/index.js Voir le fichier

@@ -29,7 +29,7 @@ export default {
29 29
         ToolClass.ToolRequest({ url: Api.WxLogin.url, method: Api.WxLogin.method, ...payload, success (res) { context.commit('UpdateUserInfo', { ...res.data.data.person, sessionKey: res.data.data.sessionKey }); resolve(res) }, error (res) { reject(res) } })
30 30
       })
31 31
     },
32
-    UpdateUserInfo (context, payload) { // 更新用户信息
32
+    PutUserInfo (context, payload) { // 更新用户信息
33 33
       return new Promise((resolve, reject) => {
34 34
         ToolClass.ToolRequest({ url: Api.UpdateUserInfo.url, method: Api.UpdateUserInfo.method, ...payload, success (res) { context.commit('UpdateUserInfo', res.data.data.person); resolve(res) }, error (res) { reject(res) } })
35 35
       })