db 2 жил өмнө
parent
commit
15108d812f

+ 3 - 3
.env.development

@@ -1,7 +1,7 @@
 VITE_APP_BASE_URL="/cygx"
 
-VITE_APP_OUTDIR="dist"
+VITE_APP_OUTDIR="horz_cygx_zs"
 
-VITE_APP_WX_APPID ="wxb7cb8a15abad5b8e"
+VITE_APP_WX_APPID ="wx9b5d7291e581233a"
 
-VITE_APP_CYGX_BASEAPIURL="http://rddpweb.brilliantstart.cn/api"
+VITE_APP_CYGX_BASEAPIURL="http://8.136.199.33:8103/api"

+ 1 - 1
.env.product

@@ -1,6 +1,6 @@
 VITE_APP_BASE_URL="/cygx"
 
-VITE_APP_OUTDIR="cygxzs"
+VITE_APP_OUTDIR="horz_cygx_zs"
 
 VITE_APP_WX_APPID ="wxb7cb8a15abad5b8e"
 

+ 3 - 3
.env.test

@@ -1,7 +1,7 @@
 VITE_APP_BASE_URL="/cygx"
 
-VITE_APP_OUTDIR="cygx_xzs"
+VITE_APP_OUTDIR="horz_cygx_zs"
 
-VITE_APP_WX_APPID ="wxb7cb8a15abad5b8e"
+VITE_APP_WX_APPID ="wx9b5d7291e581233a"
 
-VITE_APP_CYGX_BASEAPIURL="http://rddpweb.brilliantstart.cn/api"
+VITE_APP_CYGX_BASEAPIURL="http://8.136.199.33:8103/api"

+ 2 - 0
.gitignore

@@ -3,4 +3,6 @@ node_modules
 dist
 dist-ssr
 *.local
+horz_cygx_zs
+horz_cygx_zs.zip
 package-lock.json

+ 2 - 1
index.html

@@ -5,7 +5,8 @@
     <link rel="icon" href="/favicon.ico" />
     <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover"/>
     <title>Vite App</title>
-    <script type="text/javascript" src="https://res2.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
+    <script src="http://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
+    <!-- <script  src="https://res2.wx.qq.com/open/js/jweixin-1.6.0.js"></script> -->
   </head>
   <body>
     <div id="app"></div>

+ 6 - 6
src/App.vue

@@ -2,13 +2,13 @@
   <router-view></router-view>
 </template>
 
-<script>
-// import { onMounted } from "vue";
-// import { wxLogin } from "@/util/wxLogin";
+<script setup>
+import { onMounted } from "vue";
+import { wxLogin } from "@/util/wxLogin";
 
-// onMounted(() => {
-//   wxLogin();
-// });
+onMounted(() => {
+  wxLogin();
+});
 </script>
 
 <style>

+ 14 - 0
src/api/api.js

@@ -1,12 +1,26 @@
 import { get, post } from "./http";
 
+//微信登录小助手接口
 export const apiWxLogin = (params) => {
   return get("/wechat/loginByxzs", params);
 };
 
+//微信获取签名接口
 export const getWxSign = (params) => {
   return get("/wechat/getWxSign", params);
 };
+
+//获取用户详情接口
 export const getUser = (params) => {
   return get("/wechat/user/detail", params);
 };
+
+//获取用户的选择详情接口
+export const getUserChoose = (params) => {
+  return get("/user/choose/detail", params);
+};
+//提交用户的选择详情接口
+export const postChooseSubmit = (params) => {
+  return post("/user/choose/submit", params);
+};
+

+ 0 - 2
src/api/http.js

@@ -3,7 +3,6 @@ import axios from "axios";
 
 let config = {
   baseURL: import.meta.env.VITE_APP_CYGX_BASEAPIURL,
-  // baseURL: 'http://192.168.20.34:8103/api',
   timeout: 60 * 1000, // Timeout
 };
 const _axios = axios.create(config);
