index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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"></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. import store from '@/store';
  50. export default {
  51. name: 'home',
  52. components: { tabBar, hintTabPage, ABtarget, HomeTarget, bottomBtn },
  53. computed: {
  54. ...mapState({
  55. userInfo: (state) => state.user.userInfo,
  56. reportInfo: (state) => state.user.reportInfo,
  57. }),
  58. },
  59. data() {
  60. return {
  61. tabVal: '-1',
  62. hintTabPageIndex: 0,
  63. isGZorJZ: null,
  64. onlyShowHomeTarget: false,
  65. isLoading: false,
  66. setSIcontyle: {
  67. bottom: '85px',
  68. right: '14px',
  69. },
  70. };
  71. },
  72. watch: {
  73. // 监听切换用户
  74. 'userInfo.userName': {
  75. handler(val) {
  76. if (val) {
  77. this.getDict();
  78. // this.getReportInfo();
  79. }
  80. },
  81. immediete: true,
  82. },
  83. },
  84. activated() {
  85. this.getReportInfo();
  86. WXdigest();
  87. },
  88. created() {
  89. this.getDict();
  90. let floatingIconStyle = JSON.parse(localStorage.getItem('floatingIcon'));
  91. if (floatingIconStyle && floatingIconStyle.length) {
  92. this.setSIcontyle = {
  93. left: floatingIconStyle[0],
  94. top: floatingIconStyle[1],
  95. };
  96. }
  97. },
  98. mounted() {},
  99. methods: {
  100. onRefresh() {
  101. this.getDict(true);
  102. this.isLoading = false;
  103. },
  104. async getDict(isRefresh) {
  105. let postType = this.userInfo.postType;
  106. let postName = this.userInfo.postName;
  107. if (postName == '质感销售负责人' || postName == '质感销售专员') {
  108. this.onlyShowHomeTarget = true;
  109. } else {
  110. // <!-- 0-历史指标 1-动态指标,String类型 -->
  111. if (postType == 'GZ') {
  112. if (this.reportInfo.targetType == '0') {
  113. localStorage.setItem('isGZorJZ', 'true');
  114. this.isGZorJZ = 'true';
  115. } else if (this.reportInfo.targetType == '1') {
  116. this.onlyShowHomeTarget = true;
  117. }
  118. } else {
  119. this.onlyShowHomeTarget = false;
  120. // postType:人员类型,JZ(家装)、GZ(公装)、YF(应服)、DIY(DIY)
  121. if (postType == 'JZ') {
  122. localStorage.setItem('isGZorJZ', 'true');
  123. this.isGZorJZ = 'true';
  124. } else {
  125. localStorage.setItem('isGZorJZ', 'false');
  126. this.isGZorJZ = 'false';
  127. }
  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. this.toastLoading(0, '加载中...', true);
  172. // 获取移动端获取用户信息接口
  173. store
  174. .dispatch('getReportInfoDeta')
  175. .then(() => {
  176. this.toastLoading().clear();
  177. })
  178. .catch(() => {
  179. this.toastLoading().clear();
  180. });
  181. },
  182. deepseek() {
  183. buryingPoint({
  184. systemModel: '首页',
  185. buryingPointType: 10,
  186. buryingPointValue: '首页-Ai',
  187. buryingPointName: 'Ai',
  188. buryingPointPosition: '首页-Ai',
  189. });
  190. window.location.href = 'https://deepseek.nipponpaint.com.cn';
  191. },
  192. },
  193. };
  194. </script>
  195. <style scoped lang="scss">
  196. #app {
  197. width: 100%;
  198. height: 100%;
  199. overflow: hidden;
  200. .bgcolor {
  201. width: 100%;
  202. height: 100%;
  203. .homePage {
  204. height: 100%;
  205. width: 100%;
  206. display: flex;
  207. flex-direction: column;
  208. overflow: hidden;
  209. .content {
  210. flex: 1;
  211. overflow-y: auto;
  212. }
  213. .tabBar {
  214. height: 50px;
  215. }
  216. }
  217. }
  218. }
  219. </style>
  220. <style lang="scss">
  221. .homePage {
  222. position: relative;
  223. display: flex;
  224. flex-direction: column;
  225. .myTab {
  226. /* flex: 1; */
  227. display: flex;
  228. flex-direction: column;
  229. /* position: sticky; */
  230. /* top: 0px; */
  231. .van-tabs__wrap {
  232. position: sticky;
  233. top: 0px;
  234. z-index: 10;
  235. }
  236. .van-tabs__content {
  237. flex: 1;
  238. /* margin-bottom: 50px; */
  239. }
  240. }
  241. .myTab .van-tabs__nav--card {
  242. margin: 0 !important;
  243. border-left: 0;
  244. border-right: 0;
  245. }
  246. .myTab .van-tabs__wrap,
  247. .van-tabs__nav--card {
  248. height: 39px;
  249. }
  250. .myTab .van-tab {
  251. line-height: 40px;
  252. }
  253. .bottomBtn {
  254. margin-bottom: 55px;
  255. }
  256. .floatingIcon {
  257. position: absolute;
  258. width: 40px;
  259. z-index: 99999;
  260. height: min-content;
  261. .AIIcon {
  262. width: 100%;
  263. display: inline-block;
  264. cursor: pointer;
  265. }
  266. .AIIcon .img {
  267. border-radius: 100px;
  268. float: left;
  269. }
  270. .AIIcon .img .van-icon__image {
  271. border-radius: 100px;
  272. }
  273. .feedback {
  274. display: inline-block;
  275. width: 100%;
  276. }
  277. .feedback img {
  278. width: 100%;
  279. }
  280. }
  281. }
  282. </style>