index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <div class="homePage" ref="homePage">
  3. <div class="content">
  4. <van-nav-bar class="navBar" left-arrow title="门店拜访" @click-left="onClickLeft">
  5. </van-nav-bar>
  6. <van-tabs class="myTab" type="card" v-model="tabVal" color="#0057ba" @click="onClickTabs">
  7. <van-tab title="提示类" name="-1" v-if="isGZorJZ == 'false' && onlyShowHomeTarget == false">
  8. <van-pull-refresh v-model="isLoading" @refresh="onRefresh">
  9. <hintTabPage :tabVal="tabVal" ref="hintTabPage"></hintTabPage>
  10. </van-pull-refresh>
  11. </van-tab>
  12. <van-tab title="A类指标" name="0" v-if="onlyShowHomeTarget == false">
  13. <ABtarget :tabVal="tabVal" ref="Atarget"></ABtarget>
  14. </van-tab>
  15. <van-tab title="B类指标" name="1" v-if="onlyShowHomeTarget == false">
  16. <ABtarget :tabVal="tabVal" ref="Btarget"></ABtarget>
  17. </van-tab>
  18. <van-tab title="首页指标" name="2" v-if="onlyShowHomeTarget == true">
  19. <HomeTarget :tabVal="tabVal" ref="HomeTarget" :updataTimeFlag="true"></HomeTarget>
  20. </van-tab>
  21. </van-tabs>
  22. <div class="bottomBtn">
  23. <bottomBtn :tabVal="tabVal" ref="bottomBtn"></bottomBtn>
  24. </div>
  25. </div>
  26. <div class="floatingIcon" :style="setSIcontyle" v-dialogDrag>
  27. <div class="AIIcon" @click="deepseek">
  28. <van-icon class="img" :name="require('@/assets/ai.png')" size="40" />
  29. </div>
  30. <a
  31. class="feedback"
  32. href="https://qiweitest.nipponpaint.com.cn/weixin/ecoRules/redirect/1064/0"
  33. target="_blank"
  34. ><img src="./../../assets/feedback.png"
  35. /></a>
  36. </div>
  37. <tab-bar></tab-bar>
  38. </div>
  39. </template>
  40. <script>
  41. import { getReportInfo, getDictOption, buryingPoint } from '@/api/index';
  42. import hintTabPage from './hintTabPage/index.vue';
  43. import tabBar from '@/components/tabBar';
  44. import ABtarget from './ABtarget.vue';
  45. import HomeTarget from './HomeTarget.vue';
  46. import { mapState } from 'vuex';
  47. import bottomBtn from './bottomBtn.vue';
  48. import { WXdigest } from '@/utils/digest';
  49. export default {
  50. name: 'home',
  51. components: { tabBar, hintTabPage, ABtarget, HomeTarget, bottomBtn },
  52. computed: {
  53. ...mapState({
  54. userInfo: (state) => state.user.userInfo,
  55. }),
  56. },
  57. data() {
  58. return {
  59. tabVal: '-1',
  60. hintTabPageIndex: 0,
  61. isGZorJZ: null,
  62. onlyShowHomeTarget: false,
  63. isLoading: false,
  64. setSIcontyle: {
  65. bottom: '85px',
  66. right: '14px',
  67. },
  68. };
  69. },
  70. watch: {
  71. // 监听切换用户
  72. 'userInfo.userName': {
  73. handler(val) {
  74. if (val) {
  75. this.getDict();
  76. // this.getReportInfo();
  77. }
  78. },
  79. immediete: true,
  80. },
  81. },
  82. activated() {
  83. WXdigest();
  84. if (this.tabVal == '-1') {
  85. // 从其他页面跳转过来如果;要重新获取对应tab数据
  86. // if (this.$refs.hintTabPage) this.$refs.hintTabPage.initData();
  87. } else if (this.tabVal == '0') {
  88. // if (this.$refs.Atarget) this.$refs.Atarget.initData();
  89. } else if (this.tabVal == '1') {
  90. // if (this.$refs.Btarget) this.$refs.Btarget.initData();
  91. }
  92. },
  93. created() {
  94. this.getDict();
  95. let floatingIconStyle = JSON.parse(localStorage.getItem('floatingIcon'));
  96. if (floatingIconStyle && floatingIconStyle.length) {
  97. this.setSIcontyle = {
  98. left: floatingIconStyle[0],
  99. top: floatingIconStyle[1],
  100. };
  101. }
  102. },
  103. mounted() {},
  104. methods: {
  105. onRefresh() {
  106. this.getDict(true);
  107. this.isLoading = false;
  108. },
  109. async getDict(isRefresh) {
  110. let postName = this.userInfo.postName;
  111. if (postName == '质感销售负责人' || postName == '质感销售专员') {
  112. this.onlyShowHomeTarget = true;
  113. } else {
  114. this.onlyShowHomeTarget = false;
  115. let postType = this.userInfo.postType;
  116. // postType:人员类型,JZ(家装)、GZ(公装)、YF(应服)、DIY(DIY)
  117. if (postType == 'JZ' || postType == 'GZ') {
  118. localStorage.setItem('isGZorJZ', 'true');
  119. this.isGZorJZ = 'true';
  120. } else {
  121. localStorage.setItem('isGZorJZ', 'false');
  122. this.isGZorJZ = 'false';
  123. }
  124. }
  125. // 家装或工装不显示提示类tab
  126. this.$nextTick(() => {
  127. // 刷新状态
  128. if (!isRefresh) {
  129. if (this.isGZorJZ == 'true') {
  130. this.tabVal = '0';
  131. } else {
  132. this.tabVal = '-1';
  133. }
  134. }
  135. if (this.$refs.bottomBtn) this.$refs.bottomBtn.getReportInfo();
  136. if (this.tabVal == '-1') {
  137. if (this.$refs.hintTabPage) this.$refs.hintTabPage.initData();
  138. } else if (this.tabVal == '0') {
  139. if (this.$refs.Atarget) this.$refs.Atarget.initData();
  140. } else if (this.tabVal == '1') {
  141. if (this.$refs.Btarget) this.$refs.Btarget.initData();
  142. } else if (this.tabVal == '2') {
  143. if (this.$refs.HomeTarget) this.$refs.HomeTarget.initData();
  144. }
  145. });
  146. },
  147. onClickTabs(val) {
  148. this.$nextTick(() => {
  149. // this.tabVal == '-1' 有watch监听不需要在触发
  150. // if (this.tabVal == '0') {
  151. // if (this.$refs.Atarget) this.$refs.Atarget.initData();
  152. // } else
  153. if (this.tabVal == '1') {
  154. if (this.$refs.Btarget) this.$refs.Btarget.initData();
  155. }
  156. if (this.tabVal == '2') {
  157. if (this.$refs.HomeTarget) this.$refs.HomeTarget.initData();
  158. }
  159. });
  160. },
  161. onClickLeft() {
  162. this.$router.go(-1);
  163. // window.location.href = process.env.VUE_APP_SSB_LINK + "/homeIndex"
  164. },
  165. getReportInfo() {
  166. getReportInfo({ isContent: false }).then((res) => {
  167. if (res.code == 200) {
  168. localStorage.setItem('powerGrade', res.data.positionId);
  169. localStorage.setItem('userDeptLevel', res.data.userDeptLevel);
  170. localStorage.setItem('isDiy', res.data.diy);
  171. localStorage.setItem('uType', res.data.userType);
  172. localStorage.setItem('jzType', res.data.jzType);
  173. localStorage.setItem('customerVisits', res.data.customerManagerVisits);
  174. localStorage.setItem('postType', res.data.postType);
  175. } else {
  176. this.$toast(res.msg);
  177. }
  178. });
  179. },
  180. deepseek() {
  181. buryingPoint({
  182. systemModel: '首页',
  183. buryingPointType: 10,
  184. buryingPointValue: '首页-Ai',
  185. buryingPointName: 'Ai',
  186. buryingPointPosition: '首页-Ai',
  187. });
  188. window.location.href = 'https://deepseek.nipponpaint.com.cn';
  189. },
  190. },
  191. };
  192. </script>
  193. <style scoped lang="scss">
  194. #app {
  195. width: 100%;
  196. height: 100%;
  197. overflow: hidden;
  198. .bgcolor {
  199. width: 100%;
  200. height: 100%;
  201. .homePage {
  202. height: 100%;
  203. width: 100%;
  204. display: flex;
  205. flex-direction: column;
  206. overflow: hidden;
  207. .content {
  208. flex: 1;
  209. overflow-y: auto;
  210. }
  211. .tabBar {
  212. height: 50px;
  213. }
  214. }
  215. }
  216. }
  217. </style>
  218. <style lang="scss">
  219. .homePage {
  220. position: relative;
  221. display: flex;
  222. flex-direction: column;
  223. .myTab {
  224. /* flex: 1; */
  225. display: flex;
  226. flex-direction: column;
  227. /* position: sticky; */
  228. /* top: 0px; */
  229. .van-tabs__wrap {
  230. position: sticky;
  231. top: 0px;
  232. z-index: 10;
  233. }
  234. .van-tabs__content {
  235. flex: 1;
  236. /* margin-bottom: 50px; */
  237. }
  238. }
  239. .myTab .van-tabs__nav--card {
  240. margin: 0 !important;
  241. border-left: 0;
  242. border-right: 0;
  243. }
  244. .myTab .van-tabs__wrap,
  245. .van-tabs__nav--card {
  246. height: 39px;
  247. }
  248. .myTab .van-tab {
  249. line-height: 40px;
  250. }
  251. .bottomBtn {
  252. margin-bottom: 55px;
  253. }
  254. .floatingIcon {
  255. position: absolute;
  256. width: 40px;
  257. z-index: 99999;
  258. height: min-content;
  259. .AIIcon {
  260. width: 100%;
  261. display: inline-block;
  262. cursor: pointer;
  263. }
  264. .AIIcon .img {
  265. border-radius: 100px;
  266. float: left;
  267. }
  268. .AIIcon .img .van-icon__image {
  269. border-radius: 100px;
  270. }
  271. .feedback {
  272. display: inline-block;
  273. width: 100%;
  274. }
  275. .feedback img {
  276. width: 100%;
  277. }
  278. }
  279. }
  280. </style>