Преглед изворни кода

抖音支付页面暂时换回原来得

zhangyujun пре 2 година
родитељ
комит
397942873f

+ 7 - 0
src/api/modules/open.js

@@ -52,6 +52,13 @@ const open = {
             url: "open-api/question/info/getQuestionInfoByIds",
             params
         })
+    },
+    //根据字典类型查询字典数据信息
+    systemDictDataType(dictType){
+        return request({
+            url: "open-api/system/dict/data/type/"+dictType
+        })
+
     }
 }
 export default open

+ 13 - 0
src/api/modules/system.js

@@ -0,0 +1,13 @@
+import request from '../request'
+const system = {
+    systemDictType(dictId) {
+        return request({
+            url: `system/dict/type/${dictId}`,
+            method: 'get'
+        })
+
+    }
+
+}
+export default system
+

+ 40 - 7
src/components/m-do-topic/m-do-topic.vue

@@ -89,6 +89,7 @@
           problemList[problemListIndex].questionType < 3 &&
           !problemList[problemListIndex].isCompleted
         "
+        style="margin-top: 0"
         class="problem-ops"
       >
         <van-radio-group
@@ -98,7 +99,6 @@
         >
           <van-radio
             :value="problemList[problemListIndex].userAnswer === item.value"
-            class="problem-checkbox"
             use-icon-slot
             v-for="(item, index) in problemList[problemListIndex].optsArr"
             :key="index"
@@ -106,7 +106,7 @@
           >
             <text>{{ item.value }}</text>
             <view
-              class="problem-op"
+              class="problem-op mt15 mb15"
               :class="{
                 'problem-op_selected':
                   problemList[problemListIndex].userAnswer === item.value,
@@ -126,7 +126,7 @@
         <view
           v-for="(item, index) in problemList[problemListIndex].optsArr"
           :key="index"
-          class="problem-select"
+          class="problem-select pl30"
         >
           <icon
             v-if="item.isAnswer && item.selected"
@@ -164,6 +164,7 @@
           !problemList[problemListIndex].isCompleted
         "
         class="problem-ops"
+        style="margin-top: 0"
       >
         <van-checkbox-group
           :value="problemList[problemListIndex].userAnswer"
@@ -182,7 +183,7 @@
           >
             <text>{{ item.value }}</text>
             <view
-              class="problem-op"
+              class="problem-op mt15 mb15"
               :class="{
                 'problem-op_selected': item.selected,
               }"
@@ -208,6 +209,7 @@
           problemList[problemListIndex].questionType == 3 &&
           problemList[problemListIndex].isCompleted
         "
+        style="margin-top: 0"
       >
         <view
           v-for="(item, index) in problemList[problemListIndex].optsArr"
@@ -710,6 +712,7 @@
                   "
                   v-for="(item, index) in problemList"
                   :class="{
+                    'problem-listItem_current': problemListIndex == index,
                     'problem-listItem_dui':
                       item.userAnswer.length && item.userAnswer == item.answer,
                     'problem-listItem_cuo':
