other.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <view>
  3. <custom-nav title="其他"></custom-nav>
  4. <view class="other-container" >
  5. <view
  6. v-for="(item, i) in moduleList"
  7. :key="i"
  8. class="module"
  9. :style="{ background: `url(${require('../../static/new_other/bg.png')}) no-repeat bottom, ${item.style}`, backgroundSize: '100% 126rpx' }"
  10. @click="toModuleLink(item.name)"
  11. >
  12. <view class="name">{{ item.name }}</view>
  13. <view
  14. class="icon"
  15. :style="{ backgroundImage: `url(${require('../../static/new_other/'+item.icon)})` }"
  16. ></view>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. import { rankDay } from "@/api.js"
  23. import { mapState } from "vuex";
  24. export default {
  25. computed: {
  26. ...mapState([
  27. "userServerInfo"
  28. ])
  29. },
  30. data() {
  31. return {
  32. moduleList: [
  33. { name: '数据统计', style: 'linear-gradient(95deg, #FE5C51 0%, #FF7B5A 100%)', icon: '1.png' },
  34. { name: '培训课程表', style: 'linear-gradient(95deg, #FA924F 0%, #FF7B39 100%)', icon: '2.png' },
  35. //{ name: '礼品兑换', style: 'linear-gradient(95deg, #FB6FAC 0%, #FFAACF 100%)', icon: '3.png' },
  36. { name: '每日排行', style: 'linear-gradient(270deg, #FFBF51 0%, #FF5E58 100%)', icon: '4.png' },
  37. { name: '荣誉殿堂', style: 'linear-gradient(90deg, #E28EFF 0%, #EDBAFF 100%)', icon: '6.png' },
  38. { name: '荣誉榜单', style: 'linear-gradient(90deg, #FCC616 0%, #FED476 100%)', icon: '7.png' },
  39. { name: '地址填写', style: 'linear-gradient(90deg, #928EFF 0%, #BACAFF 100%)', icon: '8.png' },
  40. { name: '设置', style: 'linear-gradient(90deg, #5380FF 0%, #769FFE 100%)', icon: '5.png' }
  41. ],
  42. }
  43. },
  44. onLoad() {
  45. if (this.userServerInfo.upload_status) {
  46. this.moduleList.splice(6, 0, { name: '图片上传', style: 'linear-gradient(90deg, #FCC616, #FED476)', icon: '2.png' })
  47. }
  48. },
  49. methods: {
  50. goBack(){
  51. uni.redirectTo({
  52. url:"../index/index"
  53. })
  54. },
  55. toModuleLink(name) {
  56. let m = new Map([
  57. ['数据统计', () => this.tostatistics],
  58. ['培训课程表', () => this.toCourse],
  59. ['礼品兑换', () => this.toexchange],
  60. ['每日排行', () => this.toRankDay],
  61. ['设置', () => this.tosetting],
  62. ['荣誉殿堂', () => this.tohonour],
  63. ['荣誉榜单', () => this.toHotList],
  64. ['图片上传', () => this.toUpload],
  65. ['地址填写', () => this.toAddress],
  66. ])
  67. m.get(name)()()
  68. },
  69. toHotList(){
  70. uni.navigateTo({
  71. url: '../hot/hot'
  72. })
  73. },
  74. toRankDay(){ // 每日排行
  75. uni.removeStorageSync('rankDay')
  76. uni.showLoading()
  77. this.$ajax.get(rankDay).then(([, { data: res }]) => {
  78. uni.hideLoading()
  79. if(res.code === 200) {
  80. uni.setStorage({
  81. key: 'rankDay',
  82. data: res.data.path,
  83. success() {
  84. uni.navigateTo({
  85. url: '../rank-day/rank-day'
  86. })
  87. }
  88. })
  89. } else {
  90. uni.showModal({
  91. content: res.msg || '查看每日排行失败',
  92. showCancel: false
  93. })
  94. }
  95. }).catch(() => {
  96. uni.hideLoading()
  97. uni.showModal({
  98. content: '查看每日排行失败',
  99. showCancel: false
  100. })
  101. })
  102. let status=this.userServerInfo.signuped;
  103. if(status){
  104. uni.removeStorageSync('rankDay')
  105. uni.showLoading()
  106. this.$ajax.get(rankDay).then(([, { data: res }]) => {
  107. uni.hideLoading()
  108. if(res.code === 200) {
  109. uni.setStorage({
  110. key: 'rankDay',
  111. data: res.data.path,
  112. success() {
  113. uni.navigateTo({
  114. url: '../rank-day/rank-day'
  115. })
  116. }
  117. })
  118. } else {
  119. uni.showModal({
  120. content: res.msg || '查看每日排行失败',
  121. showCancel: false
  122. })
  123. }
  124. }).catch(() => {
  125. uni.hideLoading()
  126. uni.showModal({
  127. content: '查看每日排行失败',
  128. showCancel: false
  129. })
  130. })
  131. }else{
  132. uni.showModal({
  133. content: '请先报名',
  134. showCancel: false
  135. })
  136. }
  137. },
  138. toAddress(){
  139. uni.navigateTo({ url: '../addAddress/addAddress' })
  140. },
  141. // 数据统计
  142. tostatistics () {
  143. uni.navigateTo({ url: '../statistics/statistics' })
  144. },
  145. // 礼品兑换
  146. toexchange () {
  147. uni.navigateTo({ url: '../exchange/exchange' })
  148. },
  149. // 图片上传
  150. toUpload() {
  151. uni.navigateTo({ url: '../upload/upload' })
  152. },
  153. // 点击荣誉殿堂
  154. tohonour () {
  155. //普通用户直接跳转到荣誉殿堂页面
  156. if (this.userServerInfo.type === 1 || this.userServerInfo.type === 2) {
  157. uni.navigateTo({ url: '../honorList/index' })
  158. } else {
  159. //批发商和客服不可参赛,所以提示无参赛记录
  160. uni.showModal({
  161. content: "无参赛记录",
  162. showCancel: false
  163. })
  164. }
  165. },
  166. // 设置
  167. tosetting () {
  168. uni.navigateTo({ url: '../setting/setting' })
  169. },
  170. // 课程
  171. toCourse() {
  172. let now = Date.now()
  173. let { end_time, start_time } = this.userServerInfo
  174. let week
  175. if(now > end_time) {
  176. week = 3
  177. } else if (now < start_time) {
  178. week = 0
  179. } else {
  180. week = Math.ceil((now - start_time) / (7 * 24 * 60 * 60 * 1000))
  181. }
  182. uni.navigateTo({
  183. url: '../course/list?week='+week
  184. })
  185. }
  186. }
  187. }
  188. </script>
  189. <style lang="scss" scoped>
  190. .custom-nav {
  191. position: fixed;
  192. z-index: 2;
  193. top: 0;
  194. width: 100%;
  195. height: calc(44px + var(--status-bar-height));
  196. box-sizing: border-box;
  197. padding-top: var(--status-bar-height);
  198. display: flex;
  199. align-items: center;
  200. font-size: 40rpx;
  201. line-height: 40rpx;
  202. color: #2A2A2A;
  203. background: #FFFFFF;
  204. .back {
  205. font-size: 42rpx;
  206. line-height: 42rpx;
  207. margin-right: 8rpx;
  208. }
  209. }
  210. page {
  211. display: flex;
  212. flex-direction: column;
  213. .status_bar {
  214. // position: fixed;
  215. // top: 0;
  216. // padding-top: 40rpx;
  217. // left: 25rpx;
  218. height: 128rpx;
  219. z-index: 1000;
  220. line-height: 88rpx;
  221. background-color: #fff;
  222. width: 100%;
  223. display: flex;
  224. justify-content: space-between;
  225. align-items: center;
  226. }
  227. .other-container {
  228. width: 100%;
  229. // margin-top: 20rpx;
  230. padding: 20rpx;
  231. // padding-top: calc(44px + var(--status-bar-height) + 20rpx);
  232. background-color: #FFFFFF;
  233. display: flex;
  234. justify-content: space-between;
  235. align-items: center;
  236. flex-wrap: wrap;
  237. box-sizing: border-box;
  238. // margin-top: 128rpx;
  239. .module {
  240. width: calc(50% - 20rpx);
  241. // width: 330rpx;
  242. height: 220rpx;
  243. margin-right: 15rpx;
  244. margin-bottom: 30rpx;
  245. border-radius: 16rpx;
  246. &:nth-of-type(2n){
  247. margin-left: 15rpx;
  248. margin-right: 0;
  249. }
  250. padding-top: 60rpx;
  251. box-sizing: border-box;
  252. .name {
  253. color: #FFFFFF;
  254. font-size: 48rpx;
  255. line-height: 66rpx;
  256. text-align: center;
  257. }
  258. position: relative;
  259. overflow: hidden;
  260. .icon {
  261. width: 90rpx;
  262. height: 90rpx;
  263. position: absolute;
  264. background-position: bottom;
  265. background-repeat: no-repeat;
  266. background-size: 100% auto;
  267. right: 18rpx;
  268. bottom: -14rpx;
  269. }
  270. }
  271. }
  272. }
  273. </style>