southnote-mini-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (309) hide show
  1. package/app.js +22 -0
  2. package/app.json +53 -0
  3. package/app.wxss +15 -0
  4. package/assets/file/badwords.js +63008 -0
  5. package/assets/file/rules.js +38 -0
  6. package/assets/images/emoji/smile001.png +0 -0
  7. package/assets/images/emoji/smile002.png +0 -0
  8. package/assets/images/emoji/smile003.png +0 -0
  9. package/assets/images/emoji/smile004.png +0 -0
  10. package/assets/images/emoji/smile005.png +0 -0
  11. package/assets/images/emoji/smile006.png +0 -0
  12. package/assets/images/emoji/smile007.png +0 -0
  13. package/assets/images/emoji/smile008.png +0 -0
  14. package/assets/images/emoji/smile009.png +0 -0
  15. package/assets/images/emoji/smile010.png +0 -0
  16. package/assets/images/emoji/smile011.png +0 -0
  17. package/assets/images/emoji/smile012.png +0 -0
  18. package/assets/images/emoji/smile013.png +0 -0
  19. package/assets/images/emoji/smile014.png +0 -0
  20. package/assets/images/emoji/smile015.png +0 -0
  21. package/assets/images/emoji/smile016.png +0 -0
  22. package/assets/images/emoji/smile017.png +0 -0
  23. package/assets/images/emoji/smile018.png +0 -0
  24. package/assets/images/emoji/smile019.png +0 -0
  25. package/assets/images/emoji/smile020.png +0 -0
  26. package/assets/images/emoji/smile021.png +0 -0
  27. package/assets/images/emoji/smile022.png +0 -0
  28. package/assets/images/emoji/smile023.png +0 -0
  29. package/assets/images/emoji/smile024.png +0 -0
  30. package/assets/images/emoji/smile025.png +0 -0
  31. package/assets/images/emoji/smile026.png +0 -0
  32. package/assets/images/emoji/smile027.png +0 -0
  33. package/assets/images/emoji/smile028.png +0 -0
  34. package/assets/images/emoji/smile029.png +0 -0
  35. package/assets/images/emoji/smile030.png +0 -0
  36. package/assets/images/emoji/smile031.png +0 -0
  37. package/assets/images/emoji/smile032.png +0 -0
  38. package/assets/images/emoji/smile033.png +0 -0
  39. package/assets/images/emoji/smile034.png +0 -0
  40. package/assets/images/emoji/smile035.png +0 -0
  41. package/assets/images/emoji/smile036.png +0 -0
  42. package/assets/images/emoji/smile037.png +0 -0
  43. package/assets/images/emoji/smile038.png +0 -0
  44. package/assets/images/emoji/smile039.png +0 -0
  45. package/assets/images/emoji/smile040.png +0 -0
  46. package/assets/images/emoji/smile041.png +0 -0
  47. package/assets/images/emoji/smile042.png +0 -0
  48. package/assets/images/emoji/smile043.png +0 -0
  49. package/assets/images/emoji/smile044.png +0 -0
  50. package/assets/images/emoji/smile045.png +0 -0
  51. package/assets/images/emoji/smile046.png +0 -0
  52. package/assets/images/emoji/smile047.png +0 -0
  53. package/assets/images/emoji/smile048.png +0 -0
  54. package/assets/images/emoji/smile049.png +0 -0
  55. package/assets/images/emoji/smile050.png +0 -0
  56. package/assets/images/emoji/smile051.png +0 -0
  57. package/assets/images/emoji/smile052.png +0 -0
  58. package/assets/images/icons/age1.png +0 -0
  59. package/assets/images/icons/age2.png +0 -0
  60. package/assets/images/icons/age3.png +0 -0
  61. package/assets/images/icons/attachment.png +0 -0
  62. package/assets/images/icons/clear.png +0 -0
  63. package/assets/images/icons/edit_input.png +0 -0
  64. package/assets/images/icons/header_placeholder.png +0 -0
  65. package/assets/images/icons/home_collect.png +0 -0
  66. package/assets/images/icons/home_collected.png +0 -0
  67. package/assets/images/icons/home_comment.png +0 -0
  68. package/assets/images/icons/home_like.png +0 -0
  69. package/assets/images/icons/home_liked.png +0 -0
  70. package/assets/images/icons/home_message.png +0 -0
  71. package/assets/images/icons/home_share.png +0 -0
  72. package/assets/images/icons/icon_more.png +0 -0
  73. package/assets/images/icons/input_game.png +0 -0
  74. package/assets/images/icons/logo.png +0 -0
  75. package/assets/images/icons/lv1.png +0 -0
  76. package/assets/images/icons/lv2.png +0 -0
  77. package/assets/images/icons/lv3.png +0 -0
  78. package/assets/images/icons/lv4.png +0 -0
  79. package/assets/images/icons/search.png +0 -0
  80. package/assets/images/icons/sex1.png +0 -0
  81. package/assets/images/icons/sex2.png +0 -0
  82. package/assets/images/icons/sign_empty.png +0 -0
  83. package/assets/images/icons/sign_login.png +0 -0
  84. package/assets/wheel/wheel_bg.png +0 -0
  85. package/assets/wheel/wheel_bg2.png +0 -0
  86. package/assets/wheel/wheel_fore.png +0 -0
  87. package/assets/wheel/wheel_to.png +0 -0
  88. package/components/bottomSheet/bottomSheet.js +473 -0
  89. package/components/bottomSheet/bottomSheet.json +3 -0
  90. package/components/bottomSheet/bottomSheet.wxml +73 -0
  91. package/components/bottomSheet/bottomSheet.wxss +238 -0
  92. package/components/experience-item/experience-item.js +105 -0
  93. package/components/experience-item/experience-item.json +4 -0
  94. package/components/experience-item/experience-item.wxml +39 -0
  95. package/components/experience-item/experience-item.wxss +110 -0
  96. package/components/grid-item/grid-item.js +8 -0
  97. package/components/grid-item/grid-item.json +4 -0
  98. package/components/grid-item/grid-item.wxml +62 -0
  99. package/components/grid-item/grid-item.wxss +191 -0
  100. package/components/post-item/post-item.js +1085 -0
  101. package/components/post-item/post-item.json +4 -0
  102. package/components/post-item/post-item.wxml +427 -0
  103. package/components/post-item/post-item.wxss +525 -0
  104. package/components/wiki-renderer/wiki-renderer.js +636 -0
  105. package/components/wiki-renderer/wiki-renderer.json +12 -0
  106. package/components/wiki-renderer/wiki-renderer.wxml +150 -0
  107. package/components/wiki-renderer/wiki-renderer.wxss +412 -0
  108. package/components/wiki-tabs/wiki-tabs.js +52 -0
  109. package/components/wiki-tabs/wiki-tabs.json +3 -0
  110. package/components/wiki-tabs/wiki-tabs.wxml +28 -0
  111. package/components/wiki-tabs/wiki-tabs.wxss +43 -0
  112. package/index.js +49 -0
  113. package/package.json +35 -0
  114. package/pages/addGame/addGame.js +454 -0
  115. package/pages/addGame/addGame.json +3 -0
  116. package/pages/addGame/addGame.wxml +71 -0
  117. package/pages/addGame/addGame.wxss +110 -0
  118. package/pages/addSubject/addSubject.js +199 -0
  119. package/pages/addSubject/addSubject.json +4 -0
  120. package/pages/addSubject/addSubject.wxml +78 -0
  121. package/pages/addSubject/addSubject.wxss +85 -0
  122. package/pages/commonLogin/commonLogin.js +269 -0
  123. package/pages/commonLogin/commonLogin.json +4 -0
  124. package/pages/commonLogin/commonLogin.wxml +57 -0
  125. package/pages/commonLogin/commonLogin.wxss +177 -0
  126. package/pages/copyOfficial/copyOfficial.js +25 -0
  127. package/pages/copyOfficial/copyOfficial.json +3 -0
  128. package/pages/copyOfficial/copyOfficial.wxml +22 -0
  129. package/pages/copyOfficial/copyOfficial.wxss +49 -0
  130. package/pages/demo/demo.js +23 -0
  131. package/pages/demo/demo.json +3 -0
  132. package/pages/demo/demo.wxml +8 -0
  133. package/pages/demo/demo.wxss +24 -0
  134. package/pages/game/game.js +1254 -0
  135. package/pages/game/game.json +8 -0
  136. package/pages/game/game.wxml +371 -0
  137. package/pages/game/game.wxss +672 -0
  138. package/pages/home/home.js +665 -0
  139. package/pages/home/home.json +10 -0
  140. package/pages/home/home.wxml +115 -0
  141. package/pages/home/home.wxss +231 -0
  142. package/pages/lottery-winners/lottery-winners.js +60 -0
  143. package/pages/lottery-winners/lottery-winners.json +4 -0
  144. package/pages/lottery-winners/lottery-winners.wxml +53 -0
  145. package/pages/lottery-winners/lottery-winners.wxss +127 -0
  146. package/pages/message/messageCommentsAndAt/messageCommentsAndAt.js +178 -0
  147. package/pages/message/messageCommentsAndAt/messageCommentsAndAt.json +5 -0
  148. package/pages/message/messageCommentsAndAt/messageCommentsAndAt.wxml +93 -0
  149. package/pages/message/messageCommentsAndAt/messageCommentsAndAt.wxss +177 -0
  150. package/pages/message/messageEntire/messageEntire.js +112 -0
  151. package/pages/message/messageEntire/messageEntire.json +4 -0
  152. package/pages/message/messageEntire/messageEntire.wxml +44 -0
  153. package/pages/message/messageEntire/messageEntire.wxss +88 -0
  154. package/pages/message/messageLikeAndCollect/messageLikeAndCollect.js +147 -0
  155. package/pages/message/messageLikeAndCollect/messageLikeAndCollect.json +5 -0
  156. package/pages/message/messageLikeAndCollect/messageLikeAndCollect.wxml +84 -0
  157. package/pages/message/messageLikeAndCollect/messageLikeAndCollect.wxss +166 -0
  158. package/pages/message/messageNewFans/messageNewFans.js +139 -0
  159. package/pages/message/messageNewFans/messageNewFans.json +5 -0
  160. package/pages/message/messageNewFans/messageNewFans.wxml +35 -0
  161. package/pages/message/messageNewFans/messageNewFans.wxss +85 -0
  162. package/pages/officialWebview/officialWebview.js +13 -0
  163. package/pages/officialWebview/officialWebview.json +3 -0
  164. package/pages/officialWebview/officialWebview.wxml +2 -0
  165. package/pages/officialWebview/officialWebview.wxss +1 -0
  166. package/pages/post/post.js +1856 -0
  167. package/pages/post/post.json +6 -0
  168. package/pages/post/post.wxml +694 -0
  169. package/pages/post/post.wxss +1003 -0
  170. package/pages/post-editor/post-editor.js +465 -0
  171. package/pages/post-editor/post-editor.json +4 -0
  172. package/pages/post-editor/post-editor.wxml +63 -0
  173. package/pages/post-editor/post-editor.wxss +195 -0
  174. package/pages/postDialog/postDialog.js +560 -0
  175. package/pages/postDialog/postDialog.json +6 -0
  176. package/pages/postDialog/postDialog.wxml +377 -0
  177. package/pages/postDialog/postDialog.wxss +979 -0
  178. package/pages/report-category/report-category.js +29 -0
  179. package/pages/report-category/report-category.json +4 -0
  180. package/pages/report-category/report-category.wxml +14 -0
  181. package/pages/report-category/report-category.wxss +43 -0
  182. package/pages/report-form/report-form.js +65 -0
  183. package/pages/report-form/report-form.json +3 -0
  184. package/pages/report-form/report-form.wxml +11 -0
  185. package/pages/report-form/report-form.wxss +44 -0
  186. package/pages/sevenDaySignDetail/sevenDaySignDetail.js +273 -0
  187. package/pages/sevenDaySignDetail/sevenDaySignDetail.json +3 -0
  188. package/pages/sevenDaySignDetail/sevenDaySignDetail.wxml +82 -0
  189. package/pages/sevenDaySignDetail/sevenDaySignDetail.wxss +173 -0
  190. package/pages/topic/topic.js +266 -0
  191. package/pages/topic/topic.json +6 -0
  192. package/pages/topic/topic.wxml +77 -0
  193. package/pages/topic/topic.wxss +162 -0
  194. package/pages/user/user.js +939 -0
  195. package/pages/user/user.json +5 -0
  196. package/pages/user/user.wxml +179 -0
  197. package/pages/user/user.wxss +340 -0
  198. package/pages/userDatum/userDatum.js +24 -0
  199. package/pages/userDatum/userDatum.json +4 -0
  200. package/pages/userDatum/userDatum.wxml +36 -0
  201. package/pages/userDatum/userDatum.wxss +41 -0
  202. package/pages/userGameLib/userGameLib.js +105 -0
  203. package/pages/userGameLib/userGameLib.json +4 -0
  204. package/pages/userGameLib/userGameLib.wxml +42 -0
  205. package/pages/userGameLib/userGameLib.wxss +119 -0
  206. package/pages/webview/webview.js +25 -0
  207. package/pages/webview/webview.json +3 -0
  208. package/pages/webview/webview.wxml +22 -0
  209. package/pages/webview/webview.wxss +50 -0
  210. package/pages/wheelActivivty/wheelActivivty.js +492 -0
  211. package/pages/wheelActivivty/wheelActivivty.json +8 -0
  212. package/pages/wheelActivivty/wheelActivivty.wxml +131 -0
  213. package/pages/wheelActivivty/wheelActivivty.wxss +459 -0
  214. package/pages/wiki/wiki.js +138 -0
  215. package/pages/wiki/wiki.json +6 -0
  216. package/pages/wiki/wiki.wxml +20 -0
  217. package/pages/wiki/wiki.wxss +44 -0
  218. package/request/JKRequest.js +177 -0
  219. package/services/home.js +603 -0
  220. package/towxml/config.js +291 -0
  221. package/towxml/decode.js +35 -0
  222. package/towxml/decode.json +11 -0
  223. package/towxml/decode.wxml +137 -0
  224. package/towxml/decode.wxss +0 -0
  225. package/towxml/img/img.js +98 -0
  226. package/towxml/img/img.json +3 -0
  227. package/towxml/img/img.wxml +1 -0
  228. package/towxml/img/img.wxss +0 -0
  229. package/towxml/index.js +19 -0
  230. package/towxml/latex/latex.js +53 -0
  231. package/towxml/latex/latex.json +5 -0
  232. package/towxml/latex/latex.wxml +1 -0
  233. package/towxml/latex/latex.wxss +0 -0
  234. package/towxml/parse/highlight/highlight.js +1 -0
  235. package/towxml/parse/highlight/index.js +8 -0
  236. package/towxml/parse/highlight/languages/bash.js +111 -0
  237. package/towxml/parse/highlight/languages/c-like.js +236 -0
  238. package/towxml/parse/highlight/languages/c.js +22 -0
  239. package/towxml/parse/highlight/languages/css.js +132 -0
  240. package/towxml/parse/highlight/languages/dart.js +134 -0
  241. package/towxml/parse/highlight/languages/go.js +63 -0
  242. package/towxml/parse/highlight/languages/htmlbars.js +80 -0
  243. package/towxml/parse/highlight/languages/java.js +125 -0
  244. package/towxml/parse/highlight/languages/javascript.js +265 -0
  245. package/towxml/parse/highlight/languages/json.js +52 -0
  246. package/towxml/parse/highlight/languages/less.js +148 -0
  247. package/towxml/parse/highlight/languages/nginx.js +101 -0
  248. package/towxml/parse/highlight/languages/php.js +161 -0
  249. package/towxml/parse/highlight/languages/python-repl.js +29 -0
  250. package/towxml/parse/highlight/languages/python.js +131 -0
  251. package/towxml/parse/highlight/languages/scss.js +122 -0
  252. package/towxml/parse/highlight/languages/shell.js +22 -0
  253. package/towxml/parse/highlight/languages/typescript.js +215 -0
  254. package/towxml/parse/highlight/languages/xml.js +139 -0
  255. package/towxml/parse/highlight/style/github.wxss +99 -0
  256. package/towxml/parse/highlight/style/monokai.wxss +70 -0
  257. package/towxml/parse/index.js +118 -0
  258. package/towxml/parse/markdown/index.js +67 -0
  259. package/towxml/parse/markdown/markdown.js +4 -0
  260. package/towxml/parse/markdown/plugins/echarts.js +11 -0
  261. package/towxml/parse/markdown/plugins/emoji.js +2 -0
  262. package/towxml/parse/markdown/plugins/ins.js +1 -0
  263. package/towxml/parse/markdown/plugins/latex.js +158 -0
  264. package/towxml/parse/markdown/plugins/mark.js +1 -0
  265. package/towxml/parse/markdown/plugins/sub.js +1 -0
  266. package/towxml/parse/markdown/plugins/sup.js +1 -0
  267. package/towxml/parse/markdown/plugins/todo.js +147 -0
  268. package/towxml/parse/markdown/plugins/yuml.js +20 -0
  269. package/towxml/parse/parse2/Parser.js +492 -0
  270. package/towxml/parse/parse2/Tokenizer.js +903 -0
  271. package/towxml/parse/parse2/domelementtype/index.js +55 -0
  272. package/towxml/parse/parse2/domhandler/index.js +145 -0
  273. package/towxml/parse/parse2/domhandler/node.js +474 -0
  274. package/towxml/parse/parse2/entities/decode.js +179 -0
  275. package/towxml/parse/parse2/entities/decode_codepoint.js +60 -0
  276. package/towxml/parse/parse2/entities/encode.js +77 -0
  277. package/towxml/parse/parse2/entities/escape.js +112 -0
  278. package/towxml/parse/parse2/entities/generated/decode-data-html.js +9 -0
  279. package/towxml/parse/parse2/entities/generated/decode-data-xml.js +9 -0
  280. package/towxml/parse/parse2/entities/generated/encode-html.js +12 -0
  281. package/towxml/parse/parse2/entities/index.js +137 -0
  282. package/towxml/parse/parse2/index.js +8 -0
  283. package/towxml/style/main.wxss +419 -0
  284. package/towxml/style/theme/dark.wxss +73 -0
  285. package/towxml/style/theme/light.wxss +63 -0
  286. package/towxml/table/table.js +11 -0
  287. package/towxml/table/table.json +6 -0
  288. package/towxml/table/table.wxml +24 -0
  289. package/towxml/table/table.wxss +0 -0
  290. package/towxml/todogroup/todogroup.js +20 -0
  291. package/towxml/todogroup/todogroup.json +6 -0
  292. package/towxml/todogroup/todogroup.wxml +12 -0
  293. package/towxml/todogroup/todogroup.wxss +3 -0
  294. package/towxml/towxml.js +22 -0
  295. package/towxml/towxml.json +6 -0
  296. package/towxml/towxml.wxml +5 -0
  297. package/towxml/towxml.wxss +8 -0
  298. package/towxml/yuml/yuml.js +51 -0
  299. package/towxml/yuml/yuml.json +5 -0
  300. package/towxml/yuml/yuml.wxml +5 -0
  301. package/towxml/yuml/yuml.wxss +0 -0
  302. package/utils/auth.js +17 -0
  303. package/utils/base64.js +67 -0
  304. package/utils/compressImage.js +41 -0
  305. package/utils/exp.js +49 -0
  306. package/utils/formatPost.js +18 -0
  307. package/utils/parseContent.js +191 -0
  308. package/utils/query-select.js +9 -0
  309. package/utils/sensitive.js +82 -0
