wbspool 4 anni fa
parent
commit
b70d18c88a

+ 2 - 0
src/common/config/api.js

@@ -38,6 +38,8 @@ const api = {
         sendVerifyCode:`${root}/mzUser/sendVerifyCode`,
         userinfo:`${root}/mzUser/userinfo`,
         perfectInfo:`${root}/mzUser/perfectInfo`,
+        createVipOrder:`${root}/mzUser/createVipOrder`,
+        confirmVipOrder:`${root}/mzUser/confirmVipOrder`,
     },
     common:{
         uploadFile:`${root}/common/uploadFile`,

+ 1 - 0
src/pc/components.d.ts

@@ -36,5 +36,6 @@ declare module '@vue/runtime-core' {
     UiVipMagazine: typeof import('./components/ui-vip-magazine/ui-vip-magazine.vue')['default']
     UiVipPreset: typeof import('./components/ui-vip-preset/ui-vip-preset.vue')['default']
     UserAccountSettingInfoItem: typeof import('./pages/user/_components/user-account-setting-info-item.vue')['default']
+    VipSrvBox: typeof import('./components/vip-srv-box/vip-srv-box.vue')['default']
   }
 }

+ 25 - 4
src/pc/components/ui-main-article/ui-main-article.vue

@@ -1,5 +1,5 @@
 <template>
-    <ui-shadow-box @click="$router.push('/article-detail?code=' + item.code)" v-bind="$attrs" class="relative">
+    <ui-shadow-box @click="handleGoTo(item)" v-bind="$attrs" class="relative">
         <div class="flex bg-white pl-16px pr-14px items-center h-165px">
             <div class="relative">
                 <img class="w-250px h-140px object-cover" :src="item.coverUrl"/>
@@ -22,7 +22,8 @@
                 </div>
                 <div class="h-32px"></div>
                 <div class="flex w-full items-center">
-                    <div class="text-[#B8B8B8] text-size-14px font-normal">{{item.author ? item.author :'匿名'}}</div>
+                    <div class="text-[#B8B8B8] text-size-14px font-normal w-100px">{{item.author ? item.author :'匿名'}}
+                    </div>
                     <div class="flex items-center ml-76px">
                         <img class="w-18px h-auto" src="/imgs/time.png"/>
                         <div class="text-[#B8B8B8] text-size-14px font-normal ml-5px">{{item.publishTimeStr}}</div>
@@ -37,11 +38,15 @@
                 </div>
             </div>
         </div>
+
+        <vip-srv-box ref="vsb"></vip-srv-box>
+
     </ui-shadow-box>
 </template>
 
 <script>
     export default {
+        components: {},
         props: {
             item: {
                 type: Object,
@@ -49,13 +54,29 @@
                     return {};
                 }
             }
+        },
+        data() {
+            return {
+                dialogVisible: false
+            }
+        },
+        methods: {
+
+            handleGoTo(item) {
+                if (!this.$store.state.userinfo.exipreVip) {
+                    this.$refs.vsb.open();
+                    return;
+                }
+                this.$router.push('/article-detail?code=' + item.code)
+            }
+
         }
     };
 </script>
 
 <style scoped>
 
