Browse Source

修改bug

lex 2 years ago
parent
commit
772f7caf1c

+ 1 - 1
public/project/companionTeacher.html

@@ -137,7 +137,7 @@
         <div class="submit-container">
           <p class="submit-title">恭喜您已成功登记为</p>
           <p class="submit-o">{{ decodeURI(name) }} <span>【伴学老师】</span></p>
-          <p class="submit-tips">请下载管乐团管理端APP进行授课</p>
+          <p class="submit-tips">请下载管乐团老师端APP进行授课</p>
           <van-button type="primary" color="#FF8057" block round @click="submitStatus = false">立即下载</van-button>
         </div>
       </div>

+ 3 - 1
public/project/schoolRegister.html

@@ -86,7 +86,8 @@
           </template>
         </van-field>
 
-        <van-field required label="邮箱地址" v-model="forms.email" :rules="[{ required: true, message: '请输入学校邮箱地址' }]"
+        <van-field required label="邮箱地址" v-model="forms.email"
+          :rules="[{ required: true, message: '请输入学校邮箱地址' }, { pattern: emailPattern, message: '输入邮箱地址有误' }]"
           name="email" placeholder="请输入学校邮箱地址">
         </van-field>
       </van-cell-group>
@@ -167,6 +168,7 @@
           showPicker: false,
           submitStatus: false,
           pattern: /^1(3|4|5|6|7|8|9)\d{9}$/,
