mabo 2021-05-18 18:03:05 +08:00
commit 95d0d4032f
2 changed files with 18 additions and 3 deletions

View File

@ -411,3 +411,8 @@ export const getChildRegion = (id) => {
export const resetPassword = (params) => { export const resetPassword = (params) => {
return postRequest(`/user/resetPassword/${params}"`); return postRequest(`/user/resetPassword/${params}"`);
}; };
// 初始化商品索引
export const createIndex = () => {
return getRequest(`/elasticsearch`);
};

View File

@ -55,14 +55,14 @@
</div> </div>
<div class="label-btns"> <div class="label-btns">
<Button type="primary" @click="submit('formValidate')"></Button> <Button type="primary" @click="submit('formValidate')"></Button>
<Button type="primary" style="margin-left: 100px" @click="createIndex()"></Button>
</div> </div>
</Form> </Form>
</div> </div>
</template> </template>
<script> <script>
import { setSetting } from "@/api/index"; import { setSetting,createIndex } from "@/api/index";
import { handleSubmit } from "./validate"; import { handleSubmit } from "./validate";
export default { export default {
props: ["res", "type"], props: ["res", "type"],
@ -90,13 +90,23 @@ export default {
this.init(); this.init();
}, },
methods: { methods: {
//
submit(name) { submit(name) {
let that = this; let that = this;
if( handleSubmit(that, name )){ if( handleSubmit(that, name )){
this.setupSetting() this.setupSetting()
} }
}, },
//
createIndex(){
createIndex().then((res) => {
if (res.success) {
this.$Message.success("开始生成!");
} else {
this.$Message.error("服务器异常!");
}
});
},
setupSetting() { setupSetting() {
setSetting(this.type, this.formValidate).then((res) => { setSetting(this.type, this.formValidate).then((res) => {
if (res.success) { if (res.success) {