detail.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. <template>
  2. <view>
  3. <view style="background-color: #FFFFFF;">
  4. <view >
  5. <image src="/static/login_bg.jpg" style="height: 461rpx;width: 100%;"></image>
  6. <view style="padding:20rpx">
  7. <view style="display: flex;margin-top: 13rpx;">
  8. <view class="yearTag">{{goodsData.createTime | formatDate}}</view>
  9. <view class="titleTag">{{goodsData.goodsName}}</view>
  10. </view>
  11. <view style="display: flex;justify-content: space-between;margin-top: 13rpx;">
  12. <view class="noteTag"><image :src="$method.splitImgHost(goodsData.coverUrl, true)" class="wk_icon"></image>
  13. 共 <text class="blackFont">{{goodsData.updateTime}}</text> 张卷 <text class="blackFont">1200</text> 道题 </view>
  14. </view>
  15. </view>
  16. </view>
  17. <u-line color="#D6D6DB" />
  18. <view>
  19. <view>
  20. <u-tabs :list="list" item-width="50%" font-size="24" bar-width="110" :current="current" @change="change" active-color="#007AFF"></u-tabs>
  21. </view>
  22. </view>
  23. <u-line color="#D6D6DB" />
  24. </view>
  25. <view class="intro" v-if="current == 0">
  26. <view class="content">
  27. <view class="top">本题库为广东省建筑施工企业安全生产管理人员安全生产考试第三批参考题库(可两行)</view>
  28. <image class="img" src="/static/intro.png" ></image>
  29. </view>
  30. </view>
  31. <view class="title-list" v-if="current == 1">
  32. <view class="content">
  33. <view class="list" v-for="(item1,index) in outline">
  34. <view class="module">
  35. .2Z106000 施工合同管理-模块标题
  36. </view>
  37. <view class="section" :data-index="index" @click="changeItem" :class="{up:!item1.showList}">
  38. 2Z106010 施工承发包的模式-2Z106020 施工合同...
  39. </view>
  40. <view class="article" v-if="item1.showList" :class="{active:index1 == 0}" v-for="(article,index1) in item1.list">
  41. 施工承发包模式-施工合同与物资采购合同二
  42. <navigator url="/pages2/bank/questionBankTest">
  43. <view v-if="index1 == 0" class="btn">试做</view>
  44. </navigator>
  45. </view>
  46. </view>
  47. <view class="list">
  48. <view class="section" :data-index="index" @click="changeItem">
  49. 2Z106010 施工承发包的模式-2Z106020 施工合同...
  50. </view>
  51. <view class="article" :class="{active:index1 == 0}" v-for="(article,index1) in 3">
  52. 施工承发包模式-施工合同与物资采购合同二
  53. <navigator url="/pages2/bank/questionBankTest">
  54. <view v-if="index1 == 0" class="btn">试做</view>
  55. </navigator>
  56. </view>
  57. </view>
  58. <view class="list">
  59. <view class="article" :class="{active:index1 == 0}" v-for="(article,index1) in 3">
  60. 施工承发包模式-施工合同与物资采购合同二
  61. <navigator url="/pages2/bank/questionBankTest">
  62. <view v-if="index1 == 0" class="btn">试做</view>
  63. </navigator>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. <view class="bottomBox">
  69. <view class="priceTag">¥ 999.00</view>
  70. <view style="display: flex;color: #FFFFFF;align-items: center;">
  71. <view class="btn1" @click="addCart">加购物车</view>
  72. <view class="btn2" @click="buy">立即购买</view>
  73. </view>
  74. </view>
  75. </view>
  76. </template>
  77. <script>
  78. import { mapGetters } from 'vuex';
  79. export default {
  80. data() {
  81. return {
  82. list: [
  83. {
  84. name: '详情'
  85. },
  86. {
  87. name: '大纲'
  88. }
  89. ],
  90. current:0,
  91. outline:[{
  92. list:[1,2,3,4],
  93. showList:false,
  94. }],
  95. id:'',
  96. goodsData:{}
  97. };
  98. },
  99. filters: {
  100. formatDate: function (value) {
  101. var date = new Date(value);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
  102. var Y = date.getFullYear() + '-';
  103. var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
  104. var D = date.getDate() + ' ';
  105. var h = date.getHours() + ':';
  106. var m = date.getMinutes() + ':';
  107. var s = date.getSeconds();
  108. return Y+M+D+h+m+s;
  109. }
  110. },
  111. onUnload() {
  112. },
  113. computed: { ...mapGetters(['userInfo']) },
  114. onLoad(option) {
  115. console.log(option)
  116. this.id = option.id
  117. this.getDetail();
  118. },
  119. onShow() {
  120. },
  121. methods: {
  122. getDetail(){
  123. this.$api.goodsDetail(this.id).then(res => {
  124. console.log(res)
  125. this.goodsData = res.data.data;
  126. })
  127. },
  128. buy(){
  129. if(this.$method.isGoLogin()){
  130. return
  131. }
  132. this.$navTo.togo('/pages2/order/confirm_list');
  133. },
  134. addCart(){
  135. if(this.$method.isGoLogin()){
  136. return
  137. }
  138. uni.showToast({
  139. title: '添加成功',
  140. duration: 1000
  141. });
  142. },
  143. open(item){
  144. item.showChildren = !item.showChildren
  145. },
  146. change(index){
  147. this.current = index;
  148. },
  149. changeItem(e) {
  150. let index = e.currentTarget.dataset.index
  151. this.outline.forEach((arrItem,i) => {
  152. if(i == index) {
  153. arrItem.showList = !arrItem.showList
  154. }
  155. })
  156. }
  157. }
  158. };
  159. </script>
  160. <style >
  161. page{
  162. background-color: #EAEEF1;
  163. }
  164. </style>
  165. <style lang="scss" scope>
  166. .intro {
  167. background: #EAEEF1;
  168. padding:16rpx 16rpx 124rpx;
  169. .content {
  170. background:#fff;
  171. border-radius: 16rpx;;
  172. .top {
  173. border-radius: 16rpx;
  174. padding:32rpx 28rpx 16rpx;
  175. font-size: 30rpx;
  176. color: #333333;
  177. }
  178. .img {
  179. width:100%;
  180. }
  181. }
  182. }
  183. .title-list {
  184. background: #EAEEF1;
  185. padding:16rpx 16rpx 124rpx;
  186. .content {
  187. .list {
  188. background:#fff;
  189. margin-bottom:30rpx;
  190. overflow: hidden;
  191. border-radius: 16rpx;
  192. padding:10rpx 16rpx;
  193. .module {
  194. font-size: 30rpx;
  195. color: #333333;
  196. }
  197. .section {
  198. padding:30rpx 0;
  199. border-bottom: 1rpx solid #EEEEEE;
  200. font-size: 24rpx;
  201. color: #666666;
  202. &::before {
  203. content:'^';
  204. display: inline-block;
  205. margin-right:20rpx;
  206. }
  207. &.up {
  208. &::before {
  209. transform: rotate(180deg);
  210. }
  211. }
  212. }
  213. .article {
  214. height:80rpx;
  215. display: flex;
  216. align-items: center;
  217. margin-left:88rpx;
  218. font-size: 24rpx;
  219. color: #666666;
  220. border-bottom: 1rpx solid #EEEEEE;
  221. &:nth-last-of-type(1) {
  222. border:0;
  223. }
  224. &.active {
  225. color:#007AFF;
  226. .btn {
  227. width: 96rpx;
  228. height: 48rpx;
  229. line-height: 48rpx;
  230. text-align: center;
  231. color:#fff;
  232. font-size: 30rpx;
  233. border-radius:24rpx;
  234. background: #007AFF;
  235. margin-left:36rpx;
  236. border-radius: 24rpx;
  237. }
  238. }
  239. }
  240. }
  241. }
  242. }
  243. .btn2{
  244. width: 200rpx;
  245. height: 64rpx;
  246. background: linear-gradient(0deg, #FFB102, #FD644F);
  247. box-shadow: 0rpx 10rpx 16rpx 4rpx rgba(1, 99, 235, 0.04);
  248. border-radius: 32rpx;
  249. line-height: 64rpx;
  250. text-align: center;
  251. }
  252. .btn1{
  253. width: 200rpx;
  254. height: 64rpx;
  255. background: linear-gradient(0deg, #015EEA, #00C0FA);
  256. border-radius: 32rpx;
  257. line-height: 64rpx;
  258. text-align: center;
  259. margin-right: 20rpx;
  260. }
  261. .bottomBox{
  262. position: fixed;
  263. bottom: 0;
  264. width: 100%;
  265. left: 0;
  266. height:98rpx ;
  267. background-color: #FFFFFF;
  268. display: flex;
  269. justify-content: space-between;
  270. align-items: center;
  271. padding: 0 30rpx;
  272. }
  273. .blackFont{
  274. color: #333333;
  275. margin: 0 4rpx;
  276. }
  277. .wk_icon{
  278. width: 24rpx;
  279. height: 24rpx;
  280. margin-right: 12rpx;
  281. }
  282. .noteTag{
  283. ont-size: 24rpx;
  284. font-family: PingFang SC;
  285. font-weight: 500;
  286. color: #999999;
  287. align-items: center;
  288. }
  289. .priceTag{
  290. font-size: 30rpx;
  291. font-family: PingFang SC;
  292. font-weight: bold;
  293. color: #FF2D55;
  294. }
  295. .titleTag{
  296. font-size: 32rpx;
  297. font-weight: bold;
  298. color: #333333;
  299. margin-left: 8rpx;
  300. }
  301. .yearTag{
  302. width: 80rpx;
  303. height: 32rpx;
  304. background: #EBF5FF;
  305. border: 2rpx solid #007AFF;
  306. border-radius: 16rpx;
  307. font-size: 24rpx;
  308. color: #007AFF;
  309. text-align: center;
  310. line-height: 32rpx;
  311. }
  312. .itemBox{
  313. background: #FFFFFF;
  314. box-shadow: 0rpx 10rpx 9rpx 1rpx rgba(165, 196, 239, 0.1);
  315. border-radius: 24rpx;
  316. width: 100%;
  317. padding: 20rpx;
  318. margin-bottom: 20rpx;
  319. }
  320. </style>