index.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. <template>
  2. <view class="person_wrap">
  3. <template v-if="userInfo.userId">
  4. <view class="navbar-wrap">
  5. <view class="column" :class="{fixed : isFixedTop}" :style="{background: background}" id="navbar">
  6. <view class="left"></view>
  7. <view style="font-size:36rpx" class="center">我的</view>
  8. <view class="right" @click="handleSetting">
  9. <u-icon name="setting" color="#333"></u-icon>
  10. </view>
  11. </view>
  12. <!-- <view class="column" v-if="isFixedTop"></view> -->
  13. </view>
  14. <view class="header_wrap">
  15. <view class="header_top_wrap">
  16. <view class="header_info_left">
  17. <u-avatar :src="$avatar(userInfo.avatar)" size="100rpx"></u-avatar>
  18. <view class="info_wrap">
  19. <view class="info_top">
  20. <text class="follow_name">{{userInfo.userName}}</text>
  21. <u-switch v-model="onlineStatus" active-value='0' inactive-value='1' :loading="onlineLoading" @change="changeOnlineStatus"></u-switch>
  22. <text class="identity">{{ onlineStatus === '0' ? '上线' : '下线' }}</text>
  23. </view>
  24. <view class="info_bottom">
  25. <text>{{userInfo.phonenumber}}</text>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="header_info_right" @click="toPersonal">
  30. <u-icon name="arrow-right" color="#aaa"></u-icon>
  31. </view>
  32. </view>
  33. <view class="parson_menu_wrap">
  34. <view class="parson_menu_list">
  35. <navigator url="/pages/publicClue/index" open-type="switchTab" class="menu_item" hover-class="none">
  36. <image src="@/static/parson/icon-wf.png" mode=""></image>
  37. <text>销售公海</text>
  38. </navigator>
  39. <navigator url='/pages/message/index' open-type="navigate" class="menu_item" hover-class="none">
  40. <image src="@/static/parson/icon-myMessage.png" mode=""></image>
  41. <text>我的消息</text>
  42. </navigator>
  43. <navigator url='/pages/profile/index' open-type="navigate" class="menu_item" hover-class="none">
  44. <image src="@/static/parson/icon-mycase.png" mode=""></image>
  45. <text>个人资料</text>
  46. </navigator>
  47. <navigator url='/pages/privateClue/index' open-type="switchTab" class="menu_item" hover-class="none">
  48. <image src="@/static/parson/clue.png" mode=""></image>
  49. <text>销售线索</text>
  50. </navigator>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="secondHalf">
  55. <option-list></option-list>
  56. </view>
  57. </template>
  58. <u-loading-page :loading="true" v-else></u-loading-page>
  59. </view>
  60. </template>
  61. <script>
  62. import optionList from "./option/index.vue"
  63. import permision from "@/js_sdk/wa-permission/permission.js";
  64. export default {
  65. components: {
  66. optionList
  67. },
  68. data() {
  69. return {
  70. onlineLoading : false,
  71. switchSystemShow: false,
  72. navbarInitTop: 0, //导航栏初始化距顶部的距离
  73. isFixedTop: true, //是否固定顶部
  74. background: "", // 为了实现渐变背景颜色
  75. };
  76. },
  77. computed: {
  78. userInfo(){
  79. return this.$store.state.user.userInfo;
  80. },
  81. onlineStatus : {
  82. get(){
  83. return this.$store.state.user.userInfo.onlineStatus;
  84. },
  85. set(val){
  86. this.$store.commit("user/SET_USER_ONLINE_STATUS",val);
  87. },
  88. },
  89. nickName(){
  90. return this.userInfo.nickName;
  91. },
  92. userName(){
  93. return this.userInfo.userName;
  94. },
  95. deptName(){
  96. return this.userInfo.newOrgName;
  97. },
  98. time(){
  99. return this.$dayjs().format("YYYY-MM-DD HH:mm:ss")
  100. },
  101. systemList(){
  102. return this.$store.state.user.systemList;
  103. },
  104. filterSystemList() {
  105. return this.systemList.filter(v => this.userInfo.subsystemList.some(u => v.value === u.systemCode));
  106. },
  107. currentSystem: {
  108. get() {
  109. return this.$store.getters.system.value
  110. },
  111. set(val) {
  112. const system = this.systemList.find(v => v.value === val);
  113. // 如果有没保存的催记直接清掉
  114. this.$store.commit("follow/SET_FORM", {});
  115. this.$store.commit("follow/SET_PARAMS", {});
  116. this.$store.commit("user/SET_SYSTEM", system);
  117. this.$store.commit("user/SET_BELONGSYSTEM", {
  118. code: val,
  119. callback: (flag) => {
  120. if (flag) {
  121. setTimeout(() => {
  122. // 定时器可加可不加
  123. uni.reLaunch({
  124. url: "/pages/person/index",
  125. success: () => {
  126. uni.$u.toast("切换成功,当前为" + system.text);
  127. }
  128. })
  129. }, 300)
  130. } else {
  131. this.$store.commit("user/SET_TOKEN", "");
  132. this.$store.commit("user/SET_USERINFO", {});
  133. uni.reLaunch({
  134. url: "/pages/login/index",
  135. success() {
  136. uni.$u.toast("请检查您是否有该系统权限");
  137. }
  138. })
  139. }
  140. }
  141. })
  142. },
  143. },
  144. },
  145. methods: {
  146. changeOnlineStatus(val){
  147. this.onlineLoading = true;
  148. uni.$u.api.changeOnlineStatus({ userId: this.$store.state.user.userInfo.userId, onlineStatus : val });
  149. this.onlineLoading = false;
  150. },
  151. handleTest(){
  152. uni.navigateTo({
  153. url: "/pages/demo/demo"
  154. })
  155. },
  156. // 确认选择系统事件
  157. handleSystemConfirm() {
  158. },
  159. // 取消选择系统事件
  160. handleSystemCancel() {
  161. },
  162. // 点击打开选择系统
  163. handleSwitchSystem() {
  164. this.$refs.switch.showModal();
  165. },
  166. onPullDownRefresh() {
  167. uni.stopPullDownRefresh();
  168. this.$store.dispatch("user/getUserInfo");
  169. },
  170. toPersonal() {
  171. uni.navigateTo({
  172. url: "/pages/profile/index"
  173. })
  174. },
  175. handleSetting() {
  176. uni.navigateTo({
  177. url: "/pages/setting/index"
  178. })
  179. },
  180. registerFun() {
  181. if(!this.$store.state.app.callSystem){
  182. this.$store.dispatch("app/getExtensionByUserId", {
  183. userId: this.$store.state.user.userInfo.userId
  184. }).then((res) => {
  185. Promise.all([permision.requestAndroidPermission("android.permission.RECORD_AUDIO"),permision.requestAndroidPermission('android.permission.MODIFY_AUDIO_SETTINGS')]).then(result=>{
  186. const flag = result.every(v=>v == 1);
  187. if(flag){
  188. this.$store.dispatch("app/createWv");
  189. }
  190. })
  191. });
  192. }
  193. },
  194. },
  195. mounted() {
  196. if (this.navbarInitTop == 0) {
  197. const query = uni.createSelectorQuery().in(this);
  198. //获取节点距离顶部的距离
  199. query.select("#navbar").boundingClientRect(function(rect) {
  200. if (rect && rect.top > 0) {
  201. var navbarInitTop = parseInt(rect.top);
  202. this.navbarInitTop = navbarInitTop;
  203. }
  204. }).exec();
  205. }
  206. if(this.$store.state.user.token){
  207. this.$store.dispatch("user/getUserInfo");
  208. }else{
  209. uni.navigateTo({
  210. url: "/pages/login/index"
  211. })
  212. }
  213. },
  214. /**
  215. * 监听页面滑动事件
  216. */
  217. onPageScroll: function(e) {
  218. var scrollTop = parseInt(e.scrollTop); //滚动条距离顶部高度
  219. this.background = `rgba(255, 255, 255,${scrollTop / (scrollTop + 60)})`;
  220. //判断'滚动条'滚动的距离 和 '元素在初始时'距顶部的距离进行判断
  221. var isSatisfy = scrollTop >= this.navbarInitTop ? true : false;
  222. //为了防止不停的setData, 这儿做了一个等式判断。 只有处于吸顶的临界值才会不相等
  223. if (this.isFixedTop === isSatisfy) {
  224. return false;
  225. }
  226. this.isFixedTop = isSatisfy;
  227. }
  228. };
  229. </script>
  230. <style>
  231. .watermarkCans {
  232. width: 250rpx;
  233. height: 250rpx;
  234. position: absolute;
  235. z-index: -1;
  236. }
  237. </style>
  238. <style lang="scss" scoped>
  239. .switchSysytemSelect {
  240. height: 0rpx;
  241. overflow: hidden;
  242. }
  243. .switchSysytemBtn {
  244. width: 630rpx;
  245. margin: auto;
  246. margin-top: 60rpx;
  247. ::v-deep .u-button {
  248. border-radius: 100rpx;
  249. }
  250. }
  251. .person_wrap {
  252. background-size: cover;
  253. background-repeat: no-repeat;
  254. // padding: 0 30rpx;
  255. position: relative;
  256. height: 100vh;
  257. .header_wrap {
  258. box-sizing: border-box;
  259. background: url("@/static/parson/parson_background.png");
  260. background-size: cover;
  261. width: 750rpx;
  262. // position: absolute;
  263. // top: 0;
  264. // left: 0;
  265. padding: 170rpx 30rpx 0 30rpx;
  266. .header_top_wrap {
  267. display: flex;
  268. justify-content: space-between;
  269. align-items: center;
  270. .header_info_left {
  271. display: flex;
  272. align-items: center;
  273. // image {
  274. // width: 100rpx;
  275. // height: 100rpx;
  276. // margin-right: 30rpx;
  277. // border-radius: 50%;
  278. // }
  279. .info_wrap {
  280. margin-left: 20rpx;
  281. .info_top {
  282. margin-bottom: 20rpx;
  283. display: flex;
  284. align-items: center;
  285. .follow_name {
  286. font-size: 32rpx;
  287. color: #202020;
  288. font-weight: bold;
  289. margin-right: 20rpx;
  290. }
  291. .identity {
  292. display: inline-block;
  293. width: 100rpx;
  294. line-height: 36rpx;
  295. background: #ffffff;
  296. border-radius: 18px;
  297. text-align: center;
  298. font-size: 22rpx;
  299. color: #666666;
  300. margin-left: 10px;
  301. }
  302. }
  303. .info_bottom {
  304. text {
  305. font-size: 28rpx;
  306. color: #666666;
  307. }
  308. }
  309. }
  310. }
  311. .header_info_right {
  312. ::v-deep .u-icon__icon {
  313. font-size: 30rpx !important;
  314. }
  315. }
  316. }
  317. .parson_menu_wrap {
  318. background: #ffffff;
  319. border-radius: 20px;
  320. box-shadow: 0px 4px 20px 0px rgba(16, 140, 255, 0.10);
  321. margin-top: 58rpx;
  322. .parson_menu_list {
  323. display: flex;
  324. padding: 40rpx 0;
  325. .menu_item {
  326. width: 33%;
  327. display: flex;
  328. flex-direction: column;
  329. align-items: center;
  330. image {
  331. width: 48rpx;
  332. height: 48rpx;
  333. margin-bottom: 24rpx;
  334. }
  335. text {
  336. font-size: 28rpx;
  337. color: #202020;
  338. }
  339. }
  340. }
  341. }
  342. }
  343. .secondHalf {
  344. padding: 0 30rpx;
  345. }
  346. .box {
  347. height: 200vh;
  348. }
  349. }
  350. .navbar-wrap {
  351. width: 750rpx;
  352. .left {
  353. width: 70rpx;
  354. }
  355. .right {
  356. margin-right: 30rpx;
  357. ::v-deep .u-icon__icon {
  358. font-size: 40rpx !important;
  359. }
  360. }
  361. }
  362. .navbar-wrap .column {
  363. box-sizing: border-box;
  364. padding-top: 60rpx;
  365. width: 750rpx;
  366. height: 170rpx;
  367. display: flex;
  368. justify-content: space-between;
  369. align-items: center;
  370. background: transparent;
  371. top: 0;
  372. left: 0;
  373. z-index: 100;
  374. }
  375. .navbar-wrap .column.fixed {
  376. width: 750rpx;
  377. position: fixed;
  378. }
  379. .navbar-wrap .column .center {
  380. text-align: center;
  381. font-size: 36rpx;
  382. color: #333333;
  383. letter-spacing: 1px;
  384. position: relative;
  385. }
  386. </style>