Browse Source

添加基础页面

lex 2 years ago
parent
commit
c0848b7f1f

+ 1 - 1
README.md

@@ -43,7 +43,7 @@ See [Configuration Reference](https://vitejs.dev/config/).
 ```
 /src/student -- 学生端页面目录
 /src/teacher -- 老师端页面目录
-/src/manage  -- 管理端页面目录
+/src/school  -- 管理端页面目录
 /src/views 三端共用页面,路由最好配置到 routes-common 文件中
 
 /src/components -- 公用组件

+ 32 - 58
package-lock.json

@@ -9,6 +9,7 @@
       "version": "0.1.0",
       "license": "MIT",
       "dependencies": {
+        "@vant/compat": "^1.0.0",
         "@vant/use": "^1.3.6",
         "@vueuse/core": "^8.4.1",
         "browserslist": "^4.20.2",
@@ -27,7 +28,7 @@
         "qrcode.vue": "^3.3.3",
         "query-string": "^7.1.1",
         "umi-request": "^1.4.0",
-        "vant": "^3.4.6",
+        "vant": "^4.0.0",
         "vconsole": "^3.14.6",
         "vue": "^3.2.26",
         "vue-cropper": "^1.0.3",
@@ -2031,16 +2032,6 @@
         "node": ">= 8"
       }
     },
-    "node_modules/@popperjs/core": {
-      "version": "2.11.5",
-      "resolved": "https://registry.npmmirror.com/@popperjs/core/-/core-2.11.5.tgz",
-      "integrity": "sha512-9X2obfABZuDVLCgPK9aX0a/x4jaOEweTTWE2+9sr0Qqqevj2Uv5XorvusThmc9XGYpS9yI+fhh8RTafBtGposw==",
-      "license": "MIT",
-      "funding": {
-        "type": "opencollective",
-        "url": "https://opencollective.com/popperjs"
-      }
-    },
     "node_modules/@rollup/pluginutils": {
       "version": "4.2.1",
       "resolved": "https://registry.npmmirror.com/@rollup/pluginutils/-/pluginutils-4.2.1.tgz",
@@ -2317,26 +2308,20 @@
         "url": "https://opencollective.com/typescript-eslint"
       }
     },
-    "node_modules/@vant/icons": {
-      "version": "1.8.0",
-      "resolved": "https://registry.npmmirror.com/@vant/icons/-/icons-1.8.0.tgz",
-      "integrity": "sha512-sKfEUo2/CkQFuERxvkuF6mGQZDKu3IQdj5rV9Fm0weJXtchDSSQ+zt8qPCNUEhh9Y8shy5PzxbvAfOOkCwlCXg==",
-      "license": "MIT"
+    "node_modules/@vant/compat": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmmirror.com/@vant/compat/-/compat-1.0.0.tgz",
+      "integrity": "sha512-u3YOaLkz/5qtF+57hhveZWYdPHSpaN01WNbuS5WZAD7PNTeF7AqKvQ7Ws8KK4e2lCWN+FeRWfNuCk0xv6TxAvw=="
     },
     "node_modules/@vant/popperjs": {
-      "version": "1.2.1",
-      "resolved": "https://registry.npmmirror.com/@vant/popperjs/-/popperjs-1.2.1.tgz",
-      "integrity": "sha512-qzQlrPE4aOsBzfrktDVwzQy/QICCTKifmjrruhY58+Q2fobUYp/T9QINluIafzsD3VJwgP8+HFVLBsyDmy3VZQ==",
-      "license": "MIT",
-      "dependencies": {
-        "@popperjs/core": "^2.9.2"
-      }
+      "version": "1.3.0",
+      "resolved": "https://registry.npmmirror.com/@vant/popperjs/-/popperjs-1.3.0.tgz",
+      "integrity": "sha512-hB+czUG+aHtjhaEmCJDuXOep0YTZjdlRR+4MSmIFnkCQIxJaXLQdSsR90XWvAI2yvKUI7TCGqR8pQg2RtvkMHw=="
     },
     "node_modules/@vant/use": {
-      "version": "1.4.1",
-      "resolved": "https://registry.npmmirror.com/@vant/use/-/use-1.4.1.tgz",
-      "integrity": "sha512-YonNN0SuJLEJuqdoMcVAJm2JUZWkHNrW81QzeF6FLyG5HFUGlmTM5Sby7gdS3Z/8UDMlkWRQpJxBWbmVzmUWxQ==",
-      "license": "MIT"
+      "version": "1.4.3",
+      "resolved": "https://registry.npmmirror.com/@vant/use/-/use-1.4.3.tgz",
+      "integrity": "sha512-rSnETN7P9qT1WbItMpQxBqe3cHeK2ZFYp1sCxWUXaTeI71TqA8sOdzC36ledZ36NQgFNTch9fsRPYOkrCgZfQA=="
     },
     "node_modules/@vitejs/plugin-legacy": {
       "version": "1.7.1",
@@ -9031,14 +9016,12 @@
       }
     },
     "node_modules/vant": {
-      "version": "3.4.6",
-      "resolved": "https://registry.npmmirror.com/vant/-/vant-3.4.6.tgz",
-      "integrity": "sha512-Ol1xhEXn2wjBAWqCyr4/0EKTCQEYbAzKyOP+bKYIWl+fbJXme8Aza5soeKvWA2KD9ZBU0qS7yBVGpr+76xUEXQ==",
-      "license": "MIT",
+      "version": "4.0.0",
+      "resolved": "https://registry.npmmirror.com/vant/-/vant-4.0.0.tgz",
+      "integrity": "sha512-s3FDA7mWfkgFBWq/8J09dQZETeCzfGT41289fTIcp7VEcME62zXEw+8S41+stJVjk8fNXYRvMXsGfcD7HTLpaQ==",
       "dependencies": {
-        "@vant/icons": "^1.7.1",
-        "@vant/popperjs": "^1.1.0",
-        "@vant/use": "^1.3.6"
+        "@vant/popperjs": "^1.3.0",
+        "@vant/use": "^1.4.3"
       },
       "peerDependencies": {
         "vue": "^3.0.0"
@@ -11212,11 +11195,6 @@
         "fastq": "^1.6.0"
       }
     },
-    "@popperjs/core": {
-      "version": "2.11.5",
-      "resolved": "https://registry.npmmirror.com/@popperjs/core/-/core-2.11.5.tgz",
-      "integrity": "sha512-9X2obfABZuDVLCgPK9aX0a/x4jaOEweTTWE2+9sr0Qqqevj2Uv5XorvusThmc9XGYpS9yI+fhh8RTafBtGposw=="
-    },
     "@rollup/pluginutils": {
       "version": "4.2.1",
       "resolved": "https://registry.npmmirror.com/@rollup/pluginutils/-/pluginutils-4.2.1.tgz",
@@ -11390,23 +11368,20 @@
         "eslint-visitor-keys": "^3.0.0"
       }
     },
-    "@vant/icons": {
-      "version": "1.8.0",
-      "resolved": "https://registry.npmmirror.com/@vant/icons/-/icons-1.8.0.tgz",
-      "integrity": "sha512-sKfEUo2/CkQFuERxvkuF6mGQZDKu3IQdj5rV9Fm0weJXtchDSSQ+zt8qPCNUEhh9Y8shy5PzxbvAfOOkCwlCXg=="
+    "@vant/compat": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmmirror.com/@vant/compat/-/compat-1.0.0.tgz",
+      "integrity": "sha512-u3YOaLkz/5qtF+57hhveZWYdPHSpaN01WNbuS5WZAD7PNTeF7AqKvQ7Ws8KK4e2lCWN+FeRWfNuCk0xv6TxAvw=="
     },
     "@vant/popperjs": {
-      "version": "1.2.1",
-      "resolved": "https://registry.npmmirror.com/@vant/popperjs/-/popperjs-1.2.1.tgz",
-      "integrity": "sha512-qzQlrPE4aOsBzfrktDVwzQy/QICCTKifmjrruhY58+Q2fobUYp/T9QINluIafzsD3VJwgP8+HFVLBsyDmy3VZQ==",
-      "requires": {
-        "@popperjs/core": "^2.9.2"
-      }
+      "version": "1.3.0",
+      "resolved": "https://registry.npmmirror.com/@vant/popperjs/-/popperjs-1.3.0.tgz",
+      "integrity": "sha512-hB+czUG+aHtjhaEmCJDuXOep0YTZjdlRR+4MSmIFnkCQIxJaXLQdSsR90XWvAI2yvKUI7TCGqR8pQg2RtvkMHw=="
     },
     "@vant/use": {
-      "version": "1.4.1",
-      "resolved": "https://registry.npmmirror.com/@vant/use/-/use-1.4.1.tgz",
-      "integrity": "sha512-YonNN0SuJLEJuqdoMcVAJm2JUZWkHNrW81QzeF6FLyG5HFUGlmTM5Sby7gdS3Z/8UDMlkWRQpJxBWbmVzmUWxQ=="
+      "version": "1.4.3",
+      "resolved": "https://registry.npmmirror.com/@vant/use/-/use-1.4.3.tgz",
+      "integrity": "sha512-rSnETN7P9qT1WbItMpQxBqe3cHeK2ZFYp1sCxWUXaTeI71TqA8sOdzC36ledZ36NQgFNTch9fsRPYOkrCgZfQA=="
     },
     "@vitejs/plugin-legacy": {
       "version": "1.7.1",
@@ -15909,13 +15884,12 @@
       "dev": true
     },
     "vant": {
-      "version": "3.4.6",
-      "resolved": "https://registry.npmmirror.com/vant/-/vant-3.4.6.tgz",
-      "integrity": "sha512-Ol1xhEXn2wjBAWqCyr4/0EKTCQEYbAzKyOP+bKYIWl+fbJXme8Aza5soeKvWA2KD9ZBU0qS7yBVGpr+76xUEXQ==",
+      "version": "4.0.0",
+      "resolved": "https://registry.npmmirror.com/vant/-/vant-4.0.0.tgz",
+      "integrity": "sha512-s3FDA7mWfkgFBWq/8J09dQZETeCzfGT41289fTIcp7VEcME62zXEw+8S41+stJVjk8fNXYRvMXsGfcD7HTLpaQ==",
       "requires": {
-        "@vant/icons": "^1.7.1",
-        "@vant/popperjs": "^1.1.0",
-        "@vant/use": "^1.3.6"
+        "@vant/popperjs": "^1.3.0",
+        "@vant/use": "^1.4.3"
       }
     },
     "vconsole": {

+ 2 - 1
package.json

@@ -21,6 +21,7 @@
     "generate": "plop"
   },
   "dependencies": {
+    "@vant/compat": "^1.0.0",
     "@vant/use": "^1.3.6",
     "@vueuse/core": "^8.4.1",
     "browserslist": "^4.20.2",
@@ -39,7 +40,7 @@
     "qrcode.vue": "^3.3.3",
     "query-string": "^7.1.1",
     "umi-request": "^1.4.0",
-    "vant": "^3.4.6",
+    "vant": "^4.0.0",
     "vconsole": "^3.14.6",
     "vue": "^3.2.26",
     "vue-cropper": "^1.0.3",

+ 1 - 1
manage.html → school.html

@@ -43,7 +43,7 @@
 
 <body>
   <div id="app"></div>
-  <script type="module" src="/src/manage/main.ts"></script>
+  <script type="module" src="/src/school/main.ts"></script>
 </body>
 
 </html>

BIN
src/common/images/icon_filter.png


BIN
src/common/images/icon_search.png


+ 20 - 8
src/components/o-img-code/index.tsx

@@ -25,12 +25,13 @@ export default defineComponent({
     return {
       isSuffix: suffix,
       showStatus: false,
-      identifyingCode: origin + suffix + '/code/getImageCode?phone=' + this.phone,
+      identifyingCode: null,
       code: null
     }
   },
   mounted() {
     this.showStatus = this.value
+    this.sendImgCode()
   },
   watch: {
     value(val: any) {
@@ -43,30 +44,41 @@ export default defineComponent({
     }
   },
   methods: {
+    async sendImgCode() {
+      const { data } = await request.get(this.isSuffix + '/open/sendImgCode', {
+        requestType: 'form',
+        params: {
+          phone: this.phone
+        }
+      })
+      this.identifyingCode = data
+    },
     async updateIdentifyingCode() {
+      this.sendImgCode()
       // 刷新token
-      const origin = window.location.origin
-      this.identifyingCode = `${origin}${this.isSuffix}/code/getImageCode?phone=${
-        this.phone
-      }&token=${Math.random()}`
+      // const origin = window.location.origin
+      // this.identifyingCode = `${origin}${this.isSuffix}/code/getImageCode?phone=${
+      //   this.phone
+      // }&token=${Math.random()}`
     },
     async checkVerifyLoginImage() {
       try {
         if ((this as any).code.length < 4) {
           return
         }
-        await request.post(`${this.isSuffix}/code/verifyImageCode`, {
+        await request.post(`${this.isSuffix}/open/verifyImgCode`, {
           requestType: 'form',
           data: {
             phone: this.phone,
             code: this.code
           }
         })
-        await request.post(`${this.isSuffix}/code/sendSmsCode`, {
+        await request.post(`${this.isSuffix}/open/sendSms`, {
           requestType: 'form',
           data: {
             mobile: this.phone,
-            type: 'LOGIN'
+            type: 'LOGIN',
+            clientId: state.clientId[state.platformType]
           }
         })
         Toast('验证码已发送')

+ 7 - 3
src/components/o-search/index.module.less

@@ -7,15 +7,15 @@
       user-select: text !important;
     }
     .van-search__field {
-      padding: 0.13333rem var(--van-padding-xs) 0.13333rem 0 !important;
+      // padding: 0.13333rem var(--van-padding-xs) 0.13333rem 0 !important;
       background: transparent !important;
     }
   }
 }
 .col-search {
   --van-cell-background-color: transparent;
-  // padding-left: 14px;
-  // padding-right: 14px;
+  padding-left: 13px;
+  padding-right: 13px;
   :global {
     .van-field__left-icon {
       display: flex;
@@ -31,6 +31,10 @@
       font-size: 14px;
     }
   }
+  .leftIcon {
+    font-size: 16px;
+    margin-top: -3px;
+  }
   &.default {
     :global {
       .van-search__content {

+ 1 - 2
src/components/o-search/index.tsx

@@ -3,7 +3,6 @@ import { defineComponent, PropType } from 'vue'
 import styles from './index.module.less'
 import iconSearch from '@common/images/icon_search.png'
 import iconFilter from '@common/images/icon_filter.png'
-
 type inputBackground = 'default' | 'white' | 'transparent'
 
 export default defineComponent({
@@ -87,7 +86,7 @@ export default defineComponent({
           onClick={() => this.$emit('click')}
           v-slots={{
             left: () => this.$slots.left && this.$slots.left(),
-            'left-icon': () => <Icon name={this.leftIcon} size={16} />,
+            'left-icon': () => <Icon name={this.leftIcon} class={styles.leftIcon} />,
             'right-icon': () => (
               <Button
                 class={styles.searchBtn}

+ 3 - 3
src/helpers/native-message.ts

@@ -27,7 +27,7 @@ window.postMessage = (message: IPostMessage) => {
 type CallBack = (evt?: IPostMessage) => void
 
 // eslint-disable-next-line @typescript-eslint/no-empty-function
-const loop = () => {}
+const loop = () => { }
 
 const calls: { [key: string]: CallBack | CallBack[] } = {}
 
@@ -77,7 +77,7 @@ if (browserInfo.isApp) {
 }
 
 const instance: any =
-  (window as any).COLEXIU || (window as any).webkit?.messageHandlers?.COLEXIU
+  (window as any).ORCHESTRA || (window as any).webkit?.messageHandlers?.ORCHESTRA
 
 export const postMessage = (data: IPostMessage, callback?: CallBack) => {
   if (browserInfo.isApp) {
@@ -111,7 +111,7 @@ export const removeListenerMessage = (api: string, callback: CallBack) => {
     const uuid = api
     if (Array.isArray(calls[uuid])) {
       const indexOf = (calls[uuid] as CallBack[]).indexOf(callback)
-      ;(calls[uuid] as CallBack[]).splice(indexOf, 1)
+        ; (calls[uuid] as CallBack[]).splice(indexOf, 1)
     }
   }
 }

+ 10 - 9
src/helpers/request.ts

@@ -3,7 +3,7 @@ import cleanDeep from 'clean-deep'
 import { browser, openLoading, closeLoading } from '@/helpers/utils'
 import { setLogout, setLoginError } from '@/state'
 import { postMessage } from './native-message'
-import { Toast } from 'vant'
+import { showLoadingToast, showToast, closeToast } from 'vant'
 
 export interface SearchInitParams {
   rows?: string | number
@@ -36,7 +36,7 @@ request.interceptors.request.use(
     // openLoading();
     if (!options.hideLoading) {
       clearTimeout(toast)
-      Toast.loading({
+      showLoadingToast({
         message: '加载中...',
         forbidClick: true,
         loadingType: 'spinner',
@@ -75,32 +75,33 @@ request.interceptors.request.use(
 request.interceptors.response.use(
   async res => {
     toast = setTimeout(() => {
-      Toast.clear()
+      closeToast()
     }, 100)
 
     if (res.status > 299 || res.status < 200) {
       clearTimeout(toast)
       const msg = '服务器错误,状态码' + res.status
-      Toast(msg)
+      showToast(msg)
       throw new Error(msg)
     }
     const data = await res.clone().json()
     if (data.code !== 200 && data.errCode !== 0) {
       let msg = data.msg || data.message || '处理失败,请重试'
       if (initRequest) {
-        if (data.code === 403 || data.code === 401) {
+        if (data.code === 403 || data.code === 5000) {
           setLogout()
         } else {
           setLoginError()
         }
       }
-      if (!(data.code === 403 || data.code === 401)) {
+      console.log(data.code, '5104')
+      if (!(data.code === 403 || data.code === 5000)) {
         clearTimeout(toast)
-        Toast(msg)
+        showToast(msg)
       }
       const browserInfo = browser()
-      if (data.code === 403) {
-        msg += '403'
+      if (data.code === 5000) {
+        msg += '5000'
         if (browserInfo.isApp) {
           postMessage({
             api: 'login'

+ 10 - 7
src/router/index.ts

@@ -1,10 +1,10 @@
 import { browser } from '@/helpers/utils'
 import { Dialog } from 'vant'
-import { createRouter, createWebHistory, Router } from 'vue-router'
+import { createRouter, createWebHashHistory, createWebHistory, Router } from 'vue-router'
 import { postMessage } from '@/helpers/native-message'
 import routesTeacher from './routes-teacher'
 import routesStudent from './routes-student'
-import routesManage from './routes-manage'
+import routesSchool from './routes-school'
 
 const paymentType = (window as any).paymentType
 let routes: any = []
@@ -15,16 +15,19 @@ if (paymentType === 'STUDENT') {
   routes = routesTeacher
   baseUrl = '/teacher.html'
 } else if (paymentType === 'SCHOOL') {
-  routes = routesManage
+  routes = routesSchool
   baseUrl = '/school.html'
 }
 
-if (location.origin.indexOf('location') <= -1 || location.origin.indexOf('192.168.3') <= -1) {
-  baseUrl = ''
-}
+// if (location.origin.indexOf('location') <= -1 || location.origin.indexOf('192.168.3') <= -1) {
+//   baseUrl = ''
+// }
+
+console.log(routes, baseUrl, paymentType)
 
 const router: Router = createRouter({
-  history: createWebHistory(baseUrl),
+  // history: createWebHistory('/school.html'),
+  history: createWebHashHistory(),
   routes,
   scrollBehavior(to, from, savedPosition) {
     if (to.hash) {

+ 0 - 36
src/router/routes-manage.ts

@@ -1,36 +0,0 @@
-import Auth from '@/views/layout/auth'
-import { router, rootRouter } from './routes-common'
-
-type metaType = {
-  isRegister: boolean
-}
-
-// 不需要登录的路由
-const noLoginRouter = [
-
-]
-
-export default [
-  {
-    path: '/',
-    component: Auth,
-    children: [
-      ...router,
-      {
-        path: '/login',
-        name: 'login',
-        component: () => import('@/views/layout/login'),
-        meta: {
-          isRegister: false
-        } as metaType
-      },
-      {
-        path: '/home',
-        name: 'home',
-        component: () => import('@/teacher/home/index')
-      }
-    ]
-  },
-  ...rootRouter,
-  ...noLoginRouter
-]

+ 67 - 0
src/router/routes-school.ts

@@ -0,0 +1,67 @@
+import Auth from '@/views/layout/auth'
+import { router, rootRouter } from './routes-common'
+
+type metaType = {
+  isRegister: boolean
+}
+
+// 不需要登录的路由
+const noLoginRouter = [
+
+]
+
+export default [
+  {
+    path: '/',
+    component: Auth,
+    children: [
+      ...router,
+      {
+        path: '/login',
+        name: 'login',
+        component: () => import('@/views/layout/login'),
+        meta: {
+          isRegister: false
+        } as metaType
+      },
+      {
+        path: '/home',
+        name: 'home',
+        component: () => import('@/school/home/index')
+      },
+      {
+        path: '/my-orchestra',
+        name: 'my-orchestra',
+        component: () => import('@/school/orchestra/index'),
+        meta: {
+          title: '我的乐团'
+        }
+      },
+      {
+        path: '/create-orchestra',
+        name: 'create-orchestra',
+        component: () => import('@/school/orchestra/create-orchestra'),
+        meta: {
+          title: '新建乐团'
+        }
+      },
+      {
+        path: '/mass-message',
+        name: 'mass-message',
+        component: () => import('@/school/mass-message/index'),
+        meta: {
+          title: '群发记录'
+        }
+      }, {
+        path: '/create-message',
+        name: 'create-message',
+        component: () => import('@/school/mass-message/create-message'),
+        meta: {
+          title: '群发消息'
+        }
+      }
+    ]
+  },
+  ...rootRouter,
+  ...noLoginRouter
+]

+ 0 - 0
src/manage/App.vue → src/school/App.vue


+ 0 - 0
src/manage/home/index.module.less → src/school/home/index.module.less


+ 0 - 0
src/manage/home/index.tsx → src/school/home/index.tsx


+ 7 - 4
src/manage/main.ts → src/school/main.ts

@@ -4,6 +4,7 @@ import router from '../router/index'
 import { postMessage } from '@/helpers/native-message'
 
 import 'normalize.css'
+import 'vant/lib/index.css';
 
 import '../styles/index.less'
 import { state } from '@/state'
@@ -23,19 +24,21 @@ postMessage(
 
 // import Vconsole from 'vconsole'
 // const vconsole = new Vconsole()
-if (browser().isTeacher) {
+const paymentType = (window as any).paymentType // 浏览器设置
+if (browser().isTeacher || paymentType === 'TEACHER') {
   state.platformType = 'TEACHER'
-} else if (browser().isStudent) {
+} else if (browser().isStudent || paymentType === 'STUDENT') {
   state.platformType = 'STUDENT'
-} else if (browser().isSchool) {
+} else if (browser().isSchool || paymentType === 'SCHOOL') {
   state.platformType = 'SCHOOL'
 } else {
   state.platformType = 'SCHOOL'
 }
+
 if (state.platformType === 'TEACHER') {
   state.platformApi = '/api-teacher'
 } if (state.platformType === 'SCHOOL') {
-  state.platformApi = '/api-manage'
+  state.platformApi = '/api-school'
 } else {
   state.platformApi = '/api-student'
 }

+ 42 - 0
src/school/mass-message/create-message.tsx

@@ -0,0 +1,42 @@
+import OHeader from '@/components/o-header'
+import { Cell, CellGroup, Field, Uploader } from 'vant'
+import { defineComponent, reactive } from 'vue'
+import styles from './index.module.less'
+
+export default defineComponent({
+  name: 'create-message',
+  setup() {
+    const forms = reactive({
+      type: null,
+      content: null
+    })
+    return () => (
+      <div class={styles['create-message']}>
+        <OHeader />
+
+        <CellGroup inset>
+          <Cell title="发送方式" value={''} isLink />
+          <Cell title="发送时间" value={''} isLink />
+          <Cell title="发送内容">
+            {{
+              label: () => (
+                <Field
+                  style={{ padding: '0' }}
+                  placeholder="请输入发送内容"
+                  v-model={forms.content}
+                  type="textarea"
+                  rows={3}
+                />
+              )
+            }}
+          </Cell>
+          <Cell title="上传辅件">
+            <Uploader />
+          </Cell>
+
+          <Cell title="发送对象"></Cell>
+        </CellGroup>
+      </div>
+    )
+  }
+})

+ 48 - 0
src/school/mass-message/index.module.less

@@ -0,0 +1,48 @@
+.massMessage {
+  --van-tab-active-text-color: var(--van-primary-color);
+  --van-tab-text-color: #777;
+  --van-tab-font-size: 16px;
+  :global {
+    .van-tab {
+      font-weight: 600;
+    }
+  }
+
+  .waitSend {
+    font-weight: 600;
+    color: var(--van-primary-color);
+    font-size: 14px;
+
+    :global {
+      .van-cell__value {
+        color: var(--van-primary-color);
+      }
+    }
+  }
+
+  .send {
+    color: #aaa;
+    :global {
+      .van-cell__value {
+        color: #aaa;
+      }
+    }
+  }
+
+  .time {
+    font-weight: 600;
+    .clockO {
+      font-size: 15px;
+      font-weight: 600;
+      margin-right: 5px;
+    }
+  }
+
+  .messageContent {
+    font-size: 14px;
+    text-align: left;
+    color: #333;
+    line-height: 21px;
+    padding-bottom: 4px;
+  }
+}

+ 112 - 0
src/school/mass-message/index.tsx

@@ -0,0 +1,112 @@
+import OEmpty from '@/components/o-empty'
+import OHeader from '@/components/o-header'
+import OSearch from '@/components/o-search'
+import OSticky from '@/components/o-sticky'
+import request from '@/helpers/request'
+import { Cell, CellGroup, Icon, List, Tab, Tabs } from 'vant'
+import { defineComponent, reactive } from 'vue'
+import { useRouter } from 'vue-router'
+import styles from './index.module.less'
+
+export default defineComponent({
+  name: 'mass-message',
+  setup() {
+    const router = useRouter()
+    const state = reactive({
+      list: [],
+      dataShow: true, // 判断是否有数据
+      loading: false,
+      finished: false,
+      params: {
+        search: null,
+        page: 1,
+        rows: 10
+      }
+    })
+    const getList = async () => {
+      try {
+        // const res = await request.post(url, {
+        //   data: {
+        //     ...params
+        //   }
+        // })
+        // state.loading = false
+        // const result = res.data || {}
+        // 处理重复请求数据
+        // if (state.list.length > 0 && result.pageNo === 1) {
+        //   return
+        // }
+        // state.list = state.list.concat(result.rows || [])
+        // state.finished = result.pageNo >= result.totalPage
+        // state.params.page = result.pageNo + 1
+        // state.dataShow = state.list.length > 0
+      } catch {
+        // state.dataShow = false
+        // state.finished = true
+      }
+    }
+    return () => (
+      <div class={styles.massMessage}>
+        <OSticky position="top">
+          <OHeader border={false}>
+            {{
+              right: () => (
+                <span
+                  style="color: var(--van-primary-color)"
+                  onClick={() => {
+                    router.push('/create-message')
+                  }}
+                >
+                  消息群发
+                </span>
+              )
+            }}
+          </OHeader>
+          <Tabs lineWidth={18}>
+            <Tab title="待发送"></Tab>
+            <Tab title="已发送"></Tab>
+          </Tabs>
+
+          <OSearch
+            background="#f6f8f9"
+            inputBackground="white"
+            placeholder="请输入群聊/学员名称"
+            onSearch={(val: string) => {
+              console.log('val', val)
+            }}
+          />
+        </OSticky>
+
+        {state.dataShow ? (
+          <List
+            v-model:loading={state.loading}
+            finished={state.finished}
+            finishedText=" "
+            class={[styles.liveList]}
+            onLoad={getList}
+            immediateCheck={false}
+          >
+            <CellGroup inset>
+              <Cell class={styles.waitSend} titleStyle={{ flex: '1 auto' }}>
+                {{
+                  title: () => (
+                    <div class={styles.time}>
+                      <Icon name="clock-o" class={styles.clockO} />
+                      2022年10月31日 13:00:00
+                    </div>
+                  ),
+                  value: () => <span>待发送</span>
+                }}
+              </Cell>
+              <Cell valueClass={styles.messageContent}>
+                乐团今日的训练课程由于学校举办运动会延至明天进行,请同学们按时参加运动会,明天带好乐器下午三点准时到教室训练。最近天气转凉了,大家也记得多穿点衣服,不要冻感冒了。
+              </Cell>
+            </CellGroup>
+          </List>
+        ) : (
+          <OEmpty btnStatus={false} classImgSize="SMALL" tips="暂无群发消息" />
+        )}
+      </div>
+    )
+  }
+})

+ 42 - 0
src/school/orchestra/create-orchestra/index.tsx

@@ -0,0 +1,42 @@
+import OHeader from '@/components/o-header'
+import OSticky from '@/components/o-sticky'
+import { Button, Cell, CellGroup, Field } from 'vant'
+import { defineComponent } from 'vue'
+import styles from '../index.module.less'
+
+export default defineComponent({
+  name: 'create-orchestra',
+  setup() {
+    return () => (
+      <div class={styles['create-orchestra']}>
+        <OHeader />
+
+        <CellGroup inset>
+          <Field label="乐团名称" placeholder="请输入乐团名称" inputAlign="right" maxlength={30} />
+          <Field label="乐团声部" readonly placeholder="选择声部" isLink inputAlign="right" />
+
+          {[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 7, 8, 9, 10].map((item: any) => (
+            <Cell title="长笛" isLink>
+              {{
+                value: () => (
+                  <>
+                    已选 <span style={{ color: 'var(--van-primary-color)' }}>{item + 1}</span>
+                    名学生
+                  </>
+                )
+              }}
+            </Cell>
+          ))}
+        </CellGroup>
+
+        <OSticky position="bottom">
+          <div class={['btnGroup']}>
+            <Button type="primary" block round>
+              下一步
+            </Button>
+          </div>
+        </OSticky>
+      </div>
+    )
+  }
+})

+ 13 - 0
src/school/orchestra/index.module.less

@@ -0,0 +1,13 @@
+.searchBand {
+  // margin: 12px 13px;
+  font-size: 14px;
+  font-weight: 600;
+  color: #333333;
+}
+
+.create-orchestra {
+  --van-cell-group-inset-padding: 13px;
+  --van-cell-vertical-padding: 16px;
+  --van-cell-horizontal-padding: 12px;
+  --van-cell-font-size: 16px;
+}

+ 59 - 0
src/school/orchestra/index.tsx

@@ -0,0 +1,59 @@
+import OHeader from '@/components/o-header'
+import OSticky from '@/components/o-sticky'
+import { Icon, Popover } from 'vant'
+import { defineComponent, reactive } from 'vue'
+import { useRouter } from 'vue-router'
+import styles from './index.module.less'
+
+export default defineComponent({
+  name: 'my-orchestra',
+  setup() {
+    const router = useRouter()
+    const state = reactive({
+      showPopover: false,
+      actions: [
+        { text: '全部乐团', color: 'var(--van-primary-color)' },
+        { text: '交付团' },
+        { text: '晋升团' }
+      ]
+    })
+    return () => (
+      <>
+        <OSticky position="top">
+          <OHeader>
+            {{
+              right: () => (
+                <Icon
+                  name="plus"
+                  size={19}
+                  color="#333"
+                  onClick={() => {
+                    router.push('/create-orchestra')
+                  }}
+                />
+              )
+            }}
+          </OHeader>
+          <div style={{ padding: '12px 13px', background: '#F8F8F8' }}>
+            <Popover
+              v-model:show={state.showPopover}
+              actions={state.actions}
+              showArrow={false}
+              placement="bottom-start"
+              offset={[0, 12]}
+            >
+              {{
+                reference: () => (
+                  <div class={styles.searchBand}>
+                    全部乐团 <Icon name={state.showPopover ? 'arrow-up' : 'arrow-down'} />
+                  </div>
+                )
+              }}
+            </Popover>
+          </div>
+        </OSticky>
+        乐园列表
+      </>
+    )
+  }
+})

+ 6 - 1
src/state.ts

@@ -10,7 +10,12 @@ export const state = reactive({
     data: {} as any
   },
   platformType: '' as 'STUDENT' | 'TEACHER' | 'SCHOOL',
-  platformApi: '/api-student' as '/api-student' | '/api-teacher' | '/api-manage',
+  clientId: {
+    STUDENT: 'jmedu-student',
+    TEACHER: 'jmedu-teacher',
+    SCHOOL: 'jmedu-school'
+  },
+  platformApi: '/api-student' as '/api-student' | '/api-teacher' | '/api-school',
   version: '', // 版本号 例如: 1.0.0
   ossUploadUrl: 'https://ks3-cn-beijing.ksyuncs.com/',
   musicCertStatus: false as boolean, // 是否音乐认证

+ 1 - 1
src/student/main.ts

@@ -2,7 +2,7 @@ import { createApp } from 'vue'
 import App from './App.vue'
 import router from '../router/index'
 // import { postMessage } from '@/helpers/native-message'
-
+import 'vant/lib/index.css';
 import 'normalize.css'
 
 import '../styles/index.less'

+ 5 - 2
src/styles/index.less

@@ -14,8 +14,9 @@
   --van-gray-8: #333;
   // --van-red: #ee0a24;
   // --van-blue: #1989fa;
-  --van-primary: #2dc7aa !important;
-  --van-picker-confirm-action-color: #2dc7aa !important;
+  --van-primary: #ff8057 !important;
+  --van-picker-confirm-action-color: #ff8057 !important;
+  --van-primary-text: #f67146 !important;
   // --van-orange: #ff976a;
   // --van-orange-dark: #ed6a0c;
   // --van-orange-light: #fffbe8;
@@ -77,6 +78,7 @@
   // --van-border-radius-md: 4px;
   // --van-border-radius-lg: 8px;
   // --van-border-radius-max: 999px;
+  --van-cell-group-inset-padding: 0 13px;
 
   --van-tag-default-color: #f8f8f8 !important;
   --van-tag-text-default-color: #c0c0c0;
@@ -106,6 +108,7 @@
   -moz-osx-font-smoothing: grayscale;
   color: #2c3e50;
   min-height: 100vh;
+  font-family: PingFangSC-Medium, PingFang SC;
 }
 
 body {

+ 2 - 2
src/teacher/main.ts

@@ -4,7 +4,7 @@ import router from '../router/index'
 import { postMessage } from '@/helpers/native-message'
 
 import 'normalize.css'
-
+import 'vant/lib/index.css';
 import '../styles/index.less'
 import { state } from '@/state'
 import { browser } from '@/helpers/utils'
@@ -48,7 +48,7 @@ if (browser().isTeacher || paymentType === 'TEACHER') {
 if (state.platformType === 'TEACHER') {
   state.platformApi = '/api-teacher'
 } else if (state.platformType === 'SCHOOL') {
-  state.platformApi = '/api-manage'
+  state.platformApi = '/api-school'
 } else {
   state.platformApi = '/api-student'
 }

+ 5 - 3
src/views/layout/auth.tsx

@@ -44,13 +44,15 @@ export default defineComponent({
       if (state.user.status === 'init' || state.user.status === 'error') {
         this.loading = true
         try {
-          const res = await request.get('/api-student/student/queryUserInfo', {
-            initRequest: true // 初始化接口
+          const res = await request.get(state.platformApi + '/appLoginUser/getUserInfo', {
+            initRequest: true, // 初始化接口
+            requestType: 'form'
           })
           setLogin(res.data)
         } catch (e: any) {
+          console.log(e, 'e')
           const message = e.message
-          if (message.indexOf('403') === -1 && message.indexOf('authentication') === -1) {
+          if (message.indexOf('5000') === -1 && message.indexOf('authentication') === -1) {
             setLoginError()
           } else {
             setLogout()

BIN
src/views/layout/images/bottom_bg.png


BIN
src/views/layout/images/top_bg.png


+ 2 - 3
src/views/layout/login.module.less

@@ -1,7 +1,6 @@
 .login {
   min-height: 100vh;
-  background: url('./images/top_bg.png') no-repeat top center,
-    url('./images/bottom_bg.png') no-repeat bottom center;
+  background: url('./images/top_bg.png') no-repeat top center;
   background-color: #fff;
   background-size: 100%;
 
@@ -15,7 +14,7 @@
   }
 
   .codeText {
-    color: var(--van-primary);
+    color: var(--van-primary-text);
   }
 
   .margin34 {

+ 38 - 28
src/views/layout/login.tsx

@@ -18,7 +18,7 @@ export default defineComponent({
       smsCode: '',
       countDownStatus: true, // 是否发送验证码
       countDownTime: 1000 * 120, // 倒计时时间
-      countDownRef: null as any, // 倒计时实例
+      // countDownRef: null as any, // 倒计时实例
       imgCodeStatus: false
     }
   },
@@ -31,6 +31,14 @@ export default defineComponent({
         this.username && this.smsCode && (status = false)
       }
       return status
+    },
+    appName() {
+      const template = {
+        STUDENT: '学生端',
+        TEACHER: '老师端',
+        SCHOOL: '管理端'
+      }
+      return template[state.platformType]
     }
   },
   mounted() {
@@ -51,39 +59,39 @@ export default defineComponent({
     },
     async onLogin() {
       try {
-        let res: any
+        // let res: any
+        const forms: any = {
+          username: this.username,
+          client_id: state.clientId[state.platformType],
+          client_secret: state.clientId[state.platformType]
+        }
         if (this.loginType === 'PWD') {
-          res = await request.post('/api-auth/usernameLogin', {
-            requestType: 'form',
-            data: {
-              username: this.username,
-              password: this.password,
-              clientId: 'student',
-              clientSecret: 'student'
-            }
-          })
+          forms.password = this.password
+          forms.loginType = 'PASSWORD'
+          forms.grant_type = 'PASSWORD'
         } else {
-          res = await request.post('/api-auth/smsLogin', {
-            requestType: 'form',
-            data: {
-              clientId: 'student',
-              clientSecret: 'student',
-              phone: this.username,
-              smsCode: this.smsCode
-            }
-          })
+          forms.password = this.smsCode
+          forms.loginType = 'SMS'
+          forms.grant_type = 'SMS'
         }
+        const { data } = await request.post('/api-oauth/userlogin', {
+          requestType: 'form',
+          data: {
+            ...forms
+          }
+        })
 
-        const { authentication } = res.data
-        setAuth(authentication.token_type + ' ' + authentication.access_token)
+        setAuth(data.token_type + ' ' + data.access_token)
 
-        let userCash = await request.get('/api-student/student/queryUserInfo', {
+        const userCash = await request.get(state.platformApi + '/appLoginUser/getUserInfo', {
           initRequest: true // 初始化接口
         })
         setLogin(userCash.data)
 
         this.directNext()
-      } catch {}
+      } catch {
+        //
+      }
     },
     async onSendCode() {
       // 发送验证码
@@ -94,11 +102,13 @@ export default defineComponent({
     },
     onCodeSend() {
       this.countDownStatus = false
-      this.countDownRef.start()
+      this.$nextTick(() => {
+        ;(this.$refs.countDownRef as any).start()
+      })
     },
     onFinished() {
       this.countDownStatus = true
-      this.countDownRef.reset()
+      ;(this.$refs.countDownRef as any).reset()
     },
     onChange() {
       if (this.loginType === 'PWD') {
@@ -113,7 +123,7 @@ export default defineComponent({
       <div class={styles.login}>
         <div class={styles.loginTitle}>
           您好,
-          <br /> 欢迎使用酷乐秀
+          <br /> 欢迎使用管乐团{this.appName}
         </div>
         <CellGroup class={styles.margin34} border={false}>
           <Row style={{ marginBottom: '16px' }}>
@@ -166,7 +176,7 @@ export default defineComponent({
                         </span>
                       ) : (
                         <CountDown
-                          ref={this.countDownRef}
+                          ref="countDownRef"
                           auto-start={false}
                           time={this.countDownTime}
                           onFinish={this.onFinished}

+ 14 - 14
vite.config.ts

@@ -12,10 +12,10 @@ function resolve(dir: string) {
 // https://vitejs.dev/config/
 // https://github.com/vitejs/vite/issues/1930 .env
 // const proxyUrl = 'https://mstutest.dayaedu.com/';
-const proxyUrl = 'https://dev.colexiu.com/'
+const proxyUrl = 'http://47.98.131.38:8989/'
 // const proxyUrl = 'http://192.168.3.143:8000/'
 export default defineConfig({
-  base: './',
+  base: '/',
   plugins: [
     vue(),
     vueJsx(),
@@ -23,15 +23,15 @@ export default defineConfig({
       targets: ['> 0.25%, not dead'],
       ignoreBrowserslistConfig: true
     }),
-    styleImport({
-      libs: [
-        {
-          libraryName: 'vant',
-          esModule: true,
-          resolveStyle: name => `vant/es/${name}/style`
-        }
-      ]
-    })
+    // styleImport({
+    //   libs: [
+    //     {
+    //       libraryName: 'vant',
+    //       esModule: true,
+    //       resolveStyle: name => `../../vant/es/${name}/style`
+    //     }
+    //   ]
+    // })
   ],
   resolve: {
     alias: {
@@ -48,11 +48,11 @@ export default defineConfig({
     strictPort: true,
     cors: true,
     proxy: {
-      '/api-auth': {
+      '/api-oauth': {
         target: proxyUrl,
         changeOrigin: true
       },
-      '/api-student': {
+      '/api-school': {
         target: proxyUrl,
         changeOrigin: true
       },
@@ -67,7 +67,7 @@ export default defineConfig({
       input: {
         index: resolve('index.html'),
         teacher: resolve('teacher.html'),
-        manage: resolve('manage.html')
+        school: resolve('school.html')
       }
     },
     // target: 'es2015',