StephenArk30 před 6 roky
rodič
revize
342308cd63

+ 3 - 2
sourcecode/h5app/vue/src/components/addPhoto.vue

@@ -12,7 +12,7 @@
 
 <script>
     export default {
-        name: "choosePhoto",
+        name: "addPhoto",
         data() {
             return {
                 photoURL: require('../assets/camera.png')
@@ -32,6 +32,7 @@
             onRead: function (e) {
                 let f = e.target.files[0];
                 console.log(f);
+
                 let reads = new FileReader();
                 reads.readAsDataURL(f);
                 let that = this;
@@ -40,7 +41,7 @@
                     that.photoURL = this.result;
                 };
                 this.chosen = true;
-                this.$emit('onRead', this.chosen);
+                this.$emit('onRead', f);
                 // console.log(this.chosen);
             }
         }

+ 28 - 12
sourcecode/h5app/vue/src/views/PresentRegister.vue

@@ -50,14 +50,16 @@
             <p>上传礼物照片</p>
 
             <div style="margin-bottom: 10px">
-                <form method="POST" enctype="multipart/form-data"
-                      action="http://gift-server.niimei.com:8866/fileserver/upload?sign=abcdefg">
-                    <add-photo v-model="hasPhoto"/>
-                    <button type="submit" value="Upload"
-                            class="van-button van-button--primary van-button--large submit_button"
-                            @click="publishPresent">下一步
-                    </button>
-                </form>
+                <!--<form method="POST" enctype="multipart/form-data"-->
+                <!--action="https://gift-server.niimei.com/fileserver/upload?sign=abcdefg">-->
+                <!--<add-photo v-model="hasPhoto"/>-->
+                <!--<button type="submit" value="Upload"-->
+                <!--class="van-button van-button&#45;&#45;primary van-button&#45;&#45;large submit_button"-->
+                <!--@click="publishPresent">下一步-->
+                <!--</button>-->
+                <!--</form>-->
+                <add-photo v-model="photo"/>
+                <van-button type="primary" class="submit_button" @click="publishPresent">下一步</van-button>
             </div>
         </div>
 
@@ -103,7 +105,7 @@
                     "洋气", "精致",  "轻奢",  "其它",
                 ],
                 tag: 0,
-                hasPhoto: false,
+                photo: null,
                 nobr: "float: left; margin-right: 5px",
                 br: ""
             }
@@ -118,16 +120,27 @@
                     this.descError = true;
                     Toast.fail('请输入至少15个字的礼物介绍');
                     return;
-                } else if (this.hasPhoto === false) {
+                } else if (this.photo === null) {
                     Toast.fail('请上传礼物照片');
                     return;
                 }
                 // 上传礼物信息
                 let userId = localStorage.getItem("frontend-userid");
-                // tag
                 let tag = this.tag;
                 let gender = this.gender;
+
+                console.log('------- photo -------');
                 console.log(this.photo);
+                let formData = new FormData();
+                formData.append('file', this.photo);
+                BasicFunction.get_data("fileserver/upload?sign=abcdefg", function (res) {
+                    console.log('----- upload photo result -----');
+                    console.log(res);
+                    if (res.ret === '10000') {
+                    } else {
+                        Toast.fail('上传图片失败,请检查网络');
+                    }
+                }, formData);
 
                 let present = [{
                     goodid: this.presentId,
@@ -139,7 +152,7 @@
                     sellPrice: "0.0", marketPrice: "0.0", costPrice: "0.0",
                     upTime: getNowFormatDate(), downTime: getNowFormatDate(), createTime: getNowFormatDate(),
                     storeNums: "0",
-                    img: this.photo.file.name,
+                    img: this.photo.name,
                     isDel: "0", content: "none", keywords: "none",
                     description: this.desc,
                     searchWords: "", weight: "0.0", point: "0", unit: "0", brandId: "0",
@@ -160,6 +173,9 @@
                     }
                 }, present);
             },
