index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. <template>
  2. <!-- <page-meta :page-font-size="`${this.scaleFontSize}px`" :root-font-size="`${this.scaleFontSize}px`"></page-meta> -->
  3. <view class="border-box">
  4. <view class="content y-bc">
  5. <view style="width: 100%;">
  6. <view class="logo">
  7. <image src='/static/image/device/title.png'></image>
  8. </view>
  9. <view class="btn-box x-f">
  10. <!-- <view class="item-box x-c">
  11. <image src="/static/image/device/code_icon32.png"></image>
  12. <view>邀请二维码</view>
  13. </view>
  14. <view class="item-box x-c">
  15. <image src="/static/image/device/company_manage_icon32.png"></image>
  16. <view>公司管理</view>
  17. </view> -->
  18. <view class="item-box x-c" @click="logout">
  19. <image src="/static/image/device/exit_icon32.png"></image>
  20. <view>退出登录</view>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="center-box" :class="{ 'flex-box': width < height }">
  25. <view class="bg-item y-start" @click="goTest()">
  26. <view class="title">体质辨识</view>
  27. <view class="more">
  28. <text>点击了解</text>
  29. </view>
  30. </view>
  31. <view class="bg-item y-start" @click="goUser()">
  32. <view class="title">客户管理</view>
  33. <view class="more">
  34. <text>点击了解</text>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="footer">
  39. <view>登录账号:{{info.userName||'-'}}</view>
  40. <view>姓名:{{info.nickName||'-'}}</view>
  41. </view>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. import store from '@/store';
  47. import {selectUserInfo} from '@/api/user.js';
  48. export default {
  49. components: {
  50. },
  51. data() {
  52. return {
  53. height: uni.getSystemInfoSync().screenHeight,
  54. width: uni.getSystemInfoSync().screenWidth,
  55. statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
  56. option: '',
  57. top: 0,
  58. statusBarBG: 'none',
  59. headerHeight: 44,
  60. // locCity: '国健通',
  61. scaleFontSize: uni.getStorageSync('fontSize'),
  62. info:{},
  63. user:{}
  64. };
  65. },
  66. onPageScroll(e) {
  67. if (this.template == 'homeIndex') {
  68. this.top = e.scrollTop;
  69. }
  70. },
  71. computed: {
  72. // 计算属性的 getter
  73. headerBG() {
  74. if (this.template == 'homeIndex') {
  75. var top = this.top / 88;
  76. return 'rgba(255,92,3, ' + top + ')';
  77. }
  78. }
  79. },
  80. onLoad(option) {
  81. const systemInfo = uni.getSystemInfoSync();
  82. console.log("qxj screenWidth:"+systemInfo.screenWidth);
  83. console.log("qxj screenHeight:"+systemInfo.screenHeight); //定制设备平板 800x1232 平板设备1280x785
  84. let that = this;
  85. uni.setNavigationBarTitle({
  86. title: that.$qconfig.appName
  87. });
  88. uni.setStorageSync('indexTemplate', 0);
  89. this.option = option;
  90. this.user=JSON.parse(uni.getStorageSync('userInfo'));
  91. this.selectUserInfo();
  92. //this.scaleFontSize = store.state.timStore.fontSize;
  93. // this.$nextTick(()=>{
  94. // this.$refs[this.template].initLoad(this.option)
  95. // })
  96. },
  97. onReady() {
  98. // this.$refs.indexSubsection.selectorQuery();
  99. // this.$refs[this.template].initReady();
  100. },
  101. onShow() {
  102. if (!this.$isLogin()) {
  103. uni.navigateTo({
  104. url: '/pages/auth/loginIndex'
  105. });
  106. } else {
  107. // this.$updateMsgDot();
  108. }
  109. },
  110. methods: {
  111. selectUserInfo(){
  112. selectUserInfo().then(res => {
  113. if(res.code==200){
  114. console.log('res',res)
  115. this.info=res.user
  116. }
  117. else{
  118. uni.showToast({title: res.msg,icon: 'none'});
  119. }
  120. },
  121. rej => {}
  122. );
  123. },
  124. logout(){
  125. uni.showModal({
  126. title:"提示",
  127. content:"确认退出登录吗?",
  128. showCancel:true,
  129. cancelText:'取消',
  130. confirmText:'确定',
  131. success:res=>{
  132. if(res.confirm){
  133. // this.$logout();
  134. uni.removeStorageSync('AppToken');
  135. uni.removeStorageSync('selectUser');
  136. uni.$emit('loginOut');
  137. uni.reLaunch({
  138. url: '/pages/auth/loginIndex'
  139. });
  140. }else{
  141. }
  142. }
  143. })
  144. },
  145. goUser(){
  146. // uni.redirectTo({
  147. // url: '/pages/user/myUserList?userId='+this.user.userId
  148. // });
  149. uni.navigateTo({
  150. url: '/pages/user/myUserList?userId='+this.user.userId
  151. })
  152. },
  153. goTest(){
  154. // uni.redirectTo({
  155. // url: '/pages/device/tongue/index?userId='+this.user.userId
  156. // });
  157. uni.navigateTo({
  158. url:'/pages/device/tongue/index?userId='+this.user.userId
  159. })
  160. },
  161. changeTemplate(e) {
  162. const tem = e == 1 ? 'watchIndex' : 'homeIndex';
  163. if (this.template == tem) return;
  164. this.template = tem;
  165. uni.pageScrollTo({
  166. scrollTop: 0,
  167. duration: 100
  168. });
  169. this.$nextTick(() => {
  170. //this.$refs[this.template].initLoad(this.option)
  171. this.$refs[this.template].initReady();
  172. // this.$refs[this.template].initShow();
  173. });
  174. },
  175. registerIdCode() {
  176. //注册,先注册再获取,注意APP合规性,若最终用户未同意隐私政策则不要调用
  177. idCode.register((res) => {
  178. console.log(res);
  179. });
  180. },
  181. async getLocation() {
  182. let status;
  183. // #ifdef APP-PLUS
  184. status = await this.checkPermission();
  185. if (status !== 1) {
  186. return;
  187. }
  188. // #endif
  189. // #ifdef MP-WEIXIN || MP-TOUTIAO || MP-QQ
  190. status = await this.getSetting();
  191. if (status === 2) {
  192. this.showConfirm();
  193. return;
  194. }
  195. // #endif
  196. this.doGetLocation();
  197. },
  198. doGetLocation() {
  199. getLocation().then((res) => {
  200. this.locCity = res.city.replace(/市|区/g, '');
  201. });
  202. },
  203. getSetting: function() {
  204. return new Promise((resolve, reject) => {
  205. uni.getSetting({
  206. success: (res) => {
  207. if (res.authSetting['scope.userLocation'] === undefined) {
  208. resolve(0);
  209. return;
  210. }
  211. if (res.authSetting['scope.userLocation']) {
  212. resolve(1);
  213. } else {
  214. resolve(2);
  215. }
  216. }
  217. });
  218. });
  219. },
  220. openSetting: function() {
  221. this.hideConfirm();
  222. uni.openSetting({
  223. success: (res) => {
  224. if (res.authSetting && res.authSetting['scope.userLocation']) {
  225. this.doGetLocation();
  226. }
  227. },
  228. fail: (err) => {}
  229. });
  230. },
  231. async checkPermission() {
  232. let status = permision1.isIOS ? await permision1.requestIOS('location') : await permision1
  233. .requestAndroid('android.permission.ACCESS_FINE_LOCATION');
  234. if (status === null || status === 1) {
  235. status = 1;
  236. } else if (status === 2) {
  237. uni.showModal({
  238. content: '系统定位已关闭',
  239. confirmText: '确定',
  240. showCancel: false,
  241. success: function(res) {}
  242. });
  243. } else if (status.code) {
  244. uni.showModal({
  245. content: status.message
  246. });
  247. } else {
  248. uni.showModal({
  249. content: '需要定位权限',
  250. confirmText: '设置',
  251. success: function(res) {
  252. if (res.confirm) {
  253. permision1.gotoAppSetting();
  254. }
  255. }
  256. });
  257. }
  258. return status;
  259. },
  260. showQidai() {
  261. uni.showToast({
  262. title: '功能完善中,敬请期待...',
  263. icon: 'none'
  264. });
  265. },
  266. goToMsg() {
  267. uni.switchTab({
  268. url: '/pages_im/pages/conversation/conversationList/index'
  269. });
  270. },
  271. async goToWXMsg() {
  272. const url = getApp().globalData.kfurl; //企业微信客服链接
  273. const corpId = getApp().globalData.corpId; //企业id
  274. // #ifdef H5
  275. window.location.href = url;
  276. // #endif
  277. // #ifdef MP-WEIXIN
  278. wx.openCustomerServiceChat({
  279. extInfo: {
  280. url
  281. },
  282. corpId,
  283. success(res) {
  284. console.log('成功');
  285. },
  286. fail(err) {
  287. console.log(err, '报错');
  288. }
  289. });
  290. // #endif
  291. // #ifdef APP-PLUS
  292. let shares = await this.getAppShare().catch((err) => {
  293. throw Error(err);
  294. });
  295. shares['weixin'].openCustomerServiceChat({
  296. corpid: corpId,
  297. url
  298. },
  299. (suc) => {
  300. console.log('客服打开成功', JSON.stringify(res));
  301. },
  302. (err) => {
  303. console.log('error', JSON.stringify(err));
  304. }
  305. );
  306. // #endif
  307. },
  308. getAppShare() {
  309. // #ifdef APP-PLUS
  310. return new Promise((re, rj) => {
  311. let shares = null;
  312. var pusher = plus.share.getServices(
  313. function(s) {
  314. shares = {};
  315. s.forEach((e) => (shares[e.id] = e));
  316. re(shares);
  317. },
  318. function(e) {
  319. rj(e);
  320. }
  321. );
  322. });
  323. // #endif
  324. },
  325. getIdCodes() {
  326. //获取设备的各种标识码
  327. idCode.getIdCodes((res) => {
  328. if (res.data) {
  329. //this.msgList.unshift(JSON.stringify(res.data));
  330. let ua = plus.navigator.getUserAgent();
  331. console.log('qxj ua:' + ua);
  332. console.log('qxj getIdCodes:' + JSON.stringify(res.data));
  333. }
  334. });
  335. },
  336. scanQRCode() {
  337. const that = this;
  338. uni.scanCode({
  339. success(res) {
  340. if (res.result) {
  341. // 扫描成功,处理二维码内容
  342. console.log('扫描结果:', res.result);
  343. const scanInfo = res.result;
  344. if (scanInfo && scanInfo.indexOf('https://userapp.his.cdwjyyh.com/bindcompanyuser') > -
  345. 1) {
  346. const companyUserId = this.getUrlParam(scanInfo).companyUserId;
  347. console.log('扫描结果公司码:', companyUserId);
  348. this.$handleBindCompanyFsUser(companyUserId);
  349. }
  350. } else {
  351. // 扫描失败
  352. uni.showToast({
  353. title: '扫描失败',
  354. icon: 'none'
  355. });
  356. }
  357. },
  358. fail() {}
  359. });
  360. },
  361. getUrlParam(url) {
  362. const queryStr = url.split('?')[1];
  363. if (!queryStr) {
  364. return {};
  365. }
  366. const params = queryStr.split('&');
  367. const queryParams = {};
  368. params.forEach((param) => {
  369. const [key, value] = param.split('=');
  370. queryParams[key] = value;
  371. });
  372. return queryParams;
  373. }
  374. }
  375. };
  376. </script>
  377. <style lang="scss" scoped>
  378. // @mixin u-flex($flexD, $alignI, $justifyC) {
  379. // display: flex;
  380. // flex-direction: $flexD;
  381. // align-items: $alignI;
  382. // justify-content: $justifyC;
  383. // }
  384. .border-box{
  385. width: 100vw;
  386. height: 100vh;
  387. background-image:url(/static/image/device/ipad_yjf_boder.png);
  388. background-repeat: no-repeat;
  389. position: relative;
  390. background-size: 100% 100%;
  391. box-sizing: border-box;
  392. padding: 10px;
  393. }
  394. .content{
  395. // display: flex;
  396. width: 100%;
  397. height: 100%;
  398. background-image:url(/static/image/device/ipad_home_bg.png);
  399. background-repeat: no-repeat;
  400. background-size: 100% 100%;
  401. position: relative;
  402. padding-top: 20px;
  403. .logo{
  404. width: 100%;
  405. display: flex;
  406. justify-content: center;
  407. image{
  408. width:593px;
  409. height: 148px;
  410. }
  411. }
  412. .btn-box{
  413. width: 100%;
  414. text-align: right;
  415. justify-content: right;
  416. margin-top: 50px;
  417. padding-right: 37px;
  418. .item-box{
  419. width: 167px;
  420. height: 47px;
  421. background: #8F6726;
  422. border-radius: 9px 9px 9px 9px;
  423. margin-left: 16px;
  424. font-family: Microsoft YaHei, Microsoft YaHei;
  425. font-weight: 400;
  426. font-size: 18px;
  427. color: #FFFFFF;
  428. text-align: center;
  429. image{
  430. width: 24px;
  431. height: 24px;
  432. margin-right:10px ;
  433. }
  434. }
  435. }
  436. .center-box{
  437. width: 100%;
  438. display: flex;
  439. align-items: center;
  440. justify-content: center;
  441. &.flex-box{
  442. flex-direction: column;
  443. .bg-item:last-child{
  444. margin-left: 0px;
  445. margin-top: 40px;
  446. }
  447. }
  448. .bg-item{
  449. width: 504px;
  450. height: 267px;
  451. padding: 41px;
  452. border-radius: 16px;
  453. background-image:url(/static/image/device/tzbs_bg.png);
  454. background-repeat: no-repeat;
  455. background-size: 100% 100%;
  456. &:last-child{
  457. margin-left: 40px;
  458. background-image:url(/static/image/device/khgl_bg.png);
  459. }
  460. .title{
  461. font-family: Source Han Serif CN, Source Han Serif CN;
  462. font-weight: bold;
  463. font-size: 39px;
  464. color: #FFFFFF;
  465. text-align: left;
  466. }
  467. .more{
  468. margin-top: 15px;
  469. width: 89px;
  470. height: 30px;
  471. background: #FFFFFF;
  472. border-radius: 6px 6px 6px 6px;
  473. display: flex;
  474. align-items: center;
  475. justify-content: center;
  476. background: #FFFFFF;
  477. text-align: center;
  478. text{
  479. font-family: PingFang SC, PingFang SC;
  480. font-weight: 400;
  481. font-size: 16px;
  482. color: #A14212;
  483. }
  484. }
  485. }
  486. }
  487. .footer{
  488. width: 100%;
  489. display: flex;
  490. align-items: center;
  491. justify-content: center;
  492. // position: absolute;
  493. padding-bottom:50px;
  494. view{
  495. font-family: PingFang SC, PingFang SC;
  496. font-weight: 400;
  497. font-size: 20px;
  498. color: #8F6726;
  499. text-align: center;
  500. &:last-child{
  501. margin-left: 40px;
  502. }
  503. }
  504. }
  505. }
  506. // @media screen and (max-width: 1149px) and (min-aspect-ratio: 1/1) {
  507. // .bg-item{
  508. // margin-left: 0 !important;
  509. // transform: scale(0.85);
  510. // }
  511. // .content .logo{
  512. // transform: scale(0.9);
  513. // }
  514. // }
  515. </style>