index.vue 7.9 KB

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