+            onRead: function () {
+                this.hasPhoto = true;
+            }
         },
         created: function () {
             if (!localStorage.getItem('frontend-userid')) {

+ 36 - 69
sourcecode/h5app/vue/src/views/SecurityVerify.vue

@@ -23,38 +23,7 @@
                 >
                     <van-button slot="button" size="small" type="primary">发送验证码</van-button>
                 </van-field>
-                <van-field
-                        v-model="wechat"
-                        required
-                        clearable
-                        label="微信"
-                        placeholder="请输入微信号"
-                        maxlength="20"
-                        :error="wechatError"
-                        @click="wechatError=false"
-                />
-                <van-field
-                        v-model="password"
-                        required
-                        clearable
-                        type="password"
-                        label="密码"
-                        placeholder="请输入密码"
-                        maxlength="16"
-                        :error="passError"
-                        @click="passError=false"
-                />
-                    <van-field
-                            v-model="passverify"
-                            required
-                            clearable
-                            type="password"
-                            label="确认密码"
-                            placeholder="请再次输入密码"
-                            maxlength="16"
-                            :error="passVerifyError"
-                            @click="passVerifyError=false"
-                    />
+
                 <van-field
                         v-model="username"
                         required
@@ -87,14 +56,16 @@
         <div class="card" style="margin-bottom: 70px">
             <p>上传校卡照片</p>
             <div style="margin-bottom: 10px">
-                <form method="POST" enctype="multipart/form-data"
-                      action="http://gift-server.niimei.com:8866/fileserver/upload?sign=abcdefg">
-                    <add-photo v-model="hasPhoto"/>
-                    <button type="submit" value="Upload"
-                            class="van-button van-button--primary van-button--large submit_button"
-                            @click="next">下一步
-                    </button>
-                </form>
+                <!--<form method="POST" enctype="multipart/form-data"-->
+                <!--action="https://gift-server.niimei.com/fileserver/upload?sign=abcdefg">-->
+                <!--<add-photo v-model="hasPhoto"/>-->
+                <!--<button type="submit" value="Upload"-->
+                <!--class="van-button van-button&#45;&#45;primary van-button&#45;&#45;large submit_button"-->
+                <!--@click="next">下一步-->
+                <!--</button>-->
+                <!--</form>-->
+                <add-photo v-model="photo"/>
+                <van-button class="submit_button" type="primary" @click="publishPresent">下一步</van-button>
             </div>
             <p>活动仅允许深大学生参与,请上传正面校卡照片审核~</p>
         </div>
@@ -129,12 +100,6 @@
                 phone: '',
                 phoneError: false,
                 sms: '',
-                wechat: '',
-                wechatError: false,
-                password: '',
-                passError: false,
-                passverify: '',
-                passVerifyError: false,
                 username: '',
                 usernameError: false,
                 radio: '0',
@@ -147,7 +112,7 @@
                     {id: 2, name: '南区'},
                     {id: 3, name: '西丽'}
                 ],
-                hasPhoto: false
+                photo: null
             };
         },
         methods: {
@@ -156,40 +121,42 @@
                 if (this.phone.length !== 11) {
                     this.phoneError = true;
                     return;
-                } else if (this.wechat.length < 6) {
-                    this.wechatError = true;
-                    Toast.fail('请输入最少6位微信号');
-                    return;
-                } else if (this.password.length < 8) {
-                    this.passError = true;
-                    return;
-                } else if (this.password !== this.passverify) {
-                    this.passVerifyError = true;
-                    return;
                 } else if (this.username.length < 1) {
                     this.usernameError = true;
                     return;
                 } else if (this.dorId === -1) {
                     Toast.fail('请选择宿舍区');
                     return;
-                } else if (this.hasPhoto === false) {
+                } else if (this.photo === null) {
                     Toast.fail('请上传校卡正面照片');
                     return;
                 }
 
-                let success = true;
-                BasicFunction.get_data("ajaxregister?u=" + this.phone + '&p=' + this.password, function (response) {
-                    console.log("------ Data Rcvd in Reg --------");
-                    console.log(response);
-                    if (response.ret !== "10000") {
-                        // 不需要 设置 SessionID, 已经自动保存在jSessionID中
-                        Toast.fail("注册失败,请检查网络");
-                        success = false;
+                // let success = true;
+                // BasicFunction.get_data("ajaxregister?u=" + this.phone + '&p=' + this.password, function (response) {
+                //     console.log("------ Data Rcvd in Reg --------");
+                //     console.log(response);
+                //     if (response.ret !== "10000") {
+                //         // 不需要 设置 SessionID, 已经自动保存在jSessionID中
+                //         Toast.fail("注册失败,请检查网络");
+                //         success = false;
+                //     } else {
+                //         localStorage.setItem("frontend-userid", response.model.userId);
+                //     }
+                // }, {});
+                // if (!success) return;
+                console.log('------- photo -------');
+                console.log(this.photo);
+                let formData = new FormData();
+                formData.append('file', this.photo);
+                BasicFunction.get_data("fileserver/upload?sign=abcdefg", function (res) {
+                    console.log('----- upload photo result -----');
+                    console.log(res);
+                    if (res.ret === '10000') {
                     } else {
-                        localStorage.setItem("frontend-userid", response.model.userId);
+                        Toast.fail('上传图片失败,请检查网络');
                     }
-                }, {});
-                if (!success) return;
+                }, formData);
 
                 let userId = localStorage.getItem('frontend-userid');
                 let useridentity = [{

+ 3 - 2
sourcecode/h5app/vue/src/views/login.vue

@@ -31,8 +31,9 @@
                     Toast.fail('链接失效,请回到公众号重新获取链接');
                 }
             }, {});
-            if (userid.length === 0) this.$router.push('warning');
-            else this.$router.push('index');
+            // if (userid.length === 0) this.$router.push('warning');
+            // else this.$router.push('index');
+            this.$router.push('index');
         }
     }