图书馆小程序
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.

863 lines
25 KiB

5 months ago
3 weeks ago
3 weeks ago
5 months ago
5 months ago
4 months ago
5 months ago
5 months ago
5 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
4 months ago
4 months ago
5 months ago
5 months ago
5 months ago
4 months ago
5 months ago
5 months ago
4 months ago
5 months ago
5 months ago
5 months ago
4 months ago
5 months ago
5 months ago
4 months ago
5 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
4 months ago
5 months ago
5 months ago
4 months ago
4 months ago
5 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
5 months ago
4 months ago
5 months ago
4 months ago
4 months ago
4 months ago
4 months ago
5 months ago
4 months ago
5 months ago
5 months ago
4 months ago
4 weeks ago
4 months ago
4 weeks ago
4 months ago
4 months ago
5 months ago
4 months ago
5 months ago
5 months ago
4 months ago
3 weeks ago
4 months ago
5 months ago
3 weeks ago
5 months ago
4 months ago
4 months ago
4 months ago
4 months ago
3 weeks ago
3 weeks ago
5 months ago
4 months ago
5 months ago
3 weeks ago
4 months ago
4 months ago
4 weeks ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
1 month ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
3 weeks ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
5 months ago
4 months ago
5 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
4 months ago
4 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
4 months ago
4 months ago
5 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 weeks ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
5 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
  1. <template>
  2. <view style="padding-bottom: 20px;">
  3. <view class="top-bar">
  4. <uni-icons class="erweima-top" custom-prefix="iconfont" type="icon-erweima" size="22" color="#fff" @click="showTopImgPopup"></uni-icons>
  5. <image class="top-bar-bg" src="@/static/images/mingqi-beij@2x.png" mode="aspectFill"></image>
  6. <view class="library-info">
  7. <image class="avatar" :src="libraryLogo" mode="aspectFill"></image>
  8. <view class="library-name">{{ fondsName }}</view>
  9. </view>
  10. <uni-icons class="search-icon" type="search" size="24" @click="onToSearch"></uni-icons>
  11. </view>
  12. <view class="status-cards">
  13. <view class="status-card" @click="toBorrowPage(0)">
  14. <view class="status-icon icon-color1" >
  15. <uni-icons custom-prefix="iconfont" type="icon-daiban02" size="22"></uni-icons>
  16. </view>
  17. <view class="status-label">在借中</view>
  18. </view>
  19. <!-- <view class="status-card" @click="toBorrowPage(2)">
  20. <view class="status-icon icon-color2" >
  21. <uni-icons custom-prefix="iconfont" type="icon-zuofei05" size="22"></uni-icons>
  22. </view>
  23. <view class="status-label">将过期</view>
  24. </view>
  25. <view class="status-card" @click="toBorrowPage(3)">
  26. <view class="status-icon icon-color3" >
  27. <uni-icons custom-prefix="iconfont" type="icon-yuqi04" size="22"></uni-icons>
  28. </view>
  29. <view class="status-label">已过期</view>
  30. </view> -->
  31. <view class="status-card" @click="toBorrowPage(1)">
  32. <view class="status-icon icon-color4" >
  33. <uni-icons custom-prefix="iconfont" type="icon-a-zhidu4" size="22"></uni-icons>
  34. </view>
  35. <view class="status-label">历史借阅</view>
  36. </view>
  37. </view>
  38. <swiper
  39. v-if="bannerList.length"
  40. class="banner-swiper"
  41. interval="3000"
  42. circular
  43. :vertical="false"
  44. :indicator-dots="true"
  45. :autoplay="true"
  46. >
  47. <swiper-item v-for="(item, idx) in bannerList" :key="idx">
  48. <image :src="item.imgUrl" mode="aspectFill"></image>
  49. </swiper-item>
  50. </swiper>
  51. <!-- :indicator-dots="true" -->
  52. <swiper class="menu-swiper" interval="6000" :vertical="false" :autoplay="false">
  53. <swiper-item>
  54. <view class="menu-grid">
  55. <view class="menu-item" @click="onToSearch">
  56. <view class="menu-icon">
  57. <uni-icons custom-prefix="iconfont" type="icon-ziyuan" size="22"></uni-icons>
  58. </view>
  59. <view class="menu-label">书目检索</view>
  60. </view>
  61. <view class="menu-item" @click="onToLendCar">
  62. <view class="menu-icon">
  63. <uni-icons custom-prefix="iconfont" type="icon-z_renew_normal" size="24"></uni-icons>
  64. </view>
  65. <view class="menu-label">图书续借</view>
  66. </view>
  67. <!-- <view class="menu-item" >
  68. <view class="menu-icon">
  69. <uni-icons custom-prefix="iconfont" type="icon-guanwaizhuanjie1" size="26"></uni-icons>
  70. </view>
  71. <view class="menu-label">图书转借</view>
  72. </view> -->
  73. <view class="menu-item" @click="toLibraryCard">
  74. <view class="menu-icon">
  75. <uni-icons custom-prefix="iconfont" type="icon-duzhezheng" size="26"></uni-icons>
  76. </view>
  77. <view class="menu-label">电子证</view>
  78. </view>
  79. <view class="menu-item" @click="toRanking">
  80. <view class="menu-icon">
  81. <uni-icons custom-prefix="iconfont" type="icon-paihangbang" size="22"></uni-icons>
  82. </view>
  83. <view class="menu-label">借阅排行</view>
  84. </view>
  85. <view class="menu-item" @click="toActivityList">
  86. <view class="menu-icon">
  87. <uni-icons custom-prefix="iconfont" type="icon-remenhuodong" size="26"></uni-icons>
  88. </view>
  89. <view class="menu-label">活动报名</view>
  90. </view>
  91. <view class="menu-item" @click="toFeedback">
  92. <view class="menu-icon">
  93. <uni-icons custom-prefix="iconfont" type="icon-ruguanyuyue" size="26"></uni-icons>
  94. </view>
  95. <view class="menu-label">预约入馆</view>
  96. </view>
  97. <view class="menu-item" @click="onToUser">
  98. <view class="menu-icon">
  99. <uni-icons custom-prefix="iconfont" type="icon-yonghuxinxi-gerenxinxi" size="20"></uni-icons>
  100. </view>
  101. <view class="menu-label">个人中心</view>
  102. </view>
  103. <view class="menu-item" @click="goRegister">
  104. <view class="menu-icon">
  105. <uni-icons custom-prefix="iconfont" type="icon-daohang-banzhengxuzhi" size="25"></uni-icons>
  106. </view>
  107. <view class="menu-label">在线办证</view>
  108. </view>
  109. </view>
  110. </swiper-item>
  111. </swiper>
  112. <!-- 已有绑定滑动切换多个借阅证 -->
  113. <view v-if="isBindLibraryCard" class="library-card-has">
  114. <view class="section-title">我的借阅证</view>
  115. <!-- 左右滑动切换证件 -->
  116. <!-- :indicator-dots="readerCardList.length > 1"
  117. indicator-color="#d1d1d1"
  118. indicator-active-color="#01a4fe" -->
  119. <swiper
  120. class="card-swiper"
  121. :circular="false"
  122. >
  123. <swiper-item v-for="item in readerCardList" :key="item.id">
  124. <!-- :class="{'active': item.bindDefault}" -->
  125. <view class="card-item" @click.stop="showQrcode(item.bindValue)">
  126. <image class="card-left-img" src="@/static/images/card-img2.png" mode="widthFix" />
  127. <view class="card-right-info">
  128. <text class="info-title">读者证号</text>
  129. <text class="info-num">{{ formatCardNo(item.bindValue) }}</text>
  130. </view>
  131. <view class="default-tag" v-if="item.bindDefault">默认证</view>
  132. <uni-icons class="erweima-style" custom-prefix="iconfont" type="icon-erweima" size="28"></uni-icons>
  133. </view>
  134. </swiper-item>
  135. </swiper>
  136. </view>
  137. <!-- 未绑定借阅证 -->
  138. <view class="library-card-section" @click="toCheckLogin" v-else>
  139. <view class="section-title">借阅证</view>
  140. <image class="card-icon" src="@/static/images/card-img2.png"></image>
  141. <view class="card-tip">您还没有绑定读者证哦</view>
  142. <button class="bind-btn">立即绑定</button>
  143. </view>
  144. <root-portal>
  145. <uni-popup
  146. ref="popup"
  147. type="center"
  148. :mask-click="true"
  149. @maskClick="closeAllPopup"
  150. >
  151. <view class="qrcode-popup">
  152. <view class="qrcode-title">读者证二维码</view>
  153. <w-qrcode
  154. v-if="qrcodeText"
  155. :value="qrcodeText"
  156. :size="160"
  157. foreground="#333"
  158. background="#ffffff"
  159. />
  160. <view class="qrcode-num" v-if="qrcodeText">{{ qrcodeText }}</view>
  161. <!-- <view class="close-btn" @click="closeAllPopup" style="margin-top:15px;">关闭</view> -->
  162. </view>
  163. </uni-popup>
  164. <uni-popup
  165. ref="erweimapopup"
  166. type="center"
  167. :mask-click="true"
  168. @maskClick="closeErweiPopup"
  169. :custom-style="popupFixedStyle"
  170. >
  171. <view class="qrcode-popup" style="width: auto !important;">
  172. <image
  173. v-if="wecharQRCode"
  174. :src="wecharQRCode"
  175. style="width:200px;height:200px;"
  176. mode="aspectFit"
  177. :show-menu-by-longpress="true"
  178. @longpress="onQRCodeLongPress"
  179. ></image>
  180. <!-- <view class="qrcode-tip">长按二维码可识别</view> -->
  181. </view>
  182. </uni-popup>
  183. </root-portal>
  184. <view class="recommendation-section">
  185. <view class="section-title">
  186. <text class="left-txt">图书推荐</text>
  187. <view class="more-link" @click="getMoreBoook" v-if="!(recommendedBooks.length === 0 && !isLoading)">
  188. <text style="margin-right: 5px;">查看更多</text>
  189. <uni-icons custom-prefix="iconfont" type="icon-gengduo" size="12"></uni-icons>
  190. </view>
  191. </view>
  192. <view class="recommendation-list">
  193. <uni-load-more status="loading" v-if="isLoading"></uni-load-more>
  194. <view v-else class="book-item" v-for="(item,index) in recommendedBooks.slice(0,3)" @click="goToBookDetail(item)" :key="index" >
  195. <!-- :src="item.base64Cover || '/static/images/default-book.jpg'" -->
  196. <image
  197. class="book-cover"
  198. :src="item.base64Cover || '/static/images/default-book.jpg'"
  199. @error="onImgError"
  200. ></image>
  201. <view class="book-title">{{item.name}}</view>
  202. </view>
  203. </view>
  204. <view class="empty" v-if="recommendedBooks.length === 0 && !isLoading">
  205. <uni-icons custom-prefix="iconfont" type="icon-kongshuju" size="80"></uni-icons>
  206. <text style="margin-top: 20px;">暂无推荐书籍~</text>
  207. </view>
  208. </view>
  209. </view>
  210. </template>
  211. <script>
  212. import { FetchInitScreenSetting, FetchOpenId, FetchFindAllReaderBindByOpenId} from '@/api/user';
  213. import { FetchInitScreenBookRecommend } from '@/api/book';
  214. import config from '@/utils/config';
  215. import { STORAGE_KEYS } from '@/utils/storage';
  216. import { waitLibcodeReady,waitFondsNameReady } from '@/utils/global'
  217. export default {
  218. data() {
  219. return {
  220. fondsName: getApp().globalData.fondsName || '',
  221. isLoading: true,
  222. recommendedBooks: [],
  223. userInfo: {},
  224. isBindLibraryCard: false,
  225. readerCardList: [], // 多个借阅证
  226. baseUrl: config.baseUrl,
  227. qrcodeText: '', // 二维码内容
  228. popupFixedStyle: 'position:fixed;top:0;left:0;right:0;bottom:0;',
  229. wecharQRCode: null,
  230. libraryLogo: null, // 新增:图书馆logo图片地址
  231. bannerList: [] // 新增 banner轮播数组
  232. };
  233. },
  234. async onLoad() {
  235. // this.getRecommendBooks();
  236. // this.getScreenSetting()
  237. const fondsName = await waitFondsNameReady()
  238. if(fondsName){
  239. uni.setNavigationBarTitle({
  240. title: fondsName
  241. })
  242. }else{
  243. uni.setNavigationBarTitle({
  244. title: "图书馆"
  245. })
  246. }
  247. this.initPage()
  248. },
  249. onShow() {
  250. this.initUserAndCheckBind();
  251. },
  252. methods:{
  253. async initPage(){
  254. const libcode = await waitLibcodeReady()
  255. if(!libcode){
  256. uni.showToast({title:'获取图书馆编码失败',icon:'none'})
  257. return
  258. }
  259. this.getRecommendBooks(libcode);
  260. this.getScreenSetting(libcode)
  261. },
  262. async getScreenSetting(libcode) {
  263. const res = await FetchInitScreenSetting({ libcode });
  264. // 处理微信二维码
  265. if (res.data.wechat_qr_code && res.data.wechat_qr_code.context) {
  266. const imageUrl = this.baseUrl + '/files/' + res.data.wechat_qr_code.context;
  267. try {
  268. this.wecharQRCode = imageUrl;
  269. } catch (err) {
  270. this.wecharQRCode = null;
  271. }
  272. } else {
  273. this.wecharQRCode = null;
  274. }
  275. // 新增:处理图书馆logo
  276. if(res.data.library_logo && res.data.library_logo.context){
  277. this.libraryLogo = this.baseUrl + '/files/' + res.data.library_logo.context;
  278. }else{
  279. this.libraryLogo = null;
  280. }
  281. // ========== 解析vx_banner1 ~ vx_banner5 最多5张 ==========
  282. const banners = []
  283. for(let i = 1; i <=5; i++){
  284. const key = `vx_banner${i}`
  285. const bannerItem = res.data[key]
  286. if(bannerItem && bannerItem.context){
  287. banners.push({
  288. id: bannerItem.id,
  289. code: bannerItem.code,
  290. imgUrl: this.baseUrl + '/files/' + bannerItem.context
  291. })
  292. }
  293. }
  294. this.bannerList = banners
  295. },
  296. // 显示顶部微信二维码弹窗
  297. showTopImgPopup() {
  298. if (!this.wecharQRCode) {
  299. uni.showToast({ title: '暂无图片', icon: 'none' })
  300. return
  301. }
  302. this.$refs.erweimapopup.open()
  303. },
  304. // 格式化读者证号
  305. formatCardNo(cardNo) {
  306. if (!cardNo) return '';
  307. const str = String(cardNo);
  308. const len = str.length;
  309. if (len > 8) {
  310. // 前2位 + 中间全部* + 后2位
  311. const front = str.substring(0, 2);
  312. const end = str.substring(len - 2);
  313. const star = '*'.repeat(len - 4); // 中间全部隐藏
  314. return front + star + end;
  315. } else {
  316. // 小于等于8:*** + 后2位
  317. return '***' + str.substring(len - 2);
  318. }
  319. },
  320. onImgError(e) {
  321. e.target.src = "/static/images/default-book.jpg";
  322. },
  323. // 初始化:登录 → 获取openid → 查是否绑定
  324. async initUserAndCheckBind() {
  325. try {
  326. const libcode = await waitLibcodeReady()
  327. if(!libcode) return
  328. // 1. 先看缓存有没有 openId
  329. let openId = uni.getStorageSync('wx_login_code');
  330. // 2. 没有 → 走微信登录流程
  331. if (!openId) {
  332. const loginRes = await new Promise((resolve, reject) => {
  333. uni.login({
  334. success: resolve,
  335. fail: reject
  336. });
  337. });
  338. if (!loginRes.code) {
  339. uni.showToast({ title: '授权失败', icon: 'none' });
  340. return;
  341. }
  342. // 3. 获取 openId
  343. const openRes = await FetchOpenId({
  344. libcode,
  345. code: loginRes.code
  346. });
  347. if (openRes.code !== 200 || !openRes.data) {
  348. return;
  349. }
  350. openId = openRes.data;
  351. uni.setStorageSync('wx_login_code', openId);
  352. }
  353. // 4. 有了 openId → 查绑定状态
  354. const res = await FetchFindAllReaderBindByOpenId({
  355. libcode,
  356. openId: openId
  357. });
  358. if (res.code === 200 && res.data.length > 0) {
  359. this.isBindLibraryCard = true;
  360. // 默认证排第一位
  361. const defaultCard = res.data.find(item => item.bindDefault === true);
  362. const otherCards = res.data.filter(item => !item.bindDefault);
  363. // 合并:默认在前,其他在后
  364. this.readerCardList = defaultCard ? [defaultCard, ...otherCards] : res.data;
  365. uni.setStorageSync(STORAGE_KEYS.READER_CARD_LIST, this.readerCardList);
  366. uni.setStorageSync(STORAGE_KEYS.CURRENT_READER_CARD, defaultCard);
  367. } else {
  368. this.isBindLibraryCard = false;
  369. this.readerCardList = [];
  370. uni.setStorageSync(STORAGE_KEYS.READER_CARD_LIST, []);
  371. uni.setStorageSync(STORAGE_KEYS.CURRENT_READER_CARD, null);
  372. }
  373. } catch (err) {
  374. console.error('初始化失败:', err);
  375. const list = uni.getStorageSync(STORAGE_KEYS.READER_CARD_LIST) || [];
  376. // 同样默认排第一
  377. const defaultCard = list.find(item => item.bindDefault === true);
  378. const otherCards = list.filter(item => !item.bindDefault);
  379. this.readerCardList = defaultCard ? [defaultCard, ...otherCards] : list;
  380. this.isBindLibraryCard = list.length > 0;
  381. }
  382. },
  383. // 获取图书推荐 + 封面转 base64
  384. async getRecommendBooks(libcode) {
  385. try {
  386. const res = await FetchInitScreenBookRecommend({ libcode });
  387. let books = res.data || [];
  388. // 只处理并展示前3条,避免setData数据过大
  389. const limit = 3;
  390. const displayBooks = books.slice(0, limit);
  391. for (let i = 0; i < displayBooks.length; i++) {
  392. let item = displayBooks[i];
  393. if (item.imgVxPath) {
  394. // const imageUrl = this.baseUrl + '/api/fileRelevant/getImg?imgType=2&imgId=' + item.imgPath;
  395. const imageUrl = this.baseUrl + '/files/' + item.imgVxPath;
  396. item.base64Cover = imageUrl;
  397. // try {
  398. // const base64 = await this.urlToBase64(imageUrl);
  399. // item.base64Cover = base64;
  400. // } catch (err) {
  401. // item.base64Cover = '';
  402. // }
  403. } else {
  404. item.base64Cover = '';
  405. }
  406. }
  407. // 只将展示所需的前3条数据放入响应式,减少setData传输量
  408. this.recommendedBooks = displayBooks;
  409. this.isLoading = false;
  410. } catch (err) {
  411. console.error('获取图书推荐失败:', err);
  412. this.isLoading = false;
  413. }
  414. },
  415. goToBookDetail(item) {
  416. // 把整个图书对象 转成字符串 带过去
  417. uni.navigateTo({
  418. url: "/subpkg/pages/book-detail/book-detail?bookData=" + encodeURIComponent(JSON.stringify(item)) + "&fromRecommend=true"
  419. })
  420. },
  421. // 查看更多 → 进入图书列表页
  422. getMoreBoook(){
  423. uni.navigateTo({
  424. url: "/subpkg/pages/book-list/book-list"
  425. })
  426. },
  427. // 去图书检索页
  428. onToSearch() {
  429. uni.switchTab({
  430. url: "/pages/search/search"
  431. });
  432. },
  433. // 去图书借阅车页
  434. onToLendCar() {
  435. this.checkBindAndNavigate("/pages/lendCar/lendCar", "请您绑定读者证", true);
  436. },
  437. // 点击未绑定借阅证区域 触发跳转
  438. toCheckLogin() {
  439. uni.navigateTo({
  440. url: "/pages/login/login"
  441. });
  442. },
  443. toRanking(){
  444. uni.navigateTo({
  445. url: "/subpkg/pages/ranking/ranking"
  446. })
  447. },
  448. toActivityList(){
  449. this.checkBindAndNavigate("/subpkg/pages/activity-list/activity-list", "请您绑定读者证");
  450. },
  451. toBorrowPage(index) {
  452. if (this.isBindLibraryCard) {
  453. uni.setStorageSync('switch_tab_index', index);
  454. uni.navigateTo({
  455. url: '/subpkg/pages/myLending/myLending'
  456. });
  457. } else {
  458. uni.showModal({
  459. title: '提示',
  460. content: '请您绑定读者证',
  461. confirmText: '去绑定',
  462. cancelText: '取消',
  463. success: (res) => {
  464. if (res.confirm) {
  465. uni.navigateTo({ url: "/pages/login/login" });
  466. }
  467. }
  468. });
  469. }
  470. },
  471. toBorrowCar() {
  472. uni.switchTab({
  473. url: '/pages/lendCar/lendCar'
  474. });
  475. },
  476. toFeedback() {
  477. uni.navigateTo({
  478. url: '/subpkg/pages/seat-booking/seat-booking'
  479. });
  480. },
  481. // 去借阅证列表页
  482. toLibraryCard() {
  483. // 已绑定 → 进列表
  484. if (this.isBindLibraryCard) {
  485. uni.navigateTo({ url: '/subpkg/pages/reader-card/reader-card' });
  486. }
  487. // 未绑定 → 进绑定页
  488. else {
  489. uni.navigateTo({ url: "/pages/login/login" });
  490. }
  491. },
  492. // 去个人中心页
  493. onToUser() {
  494. this.checkBindAndNavigate("/pages/user/user", "请您绑定读者证", true);
  495. },
  496. checkBindAndNavigate(url, message, isSwitchTab = false) {
  497. if (this.isBindLibraryCard) {
  498. if (isSwitchTab) {
  499. uni.switchTab({ url });
  500. } else {
  501. uni.navigateTo({ url });
  502. }
  503. } else {
  504. uni.showModal({
  505. title: '提示',
  506. content: message,
  507. confirmText: '去绑定',
  508. cancelText: '取消',
  509. success: (res) => {
  510. if (res.confirm) {
  511. uni.navigateTo({ url: "/pages/login/login" });
  512. }
  513. }
  514. });
  515. }
  516. },
  517. showQrcode(bindValue) {
  518. this.qrcodeText = bindValue;
  519. this.$refs.popup.open();
  520. },
  521. closeAllPopup() {
  522. this.qrcodeText = '';
  523. this.$refs.popup.close();
  524. },
  525. closeErweiPopup() {
  526. this.$refs.erweimapopup.close()
  527. },
  528. /**
  529. * 二维码长按事件
  530. */
  531. onQRCodeLongPress() {
  532. // uni.showToast({
  533. // title: '长按识别二维码',
  534. // icon: 'none',
  535. // duration: 1500
  536. // });
  537. },
  538. urlToBase64(url) {
  539. return new Promise((resolve, reject) => {
  540. uni.request({
  541. url,
  542. method: 'GET',
  543. responseType: 'arraybuffer',
  544. success: (res) => {
  545. try {
  546. const buffer = new Uint8Array(res.data);
  547. let binary = '';
  548. for (let i = 0; i < buffer.length; i++) {
  549. binary += String.fromCharCode(buffer[i]);
  550. }
  551. const base64 = uni.arrayBufferToBase64(res.data);
  552. const dataUri = 'data:image/jpeg;base64,' + base64;
  553. resolve(dataUri);
  554. } catch (e) {
  555. reject(e);
  556. }
  557. },
  558. fail: reject
  559. });
  560. });
  561. },
  562. goRegister() {
  563. uni.navigateTo({
  564. url: '/subpkg/pages/register/register'
  565. });
  566. }
  567. }
  568. }
  569. </script>
  570. <style lang="scss" scoped>
  571. .top-bar{
  572. .erweima-top{
  573. position: absolute;
  574. left: 16px;
  575. top: 15px;
  576. z-index: 999;
  577. }
  578. .search-icon{
  579. position: absolute;
  580. right: 16px;
  581. top: 15px;
  582. z-index: 22;
  583. ::v-deep .uni-icons{
  584. color: #fff !important;
  585. }
  586. }
  587. }
  588. .status-cards {
  589. display: flex;
  590. background-color: #fff;
  591. margin: 10px;
  592. border-radius: 8px;
  593. padding: 20px 10px;
  594. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
  595. .status-card {
  596. flex: 1;
  597. display: flex;
  598. flex-direction: column;
  599. align-items: center;
  600. }
  601. .status-icon {
  602. display: flex;
  603. justify-content: center;
  604. align-items: center;
  605. width: 40px;
  606. height: 40px;
  607. margin-bottom: 6px;
  608. border-radius: 50%;
  609. }
  610. .icon-color1{
  611. background-color: #e4f2ff;
  612. }
  613. .icon-color2{
  614. background-color: #ffeff0;
  615. }
  616. .icon-color3{
  617. background-color: #e4fff4;
  618. }
  619. .icon-color4{
  620. background-color: #fef8e2;
  621. }
  622. .status-label {
  623. font-size: 12px;
  624. color: #333;
  625. }
  626. }
  627. swiper.banner-swiper{
  628. width: 100%;
  629. height: 130px;
  630. }
  631. swiper.banner-swiper image{
  632. width: 100%;
  633. height: 130px;
  634. }
  635. swiper.menu-swiper{
  636. width:100%;
  637. margin-top: 10px;
  638. background-color: #fff;
  639. }
  640. .menu-grid {
  641. display: grid;
  642. grid-template-columns: repeat(4, 1fr);
  643. .menu-item {
  644. flex: 1;
  645. display: flex;
  646. flex-direction: column;
  647. align-items: center;
  648. padding: 10px 0;
  649. .menu-icon{
  650. display: flex;
  651. flex-direction: column;
  652. justify-content: center;
  653. height: 30px;
  654. ::v-deep .uni-icons{
  655. color: #01a4fe !important;
  656. }
  657. }
  658. .menu-label {
  659. font-size: 12px;
  660. color: #333;
  661. text-align: center;
  662. }
  663. }
  664. }
  665. .library-card-section {
  666. display: flex;
  667. flex-direction: column;
  668. justify-content: space-between;
  669. align-items: center;
  670. width: 100%;
  671. padding: 20px 0;
  672. .section-title {
  673. font-size: 22px;
  674. font-weight: bold;
  675. background: linear-gradient(140deg, #01a4ff, #2ec8fe);
  676. -webkit-background-clip: text;
  677. color: transparent;
  678. letter-spacing: 0.1em;
  679. margin-bottom: 5px;
  680. }
  681. .card-icon {
  682. width: 80px;
  683. height: 80px;
  684. }
  685. .card-tip {
  686. font-size: 12px;
  687. color: #999;
  688. margin: 5px 0;
  689. }
  690. .bind-btn {
  691. display: flex;
  692. flex-direction: row;
  693. align-items: center;
  694. justify-content: center;
  695. border: 1px solid #06a8ff ;
  696. width: 128px !important;
  697. height: 28px;
  698. border-radius: 28px;
  699. background: linear-gradient(140deg, #01a4ff, #2ec8fe);
  700. font-size: 14px;
  701. color: #fff;
  702. line-height: 28px;
  703. }
  704. }
  705. .recommendation-section {
  706. background-color: #fff;
  707. margin: 10px;
  708. border-radius: 8px;
  709. padding: 0 0 10px 0;
  710. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
  711. .section-title{
  712. display: flex;
  713. flex-direction: row;
  714. justify-content: space-between;
  715. align-items: center;
  716. height: 40px;
  717. padding: 0 10px;
  718. .left-txt{
  719. color: #343434;
  720. font-size: 15px;
  721. font-weight: 700;
  722. }
  723. .more-link{
  724. display: flex;
  725. flex-direction: row;
  726. justify-content: flex-start;
  727. align-items: center;
  728. color: #999;
  729. font-size: 11px;
  730. }
  731. }
  732. }
  733. .library-card-has {
  734. width: 100%;
  735. padding: 20px 10px;
  736. box-sizing: border-box;
  737. .section-title {
  738. font-size: 22px;
  739. font-weight: bold;
  740. background: linear-gradient(140deg, #01a4ff, #2ec8fe);
  741. -webkit-background-clip: text;
  742. color: transparent;
  743. letter-spacing: 0.1em;
  744. margin-bottom: 10px;
  745. padding-left: 5px;
  746. }
  747. .card-list {
  748. width: 100%;
  749. }
  750. }
  751. .card-swiper {
  752. height: 106px;
  753. .card-item{
  754. display: flex;
  755. justify-content: space-between;
  756. align-items: center;
  757. padding: 10px;
  758. border: 2px solid #C6C6E2;
  759. border-radius: 8px;
  760. background: rgba(241,241,249,0.4);
  761. cursor: pointer;
  762. &.active{
  763. border-color: #01a4fe;
  764. background: rgba(1, 164, 254, 0.1);
  765. }
  766. .card-left-img{
  767. width: 80px;
  768. margin-right: 12px;
  769. display: block;
  770. }
  771. .card-right-info{
  772. flex: 1;
  773. display: flex;
  774. flex-direction: column;
  775. .info-title{
  776. font-size: 16px;
  777. color: #333;
  778. font-weight: bold;
  779. padding-bottom: 12px;
  780. }
  781. .info-num{
  782. font-size: 14px;
  783. color: #999;
  784. }
  785. }
  786. .default-tag {
  787. position: absolute;
  788. right: 12px;
  789. top: 12px;
  790. font-size: 11px;
  791. color: #01a4fe;
  792. border: 1px solid #01a4fe;
  793. border-radius: 4px;
  794. padding: 2px 6px;
  795. }
  796. }
  797. }
  798. .erweima-style{
  799. position: absolute;
  800. right: 12px;
  801. bottom: 22px;
  802. ::v-deep .icon-erweima{
  803. // font-weight: bold;
  804. color: #999 !important;
  805. }
  806. }
  807. </style>