Browse Source

fix: 修复bug

huangziyang 3 days ago
parent
commit
63bad1b255

+ 27 - 25
components/Modal/Modal.vue

@@ -83,32 +83,34 @@ defineExpose({
     v-bind="$attrs"
     background-color="transparent"
   >
-    <view
-      class="popup-content"
-      :style="{
-        backgroundColor,
-        width,
-        height,
-      }"
-    >
-      <view class="title">
-        <slot name="title">{{ title }}</slot>
-        <uni-icons type="closeempty" class="icons" @click="close"></uni-icons>
+    <slot name="custom">
+      <view
+        class="popup-content"
+        :style="{
+          backgroundColor,
+          width,
+          height,
+        }"
+      >
+        <view class="title">
+          <slot name="title">{{ title }}</slot>
+          <uni-icons type="closeempty" class="icons" @click="close"></uni-icons>
+        </view>
+        <view class="content">
+          <slot></slot>
+        </view>
+        <view v-if="footer" class="footer">
+          <slot name="footer">
+            <button class="plain" @click="c(onClose)">
+              {{ submitter.closeText || "取消" }}
+            </button>
+            <button class="primary" @click="c(onSubmit)">
+              {{ submitter.text || "确定" }}
+            </button>
+          </slot>
+        </view>
       </view>
-      <view class="content">
-        <slot></slot>
-      </view>
-      <view v-if="footer" class="footer">
-        <slot name="footer">
-          <button class="plain" @click="c(onClose)">
-            {{ submitter.closeText || "取消" }}
-          </button>
-          <button class="primary" @click="c(onSubmit)">
-            {{ submitter.text || "确定" }}
-          </button>
-        </slot>
-      </view>
-    </view>
+    </slot>
   </uni-popup>
 </template>
 

+ 13 - 6
pages.json

@@ -167,6 +167,13 @@
         "navigationBarTitleText": "客服"
       }
     },