@@ -14,7 +13,6 @@ _axios.interceptors.request.use(
     if (auth) {
       config.headers.Authorization = auth;
     }
-    config.headers.Authorization= 'b0e0cb73b728d57c3895ec3817af1429'
     return config;
   },
   function (error) {

+ 1 - 1
src/router/index.js

@@ -10,7 +10,7 @@ const routes = [
 ];
 
 const router = createRouter({
-  history: createWebHistory(import.meta.env.VITE_APP_BASE_URL),
+  history: createWebHistory(),
   routes,
 });
 

+ 30 - 6
src/util/wxLogin.js

@@ -2,7 +2,7 @@
  * 微信授权登录(静默)
  */
 
-import { apiWxLogin } from "@/api/api";
+import { apiWxLogin, getWxSign } from "@/api/api";
 import { Toast } from "vant";
 import "vant/es/toast/style";
 
@@ -31,13 +31,37 @@ export const wxLogin = async () => {
 
   if (urlParams.code) {
     let res = await apiWxLogin({ Code: urlParams.code });
-    if (res.data.Ret === 200) {
-      localStorage.setItem("Authorization", res.data.Data.Token);
-      window.location.href = `${window.location.origin}${process.env.VITE_APP_BASE_URL}/cygx/index`;
+    if (res.Ret === 200) {
+      localStorage.setItem("Authorization", res.Data.Token);
+
+      window.location.href = `${window.location.origin}/`;
     }
   } else {
-    const redirectUri = encodeURIComponent(`${window.location.origin}${process.env.VITE_APP_BASE_URL}/cygx/index`);
-    const appid = process.env.VITE_APP_WX_APPID;
+    const redirectUri = encodeURIComponent(`${window.location.origin}/`);
+    const appid = import.meta.env.VITE_APP_WX_APPID;
     window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirectUri}&response_type=code&scope=snsapi_base&state=123#wechat_redirect`;
   }
 };
+
+/**
+ * 微信js_sdk
+ */
+export const wxconfig = async () => {
+  const res = await getWxSign({ Url: window.location.href });
+  if (res.Ret === 200) {
+    wx.config({
+      debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
+      appId: res.Data.AppId, // 必填,公众号的唯一标识
+      timestamp: res.Data.Timestamp, // 必填,生成签名的时间戳
+      nonceStr: res.Data.NonceStr, // 必填,生成签名的随机串
+      signature: res.Data.Signature, // 必填,签名
+      jsApiList: ["hideAllNonBaseMenuItem", "wx-open-launch-weapp"],
+      openTagList: ["wx-open-launch-weapp"], // 可选,需要使用的开放标签列表,例如['wx-open-launch-app']
+    });
+    wx.ready(function () {
+      setTimeout(() => {
+        wx.hideAllNonBaseMenuItem();
+      }, 400);
+    });
+  }
+};

+ 350 - 2
src/views/changeTag.vue

@@ -1,12 +1,360 @@
 <script setup>
 import { reactive, toRefs, onMounted, ref, unref } from "vue";
+import { getUserChoose, getUser, postChooseSubmit } from "@/api/api.js";
+import { Toast } from "vant";
+import { wxconfig } from "@/util/wxLogin";
+
+import "vant/es/toast/style";
+
+const isSelectedClick = ref(true);
+
+/**
+ * 用户详情
+ */
+const userInfo = ref({});
+const permissionList = ref([]);
+// 获取用户详情
+const getUse = async () => {
+  if (localStorage.getItem("Authorization")) {
+    let res = await getUser();
+    if (res.Ret === 200) {
+      userInfo.value = res.Data;
+      permissionList.value = userInfo.value.Permission.split(",") || [];
+    }
+  }
+};
+
+/**
+ * 获取用户的选择
+ */
+const chooseList = ref([]);
+const activeTag = ref("");
+
+//点击产业 tag
+const tagHandel = (item) => {
+  isSelectedClick.value = true;
+  activeTag.value = item.ChartPermissionId;
+};
+//复选框组
+const handleCheckAllChange = (item) => {
+  isSelectedClick.value = true;
+  // 取到所有的子菜单id
+  let ids = item.List.map((item) => {
+    return item.IndustrialManagementId;
+  });
+  item.CheckList = item.checkAll ? ids : [];
+  item.isIndeterminate = false;
+};
+//复选框组
+const handleCheckedCitiesChange = (item) => {
+  isSelectedClick.value = true;
+  let len = item.CheckList.length;
+  item.checkAll = len === item.List.length;
+  item.isIndeterminate = len > 0 && len < item.List.length;
+};
+
+const objective = ref(false);
+const subjectivity = ref(false);
+
+const statusHandel = () => {
+  isSelectedClick.value = false;
+};
+
+//获取用户的选择
+const getChooseList = async () => {
+  const res = await getUserChoose();
+  console.log(res);
+  if (res.Ret === 200) {
+    let checkArr = [];
+    res.Data.List.forEach((item) => {
+      console.log(item);
+      let obj = {
+        checkAll: item.CheckList.length === item.List.length ? true : false,
+        isIndeterminate: item.CheckList.length > 0 && item.CheckList.length < item.List.length,
+        ...item,
+      };
+      checkArr.push(obj);
+    });
+    chooseList.value = checkArr;
+    objective.value = res.Data.IsObjective == 1 ? true : false;
+    subjectivity.value = res.Data.IsSubjective == 1 ? true : false;
+    isSelectedClick.value = res.Data.IsRefuse == 0 ? true : false;
+    activeTag.value = chooseList.value[0].ChartPermissionId;
+  }
+};
+//用户的选择保存
+const chooseSubmit = async () => {
+  let arr = [];
+  chooseList.value.forEach((item) => {
+    arr.push({
+      ChartPermissionId: item.ChartPermissionId,
+      IndustrialManagementIds: item.CheckList.join(","),
+    });
+  });
+  const res = await postChooseSubmit({
+    IsObjective: objective.value ? 1 : 0,
+    IsSubjective: subjectivity.value ? 1 : 0,
+    IsRefuse: isSelectedClick.value ? 0 : 1,
+    IndustrialManagementIds: arr.length && arr.flat(Infinity),
+  });
+  if (res.Ret === 200) {
+    Toast.success("保存成功");
+  }
+};
+
 onMounted(() => {
   document.title = "推送规则";
+  getChooseList();
+  getUse();
+  wxconfig();
 });
 </script>
 
 <template>
-  <div class="container">123</div>
+  <div class="container-tag">
+    <div class="top-content">
+      <div class="personal-details">
+        <div class="head-portrait">
+          <img :src="userInfo.Headimgurl" v-if="userInfo.Headimgurl" />
+          <img src="@/assets/img/init_imgurl.png" v-else />
+        </div>
+        <div class="details-item">
+          <template v-if="userInfo.HasPermission == 1 || userInfo.HasPermission == 2">
+            <p class="name">{{ userInfo.RealName }}</p>
+            <p class="phone">{{ userInfo.Mobile }}</p>
+            <p class="company">{{ userInfo.CompanyName }}</p>
+          </template>
+          <p class="no-info" v-else>暂无您的客户信息</p>
+        </div>
+      </div>
+      <div class="authority">
+        <template v-if="userInfo.HasPermission == 1">
+          <div class="item" v-for="item in permissionList" :key="item">{{ item }}</div>
+        </template>
+        <template v-else-if="userInfo.HasPermission == 2">
+          <div class="item">暂无权限</div>
+        </template>
+      </div>
+    </div>
+    <template v-if="userInfo.HasPermission == 1">
+      <div :class="['select-content', isSelectedClick ? 'is-active' : 'is-not']">
+        <p class="slogan">请向我推送以下行业/赛道的研究更新和活动提醒:</p>
+        <div class="checkbox-content">
+          <div class="checkbox-item">
+            <div :class="['item', activeTag == item.ChartPermissionId ? 'active' : '']" v-for="item in chooseList" :key="item.ChartPermissionId" @click="tagHandel(item)">
+              {{ item.PermissionName }}
+            </div>
+          </div>
+          <template v-for="item in chooseList" :key="item.ChartPermissionId">
+            <div v-if="activeTag == item.ChartPermissionId" class="check-ul">
+              <el-checkbox v-model="item.checkAll" :indeterminate="item.isIndeterminate" @change="handleCheckAllChange(item)">{{ item.AllTracks }}</el-checkbox>
+              <div class="check-li">
+                <el-checkbox-group v-model="item.CheckList" @change="handleCheckedCitiesChange(item)">
+                  <el-checkbox v-for="key in item.List" :key="key.IndustrialManagementId" :label="key.IndustrialManagementId">{{ key.IndustryName }}</el-checkbox>
+                </el-checkbox-group>
+              </div>
+            </div>
+          </template>
+          <div class="distinguish">
+            <p>以上赛道</p>
+            <el-checkbox @change="isSelectedClick = true" v-model="objective" label="Option 1" size="large">请向我推送【客观类】内容</el-checkbox>
+            <p class="check-explain">(线上/线下调研及调研纪要、产业跟踪、季度跟踪)</p>
+            <el-checkbox @change="isSelectedClick = true" v-model="subjectivity" label="Option 2" size="large">请向我推送【主观类】内容</el-checkbox>
+            <p class="check-explain">(行业深度报告、路演精华、财报点评、分析师沙龙、产业深度路演)</p>
+          </div>
+        </div>
+      </div>
+      <div :class="['no-push', isSelectedClick ? 'is-not' : 'is-active']" @click="statusHandel">我不希望接收最新报告和活动更新的推送</div>
+      <div class="confirm" @click="chooseSubmit">保存</div>
+    </template>
+    <template v-else>
+      <p class="inform" v-if="userInfo.HasPermission == 2">当前无行业权限,可前往【查研观向】小程序申请开通试用权限</p>
+      <p class="inform" v-else-if="userInfo.HasPermission == 3">请先前往【查研观向】小程序绑定您的联系方式并申请开通试用权限</p>
+      <div class="bottom-btn">
+        去小程序
+        <wx-open-launch-weapp id="launch-btn" class="wx-app" username="gh_a9d3744e1072" path="pages/index/index">
+          <div v-is="'script'" type="text/wxtag-template">
+            <div class="btn">去小程序</div>
+          </div>
+        </wx-open-launch-weapp>
+      </div>
+    </template>
+  </div>
 </template>
 
-<style lang="" scoped></style>
+<style lang="scss" scoped>
+.container-tag {
+  padding: 34px;
+  background: #ffffff;
+  .top-content {
+    padding: 15px;
+  }
+  .personal-details {
+    display: flex;
+    .head-portrait {
+      width: 126px;
+      height: 126px;
+      border-radius: 50%;
+      overflow: hidden;
+      img {
+        width: 100%;
+        height: 100%;
+      }
+    }
+    .details-item {
+      margin-left: 30px;
+      font-size: 28px;
+      color: #666666;
+      .name {
+        font-size: 34px;
+        font-weight: 500;
+        color: #333333;
+      }
+      .phone {
+        padding: 10px 0 5px;
+      }
+    }
+  }
+  .authority {
+    height: 138px;
+    width: 105%;
+    overflow: hidden;
+    padding-top: 10px;
+    .item {
+      width: 148px;
+      height: 34px;
+      font-size: 24px;
+      border-radius: 4px;
+      background-color: #edf4ff;
+      display: inline-block;
+      margin: 20px 20px 0 0;
+      text-align: center;
+      line-height: 32px;
+      border: 1px solid #3385ff;
+      font-weight: 400;
+      color: #3385ff;
+    }
+  }
+  .no-info {
+    line-height: 100px;
+    color: #333333;
+    font-size: 34px;
+  }
+  .inform {
+    color: #666666;
+    font-size: 28px;
+    text-align: center;
+    width: 80%;
+    margin: 200px auto;
+  }
+  .select-content {
+    padding: 20px;
+    border: 1px dashed #dadfe5;
+    .checkbox-content {
+      width: 100%;
+      overflow: hidden;
+      .slogan {
+        font-size: 28px;
+        color: #666666;
+        font-weight: 400;
+      }
+      .checkbox-item {
+        width: 105%;
+        padding-bottom: 25px;
+        border-bottom: 1px dashed #dadfe5;
+        .item {
+          width: 124px;
+          height: 38px;
+          font-size: 24px;
+          border-radius: 4px;
+          display: inline-block;
+          margin: 20px 20px 0 0;
+          text-align: center;
+          line-height: 36px;
+          border: 1px solid #3385ff;
+          font-weight: 400;
+          color: #3385ff;
+        }
+        .active {
+          background: #3385ff;
+          color: #ffffff;
+        }
+      }
+    }
+    .check-ul {
+      padding: 10px;
+    }
+    .check-li {
+      margin-top: 20px;
+      height: 520px;
+      overflow: hidden;
+      overflow-y: auto;
+      .el-checkbox {
+        width: 48%;
+        margin: 0;
+        padding: 0;
+        overflow: hidden;
+      }
+    }
+    .distinguish {
+      border-top: 1px dashed #dadfe5;
+      padding: 40px 10px;
+      .check-explain {
+        font-size: 24px;
+        color: #999;
+        text-indent: 1em;
+      }
+    }
+  }
+  .is-active {
+    background-color: #e9effe;
+    border: 1px dashed #3385ff !important;
+  }
+  .is-not {
+    background-color: #f9f9f9;
+  }
+  .confirm {
+    width: 368px;
+    height: 80px;
+    background: #3385ff;
+    font-size: 34px;
+    color: #fff;
+    margin: 0 auto;
+    text-align: center;
+    line-height: 80px;
+    border-radius: 8px;
+  }
+  .no-push {
+    font-size: 28px;
+    color: #333;
+    width: 100%;
+    height: 99px;
+    line-height: 99px;
+    border: 1px dashed #dadfe5;
+    margin: 30px 0 40px;
+    text-indent: 1em;
+  }
+  .el-checkbox-group {
+    display: flex;
+    flex-wrap: wrap;
+    justify-content: space-between;
+  }
+
+  :deep(.el-checkbox__label) {
+    width: 100%;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+  }
+  .bottom-btn {
+    width: 368px;
+    height: 80px;
+    background: #3385ff;
+    line-height: 80px;
+    text-align: center;
+    margin: 0 auto;
+    font-size: 34px;
+    color: #fff;
+  }
+}
+</style>

+ 27 - 32
src/views/index.vue

@@ -4,6 +4,9 @@ import { Button, Toast } from "vant";
 import "vant/es/toast/style";
 import { getWxSign, getUser } from "@/api/api.js";
 import { useRouter, useRoute } from "vue-router";
+import { wxconfig } from "@/util/wxLogin";
+import imgUrl_bg from "@/assets/img/bg_icon.png";
+import imgUrl_card from "@/assets/img/card_bg.png";
 const router = useRouter();
 
 /**
@@ -12,38 +15,15 @@ const router = useRouter();
 const userInfo = ref({});
 const permissionList = ref([]);
 const getUse = async () => {
-  // if (localStorage.getItem("Authorization")) {
-  let res = await getUser({
-    Token: "b0e0cb73b728d57c3895ec3817af1429",
-  });
-  console.log(res);
-  if (res.Ret === 200) {
-    userInfo.value = res.Data;
-    permissionList.value = userInfo.value.Permission.split(",") || [];
+  if (localStorage.getItem("Authorization")) {
+    let res = await getUser();
+    if (res.Ret === 200) {
+      userInfo.value = res.Data;
+      permissionList.value = userInfo.value.Permission.split(",") || [];
+    }
   }
-  // }
 };
 
-/**
- * 微信js_sdk
- */
-const wxconfig = async () => {
-  const res = await getWxSign({ Url: window.location.href });
-  if (res.Ret === 200) {
-    wx.config({
-      debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
-      appId: res.Data.AppId, // 必填,公众号的唯一标识
-      timestamp: res.Data.Timestamp, // 必填,生成签名的时间戳
-      nonceStr: res.Data.NonceStr, // 必填,生成签名的随机串
-      signature: res.Data.Signature, // 必填,签名
-      jsApiList: ["hideAllNonBaseMenuItem", "onMenuShareTimeline"],
-      openTagList: ["wx-open-launch-weapp"], // 可选,需要使用的开放标签列表,例如['wx-open-launch-app']
-    });
-    wx.ready(function () {
-      wx.hideAllNonBaseMenuItem();
-    });
-  }
-};
 /**
  * 点击跳转推送规则
  */
@@ -64,9 +44,24 @@ const handleErrorFn = () => {
 };
 
 getUse();
-// wxconfig();
+wxconfig();
 onMounted(() => {
   document.title = "登录";
+  //资源加载
+  function resourceLoad() {
+    let imgs = [imgUrl_bg, imgUrl_card];
+    for (let img of imgs) {
+      let image = new Image();
+      image.src = img;
+      image.onload = (e) => {
+        console.log("背景图预加载成功");
+      };
+      image.onerror = (e) => {
+        console.log("背景图预加载失败", e);
+      };
+    }
+  }
+  resourceLoad();
   var btn = document.getElementById("launch-btn");
   btn.addEventListener("launch", function (e) {
     console.log("success");
@@ -113,10 +108,10 @@ onMounted(() => {
         <p class="inform" v-if="userInfo.HasPermission == 1">您亦可在【推送规则】中更改您关注的赛道,让小助手更好地理解您的需求,为您降噪哦~</p>
         <p class="inform" v-else-if="userInfo.HasPermission == 2">当前无行业权限,可前往【查研观向】小程序申请开通试用权限</p>
         <p class="inform" v-else-if="userInfo.HasPermission == 3">请先前往【查研观向】小程序绑定您的联系方式并申请开通试用权限</p>
-        <div class="bottom-btn" v-if="userInfo.HasPermission == 2" @click="goChangeTag">去更改</div>
+        <div class="bottom-btn" v-if="userInfo.HasPermission == 1" @click="goChangeTag">去更改</div>
         <div class="bottom-btn" v-else>
           去小程序
-          <wx-open-launch-weapp id="launch-btn" class="wx-app" username="gh_a9d3744e1072" path="pages/index/index.html">
+          <wx-open-launch-weapp id="launch-btn" class="wx-app" username="gh_a9d3744e1072" path="pages/index/index">
             <div v-is="'script'" type="text/wxtag-template">
               <div class="btn">去小程序</div>
             </div>

+ 1 - 1
vite.config.js

@@ -7,7 +7,7 @@ import { VantResolver } from "unplugin-vue-components/resolvers";
 import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
 export default ({ mode }) =>
   defineConfig({
-    base: loadEnv(mode, process.cwd()).VITE_APP_BASE_URL,
+    // base: loadEnv(mode, process.cwd()).VITE_APP_BASE_URL,
     plugins: [
       vue(),
       AutoImport({