@@ -0,0 +1,29 @@
1
+ Page({
2
+ data: {
3
+ categories: [
4
+ '涉及政治敏感内容',
5
+ '涉及色情低俗内容',
6
+ '涉及违禁品',
7
+ '涉及未成年人有害信息',
8
+ '涉及垃圾或广告内容',
9
+ '涉及人身攻击、谩骂内容',
10
+ '涉及抄袭或侵权内容',
11
+ '引战',
12
+ '涉及企业侵权内容',
13
+ '其他'
14
+ ]
15
+ },
16
+
17
+ onLoad(options) {
18
+ this.postId = options.postId; // 保存一下,等下继续传
19
+ },
20
+
21
+ onTap(e) {
22
+ const idx = e.currentTarget.dataset.index;
23
+ const category = this.data.categories[idx] || '';
24
+ // 跳转到举报填写页,并传递分类名称(作为 query)
25
+ wx.navigateTo({
26
+ url: `/pages/report-form/report-form?category=${encodeURIComponent(category)}&postId=${this.postId}&nType=${idx+1}`
27
+ });
28
+ }
29
+ });
@@ -0,0 +1,4 @@
1
+ {
2
+ "navigationBarTitleText": "举报分类",
3
+ "usingComponents": {}
4
+ }
@@ -0,0 +1,14 @@
1
+ <view class="container">
2
+
3
+
4
+ <view class="list">
5
+ <block wx:for="{{categories}}" wx:key="index">
6
+ <view class="item" bindtap="onTap" data-index="{{index}}">
7
+ <text class="title">{{item}}</text>
8
+ <text class="arrow">›</text>
9
+ </view>
10
+ </block>
11
+ </view>
12
+
13
+
14
+ </view>
@@ -0,0 +1,43 @@
1
+ .container {
2
+ padding-top: 10px;
3
+ background: #f7f7f7;
4
+ min-height: 100vh;
5
+ }
6
+
7
+ .list {
8
+ width: 100%;
9
+ background: #fff;
10
+ border-radius: 8px;
11
+ overflow: hidden;
12
+ }
13
+
14
+ .item {
15
+ width: 100%;
16
+ display: flex;
17
+ align-items: center;
18
+ justify-content: space-between;
19
+ padding: 8px 12px;
20
+ border-bottom: 1px solid #f0f0f0;
21
+ box-sizing: border-box;
22
+ }
23
+
24
+ .item:last-child {
25
+ border-bottom: none;
26
+ }
27
+
28
+ .title {
29
+ font-size: 16px;
30
+ color: #222;
31
+ }
32
+
33
+ .arrow {
34
+ font-size: 30px;
35
+ color: #c0c0c0;
36
+ }
37
+
38
+ .foot {
39
+ margin-top: 14px;
40
+ color: #999;
41
+ font-size: 13px;
42
+ text-align: center;
43
+ }
@@ -0,0 +1,65 @@
1
+ import {
2
+ reportPost
3
+ } from "../../services/home"
4
+
5
+ Page({
6
+ data: {
7
+ category: '',
8
+ description: ''
9
+ },
10
+
11
+
12
+ onLoad(options) {
13
+ if (options && options.category) {
14
+ if (options.postId) {
15
+ this.setData({
16
+ postId: options.postId,
17
+ nType: options.nType
18
+ });
19
+ }
20
+ const category = decodeURIComponent(options.category);
21
+ this.setData({
22
+ category
23
+ });
24
+ wx.setNavigationBarTitle({
25
+ title: category
26
+ });
27
+ }
28
+ },
29
+
30
+
31
+ onInputDescription(e) {
32
+ this.setData({
33
+ description: e.detail.value.slice(0, 500)
34
+ });
35
+ },
36
+
37
+
38
+ onSubmit() {
39
+ const {
40
+ description
41
+ } = this.data;
42
+ if (!description.trim()) {
43
+ wx.showToast({
44
+ title: '请填写举报理由',
45
+ icon: 'none'
46
+ });
47
+ return;
48
+ }
49
+ let nType = this.data.nType == '10' ? '100' : this.data.nType
50
+ reportPost(this.data.postId, nType, this.data.description).then(res => {
51
+ wx.showToast({
52
+ title: '举报已提交',
53
+ icon: 'success'
54
+ });
55
+
56
+ setTimeout(() => {
57
+ wx.navigateBack({
58
+ delta: 2
59
+ });
60
+ }, 800);
61
+ })
62
+
63
+
64
+ }
65
+ });
@@ -0,0 +1,3 @@
1
+ {
2
+ "usingComponents": {}
3
+ }
@@ -0,0 +1,11 @@
1
+ <view class="form-container">
2
+
3
+
4
+ <view class="field">
5
+ <textarea placeholder="请补充举报理由" maxlength="500" value="{{description}}" bindinput="onInputDescription" class="reason-input" />
6
+ <view class="counter">{{description.length}}/500</view>
7
+ </view>
8
+
9
+
10
+ <view class="submit-btn" bindtap="onSubmit">提交</view>
11
+ </view>
@@ -0,0 +1,44 @@
1
+ .form-container {
2
+ padding: 16px;
3
+ background: #fff;
4
+ min-height: 100vh;
5
+ }
6
+
7
+ .title {
8
+ font-size: 18px;
9
+ color: #333;
10
+ margin-bottom: 16px;
11
+ font-weight: bold;
12
+ }
13
+
14
+ .field {
15
+ position: relative;
16
+ margin-bottom: 24px;
17
+ }
18
+
19
+ .reason-input {
20
+ width: 100%;
21
+ min-height: 160px;
22
+ background: #f7f7f7;
23
+ padding: 12px;
24
+ border-radius: 8px;
25
+ box-sizing: border-box;
26
+ }
27
+
28
+ .counter {
29
+ position: absolute;
30
+ bottom: -20px;
31
+ right: 0;
32
+ font-size: 12px;
33
+ color: #888;
34
+ }
35
+
36
+ .submit-btn {
37
+ width: 100%;
38
+ height: 44px;
39
+ line-height: 44px;
40
+ background: #002fa7;
41
+ color: #fff;
42
+ border-radius: 8px;
43
+ text-align: center;
44
+ }
@@ -0,0 +1,273 @@
1
+ import {
2
+ queryGameActivityInfo
3
+ } from "../../services/home";
4
+
5
+ Page({
6
+ data: {
7
+ detail: {},
8
+ loading: true,
9
+
10
+ // 视图衍生字段
11
+ rewardsList: [], // 数组形式排序后的 day 对象
12
+ signedCount: 0,
13
+ daysLeft: 0,
14
+ descList: [],
15
+ timeRange: ''
16
+ },
17
+
18
+ onLoad(options) {
19
+ const activity_id = options.activity_id;
20
+ this.loadDetail(activity_id);
21
+ },
22
+
23
+ /* 加载详情并格式化数据 */
24
+ loadDetail(activity_id) {
25
+ this.setData({
26
+ loading: true
27
+ });
28
+ queryGameActivityInfo(activity_id).then(res => {
29
+ // 假设接口返回结构同你贴出的示例
30
+ const payload = res.data || res;
31
+
32
+ // 你示例是 { code:0, data: { ... } } 风格
33
+ const data = payload.data || payload;
34
+
35
+ // 设置基础 detail
36
+ this.setData({
37
+ detail: data || {}
38
+ });
39
+
40
+ // 处理奖励对象(rewards:{ day1: {...}, day2: {...} ... })
41
+ const rewardsObj = (data.rewards) || {};
42
+ const rewardsList = [];
43
+
44
+ // 将 day1..dayN 按天数顺序转换为数组
45
+ Object.keys(rewardsObj).forEach(key => {
46
+ const m = key.match(/^day(\d+)$/);
47
+ if (m) {
48
+ const idx = parseInt(m[1], 10);
49
+ const item = rewardsObj[key] || {};
50
+ // 归一化字段
51
+ rewardsList.push({
52
+ dayKey: key,
53
+ index: idx,
54
+ is_signed: item.is_signed || 0,
55
+ item_image: item.item_image || '',
56
+ item_name: item.item_name || '',
57
+ cdkCount: (item.cdk && item.cdk[0] && item.cdk[0].count) ? item.cdk[0].count : 0,
58
+ raw: item
59
+ });
60
+ }
61
+ });
62
+
63
+ // 按 index 排序升序(day1, day2..)
64
+ rewardsList.sort((a, b) => a.index - b.index);
65
+
66
+ // 计算已累计签到天数(统计 is_signed === 1)
67
+ const signedCount = rewardsList.reduce((s, it) => s + (it.is_signed === 1 ? 1 : 0), 0);
68
+
69
+ // 计算距离结束还剩多少天(end_time 为秒级字符串)
70
+ const nowSec = Math.floor(Date.now() / 1000);
71
+ const endTimeSec = parseInt(data.end_time || 0, 10);
72
+ let daysLeft = 0;
73
+ if (endTimeSec > nowSec) {
74
+ // 计算剩余整天数(向上取整)
75
+ daysLeft = Math.ceil((endTimeSec - nowSec) / 86400);
76
+ } else {
77
+ daysLeft = 0;
78
+ }
79
+
80
+ // 标注哪个是当前可领取的 day(signedCount + 1)
81
+ const nextIndex = signedCount + 1;
82
+ const formattedRewards = rewardsList.map(it => {
83
+ const btnLabel = (it.is_signed === 1) ? '查看奖励' :
84
+ (it.index === nextIndex ? '立即领取' : `第${it.index}天`);
85
+ // border 激活条件:可领取当天显示 #eca900 边框
86
+ const borderActive = (it.is_signed !== 1 && it.index === nextIndex);
87
+
88
+ return {
89
+ ...it,
90
+ btnLabel,
91
+ borderActive
92
+ };
93
+ });
94
+
95
+ // 解析 activity_desc
96
+ const descList = this.parseDescToList(data.activity_desc || '');
97
+ // 格式化活动时间显示(YYYY-MM-DD)
98
+ const start = this.formatDateFromSec(data.start_time);
99
+ const end = this.formatDateFromSec(data.end_time);
100
+ const timeRange = `${start}-${end}`;
101
+
102
+ this.setData({
103
+ loading: false,
104
+ rewardsList: formattedRewards,
105
+ signedCount,
106
+ daysLeft,
107
+ descList,
108
+ timeRange
109
+ });
110
+
111
+ }).catch(err => {
112
+ console.error(err);
113
+ wx.showToast({
114
+ title: '加载失败',
115
+ icon: 'none'
116
+ });
117
+ this.setData({
118
+ loading: false
119
+ });
120
+ });
121
+ },
122
+
123
+ /* 点击奖励单元(整个 cell)*/
124
+ onTapRewardCell(e) {
125
+ // 如果用户点 cell(而不是按钮),我们和按钮逻辑一致:判断状态
126
+ const day = e.currentTarget.dataset.day;
127
+ this._handleRewardAction(parseInt(day, 10));
128
+ },
129
+
130
+ /* 点击单元内按钮(阻止事件冒泡)*/
131
+ onTapCellButton(e) {
132
+ e.stopPropagation && e.stopPropagation();
133
+ const idx = parseInt(e.currentTarget.dataset.index, 10);
134
+ this._handleRewardAction(idx);
135
+ },
136
+
137
+ /* 统一处理领取 / 查看 / 未到的逻辑 */
138
+ _handleRewardAction(dayIndex) {
139
+ const rl = this.data.rewardsList;
140
+ const item = rl.find(x => x.index === dayIndex);
141
+ if (!item) return;
142
+
143
+ const signedCount = this.data.signedCount;
144
+ const nextIndex = signedCount + 1;
145
+
146
+ // 检查是否在活动期间
147
+ // const nowSec = Math.floor(Date.now() / 1000);
148
+ // const startSec = parseInt(this.data.detail.start_time || 0, 10);
149
+ // const endSec = parseInt(this.data.detail.end_time || 0, 10);
150
+ // if (nowSec < startSec || nowSec > endSec) {
151
+ // wx.showToast({
152
+ // title: '不在活动时间内',
153
+ // icon: 'none'
154
+ // });
155
+ // return;
156
+ // }
157
+
158
+ // 跳转到官网 H5 页面
159
+ const navigateToWeb = () => {
160
+ // wx.miniapp.jumpToAppStore({
161
+ // success: (res) => {
162
+ // console.log('jumpToAppStore success:', res)
163
+ // },
164
+ // fail: (res) => {
165
+ // console.log('jumpToAppStore fail:', res)
166
+ // }
167
+ // })
168
+
169
+ // wx.miniapp.openUrl({
170
+ // url: "https://www.southnote.cn/#/home",
171
+ // success(res) {
172
+ // console.log('wx.miniapp.openUrl success', res)
173
+ // },
174
+ // fail(err) {
175
+ // console.log('wx.miniapp.openUrl fail', err)
176
+ // }
177
+ // })
178
+
179
+ // wx.navigateTo({
180
+ // url: `/pages/officialWebview/officialWebview?url=${encodeURIComponent('https://www.southnote.cn/#/home')}`
181
+ // });
182
+ wx.navigateTo({
183
+ url: `/pages/copyOfficial/copyOfficial?url=${encodeURIComponent('https://www.southnote.cn')}`
184
+ });
185
+ };
186
+
187
+ // 已领取或者可领取 -> 直接跳转
188
+ if (item.is_signed === 1 || dayIndex === nextIndex) {
189
+ navigateToWeb();
190
+ return;
191
+ }
192
+
193
+ // 还未到领取时间
194
+ wx.showToast({
195
+ title: '还未到领取时间',
196
+ icon: 'none'
197
+ });
198
+ },
199
+
200
+ /* 辅助:把秒级时间字符串转成 YYYY-MM-DD */
201
+ formatDateFromSec(secStr) {
202
+ const sec = parseInt(secStr || 0, 10);
203
+ if (!sec) return '';
204
+ const d = new Date(sec * 1000);
205
+
206
+ const y = d.getFullYear();
207
+ const m = (d.getMonth() + 1).toString().padStart(2, '0');
208
+ const day = d.getDate().toString().padStart(2, '0');
209
+
210
+ const hh = d.getHours().toString().padStart(2, '0');
211
+ const mm = d.getMinutes().toString().padStart(2, '0');
212
+ const ss = d.getSeconds().toString().padStart(2, '0');
213
+
214
+ return `${y}/${m}/${day} ${hh}:${mm}:${ss}`;
215
+ },
216
+
217
+ parseDescToList(desc) {
218
+ if (!desc || !desc.trim()) return [];
219
+
220
+ const list = [];
221
+ let cursor = 0;
222
+ const regex = /<color\s+([^>]+)>/g; // 只匹配开标签
223
+
224
+ let match;
225
+ while ((match = regex.exec(desc)) !== null) {
226
+ const index = match.index;
227
+ const fullTag = match[0];
228
+ const attrsStr = match[1];
229
+
230
+ // 标签前的普通文字
231
+ if (index > cursor) {
232
+ const plainText = desc.slice(cursor, index);
233
+ if (plainText) list.push({
234
+ text: plainText
235
+ });
236
+ }
237
+
238
+ // color 标签的 text 属性才是真正显示的文字
239
+ const textAttrMatch = attrsStr.match(/text=['"]([^'"]+)['"]/);
240
+ const displayText = textAttrMatch ? textAttrMatch[1] : '';
241
+
242
+ // 样式
243
+ const rgbMatch = attrsStr.match(/rgb=['"]([^'"]+)['"]/);
244
+ const boldMatch = attrsStr.match(/bold=['"]?(\d)['"]?/);
245
+ const style = {};
246
+ if (rgbMatch) style.color = rgbMatch[1];
247
+ if (boldMatch && boldMatch[1] === '1') style.bold = true;
248
+
249
+ if (displayText) list.push({
250
+ text: displayText,
251
+ ...style
252
+ });
253
+
254
+ // 更新 cursor 到闭标签结束
255
+ const closeTagIndex = desc.indexOf('</color>', regex.lastIndex);
256
+ cursor = closeTagIndex !== -1 ? closeTagIndex + 8 : regex.lastIndex;
257
+ regex.lastIndex = cursor;
258
+ }
259
+
260
+ // 标签后的普通文字
261
+ if (cursor < desc.length) {
262
+ const tail = desc.slice(cursor);
263
+ if (tail) list.push({
264
+ text: tail
265
+ });
266
+ }
267
+
268
+ return list;
269
+ }
270
+
271
+
272
+
273
+ });
@@ -0,0 +1,3 @@
1
+ {
2
+ "usingComponents": {}
3
+ }
@@ -0,0 +1,82 @@
1
+ <view class="page-root">
2
+ <scroll-view class="page-scroll" scroll-y="true">
3
+
4
+ <!-- 顶部区:标题 + 已累计签到n天 与 距离活动结束还有n天 -->
5
+ <view class="header">
6
+ <text class="title">签到领好礼</text>
7
+
8
+ <view class="summary-row">
9
+ <text class="summary-item">已累计签到<text class="em">{{signedCount}}</text>天</text>
10
+ <text class="summary-item">距离活动结束还有<text class="em">{{daysLeft}}</text>天</text>
11
+ </view>
12
+ </view>
13
+
14
+ <!-- 签到奖品区 -->
15
+ <view class="rewards-section">
16
+ <view class="rewards-grid">
17
+ <block wx:for="{{rewardsList}}" wx:key="dayKey">
18
+ <view class="reward-cell {{item.borderActive?'border-highlight':''}}" data-day="{{dayKey.index}}" bindtap="onTapRewardCell">
19
+ <!-- left-top 已领标签 -->
20
+ <view wx:if="{{item.is_signed === 1}}" class="cell-top-left">已领</view>
21
+
22
+ <!-- right-top 剩余数量 -->
23
+ <view class="cell-top-right">{{item.cdkCount}}件</view>
24
+
25
+ <!-- 道具图 -->
26
+ <image class="item-image" src="{{item.item_image}}" mode="aspectFill"></image>
27
+
28
+ <!-- 道具名字 -->
29
+ <text class="item-name">{{item.item_name}}</text>
30
+
31
+ <!-- 底部按钮 -->
32
+ <view class="cell-btn {{item.btnLabel === '查看奖励' ? 'btn-view' : ''}} {{item.btnLabel === '立即领取' ? 'btn-now' : ''}} {{item.btnLabel.indexOf('第') === 0 ? 'btn-normal' : ''}}" data-index="{{item.index}}" bindtap="onTapCellButton">
33
+ {{item.btnLabel}}
34
+ </view>
35
+
36
+ </view>
37
+ </block>
38
+ </view>
39
+ </view>
40
+
41
+ <!-- 活动说明区 -->
42
+ <view class="desc-wrapper">
43
+ <view class="desc-inner">
44
+ <view class="desc-title">活动说明</view>
45
+
46
+ <!-- 动态序号起始 -->
47
+ <block wx:if="{{descList && descList.length}}">
48
+ <!-- 1. 活动描述 -->
49
+ <view class="rule">
50
+ 1.
51
+ <block wx:for="{{descList}}" wx:key="idx">
52
+ <span style="color:{{item.color || '#444'}}; font-weight:{{item.bold ? '700' : '400'}};font-size: 22rpx;">
53
+ {{item.text}}
54
+ </span>
55
+ </block>
56
+ </view>
57
+ <!-- 2. 活动时间 -->
58
+ <view class="time-row">
59
+ 2. 活动时间:<span style="color: #002fa7;font-weight: bold;">{{timeRange}}</span>
60
+ </view>
61
+ <!-- 3~5 固定规则 -->
62
+ <view class="rule">3. 在本页面点击【立即领取】,活动期间内累计签到满对应天数即可获得相应礼包,礼包先到先得,领完为止。</view>
63
+ <view class="rule">4. 点击对应礼包即可成功领取兑换码,活动礼包一个账户仅可获得一次。</view>
64
+ <view class="rule">5. 相同类型礼包兑换码,每个游戏角色只可使用一次。</view>
65
+ </block>
66
+
67
+ <block wx:else>
68
+ <!-- descList 为空,活动时间就是 1 -->
69
+ <view class="time-row">
70
+ 1. 活动时间:<span style="color: #002fa7;font-weight: bold;">{{timeRange}}</span>
71
+ </view>
72
+ <view class="rule">2. 在本页面点击【立即领取】,活动期间内累计签到满对应天数即可获得相应礼包,礼包先到先得,领完为止。</view>
73
+ <view class="rule">3. 点击对应礼包即可成功领取兑换码,活动礼包一个账户仅可获得一次。</view>
74
+ <view class="rule">4. 相同类型礼包兑换码,每个游戏角色只可使用一次。</view>
75
+ </block>
76
+
77
+ </view>
78
+ </view>
79
+
80
+
81
+ </scroll-view>
82
+ </view>