diff --git a/rc-busness/components/NuxtLogo.vue b/rc-busness/components/NuxtLogo.vue new file mode 100644 index 00000000..970eba0e --- /dev/null +++ b/rc-busness/components/NuxtLogo.vue @@ -0,0 +1,11 @@ + + + diff --git a/rc-busness/components/Tutorial.vue b/rc-busness/components/Tutorial.vue new file mode 100644 index 00000000..6440b8fb --- /dev/null +++ b/rc-busness/components/Tutorial.vue @@ -0,0 +1,46 @@ + + diff --git a/rc-busness/components/header.vue b/rc-busness/components/header.vue new file mode 100644 index 00000000..322a709d --- /dev/null +++ b/rc-busness/components/header.vue @@ -0,0 +1,144 @@ + + + + \ No newline at end of file diff --git a/rc-busness/components/magnifier.vue b/rc-busness/components/magnifier.vue new file mode 100644 index 00000000..086bc708 --- /dev/null +++ b/rc-busness/components/magnifier.vue @@ -0,0 +1,482 @@ + + + + + diff --git a/rc-busness/components/rc-footer.vue b/rc-busness/components/rc-footer.vue new file mode 100644 index 00000000..18d7fa60 --- /dev/null +++ b/rc-busness/components/rc-footer.vue @@ -0,0 +1,531 @@ + + + + + \ No newline at end of file diff --git a/rc-busness/components/usercation.vue b/rc-busness/components/usercation.vue new file mode 100644 index 00000000..e69de29b diff --git a/rc-busness/components/userlogin.vue b/rc-busness/components/userlogin.vue new file mode 100644 index 00000000..ae105b1c --- /dev/null +++ b/rc-busness/components/userlogin.vue @@ -0,0 +1,25 @@ + + + + + \ No newline at end of file diff --git a/rc-busness/config/common.js b/rc-busness/config/common.js new file mode 100644 index 00000000..71544899 --- /dev/null +++ b/rc-busness/config/common.js @@ -0,0 +1,82 @@ +/** + * 存储localStorage + */ +export const setStore = (name, content) => { + if (!name) return + if (typeof content !== 'string') { + content = JSON.stringify(content) + } + window.localStorage.setItem(name, content) +} + +/** + * 获取localStorage + */ +export const getStore = (name) => { + if (!name) return + return window.localStorage.getItem(name) +} + +/** + * 删除localStorage + */ +export const removeStore = name => { + if (!name) return + window.localStorage.removeItem(name) +} + +/** + * 过滤周 + */ +const getWeek = (arr) => { + if (process.BROWSER_BUILD) { + let weekArr = [] + arr.forEach(function (element) { + switch (element) { + case '1': + weekArr.push('一') + break + case '2': + weekArr.push('二') + break + case '3': + weekArr.push('三') + break + case '4': + weekArr.push('四') + break + case '5': + weekArr.push('五') + break + case '6': + weekArr.push('六') + break + case '7': + weekArr.push('日') + break + default: + break + } + }) + return '每周' + weekArr.join(',') + '上课' + } +} + +/** + * 导出周几上课 + */ +export const filterWeek = value => { + if (process.BROWSER_BUILD) { + let week = [] + if (value.indexOf('@') !== -1) { + let arr = value.split('@') + arr.forEach(function (element) { + week.push(element.slice(2)) + }, this) + return getWeek(week) + } else { + week.push(value.slice(2)) + return getWeek(week) + } + } +} diff --git a/rc-busness/config/index.js b/rc-busness/config/index.js new file mode 100644 index 00000000..0f6fbc74 --- /dev/null +++ b/rc-busness/config/index.js @@ -0,0 +1,5 @@ + +module.exports={ + //图片路径地址 + rbs:'http://47.96.75.242:10086/royalcanin/', +} diff --git a/rc-busness/config/rem.js b/rc-busness/config/rem.js new file mode 100644 index 00000000..bd1440b0 --- /dev/null +++ b/rc-busness/config/rem.js @@ -0,0 +1,20 @@ +// 隔离作用域,避免全局变量的污染 +!(function(){ + function setHtmlFontSize(){ + // 1.获取手机屏幕宽度 + var w = document.documentElement.getBoundingClientRect().width; //如果用window.innerwidth的话,改变窗口大小,不能够及时获取窗口大小 + // console.log(w); + // 2.根据屏幕宽度计算html font-size大小, 7.5指的是设计稿的宽度为750,如果在公司中设计稿的尺寸为720,那么应该除以7.2 + var f = w/40; + // 3.设置html 的font-szie + document.documentElement.style.fontSize=f+"px"; + } + setHtmlFontSize(); + window.addEventListener("resize",function(){ + // setTimeout 是为了解决在苹果手机上的闪屏情况 + setTimeout(function(){ + setHtmlFontSize(); + },300) + + }) +})(); \ No newline at end of file diff --git a/rc-busness/config/request.js b/rc-busness/config/request.js new file mode 100644 index 00000000..0d215c59 --- /dev/null +++ b/rc-busness/config/request.js @@ -0,0 +1,271 @@ +import axios from 'axios' + + +// import Message from '@ele/component/Message' + + +const instance = axios.create({ + // baseURL: apiPrefix, + // baseURL: 'http://192.168.1.111:7005/', + + // baseURL: 'http://kbptestservice.keyunzhihui.com/', //40 + + baseURL: 'http://47.96.75.242:10086/royalcanin/royalcanin/', //52 + + // baseURL: 'http://192.168.1.52:8080', + // baseURL: 'http://192.168.1.60:8400', + // baseURL: '', + // baseURL: video, + // baseURL: 'http://192.168.1.68:8848/', + // baseURL: 'http://192.168.1.40:8080', + + // baseURL: 'http://192.168.33.52:8080', + + + // baseURL: 'http://192.168.1.68:8580/', + // 媒体增删查改 + // videoURL: 'http://192.168.1.115:7005/', + // baseURL: 'http://192.168.33.52:8080/', + + // baseURL: 'http://192.168.1.83:8080', + // baseURL:'http://172.19.0.9', + + // withCredentials: true, // send cookies when cross-domain requests + timeout: 60000 // request timeout +}) + +instance.interceptors.request.use( + config => { + //登录状态下socket断连时,除登出外中断一切请求 + // if (store.state.user.id && !store.state.socket.online && config.url !== '/account/logout') { + // Message.error('请等待与服务器重新连接') + // return Promise.reject('') + // } + + // header添加token + // if (store.state.user.token) { + // config.headers['X-Token'] = store.state.user.token + // } + if (localStorage.getItem('Authorization')) { + config.headers.Authorization = localStorage.getItem('Authorization'); + // config.headers.Authorization ='Bearer eyJhbGciOiJIUzUxMiJ9.eyJyb2xlQ29kZXMiOlsiUk9MRV9SOCIsIlJPTEVfUjE5IiwiUk9MRV9SMTgiLCJST0xFX1I0IiwiUk9MRV9SMTQiLCJST0xFX1IxMSIsIlJPTEVfWiszMiIsIlJPTEVfUjEwIiwiUk9MRV9SMTMiLCJST0xFX1IxMiJdLCJqdGkiOiIxIiwic3ViIjoiYWRtaW4iLCJleHAiOjE2MzI4MTQ1MDN9.M2VWwhih-T8AD1AwYYskH9y-SoOZtHk-qf4PV4Hdb7J6L4Nd7hxKw4JTibGNREjNsmTR1BwMPTDhVgioBSnDfQ' + + } + // config.headers.Authorization ='Bearer eyJhbGciOiJIUzUxMiJ9.eyJyb2xlQ29kZXMiOlsiUk9MRV9SOCIsIlJPTEVfUjE5IiwiUk9MRV9SMTgiLCJST0xFX1I0IiwiUk9MRV9SMTQiLCJST0xFX1IxMSIsIlJPTEVfWiszMiIsIlJPTEVfUjEwIiwiUk9MRV9SMTMiLCJST0xFX1IxMiJdLCJqdGkiOiIxIiwic3ViIjoiYWRtaW4iLCJleHAiOjE2MzI4MTQ1MDN9.M2VWwhih-T8AD1AwYYskH9y-SoOZtHk-qf4PV4Hdb7J6L4Nd7hxKw4JTibGNREjNsmTR1BwMPTDhVgioBSnDfQ' + return config + }, + error => Promise.reject(error) +) + +instance.interceptors.response.use( + response => { + const res = response.data, { responseType = 'json' } = response.config + console.log(res.errorCode); + if (res.errorCode === 6001) { + console.log('66666'); + localStorage.removeItem("Authorization"); + removeToken("Token") + res && Notification.error({ + title: '错误', + message: res.data.errorMessage || '请求错误,请稍后重试' + }) + return Promise.reject(res) + } + if (res.errorCode === 6002) { + console.log('6002'); + localStorage.removeItem("Authorization"); + removeToken("Token") + + res && Notification.error({ + title: '错误', + message: res.data.errorMessage || '账号或密码错误,请重试' + }) + return Promise.reject(res) + + } + if (res.errorCode === 1001) { + console.log('1001'); + localStorage.removeItem("Authorization"); + removeToken("Token") + window.location.href='/#/login' + res && Notification.error({ + title: '错误', + message: res.data.errorMessage || '请求错误,请稍后重试' + }) + return Promise.reject(res) + + } + if (res.errorCode === 1000) { + localStorage.removeItem("Authorization"); + removeToken("Token") + localStorage.removeItem("elecloud"); + console.log('---这是状态码') + window.location.href='/#/login' + // res && Notification.error({ + // title: '错误', + // message: res.data.errorMessage || '请求错误,请稍后重试' + // }) + return Promise.reject(res) + + } + if (res.errorCode === 1002) { + localStorage.removeItem("Authorization"); + removeToken("Token") + window.location.href='/#/login' + res && Notification.error({ + title: '错误', + message: res.data.errorMessage || '请求错误,请稍后重试' + }) + return Promise.reject(res) + + } + //当返回类型非{status,data,msg}的接口请求时,不使用status来判断请求是否成功 + if ((!('status' in res)) || (res.status === 200)) { + //当返回类型为json时,返回response.data + return responseType === 'json' ? res : response + } + + //服务器异常 + if (res.status === 500) { + // Message.error(res.msg || '操作失败') + return Promise.reject(res.msg) + } + + //未登录 + // if (res.status === 6001) { + // if (store.state.user.Authorization) return Promise.reject() + // return MessageBox.alert('请登录后重试', { + // type: 'warning', + // beforeClose: (action, instance, done) => { + // store.dispatch('user/logout').then(done) + // } + // }) + // } + + //没有权限 + if (res.status === 403) { + // Message.error(res.msg || '没有权限进行该操作') + return Promise.reject(res.msg) + } + if (res.status === 400) { + // Message.error(res.msg || '没有权限进行该操作') + return Promise.reject(res) + } + // if(res.) + + //其他错误 + // Message.error(res.msg || '接口有误') + return Promise.reject(res) + }, + error => { + // console.log('error',error.response); + if (axios.isCancel(error)) return + error && Notification.error({ + title: '错误', + // message: '请求错误,请稍后重试' + message: error.response.data.message || '请求错误,请稍后重试' + }) + return Promise.reject(error) + } +) + +class Api { + /** + * 数据接口定义 + * @param url 请求url,不带参数 + * @param arg 对传入参数的处理方法,返回值将作为axios[get,post]的第二个参数 + * @param chain 形参为请求返回的promise + * @param method 请求方法,小写,get、post... + */ + constructor(url, arg, chain, method) { + this.url = url + this.arg = arg + this.chain = chain + this.method = method + } + + request(...args) { + const params = this.arg ? this.arg(...args) : undefined + const promise = instance[this.method](this.url, params).catch(e => console.error(e) + + ) + return this.chain ? this.chain(promise) : promise + } +} + +class ApiJson { + /** + * 数据接口定义 + * @param url 请求url,不带参数 + * @param arg 对传入参数的处理方法,返回值将作为axios[get,post]的第二个参数 + * @param chain 形参为请求返回的promise + * @param method 请求方法,小写,get、post... + * @param header 请求方法,头部信息Json + */ + constructor(url, arg, chain, method, header) { + this.url = url + this.arg = arg + this.chain = chain + this.method = method + this.header = header + } + + request(...args) { + const params = this.arg ? this.arg(...args) : undefined + const promise = instance[this.method](this.url, params, { headers: { 'Content-Type': 'application/json' } }).catch(e => console.error(e)) + return this.chain ? this.chain(promise) : promise + } +} + +export class PostApi extends Api { + constructor(url, arg, chain) { + if (!arg) arg = data => data + super(url, arg, chain, 'post') + } +} + +export class GetApi extends Api { + constructor(url, arg, chain) { + super(url, arg, chain, 'get') + } +} + +export class DeleteApi extends Api { + constructor(url, arg, chain) { + super(url, arg, chain, 'delete') + } +} +export class PatchApi extends Api { + constructor(url, arg, chain) { + if (!arg) arg = data => data + super(url, arg, chain, 'patch') + } +} + +export class PutApi extends Api { + constructor(url, arg, chain) { + if (!arg) arg = data => data + + super(url, arg, chain, 'put') + } +} + +export class PostJsonApi extends ApiJson { + constructor(url, arg, chain) { + if (!arg) arg = data => data + let header = { headers: { 'Content-Type': 'application/json' } } + super(url, arg, chain, 'post', header) + } +} + + +export class DeleteJsonApi extends ApiJson { + constructor(url, arg, chain) { + super(url, arg, chain, 'delete') + } +} + + + + +export default instance diff --git a/rc-busness/pages/index.vue b/rc-busness/pages/index.vue new file mode 100644 index 00000000..737a2525 --- /dev/null +++ b/rc-busness/pages/index.vue @@ -0,0 +1,1097 @@ + + + diff --git a/rc-busness/plugins/ElementUI.js b/rc-busness/plugins/ElementUI.js new file mode 100644 index 00000000..4f76ef74 --- /dev/null +++ b/rc-busness/plugins/ElementUI.js @@ -0,0 +1,3 @@ +import Vue from 'vue' +import ElementUI from 'element-ui' +Vue.use(ElementUI) \ No newline at end of file diff --git a/rc-busness/plugins/lib.js b/rc-busness/plugins/lib.js new file mode 100644 index 00000000..87914288 --- /dev/null +++ b/rc-busness/plugins/lib.js @@ -0,0 +1 @@ +import 'lib-flexible' \ No newline at end of file diff --git a/rc-busness/plugins/localStorage.js b/rc-busness/plugins/localStorage.js new file mode 100644 index 00000000..9623e7c7 --- /dev/null +++ b/rc-busness/plugins/localStorage.js @@ -0,0 +1,9 @@ +import createPersistedState from 'vuex-persistedstate' + +export default ({store}) => { + window.onNuxtReady(() => { + createPersistedState({ + key: "store", // 读取本地存储的数据到store + })(store) + }) +} diff --git a/rc-busness/plugins/swiper.js b/rc-busness/plugins/swiper.js new file mode 100644 index 00000000..d9a44d93 --- /dev/null +++ b/rc-busness/plugins/swiper.js @@ -0,0 +1,4 @@ +import Vue from 'vue' +import VueAwesomeSwiper from 'vue-awesome-swiper' + +Vue.use(VueAwesomeSwiper) \ No newline at end of file diff --git a/rc-busness/plugins/vant.js b/rc-busness/plugins/vant.js new file mode 100644 index 00000000..21c75da8 --- /dev/null +++ b/rc-busness/plugins/vant.js @@ -0,0 +1,4 @@ +import Vue from 'vue' +import Vant from 'vant' + +Vue.use(Vant) diff --git a/rc-busness/static/favicon.ico b/rc-busness/static/favicon.ico new file mode 100644 index 00000000..d751f60c Binary files /dev/null and b/rc-busness/static/favicon.ico differ diff --git a/rc-busness/store/README.md b/rc-busness/store/README.md new file mode 100644 index 00000000..1972d277 --- /dev/null +++ b/rc-busness/store/README.md @@ -0,0 +1,10 @@ +# STORE + +**This directory is not required, you can delete it if you don't want to use it.** + +This directory contains your Vuex Store files. +Vuex Store option is implemented in the Nuxt.js framework. + +Creating a file in this directory automatically activates the option in the framework. + +More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/vuex-store). diff --git a/rc-busness/store/index.js b/rc-busness/store/index.js new file mode 100644 index 00000000..36da5f54 --- /dev/null +++ b/rc-busness/store/index.js @@ -0,0 +1,33 @@ +const state = () => ({position: {}}) + +const mutations = { +// changeLogin(state, val) { +// console.log(state,val); +// let list=[]; +// list.push(val); + +// JSON.parse(list); +// console.log(list); +// localStorage.setItem("cardata", list); +// }, + changeClod(state, val) { + localStorage.setItem('userInfo', val.cloud); + console.log(state,val); + }, +// changeMenu(state, user){ +// // console.log("vuex存储的变化",JSON.parse(user)) +// // console.log("vuex存储的变化",user) +// state.menuList = user; +// localStorage.setItem('menuList', user); +// } +} + +const actions = { + setPosition: ({ + commit + }, position) => { + commit('setPosition', position) + } +} + +export default {namespaced: true, state, mutations, actions}