小说小程序前端代码仓库(小程序)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

424 lines
9.9 KiB

1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
  1. <template>
  2. <view class="page">
  3. <navbar/>
  4. <view class="content">
  5. <!-- 顶部横幅广告 -->
  6. <view class="banner">
  7. <image src="https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain" mode="widthFix"></image>
  8. </view>
  9. <!-- 通知区域 -->
  10. <view class="notice">
  11. <view class="notice-icon">
  12. <image src="https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain" mode="widthFix"></image>
  13. </view>
  14. <view class="notice-text">
  15. 2025年2月平台福利活动截稿作品公示
  16. </view>
  17. <view class="notice-more">
  18. <uv-icon name="arrow-right" color="#999" size="24rpx"></uv-icon>
  19. </view>
  20. </view>
  21. <!-- 最近更新 -->
  22. <view class="section">
  23. <view class="section-header">
  24. <text class="section-title">最近更新</text>
  25. </view>
  26. <view class="recommend-list">
  27. <view class="recommend-item" v-for="(item, index) in recommendList" :key="index" @click="$utils.navigateTo('/pages_order/product/productDetail?id='+index)">
  28. <image class="recommend-cover" :src="item.cover" mode="aspectFill"></image>
  29. <view class="recommend-title">{{item.title}}</view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <!-- 精品推荐 -->
  35. <view class="section1">
  36. <view class="section-header">
  37. <text class="section-title">精品推荐</text>
  38. <text class="section-more" @click="$utils.navigateTo('/pages/index/category')">查看更多 ></text>
  39. </view>
  40. <view class="novel-list">
  41. <view class="novel-item" v-for="(item, index) in 5" :key="index" @click="$utils.navigateTo('/pages_order/product/productDetail?id='+index)">
  42. <image class="novel-cover" :src="novelCovers[index]" mode="aspectFill"></image>
  43. <view class="novel-info">
  44. <view class="novel-title">{{novelTitles[index]}}</view>
  45. <view class="novel-desc">{{novelDescs[index]}}</view>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. <PrivacyAgreementPoup/>
  51. <tabber select="home"/>
  52. </view>
  53. </template>
  54. <script>
  55. import PrivacyAgreementPoup from '@/components/config/PrivacyAgreementPoup.vue'
  56. import Position from '@/utils/position.js'
  57. import tabber from '@/components/base/tabbar.vue'
  58. import productList from '@/components/user/productList.vue'
  59. import { mapGetters } from 'vuex'
  60. // import selectArea from '../../components/selectArea.vue';
  61. export default {
  62. components : {
  63. tabber,
  64. productList,
  65. PrivacyAgreementPoup,
  66. },
  67. data() {
  68. return {
  69. area: '长沙',
  70. text : '长沙市刘师傅在服务过程中客户投诉"服务过程中有不文明的行为".....',
  71. queryParams: {
  72. pageNo: 1,
  73. pageSize: 10,
  74. title: ''
  75. },
  76. bannerList: [
  77. {
  78. url: 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
  79. },
  80. {
  81. url: 'https://cdn.uviewui.com/uview/swiper/swiper2.png',
  82. },
  83. {
  84. url: 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
  85. },
  86. ],
  87. productList: [],
  88. // 精品推荐
  89. novelCovers: [
  90. 'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain',
  91. 'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain',
  92. 'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain',
  93. 'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain',
  94. 'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain'
  95. ],
  96. // 小说标题数据
  97. novelTitles: [
  98. '我是半妖',
  99. '兽王进化',
  100. '魔法少女纯爷们',
  101. '我是一条小青龙',
  102. '女帝归来'
  103. ],
  104. // 小说描述数据
  105. novelDescs: [
  106. '都市玄幻小说,主角获得半妖化能力,通过吸收妖气不断变强...',
  107. '一场意外让主角获得兽王血脉,开始了进化之路...',
  108. '一个普通男孩意外获得魔法少女的力量,开始了奇妙冒险...',
  109. '重生为一条小青龙,主角在修仙世界中成长的故事...',
  110. '曾经的女帝重生归来,开始了复仇之路...'
  111. ],
  112. // 最近更新
  113. recommendList: [
  114. {
  115. title: '重生后,我给妹妹假装动漫女主角',
  116. cover: 'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain'
  117. },
  118. {
  119. title: '我在亮剑提前帮助',
  120. cover: 'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain'
  121. },
  122. {
  123. title: '斗罗:开局魂师测试99级',
  124. cover: 'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain'
  125. }
  126. ]
  127. }
  128. },
  129. computed : {
  130. ...mapGetters(['userShop']),
  131. },
  132. methods: {
  133. //显示选择地区
  134. showSelectArea() {
  135. // this.$refs.selectArea.open()
  136. },
  137. //搜索地址
  138. searchAddress() {
  139. Position.getLocation(res => {
  140. Position.selectAddress(res.longitude, res.latitude, success => {
  141. let address = this.extractProvinceAndCity(success)
  142. this.queryParams.title = address.city
  143. })
  144. })
  145. },
  146. //提取用户选择的地址信息(省市县信息)
  147. extractProvinceAndCity(res) { //提取用户选择的地址信息(省市)
  148. if (!res.address && res.name) { //用户直接选择城市的逻辑
  149. return {
  150. province: '',
  151. city: res.name
  152. };
  153. }
  154. if (res.address) { //用户选择了详细地址,要从详细地址中提取出省市县信息
  155. // 使用正则表达式匹配省市县
  156. const regex = /(?<province>[\u4e00-\u9fa5]+?省)(?<city>[\u4e00-\u9fa5]+?(?:市|自治州|盟|地区))/;
  157. const match = res.address.match(regex);
  158. if (match) { // 如果匹配成功,则返回省和市的信息
  159. return {
  160. province: match.groups.province,
  161. city: match.groups.city
  162. };
  163. }
  164. }
  165. return { //用户没选择地址就点了确定按钮
  166. province: '',
  167. city: ''
  168. }
  169. },
  170. }
  171. }
  172. </script>
  173. <style scoped lang="scss">
  174. .page {
  175. background-color: #f5f5f5;
  176. // min-height: 100vh;
  177. .content {
  178. padding-bottom: 75rpx;
  179. }
  180. .banner {
  181. padding: 0;
  182. image {
  183. width: 100%;
  184. height: 250rpx;
  185. border-radius: 0;
  186. }
  187. }
  188. .notice {
  189. display: flex;
  190. align-items: center;
  191. background-color: #fff;
  192. margin: 0;
  193. padding: 20rpx 30rpx;
  194. border-radius: 0;
  195. .notice-icon {
  196. margin-right: 20rpx;
  197. image {
  198. width: 80rpx;
  199. height: 80rpx;
  200. }
  201. }
  202. .notice-text {
  203. flex: 1;
  204. font-size: 28rpx;
  205. color: #333;
  206. overflow: hidden;
  207. white-space: nowrap;
  208. text-overflow: ellipsis;
  209. }
  210. .notice-more {
  211. margin-left: 20rpx;
  212. }
  213. }
  214. .section {
  215. background-color: #fff;
  216. margin: 30rpx 0 0 0;
  217. padding: 10rpx 30rpx;
  218. border-radius: 0;
  219. .section-header {
  220. display: flex;
  221. justify-content: space-between;
  222. align-items: center;
  223. margin-bottom: 20rpx;
  224. .section-title {
  225. font-size: 32rpx;
  226. font-weight: bold;
  227. color: #333;
  228. }
  229. .section-more {
  230. font-size: 24rpx;
  231. color: #999;
  232. }
  233. }
  234. .novel-list {
  235. .novel-item {
  236. display: flex;
  237. padding: 20rpx 0;
  238. border-bottom: 1px solid #eee;
  239. &:last-child {
  240. border-bottom: none;
  241. }
  242. .novel-cover {
  243. width: 160rpx;
  244. height: 200rpx;
  245. border-radius: 8rpx;
  246. margin-right: 20rpx;
  247. }
  248. .novel-info {
  249. flex: 1;
  250. display: flex;
  251. flex-direction: column;
  252. justify-content: space-between;
  253. .novel-title {
  254. font-size: 28rpx;
  255. font-weight: bold;
  256. color: #333;
  257. margin-bottom: 10rpx;
  258. }
  259. .novel-desc {
  260. font-size: 24rpx;
  261. color: #999;
  262. line-height: 1.5;
  263. display: -webkit-box;
  264. -webkit-box-orient: vertical;
  265. -webkit-line-clamp: 3;
  266. overflow: hidden;
  267. }
  268. }
  269. }
  270. }
  271. .recommend-list {
  272. display: flex;
  273. flex-wrap: wrap;
  274. justify-content: space-between;
  275. .recommend-item {
  276. width: 30%;
  277. margin-bottom: 20rpx;
  278. .recommend-cover {
  279. width: 100%;
  280. height: 200rpx;
  281. border-radius: 8rpx;
  282. margin-bottom: 10rpx;
  283. }
  284. .recommend-title {
  285. font-size: 24rpx;
  286. color: #333;
  287. overflow: hidden;
  288. white-space: nowrap;
  289. text-overflow: ellipsis;
  290. }
  291. }
  292. }
  293. }
  294. .section1 {
  295. background-color: #fff;
  296. margin: 0rpx 0 0 0;
  297. padding: 20rpx 30rpx;
  298. border-radius: 0;
  299. .section-header {
  300. display: flex;
  301. justify-content: space-between;
  302. align-items: center;
  303. margin-bottom: 20rpx;
  304. .section-title {
  305. font-size: 32rpx;
  306. font-weight: bold;
  307. color: #333;
  308. }
  309. .section-more {
  310. font-size: 24rpx;
  311. color: #999;
  312. }
  313. }
  314. .novel-list {
  315. .novel-item {
  316. display: flex;
  317. padding: 20rpx 0;
  318. border-bottom: 1px solid #eee;
  319. &:last-child {
  320. border-bottom: none;
  321. }
  322. .novel-cover {
  323. width: 160rpx;
  324. height: 200rpx;
  325. border-radius: 8rpx;
  326. margin-right: 20rpx;
  327. }
  328. .novel-info {
  329. flex: 1;
  330. display: flex;
  331. flex-direction: column;
  332. justify-content: space-between;
  333. .novel-title {
  334. font-size: 28rpx;
  335. font-weight: bold;
  336. color: #333;
  337. margin-bottom: 10rpx;
  338. }
  339. .novel-desc {
  340. font-size: 24rpx;
  341. color: #999;
  342. line-height: 1.5;
  343. display: -webkit-box;
  344. -webkit-box-orient: vertical;
  345. -webkit-line-clamp: 3;
  346. overflow: hidden;
  347. }
  348. }
  349. }
  350. }
  351. .recommend-list {
  352. display: flex;
  353. flex-wrap: wrap;
  354. justify-content: space-between;
  355. .recommend-item {
  356. width: 30%;
  357. margin-bottom: 20rpx;
  358. .recommend-cover {
  359. width: 100%;
  360. height: 200rpx;
  361. border-radius: 8rpx;
  362. margin-bottom: 10rpx;
  363. }
  364. .recommend-title {
  365. font-size: 24rpx;
  366. color: #333;
  367. overflow: hidden;
  368. white-space: nowrap;
  369. text-overflow: ellipsis;
  370. }
  371. }
  372. }
  373. }
  374. }
  375. </style>