@@ -1505,7 +1508,7 @@ export default {
             kemu: this.query.subject,
           })
           .then((res) => {
-            console.log(res)
+            console.log(res);
             res.rows.forEach((element) => {
               element.optsArr = [];
               element.opts.split("-").forEach((item, index) => {
@@ -1576,8 +1579,30 @@ export default {
   },
 };
 </script>
-
+<style>
+.pt15 {
+  padding-left: 15rpx;
+}
+.pb15 {
+  padding-bottom: 15rpx;
+}
+.mt15 {
+  margin-top: 15rpx;
+}
+.mb15 {
+  margin-bottom: 15rpx;
+}
+</style>
 <style lang="scss" scoped>
+.pt15 {
+  padding-block: 15rpx;
+}
+.pb15 {
+  padding-block: 15rpx;
+}
+.pl30 {
+  padding-left: 30rpx;
+}
 .answer {
   padding-left: 16rpx;
   padding-bottom: 16rpx;
@@ -1696,12 +1721,20 @@ export default {
         margin-left: 13rpx;
         margin-right: 13rpx;
       }
+      .problem-listItem_current {
+        background: rgba(138, 144, 153, 0.15);
+        border-color: #bfbfbf;
+        color: #5c6066;
+      }
       .problem-listItem_dui {
         background: #c1e6db;
         color: #4eb79a;
+        border-color: #4eb79a;
       }
       .problem-listItem_cuo {
-        background: #e6c5c6;
+        background: #ffbcbe;
+        color: #e65055;
+        border-color: #e65055;
       }
     }
   }

+ 2 - 1
src/otherPages/buyVip/index.vue

@@ -17,7 +17,7 @@
             >激活码激活</text
           >
         </view>
-        
+        <!-- #ifdef MP-TOUTIAO -->
         <view
           v-if="ios_vip_open||!isIos"
           class="vip-item"
@@ -50,6 +50,7 @@
             </view> -->
           </view>
         </view>
+        <!-- #endif -->
       </view>
     </view>
     <van-overlay :show="vipCodeVisible">

+ 1 - 1
src/otherPages/classifyOrder/index.vue

@@ -156,7 +156,7 @@ export default {
       padding: 0 18rpx;
       background: #06bd5e;
       font-size: 24rpx;
-      border-radius: 16rpx;
+      border-radius: 8rpx;
     }
   }
   .icon {

+ 50 - 0
src/otherPages/download/index.vue

@@ -0,0 +1,50 @@
+<template>
+  <div></div>
+</template>
+
+<script>
+export default {
+  onLoad(query) {
+    uni.showModal({
+      title: `是否下载${query.name}.pdf`,
+      content: "",
+      success(res) {
+        if (res.confirm) {
+          uni.downloadFile({
+            url: query.src,
+            success(res) {
+              uni.openDocument({
+                filePath: res.tempFilePath,
+                fileType: "pdf",
+              });
+            },
+            fail(err) {
+              console.log(err);
+            },
+          });
+        }
+      },
+    });
+
+    // console.log(query);
+    // uni.showModal({
+    //   title: "是否下载该pdf",
+    //   content: query.name + ".pdf",
+    //   success(res) {
+    //     if (res.confirm) {
+    //       uni.downloadFile({
+    //         url: query.src,
+    //         success(res) {
+    //             console.log(res)
+
+    //         },
+    //       });
+    //     }
+    //   },
+    // });
+  },
+};
+</script>
+
+<style lang="less" scoped>
+</style>

+ 38 - 27
src/otherPages/pdfList/index.vue

@@ -3,33 +3,27 @@
     <div class="head">
       <text class="head-text1">电子版答案</text>
       <image class="head-text1-fire" :src="fireIcon"></image>
-      <div class="head-text2">共5个小节</div>
+      <div class="head-text2">共{{ pdfList.length }}个小节</div>
     </div>
     <div class="container">
-      <div @click="goPath('/pages/extraWeb/index')" class="cell">
+      <div
+        v-for="(item, index) in pdfList"
+        :key="index"
+        @click="
+          goPath('/pages/pdfPreview/index', {
+            src: web,
+            token:token,
+            name:item.dictLabel,
+            code:item.dictCode
+          })
+        "
+        class="cell"
+      >
         <div class="flex">
           <div class="cell-dot"></div>
           <div class="cell-col2">
-            <div class="cell-text1">扣分题技巧口诀</div>
-            <div class="flex">
-              <div class="cell-text2">图文</div>
-              <image
-                style="width: 28rpx; height: 32rpx"
-                :src="diaryIcon"
-              ></image>
-            </div>
-          </div>
-        </div>
-        <div class="flex">
-          <div class="cell-button">开始学习</div>
-        </div>
-      </div>
-      <div  class="cell">
-        <div class="flex">
-          <div class="cell-dot"></div>
-          <div class="cell-col2">
-            <div class="cell-text1">扣分题技巧口诀</div>
-            <div class="flex">
+            <div class="cell-text1">{{ item.dictLabel }}</div>
+            <div style="margin-top:10rpx" class="flex">
               <div class="cell-text2">图文</div>
               <image
                 style="width: 28rpx; height: 32rpx"
@@ -49,21 +43,38 @@
 <script>
 import fireIcon from "@/assets/img/fire-icon.png";
 import diaryIcon from "@/assets/img/diary-icon.png";
+import api from "@/api/index";
+import utils from "@/utils/index";
 export default {
   data() {
     return {
+      web:
+        process.env.NODE_ENV === "development"
+          ? "https://mn1.zzxcx.net/#/pdf/preview"
+          : "https://mn.zzxcx.net/#/pdf/preview",
       fireIcon,
       diaryIcon,
+      pdfList: []
     };
   },
   methods: {
-    goPath(url) {
-        uni.navigateTo({
-            url
-        })
-        
+    goPath(url, query = {}) {
+      uni.navigateTo({
+        url: url + "?" + utils.mapToUrlQuery(query),
+      });
+    },
+  },
+  computed: {
+    token() {
+      return this.$store.state.user.tokenObj.token
     }
   },
+
+  mounted() {
+    api.open.systemDictDataType("learning_materials").then((res) => {
+      this.pdfList = res.data;
+    });
+  },
 };
 </script>
 

+ 22 - 3
src/pages.json

@@ -12,7 +12,7 @@
         "navigationStyle": "default"
         // #endif
       }
-    },
+    }, 
     {
       "path": "pages/carVideo/videoList",
       "style": {
@@ -30,6 +30,13 @@
       "path": "pages/extraWeb/index",
       "style": {}
     },
+    {
+      "path": "pages/download/index",
+      "style": {
+        "navigationBarTitleText": "下载",
+        "enablePullDownRefresh": false
+      }
+    },
     {
       "path": "pages/lightMock/index",
       "style": {
@@ -67,9 +74,9 @@
         "navigationBarTitleText": "浏览足迹"
       }
     },
-    //webview页面
+    //pdf预览页面
     {
-      "path": "pages/webview/webview",
+      "path": "pages/pdfPreview/index",
       "style": {
         "navigationBarTitleText": "",
         "enablePullDownRefresh": false
@@ -298,6 +305,13 @@
             "enablePullDownRefresh": false
           }
         },
+        {
+          "path": "download/index",
+          "style": {
+            "navigationBarTitleText": "下载",
+            "enablePullDownRefresh": false
+          }
+        },
         {
           "path": "exerciseExam/index",
           "style": {
@@ -465,6 +479,11 @@
         "name":"科一秘卷",
         "path":"otherPages/selectRulePaper/index",
         "query": "liceCar=1&liceTruck=&liceBus=&liceMoto=&name=%E7%A7%91%E7%9B%AE%E4%B8%80&gs=xc&cert=C1%2FC2%2FC3&vehicle=%E8%BD%BF%E8%BD%A6&subject=1&title=%E7%B2%BE%E9%80%89%E8%80%83%E9%A2%98&sort=3&__id__=1"
+      },
+      {
+        "name":"pdf列表",
+        "path":"otherPages/pdfList/index",
+        "query": "liceCar=1&liceTruck=&liceBus=&liceMoto=&name=%E7%A7%91%E7%9B%AE%E4%B8%80&gs=xc&cert=C1%2FC2%2FC3&vehicle=%E8%BD%BF%E8%BD%A6&subject=1&title=%E7%B2%BE%E9%80%89%E8%80%83%E9%A2%98&sort=3&__id__=1"
       }
     ]
   }

+ 80 - 56
src/pages/carVideo/videoList.vue

@@ -1,64 +1,88 @@
 <template>
-	<loading v-if="loading"></loading>
-	<view v-else class="carVideo">
-		<topbar>
-			<van-search shape="round" placeholder="搜索学车视频" @search='search' />
-		</topbar>
-		<van-tabs id='tabs' :active="active" :sticky='true'>
-			<van-tab :title="item.chapterName" v-for="(item,index) in typeList" :key='index' class="vant-tab">
-				<branch-one v-if="index==0" :carVideoList="item.children"></branch-one>
-				<branch-two v-else-if="index==1" :carVideoList="item.children"></branch-two>
-				<branch-two v-else-if="index==2" :carVideoList="item.children"></branch-two>
-				<branch-one v-else-if="index==3" :carVideoList="item.children"></branch-one>
-				<get-cert v-else-if="index==4"></get-cert>
-				<branch-two v-else :carVideoList="item.children"></branch-two>
-			</van-tab>
-		</van-tabs>
-	</view>
+  <loading v-if="loading"></loading>
+  <view v-else class="carVideo">
+    <topbar>
+      <van-search shape="round" placeholder="搜索学车视频" @search="search" />
+    </topbar>
+    <van-tabs id="tabs" :active="active" :sticky="true">
+      <van-tab
+        :title="item.chapterName"
+        v-for="(item, index) in typeList"
+        :key="index"
+        class="vant-tab"
+      >
+        <branch-one
+          v-if="index == 0"
+          :carVideoList="item.children"
+        ></branch-one>
+        <branch-two
+          v-else-if="index == 1"
+          :carVideoList="item.children"
+        ></branch-two>
+        <branch-two
+          v-else-if="index == 2"
+          :carVideoList="item.children"
+        ></branch-two>
+        <branch-one
+          v-else-if="index == 3"
+          :carVideoList="item.children"
+        ></branch-one>
+        <get-cert v-else-if="index == 4"></get-cert>
+        <branch-two v-else :carVideoList="item.children"></branch-two>
+      </van-tab>
+    </van-tabs>
+  </view>
 </template>
 
 <script>
-	import branchOne from './components/branchOne.vue'
-	import branchTwo from './components/branchTwo.vue'
-	export default {
-		components: {
-			branchOne,
-			branchTwo,
-		},
-		data: () => ({
-			active: 1,
-			typeList: [],
-			loading: true
-		}),
-		async mounted() {
-			let {
-				data
-			} = await this.$api.carVideo.getTreeList()
-			this.typeList = data
-			this.loading = false
-			this.$nextTick(() => {
-				this.selectComponent('#tabs').resize();
-			})
-		},
-		methods: {
-			async search(e) {
-				let {
-					data
-				} = await this.$api.carVideo.getSearchList(e.detail)
-				console.log(data)
-				this.$utils.route.goPage('/pages/carVideo/more', null, {
-					carVideoList: data
-				})
-			}
-		}
-	}
+import branchOne from "./components/branchOne.vue";
+import branchTwo from "./components/branchTwo.vue";
+export default {
+  components: {
+    branchOne,
+    branchTwo,
+  },
+  async onReady() {
+
+    await this.$store.dispatch("Login");
+    uni.showToast({
+      title: "你结束了登陆",
+	  duration:2500
+    });
+
+    await this.$store.dispatch("GetInfo");
+  },
+  data: () => ({
+    active: 1,
+    typeList: [],
+    loading: true,
+  }),
+  async mounted() {
+    let { data } = await this.$api.carVideo.getTreeList();
+    this.typeList = data;
+    this.loading = false;
+    this.$nextTick(() => {
+      this.selectComponent("#tabs").resize();
+    });
+    console.log(this.$store.getters.token);
+  },
+  methods: {
+    async search(e) {
+      let { data } = await this.$api.carVideo.getSearchList(e.detail);
+      console.log(data);
+      this.$utils.route.goPage("/pages/carVideo/more", null, {
+        carVideoList: data,
+      });
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>
-	.carVideo {
-		position: relative;
-	}
-	 .vant-tab{
-		height: 100px;
-	}
+.carVideo {
+  position: relative;
+}
+.vant-tab {
+  height: 100px;
+}
 </style>

+ 52 - 0
src/pages/download/index.vue

@@ -0,0 +1,52 @@
+<template>
+  <div></div>
+</template>
+<script>
+export default {
+  onLoad(query) {
+    uni.showModal({
+      title: `是否下载${query.name}.pdf`,
+      content: "",
+      success(res) {
+        if (res.confirm) {
+          uni.downloadFile({
+            url: query.src,
+            success(res) {
+               console.log(res)
+              uni.openDocument({
+                filePath: res.tempFilePath,
+                fileName:`${query.name}.pdf`,
+                fileType: "pdf",
+              });
+            },
+            fail(err) {
+              console.log(err);
+            },
+          });
+        }
+      },
+    });
+
+    // console.log(query);
+    // uni.showModal({
+    //   title: "是否下载该pdf",
+    //   content: query.name + ".pdf",
+    //   success(res) {
+    //     if (res.confirm) {
+    //       uni.downloadFile({
+    //         url: query.src,
+    //         success(res) {
+    //             console.log(res)
+
+    //         },
+    //       });
+    //     }
+    //   },
+    // });
+  },
+};
+</script>
+
+<style lang="less" scoped>
+
+</style>

+ 5 - 18
src/pages/extraWeb/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="box">
+  <div>
     <web-view :src="src"></web-view>
   </div>
 </template>
@@ -8,32 +8,19 @@
 export default {
   data() {
     return {
-      query: {
-        url: "",
-        file: "",
-      },
-      src: "https://mn1.zzxcx.net/#/pdf/preview",
+      query: {},
+      src: "",
     };
   },
   methods: {
     name() {},
   },
   onLoad(query) {
-    // this.query = query;
-    // this.src = this.query.url + "?file=" + this.query.file;
-    // console.log(query);
+    this.query = query;
+    this.src = this.query.src;
   },
 };
 </script>
 
 <style lang="scss" scoped>
-.box {
-  position: relative;
-}
-.menu {
-  position: absolute;
-  top: 0;
-  z-index: 9999;
-  background: red;
-}
 </style>

+ 21 - 0
src/pages/pdfPreview/index.vue

@@ -0,0 +1,21 @@
+<template>
+  <web-view class="webview" :src="decodeURIComponent(src)"></web-view>
+</template>
+
+<script>
+export default {
+  data() {
+    return {
+      src: encodeURIComponent(""),
+    };
+  },
+  onLoad: function (option) {
+    this.src = `${option.src}?token=${option.token}&name=${option.name}&code=${option.code}`;
+  },
+};
+</script> 
+
+<style lang="scss">
+.webview {
+}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
+</style>

+ 22 - 1
src/pages/user/index.vue

@@ -60,6 +60,16 @@
         center
       >
       </van-cell>
+      <van-cell
+        title="资料下载"
+        is-link
+        @click="goVipPath('/otherPages/pdfList/index')"
+        center
+      >
+        <template #icon>
+          <m-icon type="fkbz" class="cell-icon" />
+        </template>
+      </van-cell>
 
       <!-- #endif -->
       <!-- #ifdef MP-WEIXIN -->
@@ -68,7 +78,7 @@
         title="反馈帮助"
         is-link
         center
-        url="/pages/webview/webview?src=https://support.qq.com/product/359609"
+        url="/pages/extraWeb/index?src=https://support.qq.com/product/359609"
       >
         <template #icon>
           <m-icon type="fkbz" class="cell-icon" />
@@ -109,6 +119,17 @@ export default {
     this.$store.dispatch("GetInfo");
   },
   methods: {
+    goVipPath(url) {
+      if (this.isVip) {
+        uni.navigateTo({
+          url,
+        });
+      } else {
+        uni.showToast({
+          title: "vip才能使用",
+        });
+      }
+    },
     getUserProfile(e) {
       let that = this;
       uni.getUserProfile({

+ 0 - 20
src/pages/webview/webview.vue

@@ -1,20 +0,0 @@
-<template>
-	<web-view class="webview" :src="decodeURIComponent(src)"></web-view>
-</template>
-
-<script>
-	export default {
-		data() {
-			return {
-				src: encodeURIComponent('')
-			};
-		},
-		onLoad: function (option) {
-		    this.src = option.src;
-		}
-	}
-</script>
-
-<style lang="scss">
-	.webview{}
-</style>

+ 1 - 1
src/store/getters.js

@@ -1,7 +1,7 @@
 
 const crypto = require("crypto");
 const getters = {
-  token: state => state.user.token,
+  token: state => state.user.tokenObj.token,
   userInfo: state => state.user.userInfo,
   isVip: state => {