Ver código fonte

feat:新增举报盗版

zhubo@luojigou.vip 3 anos atrás
pai
commit
726b826644

+ 64 - 48
project.config.json

@@ -1,52 +1,68 @@
 {
-  "miniprogramRoot": "dist/",
-  "projectname": "agent-auth-react",
-  "description": "",
-  "appid": "wxa2a88149778755c4",
-  "setting": {
-    "urlCheck": false,
-    "es6": false,
-    "enhance": false,
-    "postcss": true,
-    "preloadBackgroundData": false,
-    "minified": true,
-    "newFeature": true,
-    "coverView": true,
-    "nodeModules": false,
-    "autoAudits": false,
-    "showShadowRootInWxmlPanel": false,
-    "scopeDataCheck": false,
-    "uglifyFileName": false,
-    "checkInvalidKey": true,
-    "checkSiteMap": true,
-    "uploadWithSourceMap": true,
-    "compileHotReLoad": false,
-    "useMultiFrameRuntime": true,
-    "useApiHook": true,
-    "useApiHostProcess": true,
-    "babelSetting": {
-      "ignore": [],
-      "disablePlugins": [],
-      "outputPath": ""
+    "miniprogramRoot": "dist/",
+    "projectname": "agent-auth-react",
+    "description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
+    "appid": "wxa2a88149778755c4",
+    "setting": {
+        "urlCheck": false,
+        "es6": false,
+        "enhance": false,
+        "postcss": true,
+        "preloadBackgroundData": false,
+        "minified": true,
+        "newFeature": true,
+        "coverView": true,
+        "nodeModules": false,
+        "autoAudits": false,
+        "showShadowRootInWxmlPanel": false,
+        "scopeDataCheck": false,
+        "uglifyFileName": false,
+        "checkInvalidKey": true,
+        "checkSiteMap": true,
+        "uploadWithSourceMap": true,
+        "compileHotReLoad": false,
+        "useMultiFrameRuntime": true,
+        "useApiHook": true,
+        "useApiHostProcess": true,
+        "babelSetting": {
+            "ignore": [],
+            "disablePlugins": [],
+            "outputPath": ""
+        },
+        "enableEngineNative": false,
+        "useIsolateContext": true,
+        "useCompilerModule": false,
+        "userConfirmedUseCompilerModuleSwitch": false,
+        "userConfirmedBundleSwitch": false,
+        "packNpmManually": false,
+        "packNpmRelationList": [],
+        "minifyWXSS": true,
+        "lazyloadPlaceholderEnable": false,
+        "useStaticServer": true,
+        "showES6CompileOption": false,
+        "disableUseStrict": false,
+        "useCompilerPlugins": false,
+        "minifyWXML": true
     },
-    "enableEngineNative": false,
-    "useIsolateContext": true,
-    "useCompilerModule": false,
-    "userConfirmedUseCompilerModuleSwitch": false,
-    "userConfirmedBundleSwitch": false,
-    "packNpmManually": false,
-    "packNpmRelationList": [],
-    "minifyWXSS": true
-  },
-  "compileType": "miniprogram",
-  "simulatorType": "wechat",
-  "simulatorPluginLibVersion": {},
-  "compilerOptions": {
-    "paths": {
-      "@": [
-        "./src"
-      ]
+    "compileType": "miniprogram",
+    "simulatorType": "wechat",
+    "simulatorPluginLibVersion": {},
+    "compilerOptions": {
+        "paths": {
+            "@": [
+                "./src"
+            ]
+        }
+    },
+    "condition": {},
+    "libVersion": "2.24.5",
+    "srcMiniprogramRoot": "dist/",
+    "packOptions": {
+        "ignore": [],
+        "include": []
+    },
+    "editorSetting": {
+        "tabIndent": "insertSpaces",
+        "tabSize": 4
     }
-  },
-  "condition": {}
 }

+ 80 - 50
project.private.config.json

@@ -1,54 +1,84 @@
 {
-  "setting": {},
-  "condition": {
-    "plugin": {
-      "list": []
+    "setting": {
+        "compileHotReLoad": true
     },
-    "game": {
-      "list": []
-    },
-    "gamePlugin": {
-      "list": []
-    },
-    "miniprogram": {
-      "list": [
-        {
-          "name": "pages/AuthOpra/index",
-          "pathName": "pages/AuthOpra/index",
-          "query": "type=0&__key_=16258148111122",
-          "scene": null
-        },
-        {
-          "name": "pages/AuthQuery/index",
-          "pathName": "pages/AuthQuery/index",
-          "query": "__key_=16260581158361",
-          "scene": null
-        },
-        {
-          "name": "pages/AuthOpra/index",
-          "pathName": "pages/AuthOpra/index",
-          "query": "type=1&__key_=16260702285962",
-          "scene": null
-        },
-        {
-          "name": "pages/AuthQuery/index",
-          "pathName": "pages/AuthQuery/index",
-          "query": "__key_=16273498749021",
-          "scene": null
-        },
-        {
-          "name": "pages/ScanResult/index",
-          "pathName": "pages/ScanResult/index",
-          "query": "__key_=16273582146504",
-          "scene": null
-        },
-        {
-          "name": "pages/AuthOpra/index",
-          "pathName": "pages/AuthOpra/index",
-          "query": "type=1&No=GT&__key_=16297091822202",
-          "scene": null
+    "condition": {
+        "miniprogram": {
+            "list": [
+                {
+                    "name": "pages/AuthOpra/index",
+                    "pathName": "pages/AuthOpra/index",
+                    "query": "type=0&__key_=16258148111122",
+                    "scene": null
+                },
+                {
+                    "name": "pages/AuthQuery/index",
+                    "pathName": "pages/AuthQuery/index",
+                    "query": "__key_=16260581158361",
+                    "scene": null
+                },
+                {
+                    "name": "pages/AuthOpra/index",
+                    "pathName": "pages/AuthOpra/index",
+                    "query": "type=1&__key_=16260702285962",
+                    "scene": null
+                },
+                {
+                    "name": "pages/AuthQuery/index",
+                    "pathName": "pages/AuthQuery/index",
+                    "query": "__key_=16273498749021",
+                    "scene": null
+                },
+                {
+                    "name": "pages/ScanResult/index",
+                    "pathName": "pages/ScanResult/index",
+                    "query": "__key_=16273582146504",
+                    "scene": null
+                },
+                {
+                    "name": "pages/AuthOpra/index",
+                    "pathName": "pages/AuthOpra/index",
+                    "query": "type=1&No=GT&__key_=16297091822202",
+                    "scene": null
+                },
+                {
+                    "name": "",
+                    "pathName": "pages/ReportPiracy/index",
+                    "query": "__key_=16545838316651",
+                    "launchMode": "default",
+                    "scene": null
+                },
+                {
+                    "name": "",
+                    "pathName": "pages/ReportPiracy/index",
+                    "query": "__key_=16545838316651",
+                    "launchMode": "default",
+                    "scene": null
+                },
+                {
+                    "name": "",
+                    "pathName": "pages/ReportPiracy/index",
+                    "query": "__key_=16546531765031",
+                    "launchMode": "default",
+                    "scene": null
+                },
+                {
+                    "name": "",
+                    "pathName": "pages/ReportPiracy/index",
+                    "query": "__key_=16546557954711",
+                    "launchMode": "default",
+                    "scene": null
+                },
+                {
+                    "name": "",
+                    "pathName": "pages/ReportPiracy/index",
+                    "query": "__key_=16546730551821",
+                    "launchMode": "default",
+                    "scene": null
+                }
+            ]
         }
-      ]
-    }
-  }
+    },
+    "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
+    "projectname": "xcx-verify"
 }

+ 24 - 0
src/api/report.ts

@@ -0,0 +1,24 @@
+import { request } from '../service/request'
+
+/**
+ * 提交举报信息
+ */
+
+type reportAddType = {
+  province: string,
+  city: string,
+  region: string,
+  address: string,
+  channel: string,
+  phone: string
+}
+
+export const addReport = (data: reportAddType) => {
+  return request({
+    url: `report/add`,
+    method: 'POST',
+    data
+  })
+}
+
+

+ 1 - 0
src/app.config.ts

@@ -10,6 +10,7 @@ export default {
     'pages/QueryRecord/index',
     'pages/ShopCate/index',
     'pages/AuthResult/index',
+    'pages/ReportPiracy/index',
   ],
   // "subpackages": [
   //   {

BIN
src/assets/ReportPiracy/close.png


BIN
src/assets/ReportPiracy/landline.png


BIN
src/assets/ReportPiracy/phone.png


BIN
src/assets/ReportPiracy/title.png


BIN
src/assets/home/home0.png


BIN
src/assets/home/home1.png


BIN
src/assets/home/home2.png


+ 61 - 61
src/pages/AuthQuery/index.tsx

@@ -15,79 +15,79 @@ import './index.scss'
 import bg from '../../assets/authQuery/auth-bg.png'
 import step from '../../assets/authQuery/three-step.png'
 
-const gridList = [{id: 0, No: 'GT'}, {id: 3, No: 'GX'}]
+const gridList = [{ id: 0, No: 'GT' }, { id: 3, No: 'GX' }]
 
 interface CustomerType {
-    id: number,
-    name: string,
-    
-    pId: number
+  id: number,
+  name: string,
+
+  pId: number
 }
 
 const CateGrid: React.FC = () => {
 
-    useEffect(() => {
-        GetQueryAllCustomerType()
-    }, [])
-
-    const [ customerType, setCustomerType ] = useState<CustomerType[]>([])
+  useEffect(() => {
+    GetQueryAllCustomerType()
+  }, [])
 
-    const goPage = (records ): void => {
-        let type:number
-        if (records.id === 0) {
-            type = customerType[0].id
-        } else {
-            type = customerType[1].id
-        }
-
-        Taro.navigateTo({
-             url: `/pages/AuthOpra/index?type=${type}&No=${records.No}`
-        });
+  const [customerType, setCustomerType] = useState<CustomerType[]>([])
 
+  const goPage = (records): void => {
+    let type: number
+    if (records.id === 0) {
+      type = customerType[0].id
+    } else {
+      type = customerType[1].id
     }
 
-    /**
-     * @description 获取产品分类
-     */
-
-    const GetQueryAllCustomerType = async () => {
-      const data =  await getQueryAllCustomerType()
-      console.log(data);
-      setCustomerType(data)
-    }
-
-    return (
-        <View className='CateGrid'>
-            { 
-                gridList.map((item, index) => (
-                    <Image 
-                      key={item.id} 
-                      className='gridImg' 
-                      src={require(`../../assets/authQuery/auth${item.id}.png`)}
-                      onClick={() => goPage(item)}
-                    />
-                ))
-            }
-        </View>
-    )
-} 
+    Taro.navigateTo({
+      url: `/pages/AuthOpra/index?type=${type}&No=${records.No}`
+    });
+
+  }
+
+  /**
+   * @description 获取产品分类
+   */
+
+  const GetQueryAllCustomerType = async () => {
+    const data = await getQueryAllCustomerType()
+    console.log(data);
+    setCustomerType(data)
+  }
+
+  return (
+    <View className='CateGrid'>
+      {
+        gridList.map((item, index) => (
+          <Image
+            key={item.id}
+            className='gridImg'
+            src={require(`../../assets/authQuery/auth${item.id}.png`)}
+            onClick={() => goPage(item)}
+          />
+        ))
+      }
+    </View>
+  )
+}
 
 
 const AuthQuery: React.FC = () => {
-    return (
-        <View className='AuthQuery'>
-            <NavBar 
-              fixed 
-              title='' 
-              icon={<AtIcon value='chevron-left' size='30rpx' color='#fff'  />
-            }
-            />
-            <Image className='AuthQuery-img' src={bg} />
-            <Image className='step'  src={step} mode='aspectFill' />
-            <CateGrid />
-        </View>
-        // <image src='https://img12.360buyimg.com/jdphoto/s72x72_jfs/t6160/14/2008729947/2754/7d512a86/595c3aeeNa89ddf71.png' ></image>
-    )
+  return (
+    <View className='AuthQuery'>
+      <NavBar
+        fixed
+        title=''
+        icon={<AtIcon value='chevron-left' size='30rpx' color='#fff' />
+        }
+      />
+      <Image className='AuthQuery-img' src={bg} />
+      <Image className='step' src={step} mode='aspectFill' />
+      <CateGrid />
+    </View>
+    // <image src='https://img12.360buyimg.com/jdphoto/s72x72_jfs/t6160/14/2008729947/2754/7d512a86/595c3aeeNa89ddf71.png' ></image>
+  )
 }
 
-export default AuthQuery
+export default AuthQuery

+ 15 - 0
src/pages/ReportPiracy/data.d.ts

@@ -0,0 +1,15 @@
+
+export type modalProps = {
+  visable: boolean,
+  closeModal: () => void
+}
+
+
+export type formProps = {
+  formData: any,
+  regionErr: boolean,
+  channelErr: boolean,
+  phoneErr: boolean,
+  changeForm: (key, value) => void
+  submit: () => void
+}

+ 3 - 0
src/pages/ReportPiracy/index.config.ts

@@ -0,0 +1,3 @@
+export default {
+  navigationBarTitleText: '举报盗版',
+}

+ 261 - 0
src/pages/ReportPiracy/index.scss

@@ -0,0 +1,261 @@
+@import "~taro-ui/dist/style/components/curtain.scss";
+
+
+.ReportPiracy {
+  width: 100vw;
+  min-height: 100vh;
+  background-color: #F5F6F8;
+  overflow: hidden;
+
+  .title {
+    margin: 50px auto 0;
+    display: block;
+    width: 606px;
+    height: 144px;
+  }
+
+  .ReportPiracyForm {
+    margin: 28px auto 0;
+    padding: 60px 0;
+    width: 686px;
+    background: #FFFFFF;
+    border-radius: 20px;
+    box-sizing: border-box;
+
+    .item {
+      display: flex;
+      align-items: center;
+      margin: 0 52px;
+
+      .label {
+        display: flex;
+        // align-items: center;
+        width: 220px;
+        height: 42px;
+        font-size: 30px;
+        font-family: PingFangSC-Medium, PingFang SC;
+        font-weight: 550;
+        color: #666666;
+        line-height: 42px;
+
+        .required {
+          line-height: 46px;
+          color: #FF2323;
+        }
+      }
+
+      .content {
+        input {
+          padding-left: 30px;
+          width: 362px;
+          height: 88px;
+          font-size: 28px;
+          font-family: PingFangSC-Regular, PingFang SC;
+          font-weight: 400;
+          color: #333;
+          background-color: #FFFFFF;
+          border-radius: 8px;
+          border: 2px solid rgba(2, 48, 149, 0.5);
+          box-sizing: border-box;
+        }
+
+        input::-webkit-input-placeholder {
+          font-size: 28px;
+          font-family: PingFangSC-Regular, PingFang SC;
+          font-weight: 400;
+          color: #999999;
+        }
+
+        .picker {
+          padding-left: 30px;
+          width: 362px;
+          height: 88px;
+          line-height: 88px;
+          font-size: 28px;
+          font-family: PingFangSC-Regular, PingFang SC;
+          font-weight: 400;
+          color: #333;
+          background-color: #FAFAFA;
+          border-radius: 8px;
+          box-sizing: border-box;
+        }
+
+        .placeholder {
+          font-size: 28px;
+          font-family: PingFangSC-Regular, PingFang SC;
+          font-weight: 400;
+          color: #999999;
+        }
+      }
+    }
+
+    .hint {
+      margin: 0 52px;
+      padding-left: 220px;
+      height: 38px;
+      font-size: 22px;
+      font-family: PingFangSC-Regular, PingFang SC;
+      font-weight: 400;
+      color: #FF2E2E;
+      line-height: 32px;
+    }
+
+    .address {
+      input {
+        margin: 0 auto 40px;
+        width: 582px;
+        height: 72px;
+        border-bottom: 2px solid #ddd;
+      }
+    }
+
+    .submitBtn {
+      margin: 42px auto 0;
+      width: 592px;
+      height: 108px;
+      line-height: 108px;
+      font-size: 34px;
+      font-family: PingFangSC-Medium, PingFang SC;
+      font-weight: 500;
+      color: #FFFFFF;
+      background-color: #002F95;
+      border-radius: 54px;
+      text-align: center;
+    }
+  }
+
+  .HotLine {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    margin: 24px auto;
+    width: 686px;
+    height: 172px;
+    background: #FFFFFF;
+    border-radius: 20px;
+
+    .name {
+      margin-left: 100px;
+      height: 44px;
+      font-size: 32px;
+      font-family: PingFangSC-Medium, PingFang SC;
+      font-weight: 550;
+      color: #333333;
+      line-height: 44px;
+    }
+
+    .tels {
+      margin-right: 144px;
+
+      .tel {
+        display: flex;
+        align-items: center;
+
+        .imgUrl {
+          margin-right: 20px;
+          width: 26px;
+          height: 26px;
+        }
+
+        .phone {
+          height: 38px;
+          font-size: 32px;
+          font-family: DINAlternate-Bold, DINAlternate;
+          font-weight: 550;
+          color: #023095;
+          line-height: 38px;
+        }
+      }
+
+      .tel + .tel {
+        margin-top: 12px;
+      }
+    }
+  }
+
+  .Remark {
+    margin: 0 auto;
+    width: 648px;
+    height: 88px;
+    font-size: 26px;
+    font-family: PingFangSC-Regular, PingFang SC;
+    font-weight: 400;
+    color: #999999;
+    line-height: 44px;
+    text-align: center;
+  }
+
+  .AtCurtain {
+    position: fixed;
+    top: 0;
+    left: 0;
+    z-index: 9;
+    width: 100vw;
+    height: 100vh;
+    background-color: rgba(0,0,0,0.7);
+
+    .model {
+      position: absolute;
+      top: 50%;
+      left: 50%;
+      width: 686px;
+      height: 502px;
+      background-color: #fff;
+      border-radius: 24px;
+      transform: translate(-50%, -50%);
+      box-sizing: border-box;
+      overflow: hidden;
+
+      .close {
+        position: absolute;
+        top: 40px;
+        right: 40px;
+        z-index: 99;
+        display: block;
+        width: 26px;
+        height: 26px;
+      }
+
+      .tip {
+        margin-top: 60px;
+        margin-bottom: 74px;
+        height: 52px;
+        font-size: 38px;
+        font-family: PingFangSC-Medium, PingFang SC;
+        font-weight: 550;
+        color: #333333;
+        line-height: 52px;
+        text-align: center;
+      }
+
+      .line {
+        margin-bottom: 12px;
+        height: 44px;
+        font-size: 32px;
+        font-family: PingFangSC-Regular, PingFang SC;
+        font-weight: 400;
+        color: #333333;
+        line-height: 44px;
+        text-align: center;
+      }
+
+      .secondLine {
+        margin-bottom: 60px;
+      }
+
+      .ok {
+        margin: 0 auto;
+        width: 264px;
+        height: 88px;
+        line-height: 88px;
+        font-size: 32px;
+        font-family: PingFangSC-Medium, PingFang SC;
+        font-weight: 500;
+        color: #FFFFFF;
+        background: #002F95;
+        border-radius: 84px;
+        text-align: center;
+      }
+    }
+  }
+}

+ 244 - 0
src/pages/ReportPiracy/index.tsx

@@ -0,0 +1,244 @@
+import React, { useState } from 'react'
+import { Picker, View, Image, Input } from '@tarojs/components'
+import Taro from '@tarojs/taro'
+import { AtCurtain } from 'taro-ui'
+import type { modalProps, formProps } from './data'
+import './index.scss'
+import { addReport } from '../../api/report'
+
+const channelList = ['园所', '网店', '柜台', '经销商', '其他']
+
+// 填写的表单
+const ReportPiracyForm: React.FC<formProps> = ({ formData, regionErr, channelErr, phoneErr, changeForm, submit }) => {
+
+  const [selectorChecked, setSelectorChecked] = useState<string>('')
+  const [region, setRegion] = useState<string>('')
+
+  // 修改渠道
+  const changeChannel = (e) => {
+    changeForm('channel', channelList[e.detail.value])
+    setSelectorChecked(channelList[e.detail.value])
+  }
+
+  // 修改详细地址
+  const changeAddress = (e) => {
+    changeForm('address', e.detail.value)
+  }
+
+  // 修改手机号
+  const changePhone = (e) => {
+    changeForm('phone', e.detail.value)
+  }
+
+  const onChange = (e) => {
+    const { value } = e.detail
+    let name = ''
+    value.map(i => name += i)
+    setRegion(name)
+    changeForm('province', value[0])
+    changeForm('city', value[1])
+    changeForm('region', value[2])
+  }
+
+  return (
+    <View className='ReportPiracyForm'>
+      <View className='item'>
+        <View className='label'>
+          <View className='required'>*</View>
+          <View>举报地区</View>
+        </View>
+        <View className='content'>
+          <Picker className='picker' mode='region' onChange={onChange} >
+            <View className={region ? '' : 'placeholder'}>
+              {region ? region : '请填写举报地区'}
+            </View>
+          </Picker>
+        </View>
+      </View>
+      <View className='hint'>{regionErr ? '*请填写举报地区' : ''}</View>
+
+      <View className='address'>
+        <Input value={formData.address} name='address' type='text' placeholder='详细地址(选填)' onInput={changeAddress} />
+      </View>
+
+      <View className='item'>
+        <View className='label'>
+          <View className='required'>*</View>
+          <View>盗版发现渠道</View>
+        </View>
+        <View className='content'>
+          <Picker className='picker' mode='selector' range={channelList} onChange={changeChannel}>
+            <View className={selectorChecked ? '' : 'placeholder'}>
+              {selectorChecked || '请选择'}
+            </View>
+          </Picker>
+        </View>
+      </View>
+      <View className='hint'>{channelErr ? '*请填写盗版发现渠道' : ''}</View>
+
+      <View className='item'>
+        <View className='label'>
+          <View className='required'>*</View>
+          <View>联系方式</View>
+        </View>
+        <View className='content'>
+          <Input type='number' value={formData.phone} placeholder='请填写' maxlength='11' onInput={changePhone} />
+        </View>
+      </View>
+      <View className='hint'>{phoneErr ? '*请填写联系方式' : ''}</View>
+
+      <View className='submitBtn' onClick={submit}>提交审核</View>
+    </View >
+  )
+}
+
+const HotLineList = [{
+  id: 'landline',
+  phone: '400-680-7300'
+}, {
+  id: 'phone',
+  phone: '18511949815'
+}]
+
+// 热线电话
+const HotLine: React.FC = () => {
+  return (
+    <View className='HotLine'>
+      <View className='name'>举报热线:</View>
+      <View className='tels'>
+        {
+          HotLineList.map(item => (
+            <View className='tel' key={item.id}>
+              <Image src={require(`../../assets/ReportPiracy/${item.id}.png`)} className='imgUrl' mode='aspectFill'></Image>
+              <View className='phone'>{item.phone}</View>
+            </View>
+          ))
+        }
+
+      </View>
+    </View>
+  )
+}
+
+// 最下方的提示
+const Remark: React.FC = () => {
+  return (
+    <View className='Remark'>
+      <View className='firstLine'>如您发现盗版请立即举报,我们将保护您的个人隐私,</View>
+      <View className='secondLine'>为您的善举提供有偿的奖励。</View>
+    </View>
+  )
+}
+
+// 提交成功弹窗
+const SubmitModel: React.FC<modalProps> = ({ visable, closeModal }) => {
+
+  return (
+    <AtCurtain
+      className='AtCurtain'
+      isOpened={visable}
+      onClose={closeModal}
+    >
+      <View className='model'>
+        <Image src={require('../../assets/ReportPiracy/close.png')} className='close' mode='aspectFill' onClick={closeModal}></Image>
+        <View className='tip'>提交成功</View>
+        <View className='line firstLine'>感谢您的善举,我们将保护您的个人隐私</View>
+        <View className='line secondLine'>中德智慧工作人员会及时与您联系</View>
+        <View className='ok' onClick={closeModal}>好的</View>
+      </View>
+    </AtCurtain>
+  )
+}
+
+const ReportPiracy: React.FC = () => {
+
+  const [visable, setVisable] = useState<boolean>(false)
+  const [regionErr, setRegionErr] = useState<boolean>(false)
+  const [channelErr, setChannelErr] = useState<boolean>(false)
+  const [phoneErr, setPhoneErr] = useState<boolean>(false)
+  const [formData, setFormData] = useState<Record<string, any>>({
+    province: '',
+    city: '',
+    region: '',
+    address: '',
+    channel: '',
+    phone: ''
+  })
+
+  // 打开弹窗
+  const openModal = () => setVisable(true)
+
+  // 关闭
+  const closeModal = () => {
+    setVisable(false)
+    Taro.navigateBack({
+      delta: 1
+    })
+  }
+
+  const changeForm = (key, value) => {
+
+    let newObj = {}
+
+    newObj[key] = value
+
+    const data = Object.assign(formData, newObj)
+
+    setFormData(data)
+    console.log(formData, 'formData');
+  }
+
+  // 验证
+  const beforeSubmit = () => {
+    if (!formData.province) {
+      setRegionErr(true)
+      return false
+    }
+    if (!formData.channel) {
+      setChannelErr(true)
+      return false
+    }
+    const myreg=/^[1][3,4,5,6,7,8,9][0-9]{9}$/;
+
+    if (!formData.phone || !myreg.test(formData.phone)) {
+      setPhoneErr(true)
+      return false
+    }
+    return true
+  }
+
+  // 提交
+  const submit = () => {
+    if (!beforeSubmit()) return
+    add()
+  }
+
+  const add = async () => {
+    const { region, city, province, address, channel, phone } = formData
+    const params = {
+      province: province,
+      city: city,
+      region: region,
+      address: address,
+      channel: channel,
+      phone: phone
+    }
+
+    const data = await addReport(params)
+
+    console.log(data, 'data');
+
+    openModal()
+  }
+
+  return (
+    <View className='ReportPiracy'>
+      <Image src={require('../../assets/ReportPiracy/title.png')} className='title' mode='aspectFill'></Image>
+      <ReportPiracyForm formData={formData} regionErr={regionErr} channelErr={channelErr} phoneErr={phoneErr} changeForm={changeForm} submit={submit}></ReportPiracyForm>
+      <HotLine />
+      <Remark />
+      <SubmitModel visable={visable} closeModal={closeModal}></SubmitModel>
+    </View>
+  )
+}
+export default ReportPiracy

+ 48 - 43
src/pages/index/index.tsx

@@ -1,5 +1,5 @@
 
-import React , { useState } from 'react'
+import React, { useState } from 'react'
 
 import Taro, { useDidShow } from '@tarojs/taro'
 
@@ -15,48 +15,48 @@ import Tip from '../../utils/tip'
 
 console.log(Taro, 'Taro.getStorageSync');
 
-const Index: React.FC = () => { 
+const Index: React.FC = () => {
 
   const [token, setToken] = useState<string>('')
 
-  const [ code, setCode ] = useState<string>('')
-   
-  useDidShow( async () => {
+  const [code, setCode] = useState<string>('')
+
+  useDidShow(async () => {
     setToken(Taro.getStorageSync('token'))
     const r = await Taro.login()
     console.log(r, 'codecodecodecode');
-    
+
     setCode(r.code)
   })
 
   const checkSession = () => {
-    return new Promise( resolve => {
-        Taro.checkSession({
-            success: async res => {
-              console.log('session_key 未过期,并且在本生命周期一直有效', res);
-                resolve(1)
-            },
-            fail: async res => {
-                
-              // session_key 已经失效,需要重新执行登录流程
-               const r =  await Taro.login() //重新登录
-               setCode(r.code)
-               resolve(0)
-            }
-          })
+    return new Promise(resolve => {
+      Taro.checkSession({
+        success: async res => {
+          console.log('session_key 未过期,并且在本生命周期一直有效', res);
+          resolve(1)
+        },
+        fail: async res => {
+
+          // session_key 已经失效,需要重新执行登录流程
+          const r = await Taro.login() //重新登录
+          setCode(r.code)
+          resolve(0)
+        }
+      })
     }).catch(e => e)
-}
-  
+  }
+
   // 获取用户手机号
-  const Getphonenumber = async (item: number ,e: any): Promise<void> => {
-    
+  const Getphonenumber = async (item: number, e: any): Promise<void> => {
+
     Tip.loading('正在登录...')
 
     await checkSession()
 
     console.log(code, '获取用户手机号');
-    
-    const data = await getUserPhoneNumber({...e.detail, code})
+
+    const data = await getUserPhoneNumber({ ...e.detail, code })
 
     Tip.loaded()
 
@@ -66,8 +66,8 @@ const Index: React.FC = () => {
   }
 
   // 跳转页面
-  const goPage = ( index: number ): void => {
-    
+  const goPage = (index: number): void => {
+
     if (!Taro.getStorageSync('token')) {
       Tip.toast('登录错误')
       return
@@ -75,34 +75,39 @@ const Index: React.FC = () => {
     switch (index) {
       case 0:
         Taro.navigateTo({
-           url: '/pages/ScanQrcode/index'
+          url: '/pages/ScanQrcode/index'
         });
         break
       case 1:
         Taro.navigateTo({
-           url: '/pages/AuthQuery/index'
+          url: '/pages/AuthQuery/index'
+        });
+        break
+      case 2:
+        Taro.navigateTo({
+          url: '/pages/ReportPiracy/index'
         });
     }
   }
 
   const RenderItem = (item: number) => {
-    
+
     const noHasPhoneEle = (
-      <Button 
-        className='button' 
+      <Button
+        className='button'
         open-type='getPhoneNumber'
         onGetPhoneNumber={(e) => Getphonenumber(item, e)}
       >
-          <Image
-            className='item-img' 
-            src={require(`../../assets/home/home${item}.png`)}
-          />
+        <Image
+          className='item-img'
+          src={require(`../../assets/home/home${item}.png`)}
+        />
       </Button>
     )
 
     const hasPhoneELe = (
       <Image
-        className='item-img' 
+        className='item-img'
         src={require(`../../assets/home/home${item}.png`)}
         onClick={() => goPage(item)}
       />
@@ -119,13 +124,13 @@ const Index: React.FC = () => {
 
   return (
     <View className='index'>
-      <Image className='index-bg'  src={require('../../assets/home/bg.png')} />
+      <Image className='index-bg' src={require('../../assets/home/bg.png')} />
       {
-        [0, 1].map( item => (
+        [0, 1, 2].map(item => (
           <React.Fragment key={item}>
-          {
-            RenderItem(item)
-          }
+            {
+              RenderItem(item)
+            }
           </React.Fragment>
         ))
       }

+ 9 - 9
src/service/config.ts

@@ -1,9 +1,9 @@
 
 /**
  *  错误的key
- * 
+ *
  *  后台返回的状态码从这里修改 一般有 code status state
- * 
+ *
  */
 
 export const errorKey: string = 'status'
@@ -22,19 +22,19 @@ export const errorCode: number = 200
 
 /**
  * 请求的baseUrl
- * 
+ *
  */
 
 // eslint-disable-next-line import/no-mutable-exports
 export let baseUrl = '2'
 
 if (process.env.NODE_ENV === 'development') {
-    // baseUrl = 'http://verify.test.luojigou.vip:8899'
-    // baseUrl = 'http://192.168.1.86:8091'
-    baseUrl = 'https://verify.luojigou.vip/'
-    // baseUrl = 'http://192.168.1.21:8091'
+  // baseUrl = 'http://verify.test.luojigou.vip:8899'
+  // baseUrl = 'http://192.168.1.15:8091/'
+  baseUrl = 'https://verify.luojigou.vip/'
+  // baseUrl = 'http://192.168.1.21:8091'
 } else {
-    baseUrl = 'http://192.168.1.21:8091'
+  baseUrl = 'http://192.168.1.21:8091'
 }
 
- 
+