Browse Source

在线选书api调试

master
xuhuajiao 1 year ago
parent
commit
6bbf3f3651
  1. 9
      library-activity/app.config.js
  2. 14
      library-activity/src/assets/css/style.scss
  3. 418
      library-activity/src/utils/api.js
  4. 186
      library-activity/src/views/bookList/bookList.vue
  5. 145
      library-activity/src/views/cart/cart.vue
  6. 335
      library-activity/src/views/index.vue
  7. 2
      library-activity/vite.config.js

9
library-activity/app.config.js

@ -4,15 +4,10 @@
const isProd = process.env.NODE_ENV === 'production' const isProd = process.env.NODE_ENV === 'production'
const proxyConfig = { const proxyConfig = {
proxy: { proxy: {
//'/api': 'https://testapi.aiyxlib.com/api',
// 'url': 'http://restapi.amap.com/',
// url: "https://testapi.aiyxlib.com/api",
'url': "http://192.168.99.111:5001/api",
'url': "http://192.168.99.67:8080/frontDemoApi",
}, },
prodProxy: { prodProxy: {
//'url': "http://192.168.99.111:5001",
//'url': 'https://testapi.aiyxlib.com',
'url': 'https://rosefinchapi.aiyxlib.com/api'
'url': 'https://rosefinchapi.aiyxlib.com/frontDemoApi'
} }
} }

14
library-activity/src/assets/css/style.scss