+          emailPattern: /^\w+@([\da-z\.-]+)\.([a-z]+|[\u2E80-\u9FFF]+)$/,
           columns: [],
           pickerType: null, // 下拉类型
           forms: {

+ 14 - 7
src/components/o-header/index.tsx

@@ -49,6 +49,11 @@ export default defineComponent({
       // 头部高度设置后返回
       type: Function,
       default: () => {}
+    },
+    desotry: {
+      // 用于组件销毁时,是否重置原生头部样式
+      type: Boolean,
+      default: true
     }
   },
   watch: {
@@ -74,13 +79,15 @@ export default defineComponent({
     })
   },
   unmounted() {
-    // 设置是否显示导航栏 0 显示 1 不显示
-    postMessage({ api: 'setBarStatus', content: { status: 1 } })
-    // 设置返回按钮颜色
-    postMessage({
-      api: 'backIconChange',
-      content: { iconStyle: 'black' as backIconColor }
-    })
+    if (this.desotry) {
+      // 设置是否显示导航栏 0 显示 1 不显示
+      postMessage({ api: 'setBarStatus', content: { status: 1 } })
+      // 设置返回按钮颜色
+      postMessage({
+        api: 'backIconChange',
+        content: { iconStyle: 'black' as backIconColor }
+      })
+    }
   },
   methods: {
     navBarInit(callBack?: Function) {

+ 1 - 1
src/school/manage-teacher/menu-function.tsx

@@ -97,7 +97,7 @@ export default defineComponent({
     })
     return () => (
       <div class={styles.menuFunction}>
-        <OHeader />
+        <OHeader desotry={false} />
 
         <div class={styles.menuContent}>
           <h2>全部功能</h2>

+ 1 - 0
src/school/orchestra/compontent/photo.tsx

@@ -44,6 +44,7 @@ export default defineComponent({
         setTimeout(() => {
           showToast('添加成功')
           state.status = false
+          state.photoName = null
         }, 100)
         setTimeout(() => {
           state.params.page = 1

+ 1 - 1
src/school/orchestra/modal/student-list.tsx

@@ -158,7 +158,7 @@ export default defineComponent({
 
     onMounted(() => {
       // 判断年级
-      if (baseState.user.data.school.schoolSystem === 'sixYearSystem') {
+      if (baseState.user.data.school?.schoolSystem === 'sixYearSystem') {
         state.classList.push({ text: '六年级', value: 6 })
       }
 

+ 1 - 1
src/school/train-planning/modal/calendar/index.tsx

@@ -151,7 +151,7 @@ export default defineComponent({
   render() {
     return (
       <div class={styles.calendarContainer}>
-        <OHeader title="训练日期" border={false} background="transparent" />
+        <OHeader title="训练日期" border={false} background="transparent" desotry={false} />
         <Calendar
           class={styles.calendar}
           showTitle={false}

+ 1 - 1
src/school/train-planning/modal/class-list/index.tsx

@@ -75,7 +75,7 @@ export default defineComponent({
     })
     return () => (
       <div class={styles.classList}>
-        <OHeader title="指定伴学老师" />
+        <OHeader title="指定伴学老师" desotry={false} />
 
         {state.list.map((item: any) => (
           <Cell

+ 1 - 1
src/school/train-planning/modal/practice-class/index.tsx

@@ -124,7 +124,7 @@ export default defineComponent({
     return () => (
       <div class={styles.practiceClass}>
         <OSticky position="top">
-          <OHeader title="选择班级" />
+          <OHeader title="选择班级" desotry={false} />
           <div style={{ padding: '12px 13px', background: '#f6f6f6' }}>
             <div class={styles.searchBand} onClick={() => (forms.showPopover = true)}>
               {forms.orchestraName} <Icon name={forms.showPopover ? 'arrow-up' : 'arrow-down'} />

+ 1 - 1
src/school/train-planning/modal/timer/index.tsx

@@ -174,7 +174,7 @@ export default defineComponent({
     })
     return () => (
       <div class={styles.timer}>
-        <OHeader title="训练时间" />
+        <OHeader title="训练时间" desotry={false} />
 
         <div class={styles.selectTimer}>{dayjs(state.calendarDate).format('YYYY年MM月DD日')}</div>
 

+ 4 - 2
src/student/music-group/pre-apply/component/addres.tsx

@@ -1,9 +1,10 @@
 import { Cell, Icon } from 'vant'
-import { defineComponent, computed, PropType } from 'vue'
+import { defineComponent, computed, PropType, reactive, onMounted } from 'vue'
 import styles from './address.module.less'
 import iconAddress from '@common/images/icon-address.png'
 import { postMessage } from '@/helpers/native-message'
 import { useRouter } from 'vue-router'
+import request from '../../request-music'
 
 export default defineComponent({
   name: 'cart-address',
@@ -23,6 +24,7 @@ export default defineComponent({
   },
   setup(props) {
     const router = useRouter()
+
     const addressInfo = computed(() => {
       return [
         props.item.province,
@@ -34,7 +36,7 @@ export default defineComponent({
 
     const selectAddress = () => {
       if (!props.isLink) return
-      router.push('/')
+      router.push('/shopAddress')
     }
 
     return () => (

+ 0 - 22
src/student/music-group/pre-apply/order-detail.tsx

@@ -118,19 +118,6 @@ export default defineComponent({
             }}
             onConfirm={(val: any) => {
               const config: any = route.query.config ? JSON.parse(route.query.config as any) : {}
-              // let a = {
-              //   paymentChannel: null,
-              //   merOrderNo: '1607581937480556546',
-              //   subject: '华为+HUAWEI+P20+1,JM测试数据511,乐器保养',
-              //   body: '华为+HUAWEI+P20+1,JM测试数据511,乐器保养',
-              //   addition: null,
-              //   price: 3798,
-              //   bankType: null,
-              //   code: null,
-              //   expirationTime: '2022-12-27+12:09:36',
-              //   wxAppId: 'wx8654c671631cfade',
-              //   userId: null
-              // }
               if (val.payCode === 'payResult') {
                 router.push({
                   path: '/payResult',
@@ -142,15 +129,6 @@ export default defineComponent({
                   }
                 })
               } else {
-                // router.push({
-                //   path: '/payCenter',
-                //   query: {
-                //     pay_channel: val.pay_channel,
-                //     wxAppId: config.wxAppId,
-                //     body: config.body,
-                //     price: config.price
-                //   }
-                // })
                 console.log(baseState.user)
                 state.qrCodeUrl =
                   window.location.origin +

+ 83 - 7
src/student/music-group/shop-address/address-operation.tsx

@@ -1,26 +1,59 @@
 import OSticky from '@/components/o-sticky'
-import { Button, Cell, CellGroup, Field, Switch } from 'vant'
+import { Button, Cell, CellGroup, Field, Picker, Popup, Switch } from 'vant'
 import { defineComponent, reactive } from 'vue'
+import request from '../request-music'
 import styles from './index.module.less'
+import { areas } from '@/helpers/area'
 
 export default defineComponent({
   name: 'address-operation',
   setup() {
     const state = reactive({
-      checked: false
+      showPicker: false,
+      defaultStatus: false,
+      phoneNumber: null,
+      province: null,
+      city: null,
+      region: null,
+      pcrStr: '',
+      name: null,
+      detailAddress: null
     })
+
+    const onSubmit = async () => {
+      try {
+        await request.post('/api-student/userReceiveAddress/save', {
+          data: {}
+        })
+      } catch {}
+    }
     return () => (
       <div class={styles.operation}>
         <CellGroup inset class={styles.form}>
-          <Field label="收货人" placeholder="请输入收货人姓名" />
-          <Field label="手机号" placeholder="请输入收货人人手机号" />
-          <Field label="所在地区" placeholder="省、市、区、街道" readonly isLink />
-          <Field label="详细地址" placeholder="小区楼栋/乡村名称" type="textarea" rows={3} />
+          <Field label="收货人" placeholder="请输入收货人姓名" v-model={state.name} />
+          <Field label="手机号" placeholder="请输入收货人人手机号" v-model={state.phoneNumber} />
+          <Field
+            label="所在地区"
+            placeholder="省、市、区、街道"
+            readonly
+            isLink
+            modelValue={state.pcrStr}
+            onClick={() => {
+              state.showPicker = true
+            }}
+          />
+          <Field
+            label="详细地址"
+            placeholder="小区楼栋/乡村名称"
+            type="textarea"
+            rows={3}
+            v-model={state.detailAddress}
+          />
         </CellGroup>
 
         <CellGroup inset style={{ marginTop: '12px' }}>
           <Cell title="设置为默认地址" center class={styles.default}>
-            {{ value: () => <Switch v-model={state.checked} size="23px" /> }}
+            {{ value: () => <Switch v-model={state.defaultStatus} size="23px" /> }}
           </Cell>
         </CellGroup>
 
@@ -31,6 +64,49 @@ export default defineComponent({
             </Button>
           </div>
         </OSticky>
+
+        <Popup v-model:show={state.showPicker} position="bottom" round>
+          <Picker
+            showToolbar
+            columns={areas}
+            columnsFieldNames={{ text: 'name', value: 'code', children: 'areas' }}
+            onCancel={() => (state.showPicker = false)}
+            onConfirm={(val: any) => {
+              console.log(val, 'val')
+              const selectedOptions = val.selectedOptions || []
+              // 因为有的只
+              if (selectedOptions.length === 2) {
+                selectedOptions.forEach((item: any, index: number) => {
+                  state.pcrStr += item.name
+                  if (index === 0) {
+                    state.province = item.id
+                  } else if (index === 1) {
+                    state.city = item.id
+                  }
+                })
+              } else {
+                selectedOptions.forEach((item: any, index: number) => {
+                  state.pcrStr += item.name
+                  if (index === 0) {
+                    state.province = item.id
+                  } else if (index === 1) {
+                    state.city = item.id
+                  } else if (index === 2) {
+                    state.region = item.id
+                  }
+                })
+              }
+
+              state.showPicker = false
+            }}
+          />
+        </Popup>
+
+        {/* 
+        <van-popup v-model:show="showPicker" position="bottom" round>
+      <van-picker show-toolbar :columns="columns" @cancel="showPicker = false" @confirm="onConfirm"
+        :columns-field-names="{ text: 'name', value: 'code', children: 'areas' }" />
+    </van-popup> */}
       </div>
     )
   }

+ 1 - 0
src/student/music-group/shop-address/index.module.less

@@ -59,6 +59,7 @@
   :global {
     .van-cell {
       font-size: 16px;
+      padding: 18px 12px;
     }
   }
 

+ 101 - 32
src/student/music-group/shop-address/index.tsx

@@ -1,12 +1,29 @@
-import { Button, Cell, SwipeCell, Tag, Image, Icon, showConfirmDialog } from 'vant'
-import { defineComponent } from 'vue'
+import { Button, Cell, SwipeCell, Tag, Image, Icon, showConfirmDialog, List } from 'vant'
+import { defineComponent, onMounted, reactive } from 'vue'
 import styles from './index.module.less'
 import iconEdit from '../pre-apply/images/icon-edit.png'
 import OSticky from '@/components/o-sticky'
+import request from '../request-music'
+import OEmpty from '@/components/o-empty'
+import { useRouter } from 'vue-router'
 
 export default defineComponent({
   name: 'shop-address',
   setup() {
+    const router = useRouter()
+    const form = reactive({
+      isClick: false,
+      list: [] as any,
+      listState: {
+        dataShow: true, // 判断是否有数据
+        loading: false,
+        finished: false
+      },
+      params: {
+        page: 1,
+        rows: 20
+      }
+    })
     const onBeforeClose = ({ position }: any) => {
       if (position === 'right') {
         showConfirmDialog({
@@ -18,40 +35,92 @@ export default defineComponent({
         return true
       }
     }
+
+    // api-student/userReceiveAddress/page
+    const getList = async () => {
+      try {
+        if (form.isClick) return
+        form.isClick = true
+        const res = await request.post('/api-student/userReceiveAddress/page', {
+          data: {
+            ...form.params
+          }
+        })
+        form.listState.loading = false
+        const result = res.data || {}
+        // 处理重复请求数据
+        if (form.list.length > 0 && result.current === 1) {
+          return
+        }
+        form.list = form.list.concat(result.rows || [])
+        form.listState.finished = result.current >= result.pages
+        form.params.page = result.current + 1
+        form.listState.dataShow = form.list.length > 0
+        form.isClick = false
+      } catch {
+        form.listState.dataShow = false
+        form.listState.finished = true
+        form.isClick = false
+      }
+    }
+
+    onMounted(() => {
+      getList()
+      console.log('1111')
+    })
     return () => (
       <div class={styles.shopAddress}>
-        {[1, 2, 3, 4, 5].map((item: any) => (
-          <SwipeCell class={styles.swipeCell} beforeClose={onBeforeClose}>
-            {{
-              default: () => (
-                <Cell center>
-                  {{
-                    title: () => (
-                      <div class={styles.title}>
-                        <span class={styles.name}>小林林</span>
-                        <span class={styles.phone}>15353535353</span>
-                        <Tag round color="#FF8057">
-                          默认
-                        </Tag>
-                      </div>
-                    ),
-                    label: () => (
-                      <div class={styles.content}>
-                        湖北省武汉市武昌区水果湖街街道楚河汉街总部国际A座3801
-                      </div>
-                    ),
-                    'right-icon': () => <Icon name={iconEdit} size="18" />
-                  }}
-                </Cell>
-              ),
-              right: () => <Button type="danger">删除</Button>
-            }}
-          </SwipeCell>
-        ))}
-
+        {form.listState.dataShow ? (
+          <List
+            v-model:loading={form.listState.loading}
+            finished={form.listState.finished}
+            finishedText=" "
+            class={[styles.liveList]}
+            onLoad={getList}
+            immediateCheck={false}
+          >
+            {form.list.map((item: any) => (
+              <SwipeCell class={styles.swipeCell} beforeClose={onBeforeClose}>
+                {{
+                  default: () => (
+                    <Cell center>
+                      {{
+                        title: () => (
+                          <div class={styles.title}>
+                            <span class={styles.name}>小林林</span>
+                            <span class={styles.phone}>15353535353</span>
+                            <Tag round color="#FF8057">
+                              默认
+                            </Tag>
+                          </div>
+                        ),
+                        label: () => (
+                          <div class={styles.content}>
+                            湖北省武汉市武昌区水果湖街街道楚河汉街总部国际A座3801
+                          </div>
+                        ),
+                        'right-icon': () => <Icon name={iconEdit} size="18" />
+                      }}
+                    </Cell>
+                  ),
+                  right: () => <Button type="danger">删除</Button>
+                }}
+              </SwipeCell>
+            ))}
+          </List>
+        ) : (
+          <OEmpty btnStatus={false} classImgSize="SMALL" tips="暂无收货地址" />
+        )}
         <OSticky position="bottom">
           <div class={'btnGroup'}>
-            <Button type="primary" round block>
+            <Button
+              type="primary"
+              round
+              block
+              onClick={() => {
+                router.push('addressOperation')
+              }}
+            >
               新建收货地址
             </Button>
           </div>

+ 2 - 2
vite.config.ts

@@ -12,8 +12,8 @@ function resolve(dir: string) {
 // https://vitejs.dev/config/
 // https://github.com/vitejs/vite/issues/1930 .env
 // const proxyUrl = 'https://mstutest.dayaedu.com/';
-// const proxyUrl = 'http://47.98.131.38:8989/'
-const proxyUrl = 'http://192.168.3.143:8989/' // 尚科
+const proxyUrl = 'http://47.98.131.38:8989/'
+// const proxyUrl = 'http://192.168.3.143:8989/' // 尚科
 // const proxyUrl = 'http://192.168.3.26:8989/' // 刘俊驰
 export default defineConfig({
   base: './',