MainLayout.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. <template>
  2. <q-layout view="hHh LpR fFf" :style="{ height: $q.screen.height, width: $q.screen.width }">
  3. <q-header reveal elevated class="bg-primary text-white">
  4. <q-toolbar class="main-headers text-white shadow-18 rounded-borders">
  5. <transition appear enter-active-class="animated zoomIn">
  6. <q-btn flat @click="drawerleft = !drawerleft" round dense icon="menu">
  7. <q-tooltip content-class="bg-amber text-black shadow-4" :offset="[15, 15]"
  8. content-style="font-size: 12px">{{ drawerleft ? $t("index.hide_menu") : $t("index.open_menu")
  9. }}</q-tooltip>
  10. </q-btn>
  11. </transition>
  12. <transition appear enter-active-class="animated zoomIn">
  13. <q-toolbar-title shrink class="text-weight-bold" @click="$router.push({ name: 'web_index' }); linkChange('')">
  14. {{ $t("index.title") }}</q-toolbar-title>
  15. </transition>
  16. <q-space />
  17. <transition appear enter-active-class="animated zoomIn">
  18. <q-btn square dense flat color="white" :label="warehouse_name" icon="maps_home_work"
  19. style="margin: 0 10px 0 10px">
  20. <q-tooltip content-class="bg-amber text-black shadow-4" :offset="[15, 15]" content-style="font-size: 12px">
  21. {{ $t("index.warehouse_switch") }}
  22. </q-tooltip>
  23. <q-menu>
  24. <q-list style="min-width: 100px">
  25. <q-item clickable v-close-popup v-for="(warehouse, index) in warehouseOptions" :key="index"
  26. @click="warehouseChange(index)">
  27. <q-item-section>{{ warehouse.warehouse_name }}</q-item-section>
  28. </q-item>
  29. </q-list>
  30. </q-menu>
  31. </q-btn>
  32. </transition>
  33. <q-separator vertical />
  34. <template v-if="authin === '1'">
  35. <transition appear enter-active-class="animated zoomIn">
  36. <q-btn-dropdown stretch flat color="white-8" icon="account_circle">
  37. <div class="q-pa-md">
  38. <div class="column items-center">
  39. <q-avatar size="72px"><q-img src="statics/staff/stafftype.png"></q-img></q-avatar>
  40. <div class="text-subtitle1 q-mt-md q-mb-xs">
  41. {{ login_name }}
  42. </div>
  43. <q-btn color="primary" :label="$t('index.change_user')" push size="sm" v-close-popup icon="face"
  44. @click="login = true">
  45. <q-tooltip content-class="bg-amber text-black shadow-4" :offset="[10, 10]"
  46. content-style="font-size: 12px">{{ $t("index.change_user") }}</q-tooltip>
  47. </q-btn>
  48. <q-separator />
  49. <q-btn color="primary" :label="$t('index.logout')" push size="sm" v-close-popup
  50. icon="img:statics/icons/logout.png" @click="Logout()">
  51. <q-tooltip content-class="bg-amber text-black shadow-4" :offset="[10, 10]"
  52. content-style="font-size: 12px">{{ $t("index.logout") }}</q-tooltip>
  53. </q-btn>
  54. </div>
  55. </div>
  56. </q-btn-dropdown>
  57. </transition>
  58. </template>
  59. <template v-if="authin === '0'">
  60. <transition appear enter-active-class="animated zoomIn">
  61. <q-btn :label="$t('index.login')" color="primary" @click="login = true" style="margin-left: 10px">
  62. <q-tooltip content-class="bg-amber text-black shadow-4" :offset="[15, 15]"
  63. content-style="font-size: 12px">{{ $t("index.login_tip") }}</q-tooltip>
  64. </q-btn>
  65. </transition>
  66. <transition appear enter-active-class="animated zoomIn">
  67. <q-btn :label="$t('index.register')" color="primary" @click="register = true" style="margin-left: 10px">
  68. <q-tooltip content-class="bg-amber text-black shadow-4" :offset="[15, 15]"
  69. content-style="font-size: 12px">{{ $t("index.register_tip") }}</q-tooltip>
  70. </q-btn>
  71. </transition>
  72. </template>
  73. </q-toolbar>
  74. </q-header>
  75. <q-drawer v-model="drawerleft" show-if-above :width="200" :breakpoint="500" bordered
  76. content-class="bg-grey-3 shadow-24">
  77. <q-scroll-area class="fit" style="overflow-y: auto">
  78. <q-list>
  79. <q-item clickable :to="{ name: 'management' }" @click="linkChange('stock')" v-ripple exact
  80. :active="link === 'stock' && link !== ''" :class="{ 'my-menu-link': link === 'stock' && link !== '' }">
  81. <q-item-section avatar><q-icon name="multiline_chart" /></q-item-section>
  82. <q-item-section>{{ $t("menuItem.stock") }}</q-item-section>
  83. </q-item>
  84. <q-separator />
  85. <q-item clickable :to="{ name: 'inboundAndOutbound' }" @click="linkChange('outbounddashboard')" v-ripple exact
  86. :active="link === 'outbounddashboard' && link !== ''" :class="{
  87. 'my-menu-link': link === 'outbounddashboard' && link !== '',
  88. }">
  89. <q-item-section avatar><q-icon name="auto_graph" /></q-item-section>
  90. <q-item-section>{{ $t("menuItem.dashboard") }}</q-item-section>
  91. </q-item>
  92. <q-separator />
  93. <q-item clickable :to="{ name: 'asn' }" @click="linkChange('inbound')" v-ripple exact
  94. :active="link === 'inbound' && link !== ''" :class="{ 'my-menu-link': link === 'inbound' && link !== '' }">
  95. <q-item-section avatar><q-icon name="speaker_notes" /></q-item-section>
  96. <q-item-section>{{ $t("menuItem.inbound") }}</q-item-section>
  97. </q-item>
  98. <q-item clickable :to="{ name: 'containerlist' }" @click="linkChange('container')" v-ripple exact
  99. :active="link === 'container' && link !== ''" :class="{
  100. 'my-menu-link': link === 'container' && link !== '',
  101. }">
  102. <q-item-section avatar><q-icon name="stay_current_landscape" /></q-item-section>
  103. <q-item-section>托盘管理</q-item-section>
  104. </q-item>
  105. <q-item clickable :to="{ name: 'dn' }" @click="linkChange('outbound')" v-ripple exact
  106. :active="link === 'outbound' && link !== ''"
  107. :class="{ 'my-menu-link': link === 'outbound' && link !== '' }">
  108. <q-item-section avatar><q-icon name="rv_hookup" /></q-item-section>
  109. <q-item-section>{{ $t("menuItem.outbound") }}</q-item-section>
  110. </q-item>
  111. <q-separator />
  112. <q-item clickable :to="{ name: 'warehouseset' }" @click="linkChange('warehouse')" v-ripple exact
  113. :active="link === 'warehouse' && link !== ''"
  114. :class="{ 'my-menu-link': link === 'warehouse' && link !== '' }">
  115. <q-item-section avatar><q-icon name="settings" /></q-item-section>
  116. <q-item-section>{{ $t("menuItem.warehouse") }}</q-item-section>
  117. </q-item>
  118. <q-item clickable :to="{ name: 'stafflist' }" @click="linkChange('staff')" v-ripple exact
  119. :active="link === 'staff' && link !== ''" :class="{ 'my-menu-link': link === 'staff' && link !== '' }">
  120. <q-item-section avatar><q-icon name="assignment_ind" /></q-item-section>
  121. <q-item-section>{{ $t("menuItem.staff") }}</q-item-section>
  122. </q-item>
  123. <q-separator />
  124. <q-item clickable :to="{ name: 'initializeupload' }" @click="linkChange('uploadcenter')" v-ripple exact
  125. :active="link === 'uploadcenter' && link !== ''"
  126. :class="{ 'my-menu-link': link === 'uploadcenter' && link !== '' }">
  127. <q-item-section avatar><q-icon name="file_upload" /></q-item-section>
  128. <q-item-section>{{ $t("menuItem.uploadcenter") }}</q-item-section>
  129. </q-item>
  130. <q-item clickable :to="{ name: 'downloadinbound' }" @click="linkChange('downloadcenter')" v-ripple exact
  131. :active="link === 'downloadcenter' && link !== ''" :class="{
  132. 'my-menu-link': link === 'downloadcenter' && link !== '',
  133. }">
  134. <q-item-section avatar><q-icon name="file_download" /></q-item-section>
  135. <q-item-section>{{ $t("menuItem.downloadcenter") }}</q-item-section>
  136. </q-item>
  137. <q-separator />
  138. </q-list>
  139. </q-scroll-area>
  140. </q-drawer>
  141. <q-page-container class="main-page" :style="{
  142. height: container_height,
  143. width: $q.screen.width,
  144. }">
  145. <router-view />
  146. </q-page-container>
  147. <q-dialog v-model="authid" transition-show="jump-down" transition-hide="jump-up">
  148. <q-card style="min-width: 350px">
  149. <q-bar class="bg-light-blue-10 text-white rounded-borders" style="height: 50px">
  150. <div>{{ $t("index.your_openid") }}</div>
  151. <q-space></q-space>
  152. <q-btn dense flat icon="close" v-close-popup>
  153. <q-tooltip content-class="bg-amber text-black shadow-4" :offset="[20, 20]"
  154. content-style="font-size: 12px">{{
  155. $t("index.close") }}</q-tooltip>
  156. </q-btn>
  157. </q-bar>
  158. <q-card-section class="q-pt-md"><q-input dense outlined square label="Openid" v-model="openid" readonly
  159. disable /></q-card-section>
  160. </q-card>
  161. </q-dialog>
  162. <q-dialog v-model="login" transition-show="" transition-hide="" persistent full-width full-height>
  163. <div class="flex flex-center"
  164. style="height: 100%; background-color: #f5f5f5; position: absolute; top: 0; left: 0; right: 0; bottom: 0;">
  165. <div style="font-size: 55px;letter-spacing: 10px;width: 100%; text-align: center; margin-top: 10px">
  166. {{ $t("index.developer") }}
  167. </div>
  168. <q-card style="min-width: 350px">
  169. <q-bar class="bg-light-blue-10 text-white rounded-borders" style="height: 50px">
  170. <q-tabs v-model="activeTab" class="tabs">
  171. <q-tab name="admin" @click="admin = true">
  172. {{ $t("index.user_login") }}
  173. <q-tooltip content-class="bg-amber text-black shadow-4" :offset="[5, 5]"
  174. content-style="font-size: 12px">{{
  175. $t("index.user_login") }}</q-tooltip>
  176. </q-tab>
  177. </q-tabs>
  178. <q-space />
  179. </q-bar>
  180. <q-card-section class="q-pt-md">
  181. <template v-if="admin">
  182. <q-input dense outlined square :label="$t('index.staff_name')" v-model="adminlogin.name" autofocus
  183. @keyup.enter="adminLogin()" />
  184. <q-input dense outlined square :label="$t('index.password')" :type="isPwd ? 'password' : 'text'"
  185. v-model="adminlogin.password" @keyup.enter="adminLogin()" style="margin-top: 5px">
  186. <template v-slot:append>
  187. <q-icon :name="isPwd ? 'visibility_off' : 'visibility'" class="cursor-pointer"
  188. @click="isPwd = !isPwd" />
  189. </template>
  190. </q-input>
  191. </template>
  192. </q-card-section>
  193. <q-card-actions align="left" class="text-primary">
  194. <q-space />
  195. <template>
  196. <q-btn color="primary" :label="$t('index.login')" style="font-size: 16px; margin: 0 8px; width: 100%"
  197. @click="adminLogin()" />
  198. </template>
  199. <div class="q-mx-auto">
  200. <q-btn flat class="text-teal-4 q-mt-sm" @click="
  201. login = false;
  202. register = true;
  203. ">
  204. {{ $t("index.register_tip") }}
  205. </q-btn>
  206. </div>
  207. </q-card-actions>
  208. </q-card>
  209. <lottie-web-cimo ref="lottie_web" animationName="welcome"
  210. style="width: 85%; max-width: 95%;height: 12%; margin :auto;" />
  211. </div>
  212. </q-dialog>
  213. <q-dialog v-model="register" transition-show="" transition-hide="" persistent full-width full-height>
  214. <div class="flex flex-center"
  215. style="height: 100%; background-color: #f5f5f5; position: absolute; top: 0; left: 0; right: 0; bottom: 0;">
  216. <div style="font-size: 55px;letter-spacing: 10px;width: 100%; text-align: center; margin-top: 10px">
  217. {{ $t("index.developer") }}
  218. </div>
  219. <q-card style="min-width: 350px">
  220. <q-bar class="bg-light-blue-10 text-white rounded-borders" style="height: 50px">
  221. <div>{{ $t("index.register_tip") }}</div>
  222. </q-bar>
  223. <q-card-section class="q-pt-md">
  224. <q-input dense outlined square :label="$t('index.staff_name')" v-model="registerform.name"
  225. @keyup.enter="Register()" />
  226. <q-input dense outlined square :label="$t('index.password')" v-model="registerform.password1"
  227. :type="isPwd ? 'password' : 'text'" @keyup.enter="Register()" style="margin-top: 5px">
  228. <template v-slot:append>
  229. <q-icon :name="isPwd ? 'visibility_off' : 'visibility'" class="cursor-pointer"
  230. @click="isPwd = !isPwd" />
  231. </template>
  232. </q-input>
  233. <q-input dense outlined square :label="$t('index.confirm_password')" v-model="registerform.password2"
  234. :type="isPwd2 ? 'password' : 'text'" @keyup.enter="Register()" style="margin-top: 5px">
  235. <template v-slot:append>
  236. <q-icon :name="isPwd2 ? 'visibility_off' : 'visibility'" class="cursor-pointer"
  237. @click="isPwd2 = !isPwd2" />
  238. </template>
  239. </q-input>
  240. </q-card-section>
  241. <q-card-actions align="right" class="text-primary q-mx-sm"><q-btn class="full-width" color="primary"
  242. :label="$t('index.register')" @click="Register()" /></q-card-actions>
  243. <q-card-actions align="center" style="margin-top: -8px">
  244. <q-btn class="text-teal-4" flat :label="$t('index.return_to_login')" @click="
  245. login = true;
  246. register = false;
  247. "></q-btn>
  248. </q-card-actions>
  249. </q-card>
  250. <lottie-web-cimo ref="lottie_web" animationName="welcome"
  251. style="width: 85%; max-width: 95%;height: 12%; margin :auto;" />
  252. </div>
  253. </q-dialog>
  254. <q-dialog v-model="switch_warehouse">
  255. <q-card class="shadow-24">
  256. <q-bar class="bg-light-blue-10 text-white rounded-borders" style="height: 50px">
  257. <div>{{ $t("index.warehouse_switch") }}</div>
  258. <q-space />
  259. </q-bar>
  260. <q-card-section style="max-height: 325px; width: 400px" class="scroll">
  261. {{ switch_state ? $t("index.switch_state_on") : $t("index.switch_state_off") }}
  262. </q-card-section>
  263. </q-card>
  264. </q-dialog>
  265. </q-layout>
  266. </template>
  267. <script>
  268. import { get, getauth, post, baseurl } from 'boot/axios_request'
  269. import { LocalStorage, SessionStorage, openURL } from 'quasar'
  270. import Bus from 'boot/bus.js'
  271. import LottieWebCimo from 'components/lottie-web-cimo'
  272. export default {
  273. components: { LottieWebCimo },
  274. data() {
  275. return {
  276. device: LocalStorage.getItem('device'),
  277. device_name: LocalStorage.getItem('device_name'),
  278. lang: 'zh-hans',
  279. container_height: this.$q.screen.height + '' + 'px',
  280. warehouse_name: '',
  281. warehouseOptions: [],
  282. warehouseOptions_openid: [],
  283. langOptions: [
  284. // { value: 'en-US', label: 'English' },
  285. { value: 'zh-hans', label: '中文简体' },
  286. // { value: 'zh-hant', label: '中文繁體' }
  287. // { value: 'fr', label: 'Français' },
  288. // { value: 'pt', label: 'Português' },
  289. // { value: 'sp', label: 'Español' },
  290. // { value: 'de', label: 'Deutsch' },
  291. // { value: 'ru', label: 'русский язык' },
  292. // { value: 'ar', label: 'Arabic' },
  293. // { value: 'it', label: 'Italiano' },
  294. // { value: 'ja', label: '日本語' }
  295. ],
  296. title: this.$t('index.webtitle'),
  297. admin: true,
  298. adminlogin: {
  299. name: '',
  300. password: ''
  301. },
  302. openid: '',
  303. appid: '',
  304. switch_state: false,
  305. switch_warehouse: false,
  306. isPwd: true,
  307. isPwd2: true,
  308. authin: '0',
  309. authid: false,
  310. left: false,
  311. drawerleft: false,
  312. tab: '',
  313. login: false,
  314. link: '',
  315. login_name: '',
  316. login_id: 0,
  317. check_code: '',
  318. register: false,
  319. registerform: {
  320. name: '',
  321. password1: '',
  322. password2: ''
  323. },
  324. needLogin: '',
  325. activeTab: ''
  326. }
  327. },
  328. methods: {
  329. linkChange(e) {
  330. var _this = this
  331. localStorage.removeItem('menulink')
  332. localStorage.setItem('menulink', e)
  333. _this.link = e
  334. console.log(_this.link)
  335. },
  336. drawerClick(e) {
  337. var _this = this
  338. if (_this.miniState) {
  339. _this.miniState = false
  340. e.stopPropagation()
  341. }
  342. },
  343. brownlink(e) {
  344. openURL(e)
  345. },
  346. apiLink() {
  347. openURL(baseurl + '/api/docs/')
  348. },
  349. adminLogin() {
  350. var _this = this
  351. if (!_this.adminlogin.name) {
  352. _this.$q.notify({
  353. message: '请输入用户名',
  354. color: 'negative',
  355. icon: 'close'
  356. })
  357. } else {
  358. if (!_this.adminlogin.password) {
  359. _this.$q.notify({
  360. message: '请输入密码',
  361. icon: 'close',
  362. color: 'negative'
  363. })
  364. } else {
  365. SessionStorage.set('axios_check', 'false')
  366. post('login/', _this.adminlogin)
  367. .then((res) => {
  368. if (res.code === '200') {
  369. _this.authin = '1'
  370. _this.login = false
  371. _this.admin = false
  372. _this.openid = res.data.openid
  373. _this.appid = res.data.appid
  374. _this.login_name = res.data.name
  375. _this.login_id = res.data.user_id
  376. LocalStorage.set('auth', '1')
  377. LocalStorage.set('openid', res.data.openid)
  378. LocalStorage.set('appid', res.data.appid)
  379. LocalStorage.set('login_name', _this.login_name)
  380. LocalStorage.set('login_id', _this.login_id)
  381. LocalStorage.set('login_mode', res.data.staff_type)
  382. _this.$q.notify({
  383. message: 'Success Login',
  384. icon: 'check',
  385. color: 'green'
  386. })
  387. localStorage.removeItem('menulink')
  388. _this.link = ''
  389. _this.$router.push({ name: 'web_index' })
  390. window.setTimeout(() => {
  391. location.reload()
  392. }, 1)
  393. } else {
  394. _this.$q.notify({
  395. message: res.msg,
  396. icon: 'close',
  397. color: 'negative'
  398. })
  399. }
  400. })
  401. .catch((err) => {
  402. _this.$q.notify({
  403. message: err.detail,
  404. icon: 'close',
  405. color: 'negative'
  406. })
  407. })
  408. }
  409. }
  410. },
  411. Logout() {
  412. var _this = this
  413. _this.authin = '0'
  414. _this.login_name = ''
  415. LocalStorage.remove('auth')
  416. SessionStorage.remove('axios_check')
  417. LocalStorage.set('login_name', '')
  418. LocalStorage.set('login_id', '')
  419. LocalStorage.set('appid', '')
  420. _this.$q.notify({
  421. message: 'Success Logout',
  422. icon: 'check',
  423. color: 'negative'
  424. })
  425. // _this.staffType();
  426. localStorage.removeItem('menulink')
  427. _this.link = ''
  428. _this.$router.push({ name: 'web_index' })
  429. window.setTimeout(() => {
  430. location.reload()
  431. }, 1)
  432. },
  433. Register() {
  434. var _this = this
  435. SessionStorage.set('axios_check', 'false')
  436. post('register/', _this.registerform)
  437. .then((res) => {
  438. if (res.code === '200') {
  439. _this.register = false
  440. _this.openid = res.data.openid
  441. _this.login_name = _this.registerform.name
  442. _this.login_id = res.data.user_id
  443. _this.authin = '1'
  444. LocalStorage.set('auth', '1')
  445. LocalStorage.set('appid', res.data.appid)
  446. LocalStorage.set('login_name', res.data.name)
  447. LocalStorage.set('login_id', res.data.user_id)
  448. LocalStorage.set('openid', res.data.openid)
  449. LocalStorage.set('login_mode', 'Admin')
  450. _this.registerform = {
  451. name: '',
  452. password1: '',
  453. password2: ''
  454. }
  455. _this.$q.notify({
  456. message: res.msg,
  457. icon: 'check',
  458. color: 'green'
  459. })
  460. _this.staffType()
  461. localStorage.removeItem('menulink')
  462. _this.link = ''
  463. _this.$router.push({ name: 'web_index' })
  464. window.setTimeout(() => {
  465. location.reload()
  466. }, 1)
  467. } else {
  468. _this.$q.notify({
  469. message: res.msg,
  470. icon: 'close',
  471. color: 'negative'
  472. })
  473. }
  474. })
  475. .catch((err) => {
  476. _this.$q.notify({
  477. message: err.detail,
  478. icon: 'close',
  479. color: 'negative'
  480. })
  481. })
  482. },
  483. staffType() {
  484. var _this = this
  485. getauth('staff/?staff_name=' + _this.login_name).then((res) => {
  486. LocalStorage.set('staff_type', res.results[0].staff_type)
  487. })
  488. },
  489. warehouseOptionsGet() {
  490. var _this = this
  491. get('warehouse/multiple/?max_page=30')
  492. .then((res) => {
  493. // if (res.count === 1) {
  494. // _this.openid = res.results[0].openid
  495. // _this.warehouse_name = res.results[0].warehouse_name
  496. // LocalStorage.set('openid', _this.openid)
  497. // } else {
  498. _this.warehouseOptions = res.results
  499. if (LocalStorage.has('openid')) {
  500. _this.warehouseOptions.forEach((item, index) => {
  501. if (item.openid === LocalStorage.getItem('openid')) {
  502. _this.warehouseOptions_openid.push(item)
  503. }
  504. })
  505. }
  506. _this.warehouse_name = res.results[0].warehouse_name
  507. localStorage.setItem('warehouse_name', res.results[0].warehouse_name)
  508. localStorage.setItem('warehouse_code', res.results[0].warehouse_code)
  509. // }
  510. })
  511. .catch((err) => {
  512. console.log(err)
  513. _this.$q.notify({
  514. message: err.detail,
  515. icon: 'close',
  516. color: 'negative'
  517. })
  518. })
  519. },
  520. warehouseChange(e) {
  521. var _this = this
  522. _this.openid = _this.warehouseOptions[e].openid
  523. if (_this.openid === LocalStorage.getItem('openid')) {
  524. _this.warehouse_name = _this.warehouseOptions[e].warehouse_name
  525. localStorage.setItem('warehouse_name', _this.warehouseOptions[e].warehouse_name)
  526. localStorage.setItem('warehouse_code', _this.warehouseOptions[e].warehouse_code)
  527. _this.switch_state = true
  528. }
  529. else {
  530. _this.switch_state = false
  531. }
  532. _this.switch_warehouse = true
  533. // LocalStorage.set('openid', _this.openid)
  534. // LocalStorage.set('staff_type', 'Admin')
  535. // _this.login_name = ''
  536. // LocalStorage.set('login_name', '')
  537. // _this.authin = '0'
  538. // _this.isLoggedIn()
  539. // LocalStorage.remove('auth')
  540. // SessionStorage.remove('axios_check')
  541. },
  542. // langChange(e) {
  543. // var _this = this
  544. // _this.lang = e
  545. // window.setTimeout(() => {
  546. // location.reload()
  547. // }, 1)
  548. // },
  549. isLoggedIn() {
  550. if (this.$q.localStorage.getItem('openid')) {
  551. this.login = true
  552. } else {
  553. this.register = true
  554. }
  555. }
  556. },
  557. created() {
  558. var _this = this
  559. _this.$i18n.locale = 'zh-hans'
  560. if (LocalStorage.has('openid')) {
  561. _this.openid = LocalStorage.getItem('openid')
  562. _this.activeTab = 'admin'
  563. } else {
  564. _this.openid = ''
  565. LocalStorage.set('openid', '')
  566. }
  567. if (LocalStorage.has('login_name')) {
  568. _this.login_name = LocalStorage.getItem('login_name')
  569. } else {
  570. _this.login_name = ''
  571. LocalStorage.set('login_name', '')
  572. }
  573. if (LocalStorage.has('auth')) {
  574. _this.authin = '1'
  575. _this.staffType()
  576. } else {
  577. LocalStorage.set('staff_type', 'Admin')
  578. _this.authin = '0'
  579. _this.isLoggedIn()
  580. }
  581. },
  582. mounted() {
  583. var _this = this
  584. _this.warehouseOptionsGet()
  585. _this.link = localStorage.getItem('menulink')
  586. Bus.$on('needLogin', (val) => {
  587. _this.isLoggedIn()
  588. })
  589. },
  590. updated() {
  591. },
  592. beforeDestroy() {
  593. Bus.$off('needLogin')
  594. },
  595. destroyed() {
  596. },
  597. watch: {
  598. login(val) {
  599. if (val) {
  600. if (this.activeTab === 'admin') {
  601. this.admin = true
  602. } else {
  603. this.admin = false
  604. }
  605. }
  606. }
  607. }
  608. }
  609. </script>
  610. <style>
  611. .tabs .q-tab__indicator {
  612. width: 25%;
  613. height: 1.5px;
  614. margin: auto;
  615. color: #d6d7d7;
  616. }
  617. .tabs .absolute-bottom {
  618. bottom: 8px;
  619. }
  620. </style>