@ -104,6 +104,10 @@
background-color: #f1f1f1; background-color: #f1f1f1;
border-radius: 0.04rem; border-radius: 0.04rem;
overflow: hidden; overflow: hidden;
img{
display: block;
width: 100%;
}
} }
.product-txt{ .product-txt{
flex: 1; flex: 1;
@ -343,9 +347,10 @@
position: relative; position: relative;
padding-top: .3rem; padding-top: .3rem;
.book-inventory{ .book-inventory{
position: absolute;
top: 2rem;
left: 0;
// position: absolute;
// top: 2rem;
// left: 0;
margin-top: .1rem;
font-size: .2rem; font-size: .2rem;
padding: 0.06rem 0; padding: 0.06rem 0;
width: 1.18rem; width: 1.18rem;
@ -371,9 +376,10 @@
color: #757676; color: #757676;
line-height: .36rem; line-height: .36rem;
.txt-title{ .txt-title{
width: 1.42rem;
// width: 1.42rem;
} }
.intro-txt{ .intro-txt{
flex: 1;
// width: 3.4rem; // width: 3.4rem;
color: #191A1A; color: #191A1A;
opacity: 1; opacity: 1;

418
library-activity/src/utils/api.js

@ -1,417 +1,23 @@
const API = {} const API = {}
// 在线选书活动页面
API.ONLINESELECTLIST = '/onlineSelectList';
//获取阅文
API.GETDOC = '/IndexApp/GetDoc';
// 在线选书二级页面
API.BOOKONLINELIST = '/bookOnlineList';
//获取视频
API.GETVIDEO = '/IndexApp/GetVideo';
// 在线选书详情
API.BOOKONLINEDETAIL = '/bookOnlineDetails'
//获取电子图书
API.GETEBOOKS = '/IndexApp/GetEBooks';
// 加入书车
API.ADDBOOKTOSHOPPINGCART = '/addBookToShoppingCart'
// 获取新闻公告
API.GETNEWS = '/IndexApp/GetNews';
// 我的书车
API.MYSHOPPINGCART = '/myShoppingCart'
// 获取banners
API.GETBANNERS = '/IndexApp/GetBanners';
// 登录
API.LOGIN = '/Account/AppLogin';
//注册页面获取图书馆列表
API.GETLIBRARYINFO= '/Account/libraryInfo';
//发送修改密码验证码
API.FORGOTACCOUNTMESSAGE= '/Account/ForgotAccountMessage';
///校验验证码
API.FORGOTVERIFICATIONCODE= '/Account/ForgotVerificationCode';
//搜索资料 GET application/x-www-form-urlencoded
API.SEARCHDOC= '/Docment/SearchDoc';
// 获取资料专题
API.GETTOPICS= '/Docment/Topics';
// 根据标识获取所属的二级类别
API.GETSECCLASS= '/Class/GetSecClass';
// 获取资料Banner
API.GETDOCBANNER= '/WebMobile/GetDocBanner';
// 首页获取视频列表
API.GETVIDEOBYMARkREC= '/Video/GetVideoByMarkRec';
// 获取视频专题列表
API.GETVIDEOTHEMETOP= '/Video/GetVideoThemeTop';
// 获取视频Banner
API.GETVIDEOBANNERS= '/WebMobile/GetVideoBanner';
//获取首页读书列表
API.GETBOOKBYMARkREC= '/EBook/GetBookByMarkRec';
// 获取电子书专题(Top)
API.GETBOOKTHEMETOP= '/EBook/GetBookThemeTop';
//获取电子书专题banner
API.GETBOOKBANNERS= '/WebMobile/GetEBookBanner';
//搜索电子图书 GET application/x-www-form-urlencoded
API.GETBOOKBASEPAGES= '/EBook/GetBookBasePages';
//根据ID获取主表信息
API.GETBOOKBASE= '/EBook/GetBookBase';
// 根据主表Id获取详情列表并获取进度 GET application/json
API.GETBASEANDDETAILSID= '/EBook/GetBaseAndDetailsAndResourceByBaseId',
//根据图书主表Id和图书资源主表Id获取图书资源信息并获取进度
API.GETRESOURCEANDUSEDBYRESOURCEID= '/EBook/GetResourceAndUsedByResourceId',
// 获取评论列表
API.GETCOMMENTPAGES= '/Comment/GetCommentPages',
// 加入收藏 post application/x-www-form-urlencoded
API.SETCOLLECTS= '/MyCollect/SetCollects';
// 猜你喜欢读书列表
API.GETEBOOKSMORE= '/EBook/GetMore';
// 评论答案
API.ADDCOMMENT= '/Comment/AddComment';
// 添加评论回复
API.ADDCOMMENTBACK= '/Comment/AddCommentBack';
// 评论举报
API.ADDREPORT= '/Report/AddReport';
// 用户点赞(目前对象包括:评论/回复、动态、问题、回答)
API.CUSTLIKE= '/Use/CustLike';
// 获取我的收藏
API.GETMYCOLLECTSPAGES= '/MyCollect/GetMyCollectsPages';
// 检查我的收藏资源状态
API.CHECKMYCOLLECTSSTATE= '/MyCollect/CheckMyCollectsState';
//获取验证注册规则
API.GETVERIFY = '/Account/GetVerify';
//发送注册验证码
API.SENDMSGCODE = '/Account/SendMsgCode';
//注册
API.REGISTER = '/Account/RegisterNew';
//获取阅文首页其他所有数据列表
API.GETDOCHOMEPAGEALL = '/WebMobile/GetDocHomePageAll';
//获取视频首页其他所有数据列表
API.GETVIDEOHOMEPAGEALL = '/WebMobile/GetVideoHomePageAll';
//获取读书首页其他所有数据列表
API.GETBOOKHOMEPAGEALL = '/WebMobile/GetEBookHomePageAll';
// 资料主表ID获取资料主表信息
API.GETCONTENT= '/Docment/GetContent';
// 获取资料(章节)内容
API.DOCDETAILS= '/Docment/DocDetails';
// 获取资料目录
API.CATALOG= '/Docment/Catalog';
//注册验证
API.CHECKREGISTERVERITY = '/Account/CheckRegisterVerityJson';
//修改密码
API.FORGOTACCOUNT = '/Account/ForgotAccount';
//获取GetQiniuDomain
API.GETQINIUDOMAIN = '/Dictionary/GetQiniuDomain';
//猜你还想看
API.GETVIDEOMORE = '/Video/GetMore';
//根据ID获取视频主表信息
API.GETVIDEOBASE = '/Video/GetVideoBase';
//加入收藏 POST application/x-www-form-urlencoded
API.SETCOLLECTS = '/MyCollect/SetCollects';
//根据主表Id获取详情列表并获取进度 GET application/json
API.GETDETAILSANDUSEDBYBASEID = '/Video/GetDetailsAndUsedByBaseIdNew';
//评论举报 POST application/x-www-form-urlencoded
API.ADDREPORT = '/Report/AddReport';
// 根据详情Id获取详情并更新进度 GET application/json
API.GETDETAIlLANDEDITUSEDBYID = '/Video/GetDetailAndEditUsedById';
//根据目录索引图书详情并更新进度 PUT application/json
API.GETLISTANDUPDATEUSED = '/EBook/GetListAndUpdateUsed';
//添加书签,笔记,划线 POST application/json
API.ADDBOOKMARK = '/EBook/AddBookMark';
//移除书签 PUT application/json
API.DELBOOkMARK = '/EBook/DelBookMark';
// 根据主表Id获取详情列表并获取进度 GET application/json
API.GETBOOKMARKPAGES = '/EBook/GetBookMarkPages';
// 加入收藏 POST application/x-www-form-urlencoded
API.SetCollects = '/MyCollect/SetCollects';
//获取问题标签 GET application/json
API.GEQUESTIONSTAGS = '/Question/GetTags';
//获取问题列表 GET application/json
API.GETQUESTIONPAGES = '/Question/GetQuestionPages';
//获取答主榜 GET application/json
API.GETTOPCUSTANSWER = '/Answer/GetTopCustAnswer';
//搜索视频 GET application/x-www-form-urlencoded
API.GETVIDEOBASEPAGES = '/Video/GetVideoBasePages';
//搜索词记录 POST application/x-www-form-urlencoded
API.ADDHOTSEARCHLOG = '/HotSearch/AddHotSearchLog';
//获取搜索热词 GET application/x-www-form-urlencoded
API.GETHOTSEARCH = '/HotSearch/GetHotSearch';
//获取AI新闻列表 GET application/x-www-form-urlencoded
API.LISTNEW = '/News/ListNew';
//获取新闻详情 GET application/x-www-form-urlencoded
API.NEWSDETAIL = '/News/Detail';
//猜你喜欢 GET application/x-www-form-urlencoded
API.GETNEWSMORE = '/News/GetMore';
//修改用户信息 POST application/x-www-form-urlencoded
API.EDITUSERINFO = '/Me/EditUserinfo';
//获取用户信息 GET application/x-www-form-urlencoded
API.GETUSERINFO = '/Me/GetUserInfo';
//上传 GET application/json
API.UPLOADTOKENEASY = '/Me/UploadTokenEasy';
//七牛云辅助 GET application/json
API.UPLOADHELPER = '/Me/UploadHelper';
//查询读者号 GET application/x-www-form-urlencoded
API.GETCRAD = '/Me/GetCrad';
//绑定微信 POST application/x-www-form-urlencoded
API.WECHATBIND = '/Me/WeChatBinding';
//微信解绑 PUT application/x-www-form-urlencoded
API.WECHATUNBOUND = '/Me/WeChatUnbound';
//切换读者证 无toke版 PUT application/x-www-form-urlencoded
API.CHANGEREADERCODE = '/Account/ChangeReaderCode';
//切换读者证 toke版 PUT application/x-www-form-urlencoded
API.CHANGEREADERCODETOKEN = '/Account/ChangeReaderCodeToken';
//阅刊列表(需登录) GET application/json
API.GETTHEMEPAGES = '/ThemeList/GetThemePages';
//阅刊更新点击量 PUT application/x-www-form-urlencoded
API.UPCLICKNUM = '/ThemeList/UpClickNum';
//获取微信token GET application/json
API.GETWECHATTOkEN = '/WeChat/GetToken';
//获取微信用户信息 GET application/json
API.GETWECHATUSERINFO = '/WeChat/GetUserInfo';
//获取Vr列表 GET application/json
API.GETVRPAGES = '/VR/GetVRPages';
//修改手机号获取验证码 POST application/json
API.CHANGEPHONEMESSAGE = '/Account/ChangePhoneMessage';
//修改手机号 PUT application/json
API.EDITPHONE = '/Account/EditPhone';
//获取活动banner GET
API.GETACTBANNERS = '/Activity/GetActBanners';
//获取活动 GET application/x-www-form-urlencoded
// API.GETRECENT = '/Activity/GetRecent';
//线上线下活动混排列表 GET application/x-www-form-urlencoded
API.GETACTALLLIST = '/IndexPc/GetActAllList';
//线上活动列表 GET application/x-www-form-urlencoded
API.GETACTONLINEPAGES = '/ActOnline/GetActOnlinePages';
//线下活动列表 GET application/x-www-form-urlencoded
API.GETACTIVITYPAGES = '/Activity/GetActivityPages';
//获取活动详情 GET application/x-www-form-urlencoded
API.GETACTIVITYDETAILS = '/Activity/GetActivityDetails';
//获取走进AI列表 GET application/json
API.GETAPPROACHLISTPAGES = '/Approach/GetApproachListPages';
//发送意见反馈 POST application/x-www-form-urlencoded
API.ADDFEEDBACKLITE = '/Feedback/AddFeedbackLite';
//关于我们 GET application/json
API.GETABOUTOUR = '/OtherInformation/GetInfoPagesLite';
//关于我们详情 GET application/json
API.GETABOUTOURDETAIL= '/OtherInformation/GetInfoById';
//获取排行榜 GET application/json
API.GETTOPBASE = '/Approach/GetTopBase';
//根据排行榜ID获取榜单 GET application/json
API.GETTOPLISTBYID = '/Approach/GetTopListById';
//获取走进AI信息 GET application/json
API.GETAPPROACHBYID = '/Approach/GetApproachById';
//获取关于TA列表 GET application/json
API.GETAPPROACHDETAILSLIST = '/Approach/GetApproachDetailsList';
//获取更多大师 GET application/json
API.GETAPPROACHLISTMORE = '/Approach/GetApproachListMore';
//获取关于TA列表-详情-基本信息 GET application/json
API.GETAPPROACHDETAILSBYID = '/Approach/GetApproachDetailsById';
//获取关于TA列表 GET application/json
API.GETAPPROACHDETAILSLISTMORE = '/Approach/GetApproachDetailsListMore';
//获取所有走进Ai二级分类 GET application/json
API.GETAPPROACHCLASS = '/Approach/GetClass';
//系统消息已读 PUT application/x-www-form-urlencoded
API.EDITMYMESSAGESCHECKED = '/MyMessages/EditMyMessagesChecked';
//获取消息数量 GET application/x-www-form-urlencoded
API.GETNUMNOCHECKED = '/MyMessages/GetNumNoChecked';
//获取我的回复消息 PUT application/x-www-form-urlencoded
API.EDITMYQUESTIONACHECKED = '/MyMessages/EditMyQuestionAChecked';
// 获取我的答案的评论回复 GET application/x-www-form-urlencoded
API.GETMYANSWERCOMMENTPAGES = '/MyMessages/GetMyAnswerCommentPages';
//获取系统消息 GET application/x-www-form-urlencoded
API.GETMYMESSAGESPAGES = '/MyMessages/GetMyMessagesPages';
//回复评论已读 PUT application/x-www-form-urlencoded
API.EDITMYCOMMENTCHECkED = '/MyMessages/EditMyCommentChecked';
//根据类型和详情ID获取主表ID跳转 GET application/x-www-form-urlencoded
API.GETBASEIDBYTYPEANDDETAILSID = '/MyMessages/GetBaseIdByTypeAndDetailsId';
//获取我的回复消息 GET application/x-www-form-urlencoded
API.GETMYCOMMENTPAGESNEW = '/MyMessages/GetMyCommentPagesNew';
//动态列表 GET application/x-www-form-urlencoded
API.GETDYNAMICPAGES = '/Dynamic/GetDynamicPages';
//动态列表 POST application/x-www-form-urlencoded
API.DYNAMICEDITATTN = '/Dynamic/EditAttn';
//根据动态ID获取详情 GET application/x-www-form-urlencoded
API.GETDYNAMICBYIDFORAPP = '/Dynamic/GetDynamicByIDForAPP';
//发布动态 POST application/x-www-form-urlencoded
API.ADDDYNAMIC = '/Dynamic/AddDynamic';
//获取第三方个人信息 GET application/json
API.GETOTHERUSERINFO = '/Me/GetOtherUserInfo';
//获取第三方问题 GET application/json
API.GETOTHERQUESTIONPAGES = '/Question/GetOtherQuestionPages';
//我的关注 GET application/json
API.MINEATTN = '/Dynamic/MineAttn';
//获取第三方关注 GET application/json
API.OTHERATTN = '/Dynamic/OtherAttn';
//我的粉丝 GET application/json
API.DYNAMICATTNME = '/Dynamic/AttnMe';
//获取第三方粉丝 GET application/json
API.DYNAMICATTNOTHER = '/Dynamic/AttnOther';
//点赞 PUT application/x-www-form-urlencoded
API.USELIKE = '/Use/UseLike';
//获取答案列表 GET application/x-www-form-urlencoded
API.GETANSEWRPAGES = '/Answer/GetAnswerPages';
//获取问题详情 GET application/json
API.GETQUESTIONBYID = '/Question/GetQuestionByID';
//发布回答 POST application/x-www-form-urlencoded
API.ADDANSWER = '/Answer/AddAnswer';
//发布问题 POST application/x-www-form-urlencoded
API.ADDQUESTION = '/Question/AddQuestion';
//用户积分明细列表 GET application/json
API.GETCUSTPOINTSLOGPAGES = '/Points/GetCustPointsLogPages';
//获取我的积分信息(当前) GET application/json
API.GETMYPOINTSINFONOW = '/Points/GetMyPointsInfoNow';
//添加积分记录 POST application/x-www-form-urlencoded
API.ADDPOINTLOG = '/Points/AddPointLog';
//根据任务标识获取积分任务并判断任务是否完成 GET application/json
API.GETPOINTSBYCODEANDCHECKISOVER = '/Points/GetPointsByCodeAndCheckIsOver';
//获取3D列表 GET application/json
API.GETVRLIST = '/IndexPc/GetVRList';
//我的邀请(邀请回答) GET application/json
API.GETMYINVITATION = '/Question/GetMyInvitation';
//邀请我的(邀请回答) GET application/json
API.GETINVITEME = '/Question/GetInviteMe';
//邀请回答人员列表(一页显示6人,最多显示5页,共计30人) GET application/json
API.GETCUSTFORANSWER = '/Question/GetCustForAnswer';
//添加邀请答题人信息 POST application/x-www-form-urlencoded
API.ADDCUSTFORANSWER = '/Question/AddCustForAnswer';
//邀请我的标记已读 PUT application/x-www-form-urlencoded
API.EDITINVITEMECHECKED = '/MyMessages/EditInviteMeChecked';
//根据sid获得机构信息 GET application/json
API.GETCLNTBYSID = '/Account/GetClntBySid';
//微信登录(新用户注册则返回userinfo) POST application/x-www-form-urlencoded
API.WECHATLOGIN = '/Account/WeChatLogin';
//微信注册 POST application/x-www-form-urlencoded
API.WECHATREGISTER = '/Account/WeChatRegister';
// 获取问答Banner
API.GETANSWERBANNERS= '/Answer/GetBanners';
// 获取JS_SDK Config 相关配置参数 GET application/json
API.GETWXJSCONFIG = '/WeChat/GetWXJSConfig';
// 根据答案Id获取答案详情(APP专用) GET application/json
API.GETANSWERBYIDFORAPP = '/Answer/GetAnswerByIdForApp';
// 删除书车
API.DELETBOOKTOSHOPPINGCART = '/deleteBookToShoppingCart'
export default API export default API

186
library-activity/src/views/bookList/bookList.vue

@ -6,13 +6,13 @@
<img @click="toCart" style="width: .48rem;" src="@assets/images/cart.png" alt="" /> <img @click="toCart" style="width: .48rem;" src="@assets/images/cart.png" alt="" />
</div> </div>
<div class="bookList-main"> <div class="bookList-main">
<input type="text" v-model="query" placeholder="搜索" class="search-input" />
<input type="search" v-model="search" placeholder="搜索" v-on:keyup.enter="getSearch" class="search-input" />
<div class="banner"> <div class="banner">
<img src="@assets/images/banner.png" alt="" /> <img src="@assets/images/banner.png" alt="" />
</div> </div>
<div class="booList-all"> <div class="booList-all">
<div class="booList-filter"> <div class="booList-filter">
<select v-model="selectedValue">
<select v-model="selectedValue" @change="getSearch">
<option value="1">热度降序</option> <option value="1">热度降序</option>
<option value="2">热度升序</option> <option value="2">热度升序</option>
<option value="3">价格降序</option> <option value="3">价格降序</option>
@ -25,25 +25,25 @@
finished-text="没有更多了" finished-text="没有更多了"
@load="onLoad" @load="onLoad"
> >
<div class="book-item" v-for="(item,index) in list" :key="item" @click="showDetial=true">
<div class="book-item" v-for="(item,index) in list" :key="index" @click="getOnlineBookDetail(item.id)">
<div class="product-cont"> <div class="product-cont">
<div class="product-img"><img src="" alt="" /></div>
<div class="product-img"><img :src="'http://192.168.99.67:8080/demoOnlineSelect/getBookCover.do?id='+item.id" alt="" /></div>
<div class="product-txt"> <div class="product-txt">
<div class="product-info"> <div class="product-info">
<h4 class="overflow-txt">秒懂AI提问让人工智能开发大脑{{ item }} </h4>
<h4 class="overflow-txt">{{item.bookName}}</h4>
<div class="author-date"> <div class="author-date">
<p class="author overflow-txt-only">秋叶 刘进新 姜梅 定秋枫</p>
<p class="date overflow-txt-only">2023年07月</p>
<p class="author overflow-txt-only">{{item.author}}</p>
<p class="date overflow-txt-only">{{ item.createdDate }}</p>
</div> </div>
<p class="book-publish">人民邮电出版社</p>
<p class="book-publish">{{ item.publish }}</p>
</div> </div>
</div> </div>
<div class="dealer"> 京东商城</div>
<div class="dealer">{{ item.supplierName }}</div>
</div> </div>
<div class="sales-progress"> <div class="sales-progress">
<van-progress :percentage="50" :show-pivot="false" color="#5A86F4" stroke-width=".17rem" />
<p>已定<span>5</span></p>
<p>剩余<span>5</span></p>
<van-progress :percentage="(item.purchase / item.total) * 100" :show-pivot="false" color="#5A86F4" stroke-width=".17rem" />
<p>已定<span>{{ item.purchase }}</span></p>
<p>剩余<span>{{ parseInt(item.total)-parseInt(item.purchase) }}</span></p>
</div> </div>
</div> </div>
</van-list> </van-list>
@ -58,46 +58,49 @@
</div> </div>
</div> </div>
<div class="product-cont"> <div class="product-cont">
<div class="product-img">
<img src="" alt="" />
</div>
<div class="book-inventory">
<p>剩余库存</p>
<span><i>5</i></span>
<div class="product-cont-left">
<div class="product-img">
<img :src="'http://192.168.99.67:8080/demoOnlineSelect/getBookCover.do?id='+detailBook.id" alt="" />
</div>
<div class="book-inventory">
<p>剩余库存</p>
<span><i>{{ parseInt(detailBook.total)-parseInt(detailBook.purchase) }}</i></span>
</div>
</div> </div>
<div class="product-txt"> <div class="product-txt">
<div class="product-info"> <div class="product-info">
<h4>秒懂AI提问让人工智能开发大脑</h4>
<h4>{{ detailBook.bookName }}</h4>
<div class="bookItem-txt"> <div class="bookItem-txt">
<span>著者</span> <span>著者</span>
<p class="author">秋叶 刘进新 姜梅 定秋枫</p>
<p class="author">{{ detailBook.author }}</p>
</div> </div>
<div class="bookItem-txt"> <div class="bookItem-txt">
<span>出版社</span> <span>出版社</span>
<p>人民邮电出版社</p>
<p>{{ detailBook.publish }}</p>
</div> </div>
<div class="bookItem-txt"> <div class="bookItem-txt">
<span>出版时间</span> <span>出版时间</span>
<p>2023年07月</p>
<p>{{ detailBook.createdDate }}</p>
</div> </div>
<div class="bookItem-txt"> <div class="bookItem-txt">
<span class="txt-title">简介</span>
<p class="intro-txt">精心提炼20种GPT提问方法及指令从入门到进阶再到精通100个案例带你玩</p>
<!-- :style="{ width: detailBook.introduce !== '' ? '1.42rem' : 'auto' }" -->
<span class="txt-title">简介</span>
<p class="intro-txt">{{ detailBook.introduce !== '' ? detailBook.introduce : '暂无简介'}}</p>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="order-dealer"> <div class="order-dealer">
<p class="dealer">京东商城</p>
<p class="dealer">{{ detailBook.supplierName }}</p>
<div class="order-pay"> <div class="order-pay">
<p>实付款<span><i></i>0</span></p> <p>实付款<span><i></i>0</span></p>
<span class="yj-price"><i></i><em>129.0</em></span>
<span class="yj-price"><i></i><em>{{ detailBook.price }}</em></span>
</div> </div>
</div> </div>
</div> </div>
<div class="dialog-btn"> <div class="dialog-btn">
<span @click="showDetial=false">取消</span> <span @click="showDetial=false">取消</span>
<span class="btn-comfired" @click="addCart">加入书车</span>
<span class="btn-comfired" @click="addCart(detailBook)">加入书车</span>
</div> </div>
</van-dialog> </van-dialog>
</div> </div>
@ -111,36 +114,118 @@ export default {
setup() { setup() {
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
let data = reactive({ let data = reactive({
query: '',
activeId: null,
search: '',
selectedValue: '1', selectedValue: '1',
showDetial: false,
list:[], list:[],
showDetial: false,
detailBook: null,
loading: false, loading: false,
finished: false
finished: false,
pagetTable: {
current: 1,
size: 10,
total: '',
}
}) })
onMounted(() => {})
onMounted(() => {
data.activeId = proxy.$route.query.activeId
})
let toBack = () => { let toBack = () => {
proxy.$router.push({ path: '/' }) proxy.$router.push({ path: '/' })
} }
let onLoad = () => {
//
setTimeout(() => {
for (let i = 0; i < 10; i++) {
data.list.push(data.list.length + 1);
}
//
data.loading = false;
let getBookLineList = () => {
let param = {
pageNo: data.pagetTable.current,
pageSize: data.pagetTable.size,
orderType: data.selectedValue,
recommendId: data.activeId,
search: data.search
}
proxy.$http
.get(proxy.$API.BOOKONLINELIST,
{
params: param
}
)
.then(res => {
if (res.length === 0) {
data.list = [];
data.finished = true;
}
data.pagetTable.total = res.data.page.totalRows
data.list.push(...res.data.bookList)
data.loading = false
if (data.list.length >= res.data.page.totalRows) {
data.finished = true
}
})
.catch((res) => {
console.log(res)
})
}
let getSearch = () =>{
data.pagetTable.current = 1
data.loading = true
data.finished = false
data.list = []
onLoad()
}
//
if (data.list.length >= 40) {
data.finished = true;
}
let onLoad = () => {
let timer = setTimeout(() => {
getBookLineList()
data.pagetTable.current ++
data.finished && clearTimeout(timer);//
}, 1000); }, 1000);
} }
let addCart = () => {
data.showDetial = false
Toast('当前书籍已成功加入书车')
let getOnlineBookDetail = (bookId) => {
proxy.$http
.post(proxy.$API.BOOKONLINEDETAIL,
{
bookId: bookId
},
{
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}
)
.then(res => {
data.detailBook = res.data.book
data.showDetial = true
})
.catch((res) => {
console.log(res)
})
}
let addCart = (detailBook) => {
proxy.$http
.post(proxy.$API.ADDBOOKTOSHOPPINGCART,
{
bookId: detailBook.id,
onlineSelectId: detailBook.listId,
supplierId: detailBook.supplierId
},
{
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}
)
.then(res => {
console.log(res)
Toast('当前书籍已成功加入书车')
data.showDetial = false
})
.catch((res) => {
console.log(res)
})
} }
let toCart = () => { let toCart = () => {
proxy.$router.push({ path: '/Cart' }) proxy.$router.push({ path: '/Cart' })
@ -150,7 +235,10 @@ export default {
toBack, toBack,
addCart, addCart,
onLoad, onLoad,
toCart
toCart,
getBookLineList,
getOnlineBookDetail,
getSearch
} }
}, },
} }
@ -164,8 +252,8 @@ export default {
.search-input{ .search-input{
display: block; display: block;
padding: .18rem .18rem .18rem .66rem; padding: .18rem .18rem .18rem .66rem;
width: calc(100% - .84rem);
height: .32rem;
width: 100%;
// height: .32rem;
line-height: .32rem; line-height: .32rem;
font-size: .26rem; font-size: .26rem;
background: url('@assets/images/search.png') no-repeat #F1F4FE .24rem center; background: url('@assets/images/search.png') no-repeat #F1F4FE .24rem center;

145
library-activity/src/views/cart/cart.vue

@ -10,28 +10,28 @@
<div class="list-top"> <div class="list-top">
<van-checkbox v-model="activeSelect" @change="handleselectedAll"></van-checkbox> <van-checkbox v-model="activeSelect" @change="handleselectedAll"></van-checkbox>
<div class="top-info"> <div class="top-info">
<p class="active-name">你选书我买单<i></i></p>
<p class="dealer">京东商城</p>
<p class="active-name">{{ list[0].selectName }}<i></i></p>
<p class="dealer">{{ list[0].supplierName }}</p>
</div> </div>
</div> </div>
<div class="product-list"> <div class="product-list">
<div v-for="(item,index) in list" :key="item.id" class="product-item" > <div v-for="(item,index) in list" :key="item.id" class="product-item" >
<van-checkbox v-model="item.checked" @change="handleSingle(index)"></van-checkbox> <van-checkbox v-model="item.checked" @change="handleSingle(index)"></van-checkbox>
<div class="product-cont" @click="showDetial=true">
<div class="product-img"><img src="" alt="" /></div>
<div class="product-cont" @click="getOnlineBookDetail(item.bookId)">
<div class="product-img"><img :src="'http://192.168.99.67:8080/demoOnlineSelect/getBookCover.do?id='+item.bookId" alt="" /></div>
<div class="product-txt"> <div class="product-txt">
<div class="product-info"> <div class="product-info">
<h4 class="overflow-txt-only">秒懂AI提问让人工智能开发大脑 {{ item.id }} </h4>
<h4 class="overflow-txt-only">{{item.bookName}} </h4>
<div class="author-date"> <div class="author-date">
<p class="author overflow-txt-only">秋叶 刘进新 姜梅 定秋枫</p>
<p class="date overflow-txt-only ">2023年07月</p>
<p class="author overflow-txt-only">{{item.author}}</p>
<p class="date overflow-txt-only">{{item.createdDate}}</p>
</div> </div>
<div class="intro overflow-txt">精心提炼20种GPT提问方法及指令从入门到进阶再到精通100个案例带你玩</div>
<div class="intro overflow-txt">{{item.introduce}}</div>
</div> </div>
<div class="product-bottom"> <div class="product-bottom">
<p class="product-price">实付款 <span><i class="rmb"></i>29.0</span><i><em></em>129.0</i></p>
<p class="product-price">实付款 <span><i class="rmb"></i>0</span><i><em></em>{{item.price}}</i></p>
<span v-if="!isDeltHandle" class="product-num">x1</span> <span v-if="!isDeltHandle" class="product-num">x1</span>
<span v-else class="item-delt" @click.stop="deltCurrentItem('active1',item.id)"></span>
<span v-else class="item-delt" @click.stop="deltCurrentItem(item.bookId)"></span>
</div> </div>
</div> </div>
</div> </div>
@ -66,40 +66,43 @@
</div> </div>
</div> </div>
<div class="product-cont"> <div class="product-cont">
<div class="product-img">
<img src="" alt="" />
</div>
<div class="book-inventory">
<p>剩余库存</p>
<span><i>5</i></span>
<div class="product-cont-left">
<div class="product-img">
<img :src="'http://192.168.99.67:8080/demoOnlineSelect/getBookCover.do?id='+detailBook.id" alt="" />
</div>
<div class="book-inventory">
<p>剩余库存</p>
<span><i>{{ parseInt(detailBook.total)-parseInt(detailBook.purchase) }}</i></span>
</div>
</div> </div>
<div class="product-txt"> <div class="product-txt">
<div class="product-info"> <div class="product-info">
<h4>秒懂AI提问让人工智能开发大脑</h4>
<h4>{{ detailBook.bookName }}</h4>
<div class="bookItem-txt"> <div class="bookItem-txt">
<span>著者</span> <span>著者</span>
<p class="author">秋叶 刘进新 姜梅 定秋枫</p>
<p class="author">{{ detailBook.author }}</p>
</div> </div>
<div class="bookItem-txt"> <div class="bookItem-txt">
<span>出版社</span> <span>出版社</span>
<p>人民邮电出版社</p>
<p>{{ detailBook.publish }}</p>
</div> </div>
<div class="bookItem-txt"> <div class="bookItem-txt">
<span>出版时间</span> <span>出版时间</span>
<p>2023年07月</p>
<p>{{ detailBook.createdDate }}</p>
</div> </div>
<div class="bookItem-txt"> <div class="bookItem-txt">
<span class="txt-title">简介</span>
<p class="intro-txt">精心提炼20种GPT提问方法及指令从入门到进阶再到精通100个案例带你玩</p>
<!-- :style="{ width: detailBook.introduce !== '' ? '1.42rem' : 'auto' }" -->
<span class="txt-title">简介</span>
<p class="intro-txt">{{ detailBook.introduce !== '' ? detailBook.introduce : '暂无简介'}}</p>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="order-dealer"> <div class="order-dealer">
<p class="dealer">京东商城</p>
<p class="dealer">{{ detailBook.supplierName }}</p>
<div class="order-pay"> <div class="order-pay">
<p>实付款<span><i></i>0</span></p> <p>实付款<span><i></i>0</span></p>
<span class="yj-price"><i></i><em>129.0</em></span>
<span class="yj-price"><i></i><em>{{ detailBook.price }}</em></span>
</div> </div>
</div> </div>
</div> </div>
@ -126,28 +129,87 @@ export default {
isDeltHandle: false, isDeltHandle: false,
showDetial: false, showDetial: false,
list:[], list:[],
checkedCount: []
checkedCount: [],
detailBook: null
}) })
onMounted(() => { onMounted(() => {
for (let i = 0; i < 2; i++) {
const json = {}
json.checked = false
json.id = data.list.length + 1
data.list.push(json);
}
getMyshoppingCart()
}) })
let getMyshoppingCart = () => {
let param = {
}
proxy.$http
.get(proxy.$API.MYSHOPPINGCART,
{
params: param
}
)
.then(res => {
data.list = res.data[0]
})
.catch((res) => {
console.log(res)
})
}
let getOnlineBookDetail = (bookId) => {
proxy.$http
.post(proxy.$API.BOOKONLINEDETAIL,
{
bookId: bookId
},
{
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}
)
.then(res => {
data.detailBook = res.data.book
data.showDetial = true
})
.catch((res) => {
console.log(res)
})
}
let deltBookShoppingCart = (ids) => {
let param = {
ids: ids
}
proxy.$http
.post(proxy.$API.DELETBOOKTOSHOPPINGCART,
param,{
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}
)
.then(res => {
})
.catch((res) => {
console.log(res)
})
}
let goPay = () => { let goPay = () => {
proxy.$router.push({ path: '/CartResult' }) proxy.$router.push({ path: '/CartResult' })
} }
let cartDelt = () =>{ let cartDelt = () =>{
data.isDeltHandle = !data.isDeltHandle data.isDeltHandle = !data.isDeltHandle
} }
let deltCurrentItem = (type, itemIndex) =>{
const targetList = type === 'active1' ? data.list : data.list2
const index = targetList.findIndex(item => item.id === itemIndex)
let deltCurrentItem = (bookId) =>{
// const targetList = type === 'active1' ? data.list : data.list2
const index = data.list.findIndex(item => item.bookId === bookId)
if (index !== -1) { if (index !== -1) {
targetList.splice(index, 1)
// data.list.splice(index, 1)
let ids = [];
ids.push(data.list[index].bookId)
ids = ids.join(',');
deltBookShoppingCart(ids)
} }
} }
@ -170,7 +232,13 @@ export default {
let confirmDelt = () => { let confirmDelt = () => {
if(data.activeSelect){ if(data.activeSelect){
data.list = []
// data.list = []
// let ids = [];
// for (let i = 0; i < data.list.length; i++) {
// ids.push(data.list[i].bookId)
// }
// ids = parse.ids.join(',');
// deltBookShoppingCart(ids)
}else{ }else{
const index = data.list.findIndex(p => p.checked); const index = data.list.findIndex(p => p.checked);
if (index !== -1) { if (index !== -1) {
@ -188,7 +256,10 @@ export default {
deltCurrentItem, deltCurrentItem,
handleselectedAll, handleselectedAll,
handleSingle, handleSingle,
confirmDelt
confirmDelt,
getMyshoppingCart,
getOnlineBookDetail,
deltBookShoppingCart
} }
} }
} }

335
library-activity/src/views/index.vue

@ -3,61 +3,23 @@
<!-- <div class="index-header">当前活动</div> --> <!-- <div class="index-header">当前活动</div> -->
<div class="active-main"> <div class="active-main">
<div class="active-list"> <div class="active-list">
<div class="active-item" @click="toActiveDetail">
<div v-for="item in data.activeList" :key="item.id" class="active-item" @click="toActiveDetail">
<div class="active-img"> <div class="active-img">
<img src="@assets/images/bookimg.png" alt="" />
<span>限选3</span>
<img :src="'http://192.168.99.67:8080/demoOnlineSelect/getImage.do?id='+item.id" alt="" />
<span>限选{{item.maxBuy}}</span>
</div> </div>
<div class="active-info"> <div class="active-info">
<div class="active-info-top"> <div class="active-info-top">
<h4>你选书我买单</h4>
<span></span>
<h4>{{item.name}}</h4>
<span>{{ item.activeStatus }}</span>
</div> </div>
</div> </div>
<div class="active-time"> <div class="active-time">
活动时间2023/10/1 - 2023/12/31
活动时间{{item.startTime.split(" ")[0].replace(/-/g, '/') + ' - ' + item.endTime.split(" ")[0].replace(/-/g, '/')}}
</div> </div>
<div class="active-bottom"> <div class="active-bottom">
<p class="active-slogn">新书 · 选书· 下单· 借阅</p>
<span class="active-btn" @click.stop="toBookList"></span>
</div>
</div>
<div class="active-item">
<div class="active-img">
<img src="@assets/images/bookimg.png" alt="" />
<span>限选3册</span>
</div>
<div class="active-info">
<div class="active-info-top">
<h4>你选书我买单</h4>
<span>活动仅剩最后3天</span>
</div>
</div>
<div class="active-time">
活动时间2023/10/1 - 2023/12/31
</div>
<div class="active-bottom">
<p class="active-slogn">新书 · 选书· 下单· 借阅</p>
<span class="active-btn"></span>
</div>
</div>
<div class="active-item">
<div class="active-img">
<img src="@assets/images/bookimg.png" alt="" />
<span>限选3册</span>
</div>
<div class="active-info">
<div class="active-info-top">
<h4>你选书我买单</h4>
<span>12.13 09:00开始</span>
</div>
</div>
<div class="active-time">
活动时间2023/10/1 - 2023/12/31
</div>
<div class="active-bottom">
<p class="active-slogn">新书 · 选书· 下单· 借阅</p>
<span class="active-btn wait-btn"></span>
<p class="active-slogn">{{item.name2}}</p>
<span :class="[ item.activeStatusType !==0 ? 'active-btn' : 'active-btn wait-btn']" @click.stop="toBookList(item.id)"></span>
</div> </div>
</div> </div>
</div> </div>
@ -72,248 +34,83 @@
<script> <script>
import { reactive, computed, onMounted, getCurrentInstance } from 'vue' import { reactive, computed, onMounted, getCurrentInstance } from 'vue'
import TabBar from '@/components/tabBar/index.vue' import TabBar from '@/components/tabBar/index.vue'
import { useStore, mapGetters } from 'vuex'
import { useRoute } from 'vue-router'
import { isWeiXin } from '@/utils/tool.js'
import { Toast } from 'vant' import { Toast } from 'vant'
export default { export default {
components: { TabBar }, components: { TabBar },
setup() { setup() {
const store = useStore()
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const data = reactive({ const data = reactive({
tabCur: 0, tabCur: 0,
isWeiXin: true,
weChatUserInfo: {},
showLoginDialog: false,
isTryOutLogin: true,
key: '',
iv: '',
activeList: [],
activeStatusType: null
}) })
onMounted(async () => { onMounted(async () => {
data.isWeiXin = isWeiXin()
data.key = CryptoJS.enc.Utf8.parse('0yxk2020aiyx2021')
data.iv = CryptoJS.enc.Utf8.parse('0yxk2020aiyx2021')
let option = proxy.$route.query
if (option.sid) {
localStorage.setItem('aiyxSid', option.sid)
//
if (option.sid == 'aiyxlibmultimediaadmin') {
ToTryLogin()
data.isTryOutLogin = false
localStorage.setItem('isTryout', 1)
}
}
getOnlineSelectList()
})
let getOnlineSelectList = () => {
let param = {
pageNo: 5,
pageSize: 5
}
proxy.$http
.get(proxy.$API.ONLINESELECTLIST,
{
params: param
}
)
.then(res => {
console.log(res)
data.activeList = res.data.list
data.activeList.forEach(item=>{
const startDateStr = item.startTime
const endDateStr = item.endTime
/* 登录判断 */
proxy.isLogin(option)
const currentDate = new Date();
const startDate = new Date(startDateStr);
const endDate = new Date(endDateStr);
const userData = localStorage.getItem('userData') || ''
if (userData) {
}
})
let toBookList = () => {
proxy.$router.push({ path: '/BookList' })
const remainingDays = Math.ceil((endDate.getTime() - currentDate.getTime()) / (1000 * 3600 * 24));
if (currentDate >= startDate && currentDate <= endDate) {
item.activeStatusType = 1
if (remainingDays <= 3) {
item.activeStatus = `活动仅剩最后 ${remainingDays}`
} else {
console.log('活动正在进行中');
}
} else if (currentDate < startDate) {
item.activeStatus = `活动 ${item.startTime} 开始`
item.activeStatusType = 0
} else {
console.log('活动已经结束');
}
})
})
.catch((res) => {
console.log(res)
})
}
let toBookList = (id) => {
// proxy.$router.push({ path: '/BookList' })
proxy.$router.push({
path: '/BookList',
query: {
activeId: id
}
})
} }
let toActiveDetail = () => { let toActiveDetail = () => {
proxy.$router.push({ path: '/ActiveDetail' }) proxy.$router.push({ path: '/ActiveDetail' })
} }
let Encrypt = (o) => {
if (typeof o === 'string') {
if (o) {
var srcs = CryptoJS.enc.Utf8.parse(o)
return CryptoJS.AES.encrypt(srcs, data.key, {
keySize: 128 / 8,
iv: data.iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7,
}).toString()
}
} else if (typeof o === 'object') {
for (var _o in o) {
if (o[_o]) {
var srcs = CryptoJS.enc.Utf8.parse(o[_o])
o[_o] = CryptoJS.AES.encrypt(srcs, data.key, {
keySize: 128 / 8,
iv: data.iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7,
}).toString()
}
}
}
return o
}
//
let ToTryLogin = () => {
let param = {
Phone: 'a0c82379-37c1-d2e3-a2bf-82e0d081787c',
Pwd: Encrypt('123456'),
}
proxy.$http
.post(proxy.$API.LOGIN, param, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
})
.then((res) => {
if (res.type == 200) {
localStorage.setItem(
'userData',
JSON.stringify(res.data)
)
localStorage.setItem(
'userphone',
'a0c82379-37c1-d2e3-a2bf-82e0d081787c'
)
if (localStorage.getItem('actOnlinePage')) {
const actionUrl =
localStorage.getItem('actonlineLink')
location.href = actionUrl
} else {
location.href = '/'
}
} else if (res.type == 403) {
Toast(res.content)
setTimeout(() => {
// let url = '/ChangeMineCard?custId=' + res.data.custId
// proxy.$router.push(url)
}, 1000)
} else {
Toast(res.content)
}
})
.catch((res) => {
console.log(res)
})
}
/* 登录判断 */
let isLogin = (option) => {
/* 如果微信code 存在, 则获取微信用户信息进行微信登录或者注册 */
if (option.code) {
localStorage.setItem('aiyxWeChatLoginStatus', 'noLogin')
proxy.getWeChatUserInfo()
localStorage.setItem('aiyxWeChatCode', option.code)
} else {
const userData = localStorage.getItem('userData') || ''
if (!userData) {
data.showLoginDialog = true
}
}
}
//
let weChatLogin = () => {
if (!data.isWeiXin) {
Toast('请使用微信登录')
return
}
let homeUrl = location.protocol + '//' + location.host
let url =
'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxd2a2989d0fb9cf1c&redirect_uri=' +
homeUrl +
'&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect'
location.href = url
}
/* 获取微信用户信息 */
let getWeChatUserInfo = () => {
const that = data
let option = proxy.$route.query
let param = {
Code: option.code || '',
}
proxy.$http
.post(proxy.$API.WECHATLOGIN, param, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
})
.then((res) => {
if (res.type == 200) {
data.showLoginDialog = false
if (res.data) {
localStorage.setItem(
'userData',
JSON.stringify(res.data)
)
localStorage.setItem('userphone', res.data.phone)
localStorage.setItem(
'aiyxWeChatLoginStatus',
'isLogin'
)
}
console.log('微信登录成功')
} else if (res.type == 203 && res.data) {
that.weChatUserInfo = res.data
localStorage.setItem(
'weChatUserInfo',
JSON.stringify(that.weChatUserInfo)
)
// proxy.$router.push('/bindMobilePhone')
} else {
console.log(res.content)
}
})
.catch((res) => {
console.log(res)
})
}
/* 获取token 和用户信息 */
let getTokenAndUserInfo = () => {
if (!location.search) {
return
}
let code = proxy.$route.query.code
if (code) {
proxy.$http
.get(proxy.$API.GETWECHATTOkEN, {
params: { Code: code },
})
.then((res) => {
if (res.type == 200) {
let data = res.data
let access_token = data.access_token
let openid = data.openid
proxy.$http
.get(proxy.$API.GETWECHATUSERINFO, {
params: {
AccessToken: access_token,
OpenId: openid,
},
})
.then((res) => {
if (res.type == 200) {
let datas = res.data
alert(
'我的昵称是:' +
datas.nickname +
',我的openid是:' +
datas.openid +
',我的城市是:' +
datas.city
)
}
})
.catch((res) => {
console.log(res)
})
}
})
.catch((res) => {
console.log(res)
})
}
}
return { return {
data, data,
toBookList, toBookList,
toActiveDetail, toActiveDetail,
Encrypt,
ToTryLogin,
isLogin,
getTokenAndUserInfo,
weChatLogin,
getWeChatUserInfo,
getOnlineSelectList
} }
}, },
} }
@ -342,6 +139,8 @@ export default {
border-radius: 0.1rem; border-radius: 0.1rem;
.active-img { .active-img {
position: relative; position: relative;
height: 2.84rem;
overflow: hidden;
img { img {
display: block; display: block;
width: 100%; width: 100%;

2
library-activity/vite.config.js

@ -49,7 +49,7 @@ export default ({ mode }) => defineConfig({
port: 8089, port: 8089,
proxy: { proxy: {
'/api': { '/api': {
target: 'http://192.168.99.111:5001',
target: 'http://192.168.99.67:8080',
changeOrigin: true, changeOrigin: true,
rewrite: path => path.replace(/^\/api/, '') rewrite: path => path.replace(/^\/api/, '')
} }

Loading…
Cancel
Save