123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- <template>
- <view class="main">
- <view class="one">
- <view class="list" :class="[index==0?'color0':index==1?'color1':index==2?'color2':'color3']"
- v-for="(item, index) in list" :key="index" @tap='toInfo(item)'>
- <text>{{item.name}}</text>
- <uni-icons type="right" color="#ffffff" size="20"></uni-icons>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- user: {},
- list: [{
- name: '实验室信息列表',
- route: 'pagesBasic/basic/index'
- },
- {
- name: '政策文件',
- route: 'pagesBasic/policyfile/index'
- }
- ]
- }
- },
- onShow: function(e) {
- const that = this;
- that.searchToken();
- },
- methods: {
- searchToken() {
- const that = this;
- try {
- const res = uni.getStorageSync('token');
- if (res) {
- const user = that.$jwt(res);
- that.$set(that, `user`, user);
- } else {
- uni.navigateTo({
- url: `/pages/login/index`
- })
- }
- } catch (e) {
- uni.showToast({
- title: err.errmsg,
- icon: 'error',
- duration: 2000
- });
- }
- },
- // 跳转
- toInfo(item) {
- const that = this;
- if (that.user && that.user._id) {
- if (item.type == '0') {
- uni.showModal({
- title: '提示',
- content: '确定退出登录吗?',
- success: async function(res) {
- if (res.confirm) {
- uni.removeStorage({
- key: 'token',
- success: function(res) {
- let url = `/pages/login/index`;
- uni.reLaunch({
- url
- })
- }
- });
- }
- }
- });
- } else {
- uni.navigateTo({
- url: `/${item.route}`
- })
- }
- } else {
- uni.navigateTo({
- url: `/pagesIndex/login/index`
- })
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .main {
- .one {
- .color0 {
- border: 2px solid var(--fF0Color);
- background: radial-gradient(circle at 7.2% 13.6%, rgb(255, 160, 122) 0%, rgb(255, 0, 0) 90%);
- }
- .color1 {
- border: 2px solid var(--f3CColor);
- background: radial-gradient(circle at 7.2% 13.6%, rgb(37, 249, 245) 0%, rgb(0, 122, 255) 90%);
- }
- .color2 {
- border: 2px solid var(--f08Color);
- background: radial-gradient(circle at 7.2% 13.6%, rgb(144, 238, 144) 0%, rgb(0, 128, 0) 90%);
- }
- .color3 {
- border: 2px solid var(--f07CColor);
- background: radial-gradient(circle at 7.2% 13.6%, rgb(175, 238, 238) 0%, rgb(7, 196, 175) 90%);
- }
- .list {
- display: flex;
- align-items: center;
- justify-content: space-between;
- border-radius: 10px;
- margin: 2vw;
- padding: 4vw;
- font-size: var(--font16Size);
- font-weight: bold;
- color: var(--mainColor);
- }
- }
- }
- </style>
|