123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273 |
- <template>
- <view>
- <custom-nav title="其他" showIndex></custom-nav>
- <view class="other-container" >
- <view
- v-for="(item, i) in moduleList"
- :key="i"
- class="module"
- :style="{ background: `url(${require('../../static/new_other/bg.png')}) no-repeat bottom, ${item.style}`, backgroundSize: '100% 126rpx' }"
- @click="toModuleLink(item.name)"
- >
- <view class="name">{{ item.name }}</view>
- <view
- class="icon"
- :style="{ backgroundImage: `url(${require('../../static/new_other/'+item.icon)})` }"
- ></view>
- </view>
-
-
- </view>
- </view>
-
- </template>
- <script>
- import { rankDay } from "@/api.js"
- import { mapState } from "vuex";
- export default {
- computed: {
- ...mapState([
- "userServerInfo"
- ])
- },
- data() {
- return {
- moduleList: [
- { name: '数据统计', style: 'linear-gradient(95deg, #FE5C51 0%, #FF7B5A 100%)', icon: '1.png' },
- { name: '培训课程表', style: 'linear-gradient(95deg, #FA924F 0%, #FF7B39 100%)', icon: '2.png' },
- //{ name: '礼品兑换', style: 'linear-gradient(95deg, #FB6FAC 0%, #FFAACF 100%)', icon: '3.png' },
- { name: '每日排行', style: 'linear-gradient(270deg, #FFBF51 0%, #FF5E58 100%)', icon: '4.png' },
- { name: '荣誉殿堂', style: 'linear-gradient(90deg, #E28EFF 0%, #EDBAFF 100%)', icon: '6.png' },
- { name: '荣誉榜单', style: 'linear-gradient(90deg, #FCC616 0%, #FED476 100%)', icon: '7.png' },
- { name: '地址填写', style: 'linear-gradient(90deg, #928EFF 0%, #BACAFF 100%)', icon: '8.png' },
- { name: '设置', style: 'linear-gradient(90deg, #5380FF 0%, #769FFE 100%)', icon: '5.png' }
- ],
- }
- },
- onLoad() {
- if (this.userServerInfo.upload_status) {
- this.moduleList.splice(6, 0, { name: '图片上传', style: 'linear-gradient(90deg, #FCC616, #FED476)', icon: '2.png' })
- }
- },
- methods: {
- toModuleLink(name) {
- let m = new Map([
- ['数据统计', () => this.tostatistics],
- ['培训课程表', () => this.toCourse],
- ['礼品兑换', () => this.toexchange],
- ['每日排行', () => this.toRankDay],
- ['设置', () => this.tosetting],
- ['荣誉殿堂', () => this.tohonour],
- ['荣誉榜单', () => this.toHotList],
- ['图片上传', () => this.toUpload],
- ['地址填写', () => this.toAddress],
- ])
- m.get(name)()()
- },
- toHotList(){
- uni.navigateTo({
- url: '../hot/hot'
- })
- },
- toRankDay(){ // 每日排行
- uni.removeStorageSync('rankDay')
- uni.showLoading()
- this.$ajax.get(rankDay).then(([, { data: res }]) => {
- uni.hideLoading()
- if(res.code === 200) {
- uni.setStorage({
- key: 'rankDay',
- data: res.data.path,
- success() {
- uni.navigateTo({
- url: '../rank-day/rank-day'
- })
- }
- })
- } else {
- uni.showModal({
- content: res.msg || '查看每日排行失败',
- showCancel: false
- })
- }
- }).catch(() => {
- uni.hideLoading()
- uni.showModal({
- content: '查看每日排行失败',
- showCancel: false
- })
- })
- let status=this.userServerInfo.signuped;
- if(status){
- uni.removeStorageSync('rankDay')
- uni.showLoading()
- this.$ajax.get(rankDay).then(([, { data: res }]) => {
- uni.hideLoading()
- if(res.code === 200) {
- uni.setStorage({
- key: 'rankDay',
- data: res.data.path,
- success() {
- uni.navigateTo({
- url: '../rank-day/rank-day'
- })
- }
- })
- } else {
- uni.showModal({
- content: res.msg || '查看每日排行失败',
- showCancel: false
- })
- }
- }).catch(() => {
- uni.hideLoading()
- uni.showModal({
- content: '查看每日排行失败',
- showCancel: false
- })
- })
- }else{
- uni.showModal({
- content: '请先报名',
- showCancel: false
- })
- }
- },
- toAddress(){
- uni.navigateTo({ url: '../addAddress/addAddress' })
- },
- // 数据统计
- tostatistics () {
- uni.navigateTo({ url: '../statistics/statistics' })
- },
- // 礼品兑换
- toexchange () {
- uni.navigateTo({ url: '../exchange/exchange' })
- },
- // 图片上传
- toUpload() {
- uni.navigateTo({ url: '../upload/upload' })
- },
- // 点击荣誉殿堂
- tohonour () {
- //普通用户直接跳转到荣誉殿堂页面
- if (this.userServerInfo.type === 1 || this.userServerInfo.type === 2) {
- uni.navigateTo({ url: '../honorList/index' })
- } else {
- //批发商和客服不可参赛,所以提示无参赛记录
- uni.showModal({
- content: "无参赛记录",
- showCancel: false
- })
- }
- },
- // 设置
- tosetting () {
- uni.navigateTo({ url: '../setting/setting' })
- },
- // 课程
- toCourse() {
- let now = Date.now()
- let { end_time, start_time } = this.userServerInfo
- let week
- if(now > end_time) {
- week = 3
- } else if (now < start_time) {
- week = 0
- } else {
- week = Math.ceil((now - start_time) / (7 * 24 * 60 * 60 * 1000))
- }
- uni.navigateTo({
- url: '../course/list?week='+week
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .custom-nav {
- position: fixed;
- z-index: 2;
- top: 0;
- width: 100%;
- height: calc(44px + var(--status-bar-height));
- box-sizing: border-box;
- padding-top: var(--status-bar-height);
- display: flex;
- align-items: center;
- font-size: 40rpx;
- line-height: 40rpx;
- color: #2A2A2A;
- background: #FFFFFF;
- .back {
- font-size: 42rpx;
- line-height: 42rpx;
- margin-right: 8rpx;
- }
- }
- page {
- display: flex;
- flex-direction: column;
- .status_bar {
- // position: fixed;
- // top: 0;
- // padding-top: 40rpx;
- // left: 25rpx;
- height: 128rpx;
- z-index: 1000;
- line-height: 88rpx;
- background-color: #fff;
- width: 100%;
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .other-container {
- width: 100%;
- // margin-top: 20rpx;
- padding: 20rpx;
- // padding-top: calc(44px + var(--status-bar-height) + 20rpx);
- background-color: #FFFFFF;
- display: flex;
- justify-content: space-between;
- align-items: center;
- flex-wrap: wrap;
- box-sizing: border-box;
- // margin-top: 128rpx;
- .module {
- width: calc(50% - 20rpx);
- // width: 330rpx;
- height: 220rpx;
- margin-right: 15rpx;
- margin-bottom: 30rpx;
- border-radius: 16rpx;
- &:nth-of-type(2n){
- margin-left: 15rpx;
- margin-right: 0;
- }
- padding-top: 60rpx;
- box-sizing: border-box;
- .name {
- color: #FFFFFF;
- font-size: 48rpx;
- line-height: 66rpx;
- text-align: center;
- }
- position: relative;
- overflow: hidden;
- .icon {
- width: 90rpx;
- height: 90rpx;
- position: absolute;
- background-position: bottom;
- background-repeat: no-repeat;
- background-size: 100% auto;
- right: 18rpx;
- bottom: -14rpx;
- }
- }
- }
- }
- </style>
|