-    .description-ec{
+    .description-ec {
         word-break: break-all;
         text-overflow: ellipsis;
         overflow: hidden;
@@ -64,7 +85,7 @@
         -webkit-line-clamp: 2; /* 这里是超出几行省略 */
     }
 
-    .relative{
+    .relative {
         cursor: pointer;
     }
 

+ 35 - 30
src/pc/components/ui-vip-article/ui-vip-article.vue

@@ -1,40 +1,45 @@
 <template>
-  <div class="h-157px flex items-center " v-bind="$attrs" @click="$router.push('vip-list?refMagazine=' + item.code + '&title=' + `${$t('VIP期刊') + '-' +item.name + item.num + '期' }`)">
-    <!-- <div class="mr-12.5px">
-      
-    </div> -->
-    <img :src="item.coverUrl" class="w-100px h-133px object-cover mr-12.5px" />
-    <div class="flex flex-col h-full">
-      <div class="h-20.5px"></div>
-
-      <div class="flex flex-1 flex-col justify-between">
-        <div class="h-28px text-size-14px font-normal text-black ">
-          {{item.name}}
+    <div class="h-157px flex items-center " v-bind="$attrs" @click="handleGoTo(item)">
+        <!-- <div class="mr-12.5px">
+
+        </div> -->
+        <img :src="item.coverUrl" class="w-100px h-133px object-cover mr-12.5px"/>
+        <div class="flex flex-col h-full">
+            <div class="h-20.5px"></div>
+
+            <div class="flex flex-1 flex-col justify-between">
+                <div class="h-28px text-size-14px font-normal text-black ">
+                    {{item.name}}
+                </div>
+                <div class="text-size-14px font-normal text-[#686868]">每{{item.num}}期</div>
+                <div class="text-size-14px font-normal text-[#686868]">{{item.dateStr}}</div>
+                <div class="text-size-14px font-normal text-[#686868]">共{{item.articleNum}}篇</div>
+            </div>
+
+            <div class="h-18px"></div>
         </div>
-        <div class="text-size-14px font-normal text-[#686868]">每{{item.num}}期</div>
-        <div class="text-size-14px font-normal text-[#686868]">{{item.dateStr}}</div>
-        <div class="text-size-14px font-normal text-[#686868]">共{{item.articleNum}}篇</div>
-      </div>
 
-      <div class="h-18px"></div>
     </div>
-  </div>
 </template>
 
 <script>
-  export default {
-    props:{
-      item:{
-        type:Object,
-        default(){
-          return {};
-        }
-      }
-    },
-    data(){
-      return {
+    export default {
+        props: {
+            item: {
+                type: Object,
+                default() {
+                    return {};
+                }
+            }
+        },
 
-      }
+        methods: {
+            handleGoTo(item) {
+
+
+
+                this.$router.push('vip-list?refMagazine=' + item.code + '&title=' + `${this.$t('VIP期刊') + '-' + item.name + item.num + '期'}`)
+            }
+        }
     }
-  }
 </script>

+ 1 - 0
src/pc/components/ui-vip-preset/ui-vip-preset.vue

@@ -14,6 +14,7 @@
         {{item.vipDescription}}
       </div>
       <div
+              @click="$emit('choose')"
         class="w-168px h-34px rounded-full text-primary border-1px border-solid border-primary flex items-center justify-center cursor-pointer"
       >
         立即开通

+ 84 - 0
src/pc/components/vip-srv-box/vip-srv-box.vue

@@ -0,0 +1,84 @@
+<template>
+    <el-dialog
+            title=""
+            :visible.sync="dialogVisible"
+            :append-to-body="true"
+            width="800px"
+            custom-class="cc-dialog"
+    >
+
+        <div class="tips" style="color: #103a22">
+            当前用户:{{$store.state.userinfo.nickname}}没有VIP权限,无法查阅此文章!
+        </div>
+
+        <div class="flex mt-24px">
+            <ui-vip-preset class="mr-32px" @choose="handleChoose(vipSmeal)" v-for="vipSmeal in vipSmeals" :item="vipSmeal"></ui-vip-preset>
+        </div>
+
+    </el-dialog>
+</template>
+
+<script>
+    export default {
+        name: "vip-srv-box",
+        data(){
+            return {
+                dialogVisible: false,
+                vipSmeals:[]
+            }
+        },
+        methods:{
+            open(){
+                this.dialogVisible = true;
+            },
+            close(){
+                this.dialogVisible = false;
+            },
+            async handleChoose(vipSmeal) {
+
+                let resp = await this.$http.post(this.$api.mzUser.createVipOrder,this.$qs.stringify({vipCode:vipSmeal.code}))
+                if(resp.data.status === 200){
+                    await this.$confirm('请在弹出的窗口完成付款操作?', '提示', {
+                        confirmButtonText: '已完成付款',
+                        cancelButtonText: '取消',
+                        type: 'warning'
+                    })
+                    resp = await this.$http.post(this.$api.mzUser.confirmVipOrder,this.$qs.stringify({orderCode:resp.data.data.vipSmOrder.code}))
+
+                    if(resp.data.status === 200){
+                        this.$message.success("开通成功");
+                        this.loadData();
+                        this.close();
+                    }
+
+                }
+
+
+
+            },
+        async loadData(){
+            let resp = await this.$http.post(this.$api.mzUser.userinfo);
+
+            if(resp.data.status === 200){
+                this.userinfo = resp.data.data.mzUser;
+                this.$store.commit('UPDATE_LOGIN_INFO',resp.data.data.mzUser)
+            }
+        }
+        },
+        async created() {
+            let r = await  this.$http.post(this.$api.common.vipSmeals);
+            if(r.data.status === 200){
+                this.vipSmeals = r.data.data.vipSmeals;
+            }
+        }
+    }
+</script>
+
+<style scoped>
+    .cc-dialog{
+        background-color:#F7F7F7;
+    }
+
+
+
+</style>

+ 2 - 0
src/pc/main.js

@@ -30,6 +30,8 @@ const i18n = new VueI18n({
   messages, // set locale messages
 });
 
+Vue.prototype.$store= store;
+
 /* eslint-disable no-new */
 new Vue({
   el: "#app",

+ 1 - 2
src/pc/pages/auth/login.vue

@@ -198,14 +198,13 @@
                 if(this.verifyCount > 0){
                     return ;
                 }
-
                 let email = "";
                 if(this.activeName === "first"){
                     email = this.loginForm.email;
                 }
 
                 if(this.activeName === "second"){
-                    email = this.regForm.password;
+                    email = this.regForm.email;
                 }
 
                 if(!email){

+ 29 - 4
src/pc/pages/search/search.vue

@@ -1,19 +1,44 @@
 <template>
   <div class="w-screen flex flex-col items-center">
     <div class="w-full h-146px bg-white flex items-center justify-center">
-      <ui-input :placeholder="$t('请输入关键字')" class="!w-800px ">
-        <el-button class="!mr-20px" slot="suffix" type="text">{{$t("搜索")}}</el-button>
+      <ui-input v-model="keywords" :placeholder="$t('请输入关键字')" class="!w-800px ">
+        <el-button @click="loadLatestArts(1)" class="!mr-20px" slot="suffix" type="text">{{$t("搜索")}}</el-button>
       </ui-input>
     </div>
     <div class="h-20px"></div>
     <div class="w-860px">
-      <ui-main-article v-for="item in 18"></ui-main-article>
+      <ui-main-article @choose="handleChoose" v-for="item in latestArts" :item="item"></ui-main-article>
     </div>
   </div>
 </template>
 
 <script>
-export default {};
+export default {
+
+  data() {
+    return {
+      keywords:'',
+      latestArts: [],
+      pageIndex: 1
+    };
+  },
+  methods: {
+    async loadLatestArts(pageIndex) {
+      let resp = await this.$http.post(this.$api.cms.articles, this.$qs.stringify({pageIndex: pageIndex,keywords:this.keywords}));
+      if (resp.data.status === 200) {
+        if(pageIndex === 1){
+          this.latestArts = resp.data.data.cmsArticles;
+        }else{
+          this.latestArts.push(...resp.data.data.cmsArticles);
+        }
+      }
+    }
+  },
+  async created() {
+    this.loadLatestArts(this.pageIndex);
+  }
+
+};
 </script>
 
 <style></style>

+ 33 - 5
src/pc/pages/user/user-personal-center.vue

@@ -50,7 +50,7 @@
     <ui-title-devider :title="$t('会员服务')"></ui-title-devider>
     <div class="h-26px"></div>
     <div class="flex justify-around">
-      <ui-vip-preset v-for="vipSmeal in vipSmeals" :item="vipSmeal"></ui-vip-preset>
+      <ui-vip-preset @choose="handleChoose(vipSmeal)" v-for="vipSmeal in vipSmeals" :item="vipSmeal"></ui-vip-preset>
     </div>
     <div class="h-111px"></div>
   </div>
@@ -65,12 +65,40 @@
                 vipSmeals:[]
             }
         },
-        async created() {
-            let resp = await this.$http.post(this.$api.mzUser.userinfo);
+        methods:{
+            async handleChoose(vipSmeal) {
+
+                let resp = await this.$http.post(this.$api.mzUser.createVipOrder,this.$qs.stringify({vipCode:vipSmeal.code}))
+                if(resp.data.status === 200){
+                    await this.$confirm('请在弹出的窗口完成付款操作?', '提示', {
+                        confirmButtonText: '已完成付款',
+                        cancelButtonText: '取消',
+                        type: 'warning'
+                    })
+                    resp = await this.$http.post(this.$api.mzUser.confirmVipOrder,this.$qs.stringify({orderCode:resp.data.data.vipSmOrder.code}))
+
+                    if(resp.data.status === 200){
+                         this.$message.success("开通成功");
+                         this.loadData();
+                    }
+
+                }
+
 
-            if(resp.data.status === 200){
-                this.userinfo = resp.data.data.mzUser;
+
+            },
+            async loadData(){
+                let resp = await this.$http.post(this.$api.mzUser.userinfo);
+
+                if(resp.data.status === 200){
+                    this.userinfo = resp.data.data.mzUser;
+                    this.$store.commit('UPDATE_LOGIN_INFO',resp.data.data.mzUser)
+                }
             }
+        },
+        async created() {
+
+            this.loadData();
 
             let r = await  this.$http.post(this.$api.common.vipSmeals);
             if(r.data.status === 200){