+    {
+      "path": "pages/contant/sub",
+      "style": {
+        "navigationStyle": "custom",
+        "navigationBarTitleText": "客服"
+      }
+    },
     {
       "path": "pages/notice/detail",
       "style": {
@@ -212,12 +219,12 @@
         "selectedIconPath": "static/icons/home_select.png",
         "text": "首页"
       },
-      {
-        "pagePath": "pages/learn/index",
-        "iconPath": "static/icons/learn.png",
-        "selectedIconPath": "static/icons/learn_select.png",
-        "text": "学习本"
-      },
+      // {
+      //   "pagePath": "pages/learn/index",
+      //   "iconPath": "static/icons/learn.png",
+      //   "selectedIconPath": "static/icons/learn_select.png",
+      //   "text": "学习本"
+      // },
       {
         "pagePath": "pages/challenge/index",
         "iconPath": "static/icons/challenge.png",

+ 11 - 3
pages/challenge/index.vue

@@ -29,9 +29,17 @@ const isPay = ref(true);
 
 const p = ref(0);
 onShow(async () => {
-  const res = await request(
-    "api/question_bank/question_reception/challenge_registration_log/detail"
-  );
+  let res;
+  try {
+    res = await request(
+      "api/question_bank/question_reception/challenge_registration_log/detail",
+      {
+        showToast: false,
+      }
+    );
+  } catch (e) {
+    isPay.value = false;
+  }
   request(
     "api/question_bank/question_reception/recharge_package/list",
     {

+ 3 - 2
pages/challenge/registration.vue

@@ -13,8 +13,8 @@ const instance = getCurrentInstance();
 const context = ref("");
 const permissions = ref(false);
 const formData = ref({
-  contact_name: "ces",
-  contact_information: "13526483571",
+  contact_name: "",
+  contact_information: "",
   pharmacist_type: 0,
 });
 const loading = ref(false);
@@ -43,6 +43,7 @@ const rules = {
 };
 onShow(() => {
   const { id } = getRoute().params;
+  loading.value = false;
   request("api/question_bank/question_reception/recharge_package/detail", {
     id,
   }).then((res) => {

+ 12 - 13
pages/contant/index.vue

@@ -17,7 +17,7 @@ onShow(() => {
   <Container title="客服" headerColor="#fff">
     <template #bg>
       <image
-        src="https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/05/bHbLzGDSB07Gc0tqCVCI3NLUx4sbUU4KHKSolvBq.png"
+        src="https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/06/62nosnkBoSUk8YfpSsgb0oOWaCIP8LiuWji117O2.png"
         mode="scaleToFill"
         class="bg"
       />
@@ -31,8 +31,7 @@ onShow(() => {
         </div>
       </view>
       <div class="tip">
-        <div class="title">添加客服可获得</div>
-        <div>服务问题优先解决</div>
+        <div class="fi">服务问题优先解决</div>
         <div>考试咨询提前收到</div>
         <div>新政策变化早知道</div>
         <div>各项活动优先参与</div>
@@ -70,14 +69,14 @@ onShow(() => {
     color: #333;
 
     .img {
-      width: 400rpx;
-      height: 400rpx;
+      width: 448rpx;
+      height: 448rpx;
     }
   }
 }
 
 .text-lg {
-  font-size: 44rpx;
+  font-size: 48rpx;
   font-weight: bold;
 }
 
@@ -90,22 +89,22 @@ onShow(() => {
   gap: 20rpx;
 
   .tip {
-    background: #fff;
+    background: url(https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/06/tIT6xZagfurccmnM2X4IqCophs5rCbrHRE3ZYJ7E.png);
+    background-size: 100% 100%;
     border-radius: 40rpx;
     padding: 20rpx 0 40rpx;
     width: 100%;
+    height: 400rpx;
     box-sizing: border-box;
     display: flex;
     flex-direction: column;
     align-items: center;
     justify-content: center;
-    gap: 20rpx;
+    gap: 24rpx;
     color: $warning;
-    .title {
-      font-size: 30rpx;
-      font-weight: bold;
-      color: #000;
-      margin-bottom: 10rpx;
+    padding-top: 24rpx;
+    .fi {
+      margin-top: 60rpx;
     }
   }
 }

+ 107 - 0
pages/contant/sub.vue

@@ -0,0 +1,107 @@
+<script setup>
+import { ref, onMounted } from "vue";
+import Container from "../../components/Container/Container.vue";
+import { request } from "@/utils/request";
+const src = ref("");
+const count = ref(3000);
+onMounted(() => {
+  request(
+    "api/question_bank/question_reception/channel_active_code/random_detail"
+  ).then((res) => {
+    src.value = res.data.qr_code;
+  });
+
+  request(
+    "api/question_bank/question_reception/user_share_forms/get_number_of_invitations"
+  ).then((res) => {
+    count.value += res.data;
+  });
+});
+</script>
+
+<template>
+  <Container title="客服" headerColor="#fff">
+    <template #bg>
+      <view class="bg"></view>
+    </template>
+    <view class="Container">
+      <view class="text-lg">添加专属助教老师为</view>
+      <view class="text-lg">您答疑解惑</view>
+      <view class="text-lg">限时领取《药品速记口诀》</view>
+      <view class="qr-code">
+        <div class="card">
+          <img :src="src" show-menu-by-longpress class="img" alt="" />
+          <span>可长按识别二维码</span>
+        </div>
+      </view>
+      <div class="success">
+        <span class="count">{{ count }}人</span>已免费领取成功啦~
+      </div>
+    </view>
+  </Container>
+</template>
+
+<style lang="scss">
+.bg {
+  width: 750rpx;
+  height: 100%;
+  background: url(https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/06/wqynNcvdPgfxPd8sGeFkumFV8rTmCQqFsxUBAXm4.png);
+  background-size: 100% 100%;
+  box-sizing: border-box;
+}
+
+.qr-code {
+  width: 100%;
+  height: 100%;
+  margin-top: 40px;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  color: $success;
+  gap: 12rpx;
+  .card {
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    flex-direction: column;
+    padding: 60rpx;
+    background-color: #fff;
+    gap: 30rpx;
+    border-radius: 40rpx;
+    width: calc(100%);
+    box-sizing: border-box;
+    color: #333;
+
+    .img {
+      width: 448rpx;
+      height: 448rpx;
+    }
+  }
+}
+
+.text-lg {
+  font-size: 48rpx;
+  font-weight: bold;
+  color: #e85c00;
+}
+
+.success {
+  background-color: #feffe7;
+  padding: 12rpx;
+  border-radius: 50rpx;
+  font-weight: 500;
+  font-size: 28rpx;
+  .count {
+    color: $error;
+  }
+}
+
+.Container {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+  padding: 70rpx 20rpx;
+  gap: 20rpx;
+}
+</style>

+ 196 - 105
pages/index/index.vue

@@ -1,110 +1,140 @@
 <template>
-  <Container
-    class="body-content"
-    title="首页"
-    bgColor="#F8F8F8"
-    :showBack="false"
-  >
-    <view class="home">
-      <!-- 倒计时 -->
-      <view class="time" v-if="(splitDays != '') & (splitDays != null)">
-        <view>距离考试倒计时</view>
-        <!-- 将天数拆分为单个数字显示 -->
-        <view
-          class="exam-countdown-tiem-item"
-          v-for="(digit, index) in splitDays"
-          :key="index"
-          >{{ digit }}</view
+  <template>
+    <Container
+      class="body-content"
+      title="首页"
+      bgColor="#F8F8F8"
+      :showBack="false"
+    >
+      <view class="home">
+        <!-- 倒计时 -->
+        <view class="time" v-if="(splitDays != '') & (splitDays != null)">
+          <view>距离2025年考试倒计时</view>
+          <!-- 将天数拆分为单个数字显示 -->
+          <view
+            class="exam-countdown-tiem-item"
+            v-for="(digit, index) in splitDays"
+            :key="index"
+            >{{ digit }}</view
+          >
+          <view>天</view>
+        </view>
+        <!-- 轮播图 -->
+        <swiper
+          class="swiper"
+          :style="{
+            height: imgHeight,
+          }"
+          circular
+          autoplay
         >
-        <view>天</view>
-      </view>
-      <!-- 轮播图 -->
-      <swiper class="swiper" circular autoplay>
-        <swiper-item v-for="(item, index) in banner_list" :key="index">
-          <view class="swiper-item"
-            ><image
-              class="swiper-item-image"
-              :src="item.image_url"
-              mode="aspectFill"
-              @load="onImageLoad($event, item, index)"
-              @click="goto_notice_list(item.link_url)"
-            ></image
-          ></view>
-        </swiper-item>
-      </swiper>
-      <!-- 公告 -->
-      <view class="notice" v-if="notice_list != '' && notice_list != null">
-        <view class="title-lable">公告</view>
-        <view class="notice-title">{{ notice_list[0]["title"] }}</view>
-        <navigator url="/pages/notice/list">
-          <view class="notice-more">{{ "更多 >" }}</view>
-        </navigator>
-      </view>
-      <!-- 2025新大纲 -->
-      <view class="new_outline">
-        <uni-section title="基础用法" type="line">
-          <view class="p-20">
-            <uni-segmented-control
-              :flex="false"
-              :current="current"
-              :values="list.map((item) => item.name)"
-              style-type="text"
-              @clickItem="(e) => (current = e.currentIndex)"
-            />
-            <!-- 执业药师 -->
-            <template v-for="(item, index) in list" :key="item.id">
-              <view v-if="current === index" class="grid">
-                <view
-                  v-for="i in item?.children"
-                  :key="i.id"
-                  class="flex"
-                  @click="clickClass(i)"
-                >
-                  <image :src="i.chapter_image_url" class="img_small"></image>
-                  <view>{{ i.name }}</view>
+          <swiper-item v-for="(item, index) in banner_list" :key="index">
+            <view class="swiper-item"
+              ><image
+                class="swiper-item-image"
+                :src="item.image_url"
+                mode="aspectFill"
+                @load="onImageLoad($event, item, index)"
+                @click="goto_notice_list(item.link_url)"
+              ></image
+            ></view>
+          </swiper-item>
+        </swiper>
+        <!-- 公告 -->
+        <view class="notice" v-if="notice_list != '' && notice_list != null">
+          <view class="title-lable">公告</view>
+          <view class="notice-title">{{ notice_list[0]["title"] }}</view>
+          <navigator url="/pages/notice/list">
+            <view class="notice-more">{{ "更多 >" }}</view>
+          </navigator>
+        </view>
+        <!-- 2025新大纲 -->
+        <view class="new_outline">
+          <uni-section title="基础用法" type="line">
+            <view class="p-20">
+              <uni-segmented-control
+                :flex="false"
+                :current="current"
+                :values="list.map((item) => item.name)"
+                style-type="text"
+                @clickItem="(e) => (current = e.currentIndex)"
+              />
+              <!-- 执业药师 -->
+              <template v-for="(item, index) in list" :key="item.id">
+                <view v-if="current === index" class="grid">
+                  <view
+                    v-for="i in item?.children"
+                    :key="i.id"
+                    class="flex"
+                    @click="clickClass(i)"
+                  >
+                    <image :src="i.chapter_image_url" class="img_small"></image>
+                    <view>{{ i.name }}</view>
+                  </view>
+                </view>
+              </template>
+            </view>
+          </uni-section>
+        </view>
+        <view class="p-20">
+          <uni-section title="往年真题" type="line">
+            <!-- 往年真题 -->
+            <view class="grid-3">
+              <view
+                v-for="item in rightList"
+                :key="item.originName"
+                class="flex"
+                @click="
+                  toReal({
+                    title: item.name + '真题',
+                    origin: item.originName,
+                  })
+                "
+              >
+                <view class="bg-red">
+                  <view class="text">{{ item.name }}真题</view>
                 </view>
-              </view>
-            </template>
-          </view>
-        </uni-section>
-      </view>
-      <view class="p-20">
-        <uni-section title="往年真题" type="line">
-          <!-- 往年真题 -->
-          <view class="grid-3">
-            <view
-              v-for="item in rightList"
-              :key="item.originName"
-              class="flex"
-              @click="
-                toReal({
-                  title: item.name + '真题',
-                  origin: item.originName,
-                })
-              "
-            >
-              <view class="bg-red">
-                <view class="text">{{ item.name }}真题</view>
               </view>
             </view>
-          </view>
-        </uni-section>
+          </uni-section>
+        </view>
+        <!-- #ifdef  MP-WEIXIN -->
+        <official-account @load="onload"></official-account>
+        <!-- #endif -->
       </view>
-      <!-- #ifdef  MP-WEIXIN -->
-      <official-account @load="onload"></official-account>
-      <!-- #endif -->
+    </Container>
+    <view class="service">
+      <CustomerService>联系客服</CustomerService>
     </view>
-  </Container>
-  <view class="service">
-    <CustomerService>联系客服</CustomerService>
-  </view>
+  </template>
+  <Modal title="ces" :footer="false" v-model:open="showModal">
+    <template #custom>
+      <view class="mo">
+        <uni-icons
+          type="closeempty"
+          class="icons"
+          color="#fff"
+          @click="showModal = false"
+        ></uni-icons>
+        <div class="bgt">
+          <span>恭喜您获得7天会员</span>
+          <span>可以免费学习所有课程以及练习题库</span>
+          <span style="margin-top: 71rpx">戳下方还可以</span>
+          <span>添加专属助教老师为您答疑解惑</span>
+          <span>限时领取《药品速记口诀》</span>
+          <span class="fixed" @click="receive"></span>
+        </div>
+      </view>
+    </template>
+  </Modal>
 </template>
 
 <script setup>
 import { ref, onMounted, computed, onBeforeUnmount } from "vue";
 
 import Container from "../../components/Container/Container.vue";
-import CustomerService from '../../components/CustomerService/CustomerService.vue';
+import CustomerService from "../../components/CustomerService/CustomerService.vue";
+import Modal from "../../components/Modal/Modal.vue";
 import { router, getRoute } from "../../utils/router";
 import { request } from "../../utils/request";
 import { arrayToTree } from "../../utils";
@@ -115,11 +145,26 @@ const banner_list = ref([]);
 const notice_list = ref([]);
 const imgHeight = ref("auto"); // 初始高度
 const rightList = ref([]);
+const showModal = ref(false);
 
 const days = ref("000"); // 默认值设为100,确保有3位数
 let timer = null;
 const exam_time = ref(""); //考试时间
 
+const isLogin = () => {
+  const userInfo = uni.getStorageSync("userLogin");
+  return !!userInfo?.is_register;
+};
+const receive = () => {
+  if (!isLogin()) {
+    router.push("/pages/login/index");
+    return;
+  }
+  showModal.value = false;
+  setTimeout(() => {
+    router.push("/pages/contant/sub");
+  }, 0);
+};
 // 将天数拆分为单个数字数组
 const splitDays = computed(() => {
   // 将数字转为字符串,然后拆分为字符数组
@@ -156,6 +201,7 @@ const toReal = (item) => {
     params: item,
   });
 };
+
 const onImageLoad = (e, item, index) => {
   const { width, height } = e.detail;
   const ratio = height / width;
@@ -163,19 +209,22 @@ const onImageLoad = (e, item, index) => {
   const imgHeightValue = systemInfo.windowWidth * ratio;
   imgHeight.value = imgHeightValue + "px";
 };
+
 onBeforeUnmount(() => {
   if (timer) clearInterval(timer);
 });
+
 const goto_notice_list = (link_url) => {
   uni.navigateTo({
     url: link_url,
   });
 };
+
 onMounted(async () => {
-  const params = getRoute().params
+  const params = getRoute().params;
   if (params.scene) {
-    const p = params.scene.split('=')
-    const value = p[1]
+    const p = params.scene.split("=");
+    const value = p[1];
     uni.setStorageSync("share_uid", value);
   }
   const res = await request(
@@ -240,6 +289,10 @@ onMounted(async () => {
     return newItem;
   });
 
+  if (!isLogin()) {
+    showModal.value = true;
+  }
+
   calculateDays();
   timer = setInterval(() => {
     calculateDays();
@@ -253,14 +306,53 @@ onMounted(async () => {
 
 <style scoped lang="scss">
 @import "@/uni.scss";
+.mo {
+  display: flex;
+  flex-direction: column;
+  align-items: flex-end;
+  width: 658rpx;
+
+  .icons {
+    background: #8a8a8b;
+    width: 48rpx;
+    height: 48rpx;
+    border-radius: 50%;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+  }
+  .bgt {
+    width: 658rpx;
+    height: 766rpx;
+    position: relative;
+    background: url(https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/06/p3qrAPK10tNFOfwy27yryTtwEOsE8x40V0wFvbOW.png);
+    background-size: 100% 100%;
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    font-weight: 600;
+    font-size: 32rpx;
+    color: #8b3700;
+    gap: 16rpx;
+    box-sizing: border-box;
+    padding-top: 161rpx;
+  }
+
+  .fixed {
+    position: absolute;
+    width: 348rpx;
+    height: 86rpx;
+    bottom: 30rpx;
+  }
+}
 .service {
-	position: absolute;
-	bottom: 20%;
-	right: 5%;
-	color: $uni-primary;
-	font-size: 28rpx;
-	margin-bottom: 40rpx;
-	text-align: right;
+  position: absolute;
+  bottom: 20%;
+  right: 5%;
+  color: $uni-primary;
+  font-size: 28rpx;
+  margin-bottom: 40rpx;
+  text-align: right;
 }
 .img_small {
   width: 112rpx;
@@ -314,7 +406,6 @@ onMounted(async () => {
 
   .swiper {
     width: 100%;
-    height: v-bind(imgHeight);
     /* 关键修复样式 */
     overflow: hidden;
     transform-style: preserve-3d;

+ 7 - 10
pages/recharge/index.vue

@@ -87,15 +87,13 @@
           </template>
         </uni-data-checkbox>
       </view>
-      <button class="open-btn" @click="onSubmit">
-        立即开通
-      </button>
+      <button class="open-btn" @click="onSubmit">立即开通</button>
     </template>
-    <!-- 客服 -->
-    <view class="service">
-      <CustomerService>联系客服</CustomerService>
-    </view>
   </Container>
+  <!-- 客服 -->
+  <view class="service">
+    <CustomerService>联系客服</CustomerService>
+  </view>
 </template>
 
 <script setup name="recharge">
@@ -118,7 +116,7 @@ const paying = ref(false);
 const onSubmit = () => {
   if (paying.value) return;
   console.log(paying.value);
-  
+
   if (!isSelected.value[0])
     return uni.showToast({
       icon: "none",
@@ -327,10 +325,9 @@ onMounted(async () => {
 .service {
   color: $uni-primary;
   font-size: 28rpx;
-  margin-bottom: 40rpx;
   text-align: right;
   position: absolute;
-  bottom: 10%;
+  bottom: 30%;
   right: 5%;
 }
 

+ 3 - 3
pages/success/error.vue

@@ -62,7 +62,7 @@ onShow(() => {
     align-items: center;
     justify-content: center;
     flex-direction: column;
-    padding: 80rpx;
+    padding: 60rpx;
     background-color: #fff;
     gap: 40rpx;
     border-radius: 40rpx;
@@ -71,8 +71,8 @@ onShow(() => {
     color: #333;
 
     .img {
-      width: 181px;
-      height: 181px;
+      width: 448rpx;
+      height: 448rpx;
     }
   }
 }

+ 3 - 3
pages/success/paysuccess.vue

@@ -66,7 +66,7 @@ onShow(() => {
     align-items: center;
     justify-content: center;
     flex-direction: column;
-    padding: 80rpx;
+    padding: 60rpx;
     background-color: #fff;
     gap: 40rpx;
     border-radius: 40rpx;
@@ -75,8 +75,8 @@ onShow(() => {
     color: #333;
 
     .img {
-      width: 181px;
-      height: 181px;
+      width: 448rpx;
+      height: 448rpx;
     }
   }
 }

+ 4 - 3
utils/request.js

@@ -31,7 +31,8 @@ port = "wap";
 // #endif
 // domain = "https://openwork.dfwy.tech/";
 // 发送网络请求的函数
-export const request = (url, data = {}, method = "GET") => {
+export const request = (url, d = {}, method = "GET") => {
+  let { showToast = true, ...data } = d;
   // 获取登录标识
   let userLogin = uni.getStorageSync("userLogin");
   let shopId = uni.getStorageSync("shopId");
@@ -68,9 +69,9 @@ export const request = (url, data = {}, method = "GET") => {
           reject("请登录");
           return;
         }
-        if (res.code !== "success") {
+        if (res.data.code !== "success" && showToast) {
           uni.showToast({
-            title: res.msg,
+            title: res.data.msg,
             icon: "none",
           });
         }